darkrider
Computer
- Nov 4, 2006
- 1
One interesting thing about music is that notes repeat
%% themselves. So for example there are multiple A's and multiple C's.Though they have the same label, their frequency is different. From one C to the next the frequency doubles. So since middle C is at 261.6 Hz
then the next C would be at 523.2 Hz. The interval between these two notes is called an octave. Starting at C,
%% they would be C, C#, D, D#, E, F, F#, G, G#, A, A#, B, C. To move to the next note we can multiply the frequency by 2^(1/12) which means the notes are equally spaced.
How can i write a function that takes in a note and will play that note.
i know the sinusoid is defined as y(t)=A*cos *pi*f*t+phase).
I just need to create samples at the right frequency for each note.Make the amplitude 1, and the phase at 0. Play in the octave startingwith middle C. Middle A is defined to be exactly 440 Hz. So middle Cis 440/(2^(9/12)) which is about 261.6. We divide since are moving down
steps. I have to use a sampling frequency of 8000 Hz.
%% themselves. So for example there are multiple A's and multiple C's.Though they have the same label, their frequency is different. From one C to the next the frequency doubles. So since middle C is at 261.6 Hz
then the next C would be at 523.2 Hz. The interval between these two notes is called an octave. Starting at C,
%% they would be C, C#, D, D#, E, F, F#, G, G#, A, A#, B, C. To move to the next note we can multiply the frequency by 2^(1/12) which means the notes are equally spaced.
How can i write a function that takes in a note and will play that note.
i know the sinusoid is defined as y(t)=A*cos *pi*f*t+phase).
I just need to create samples at the right frequency for each note.Make the amplitude 1, and the phase at 0. Play in the octave startingwith middle C. Middle A is defined to be exactly 440 Hz. So middle Cis 440/(2^(9/12)) which is about 261.6. We divide since are moving down
steps. I have to use a sampling frequency of 8000 Hz.