Generate Music using Matlab The music notes can be generated

Generate Music using Matlab: The music notes can be generated using sinusoids with specific frequencies; e.g., the middle C can be obtained as: cos(2ft), where f = 261.63 Hz. See, e.g., http://www.intmath.com/trigonometric-graphs/music.php for more details. Please code a function with the prototype: function x = tone(f, fs, td) to produce the signals for the music notes, where f is the frequency for the note, fs = 15000 Hz is the sampling frequency, and td is the time duration for the note, e.g., td = 0.4 sec. Then make the music for one of your favorite songs using this function and the Matlab function sound(), as we showed in the class. The deliverable for this project is a .doc file containing your design procedure for this music player and all the .m files.

Solution

notes={\'C\' \'E\' \'B\' \'A\' \'G\'} freq=[261.63 523.251 659.255 493.88 440.00 392.00] song={\'C\' \'C\' \'E\' \'C\' \'B\' \'A\' \'G\'} % your song dur=[0.125 0.125 0.125 0.06 0.5 0.5 2 1] a=[] for k=1:numel(song) a=[a sin(2*pi* freq(strcmp(notes,song{k}))*dur{k})]; % sinusoidal end sound(a)
Generate Music using Matlab: The music notes can be generated using sinusoids with specific frequencies; e.g., the middle C can be obtained as: cos(2ft), where

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site