Efficient Sine Wave Generation

This is a discussion on Efficient Sine Wave Generation within the C++ Programming forums, part of the General Programming Boards category; Bit of a long shot, but would anyone know of a method of generating multiple sine waves that is faster ...

  1. #1
    Budding Synth Programmer samGwilliam's Avatar
    Join Date
    Feb 2002
    Location
    Trefforest
    Posts
    368

    Efficient Sine Wave Generation

    Bit of a long shot, but would anyone know of a method of generating multiple sine waves that is faster than using a giant lookup table (where pointers traverse in different step sizes)? It wasn't a performance issue until I tried to build a 64-oscillator additive syntheiser. Currently the CPU usage goes upto about 85%.
    Last edited by samGwilliam; 05-24-2007 at 04:54 PM.

  2. #2
    Registered User
    Join Date
    May 2007
    Posts
    147
    A few questions if you please

    Are you processing wavedata as integers, floats or something else?

    What is the huge lookup table you're describing?

    What target CPU are you aiming for?

    Is threading an option you'll consider?

    Here's an interesting observation.

    I did a quick test, simulating the creation of a stereo waveform using two vectors for each channel, assuming floats for each sample at 44.1Khz, and created 64 stereo sinwaves using the default CRT sin function and a few floats to indicate the frequency of each of the waves.

    On a 2Ghz AMD 32bit CPU that took about 25% CPU duty for realtime, best guess as I could see. Said another way, letting the routine run full speed completed the waveform of 50 million samples about 5.5 times faster than realtime.

    This is a crude observation - I'm not sending data to a soundcard, nor dealing with amplitude, etc.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Sine Wave Program
    By Stiks in forum C Programming
    Replies: 10
    Last Post: 10-15-2005, 12:35 AM
  2. Processing a sine wave file
    By subdene in forum C++ Programming
    Replies: 2
    Last Post: 07-12-2004, 03:04 PM
  3. Help producing sine wave
    By ricky1981 in forum C++ Programming
    Replies: 9
    Last Post: 10-31-2003, 08:20 PM
  4. ...simple sine wave?
    By Sebastiani in forum C++ Programming
    Replies: 27
    Last Post: 12-15-2002, 01:12 PM
  5. Sine Wave Program Help
    By Unregistered in forum C Programming
    Replies: 3
    Last Post: 10-19-2001, 12:33 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21