×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

How to play different notes from a wav file

How to play different notes from a wav file

How to play different notes from a wav file

(OP)
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.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources