program is this
It is the purpose of this project to create the tones of a DTMF phone. The frequencies used for each key are described at http://www.hut.fi/~then/mytexts/dtmf_generation.html , a java applet is given at http://www.dsptutor.freeuk.com/dtmf/TG102.html
Assume a sampling frequency of 8 kHz and an amplitude of 1 for each sinusoid. Write a program that asks the user to input a phone number. Assume that the tones for each digit are hold for 0.1 seconds. Declare an array that can hold up to 1 second of samples. Then write a function that reads in a digit and fills the array from index n to index m. Use this function in a loop to create the total sequence. At the end of your program all values should be stored in one array. For test purposes, output the index and the value of the array at the index on the screen.
I finished with inserting phone number and outputing them. I need help with equation. Teacher want me to output 8000numbers for each digits(for sine wave). I asked my teacher but all he told me was to use "sample=sin(n*2*pi*f1/samplerate)+sin(n*2*pi*f2/samplerate). I tried that on my program but only getting one answer.
is this mean i have to do
for loop for sample rate that goes 0~8000 for equation above?
for example
while()
{
for (index=0;index<8000;index++)
sample=sin(n*2*pi*f1/index)+sin(n*2*pi*f2/index).
cout<<sample;
}
Thank your for reading