On Apr 27, 2011, at 1:38 AM, Ross Bencina wrote:

eu...@lavabit.com wrote:
*out++ = data->amplitude[0] * sinf( (2.0f * M_PI) * data->phase[0] );
*out++ = data->amplitude[1] * sinf( (2.0f * M_PI) * data->phase[1] );

/* Update phase, rollover at 1.0 */
data->phase[0] += (data->frequency[0] / SAMPLE_RATE);
if(data->phase[0] > 1.0f) data->phase[0] -= 2.0f;
data->phase[1] += (data->frequency[1] / SAMPLE_RATE);
if(data->phase[1] > 1.0f) data->phase[1] -= 2.0f;

You haven't shown us the declarations/data types for data->phase and data->frequency. I hope they are doubles (or at least floats).

why is the data->phase[] term having 2.0 subtracted from it, instead of 1.0 when 2.0*M_PI is the scaler inside of the sinf() function?

--

r b-j                  r...@audioimagination.com

"Imagination is more important than knowledge."




--
dupswapdrop -- the music-dsp mailing list and website:
subscription info, FAQ, source code archive, list archive, book reviews, dsp 
links
http://music.columbia.edu/cmc/music-dsp
http://music.columbia.edu/mailman/listinfo/music-dsp

Reply via email to