Hi!
I want to develop an application for the iPhone that generates custom DTMF tones. I assume the pure tone will be played from a memory buffer and not from an uploaded file, and I think I should use AVAudioPlayer class and the method "initWithData:error:", but how do I implement it? Whatever I do, I can't make it work!
I saw this code in the forum that is needed in order to calculate the sinus wave:
const int PLAYBACKFREQ = 44100;
const float PI2 = 3.14159265359f * 2;
void generateDTMF(short *buffer, int length, float freq1, float freq2) {
int i;
short *dest = buffer;
for(i=0; i<length; i++) *(dest++) = (sin(i*(PI2*(PLAYBACKFREQ/freq1))) + sin(i(PI2(PLAYBACKFREQ/freq2)))) * 16383;
}
But where should I place this code? How does it help me to fill a designated memory buffer?
Any kind of help would be appreciated!
Sagiftw