|
|
|
|
|
|
|
|
|
Ode to Joy, and other music in Mathematica
|
|
|
|
|
|
|
|
|
|
|
|
2004-04-01
|
|
|
|
|
|
For years, I have taught my trig students about how the function A sin ( B t ) can be used to represent a musical note. As we change the value of A , the amplitude of the note changes; i.e., the sound gets louder or softer. As we change the value of B , the frequency of the wave gets longer or shorter and the pitch of the note gets lower or higher. I've talked about this musical application of trig for decades. When I discovered that Mathematica could play a sine wave -- literally make the sound -- I was excited. But years ago, when I was at the high school, Mathematica was still relatively new and I was working on Apple computers and Macintosh computers that were relatively small and slow. While I could make Mathematica make a sound, it took too long and played too slow to be very impressive. But I kept my hopes high. This spring, as I developed the labs I used to teach CS 113, I was working on brand new PC computers running Mathematica 5.0! One of the CS 113 labs has a brief section on the Play function. It uses some traditional examples -- Play the note representing Middle C, for example. It also shows her students (and me) how to get Mathematica to Play several notes at once, a chord. As I was writing the labs for CS 113 this spring, I decided to make Mathematica play a recognizable tune. I searched the Wolfram site and did an internet search to try to find a Mathematica notebook or package that plays recognizable music simply by playing the sine waves I have talked about most of my life. I found a few (but not many) references to Mathematica music, but they were much, much fancier routines that made little or no reference to sine waves.
|
|
|
|
|
|
|
|
|
|
|
|
Music, Ode to Joy, Polly Wolly Doodle, Rock Island Line
|
|
|
|
|
|
|
|
|
|
|
|
| MathematicaMusic.nb (26.5 KB) - Mathematica Notebook [for Mathematica 5.0] |
|
|
|
|
|
|
|
| | | | | |
|