Play Stephen Foster's "Beautiful Dreamer" Using MATLAB

Combine your love for math with your love for music by utilizing the exponential and sine functions in MATLAB to create signals that recreate a piece of music. This example delves into the replication of Stephen Foster’s classic parlor song “Beautiful Dreamer.” beautiful_dreamer_2.jpg

Playing “Beautiful Dreamer” on the piano requires the range of keys B3, the key immediately left to Middle C, to D5. Additionally, this song includes only one sharp note, C#4. Each note has its own unique frequency. We can use this fact to create sine waves in MATLAB for each note at lengths we specify. How can the exponential function aid in the production of a note then? The addition of the exponential function serves to aid in the production of a more natural sounding note. Multiplying the sine waves by a negative exponential gradually quiets the sound of the note as time goes on just as a note slowly fades to silence after hitting a key on the piano.

Alumni Liaison

Correspondence Chess Grandmaster and Purdue Alumni

Prof. Dan Fleetwood