Re: Generation of a Waveform
Re: Generation of a Waveform
- Subject: Re: Generation of a Waveform
- From: Doug Wyatt <email@hidden>
- Date: Tue, 6 Dec 2005 07:03:11 -0800
On Dec 6, 2005, at 6:50, Linea Tessile srl wrote:
Hi people!
Does anybody know how create a waveform with a frequency of 5kHz
and a period of 200µs ?
Thanks,
Alessandra
Here's how to generate a sine wave. From /Developer/Examples/
CoreAudio/SimpleSDK/DefaultOutputUnit/RenderSin.cpp:
double cycleLength = inSampleRate / frequency;
Float32 nextFloat = sin(j / cycleLength * (M_PI * 2.0)) * amplitude;
Frequency would be 5000. inSampleRate would typically be 44100 but
could be something else depending on the hardware setting or if
you're rendering to a file with a different sample rate.
amplitude is 0-1.
Doug
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden