9. Music Synthesis: We will use MATLAB to create a playable .wav file of the musical notes. For the two parts below create a half second cosine signal for each quarter note (qC, qD, qE) and then concatenate each note into a single array, x =[qC qD qE…]. Use a Δt equal to 1/fs where fs = 48000 for the time resolution. Make each quarter note last 0.5 seconds and each eighth note last 0.25 seconds . Use sound(x,fs) to hear your array and audiowrite(filename,x,fs) to save your music to a .wav file that you will submit. a) Make a .wav file for the C major scale shown below. The scale consists of the following notes from C4 (262 Hz) to C5 (523 Hz). The table shows the specific frequency of each note. Hint: use the CMajorScale_StarterCode.m posted on CANVAS as a starting point. b) Now we will synthesize some more interesting music. The notes below are the opening of a musical piece by Mozart. The piece has quarter notes (0.5 seconds) and eighth notes (0.25 seconds) and also quarter and eight rests. A rest is where there is no sound you should have a zero amplitude cosine. See the table below for clarification. The best way to do this is to create arrays for the needed notes and rests and then put them together. Submit your .wav file and code.
Share