Line 3: Line 3:
 
Matlab can be used to create signals that can mimic the sound of a musical note, which can be used to play the tune of a song. Each note of a song is created by individual sin waves at a frequencies for each note. The following line of music has three different notes, C D and E.  <br />
 
Matlab can be used to create signals that can mimic the sound of a musical note, which can be used to play the tune of a song. Each note of a song is created by individual sin waves at a frequencies for each note. The following line of music has three different notes, C D and E.  <br />
  
[[File:C:/doremi.jpg|thumbnail|music]]
+
[[File:Doremi.jpg|thumbnail| center |Do re mi Music https://www.sheetmusicdirect.com/en-US/se/ID_No/179064/Product.aspx]]
 +
 
 +
Each of the three notes in this piece have their own unique frequency. C has a frequency about 261.63 Hz.  D and E notes are created by multiplying the C note frequency by a factor to create a new note. For D the factor is 9/8 and for E the factor is 5/4. <br />
 +
 
 +
A sine wave when played without an envelope would create a constant volume sound. However, when striking a piano key the sound is at first loud and then fades as time goes on. To replicate this effect in matlab, the sine wave can be multiplied by a negative exponential coefficient. The following code creates the song above in matlab. <br />

Revision as of 14:52, 24 November 2018

Matlab Sound of Music

Matlab can be used to create signals that can mimic the sound of a musical note, which can be used to play the tune of a song. Each note of a song is created by individual sin waves at a frequencies for each note. The following line of music has three different notes, C D and E.

Each of the three notes in this piece have their own unique frequency. C has a frequency about 261.63 Hz. D and E notes are created by multiplying the C note frequency by a factor to create a new note. For D the factor is 9/8 and for E the factor is 5/4.

A sine wave when played without an envelope would create a constant volume sound. However, when striking a piano key the sound is at first loud and then fades as time goes on. To replicate this effect in matlab, the sine wave can be multiplied by a negative exponential coefficient. The following code creates the song above in matlab.

Alumni Liaison

EISL lab graduate

Mu Qiao