(*^ ::[ Information = "This is a Mathematica Notebook file. It contains ASCII text, and can be transferred by email, ftp, or other text-file transfer utility. It should be read or edited using a copy of Mathematica or MathReader. If you received this as email, use your mail application or copy/paste to save everything from the line containing (*^ down to the line containing ^*) into a plain text file. On some systems you may have to give the file a name ending with ".ma" to allow Mathematica to recognize it as a Notebook. The line below identifies what version of Mathematica created this file, but it can be opened using any other version as well."; FrontEndVersion = "NeXT Mathematica Notebook Front End Version 2.2"; NeXTStandardFontEncoding; fontset = title, inactive, noPageBreakBelow, noPageBreakInGroup, nohscroll, preserveAspect, groupLikeTitle, center, M7, bold, L1, e8, 24, "Times"; ; fontset = subtitle, inactive, noPageBreakBelow, noPageBreakInGroup, nohscroll, preserveAspect, groupLikeTitle, center, M7, bold, L1, e6, 18, "Times"; ; fontset = subsubtitle, inactive, noPageBreakBelow, noPageBreakInGroup, nohscroll, preserveAspect, groupLikeTitle, center, M7, italic, L1, e6, 14, "Times"; ; fontset = section, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeSection, grayBox, M22, bold, L1, a20, 18, "Times"; ; fontset = subsection, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeSection, blackBox, M19, bold, L1, a15, 14, "Times"; ; fontset = subsubsection, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeSection, whiteBox, M18, bold, L1, a12, 12, "Times"; ; fontset = text, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, L1, 12; fontset = smalltext, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, L1, 10, "Times"; ; fontset = input, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeInput, M42, N23, bold, L1, 12, "Courier"; ; fontset = output, output, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, L-5, 12, "Courier"; ; fontset = message, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, L1, 12, "Courier"; ; fontset = print, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, L1, 12, "Courier"; ; fontset = info, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, L1, 12, "Courier"; ; fontset = postscript, PostScript, formatAsPostScript, output, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeGraphics, M7, l34, w282, h287, L1, 12, "Courier"; ; fontset = name, inactive, noPageBreakInGroup, nohscroll, preserveAspect, M7, italic, B65535, L1, 10, "Times"; ; fontset = header, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, italic, L1, 12, "Times"; ; fontset = leftheader, 12; fontset = footer, inactive, nohscroll, noKeepOnOnePage, preserveAspect, center, M7, italic, L1, 12, "Times"; ; fontset = leftfooter, 12; fontset = help, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, L1, 12; fontset = clipboard, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, L1, 12; fontset = completions, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, L1, 12, "Courier"; ; fontset = special1, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, L1, 12; fontset = special2, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, L1, 12; fontset = special3, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, L1, 12; fontset = special4, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, L1, 12; fontset = special5, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, L1, 12; paletteColors = 128; automaticGrouping; currentKernel; ] :[font = title; inactive; preserveAspect; startGroup] OCTAVE2 :[font = subtitle; inactive; preserveAspect] Music in Mathematica ;[s] 2:0,0;9,1;20,-1; 2:1,16,12,Times,1,18,0,0,0;1,17,13,Times,3,18,0,0,0; :[font = section; inactive; preserveAspect; startGroup] BRIEF ABSTRACT :[font = subsection; inactive; preserveAspect; endGroup] This lab exercise is designed for students with access to Mathematica. The problem builds on OCTAVE (also at this WWW site) by using exponential functions to write music. ;[s] 3:0,0;58,1;69,2;172,-1; 3:1,12,9,Times,1,14,0,0,0;1,13,10,Times,3,14,0,0,0;1,12,9,Times,1,14,0,0,0; :[font = section; inactive; Cclosed; preserveAspect; startGroup] GENERAL INFORMATION :[font = subsection; inactive; preserveAspect] FileName: OCTAVE2 :[font = subsection; inactive; preserveAspect] Full title: Music in Mathematica ;[s] 2:0,0;22,1;33,-1; 2:1,12,9,Times,1,14,0,0,0;1,13,10,Times,3,14,0,0,0; :[font = subsection; inactive; preserveAspect] Last Update: 6/6/96 :[font = subsection; inactive; preserveAspect] Developer: Aaron D. Klebanoff, Department of Mathematics, Rose-Hulman Institute of Technology, Terre Haute IN 47803 USA. Phone: 812-877-8151. Email: Aaron.Klebanoff@Rose-Hulman.Edu. :[font = subsection; inactive; preserveAspect] Contact: Aaron D. Klebanoff, Department of Mathematics, Rose-Hulman Institute of Technology, Terre Haute IN 47803 USA. Phone: 812-877-8151. Email: Aaron.Klebanoff@Rose-Hulman.Edu. FAX: 812-877-3198. :[font = subsection; inactive; preserveAspect; endGroup] Support: The production of this material is supported by the National Science Foundation under Division of Undergraduate Education grant DUE-9352849: Development Site for Complex, Technology-Based Problems in Calculus with Applications in Science and Engineering and the Arvin Foundation of Columbus IN. :[font = section; inactive; Cclosed; preserveAspect; startGroup] STATEMENT OF PROBLEM :[font = subsection; inactive; preserveAspect] 1) The pitch of a musical note is determined by the frequency of the vibration which causes it. Middle C on the piano, for example, corresponds to a vibration of 263 Hz (cycles per second). A note one octave above middle C vibrates at 526 Hz, and a note 2 octaves above middle C vibrates 1052 Hz. You might have noticed that the frequency of vibration increases in powers of 2. Since there are 12 keys on the piano between two octaves, the frequency of each tone between middle C and high C are given by 263 2^(i/12) where i=0, 1, 2, ..., 12. Verify this by animating the scale, C, C#, D, D#, E, F, F#, G, G#, A, A#, B, C with Mathematica's Play[] command. ;[s] 3:0,0;635,1;646,2;664,-1; 3:1,12,9,Times,1,14,0,0,0;1,13,10,Times,3,14,0,0,0;1,12,9,Times,1,14,0,0,0; :[font = subsection; inactive; preserveAspect] 2) Now that you have generated each tone on a standard piano between middle and high C, play the C scale: C, D, E, F, G, A, B, C. :[font = subsection; inactive; preserveAspect] 3) Verify by listening to examples that for any tone vibrating at f0 Hz, the tone vibrating at 2 f0 Hz is one octave higher and that in general 2n f0 makes a tone n octaves higher (or lower if n is negative.) ;[s] 14:0,0;66,1;67,2;68,3;97,4;98,5;99,6;145,7;146,8;147,9;148,10;149,11;193,12;194,13;208,-1; 14:1,12,9,Times,1,14,0,0,0;1,13,10,Times,3,14,0,0,0;1,12,9,Times,65,14,0,0,0;1,12,9,Times,1,14,0,0,0;1,13,10,Times,3,14,0,0,0;1,12,9,Times,65,14,0,0,0;1,12,9,Times,1,14,0,0,0;1,13,10,Times,35,14,0,0,0;1,12,9,Times,1,14,0,0,0;1,13,10,Times,3,14,0,0,0;1,12,9,Times,65,14,0,0,0;1,12,9,Times,1,14,0,0,0;1,13,10,Times,3,14,0,0,0;1,12,9,Times,1,14,0,0,0; :[font = subsection; inactive; preserveAspect; endGroup] 4) Compose "Mary Had a Little Lamb" using Mathematica's Play[] command. Hint: Start with E, D, C, D, E, E, ... and to save time, copy and past the notes that you have already generated except when you need a tone to play longer. ;[s] 3:0,0;42,1;53,2;229,-1; 3:1,12,9,Times,1,14,0,0,0;1,13,10,Times,3,14,0,0,0;1,12,9,Times,1,14,0,0,0; :[font = section; inactive; Cclosed; preserveAspect; startGroup] KEYWORDS :[font = subsection; inactive; preserveAspect; endGroup] frequency, exponential functions, music, pitch, tone :[font = section; inactive; Cclosed; preserveAspect; startGroup] TEACHER NOTES :[font = subsection; inactive; preserveAspect; startGroup] ISSUES RELATED TO THE PROBLEM :[font = subsubsection; inactive; preserveAspect; endGroup] This exercise is very memory intensive. So that students have the time to wait for their computer, it is best to start it in class but allow additional time out of class for completion. :[font = subsection; inactive; preserveAspect; startGroup] Prerequisites :[font = subsubsection; inactive; preserveAspect; endGroup] The sine, cosine and exponential functions. :[font = subsection; inactive; preserveAspect; startGroup] Time allotment - time management :[font = subsubsection; inactive; preserveAspect; endGroup] This could be started at the end of a class period. The students should complete the work on their own time assuming they have easy access to computers running Mathematica. ;[s] 3:0,0;160,1;171,2;173,-1; 3:1,10,8,Times,1,12,0,0,0;1,10,8,Times,3,12,0,0,0;1,10,8,Times,1,12,0,0,0; :[font = subsection; inactive; preserveAspect; startGroup] Expectations :[font = subsubsection; inactive; preserveAspect; endGroup] Students will have fun. :[font = subsection; inactive; preserveAspect; startGroup] Future payoffs :[font = subsubsection; inactive; preserveAspect; endGroup] Students get a quick and painless real-life application to the sine, cosine and exponential functions. :[font = subsection; inactive; preserveAspect; startGroup] Extensions :[font = subsubsection; inactive; preserveAspect; endGroup] The musically inclined may wish to listen to strange scales in which there are either more or less than 12 tones per "octave" by running through a power of two with exponents of the form 2^(i/n) where n is the number of tones in an "octave". :[font = subsection; inactive; preserveAspect; startGroup] References and Sources :[font = subsubsection; inactive; preserveAspect; endGroup; endGroup] David Rusin's WWW page explains why there are 12 tones in an octave: http://www.math.niu.edu/~rusin/papers/uses-math/music/12 :[font = section; inactive; Cclosed; preserveAspect; startGroup] POSSIBLE SOLUTION(S) :[font = subsection; inactive; preserveAspect; startGroup] 1) The middle C scale (all 13 tones.) Each tone is played for 1 second. :[font = input; preserveAspect; endGroup] Do[ Play[Sin[2 Pi 263 2^(i/12) t], {t, 0, 1}], {i, 0, 12}] :[font = subsection; inactive; preserveAspect] 2) The middle C Scale: (I simply cut and past the proper tones from the scale above. :[font = subsection; inactive; preserveAspect; startGroup] 3) Checking that octaves increase by powers of 2... :[font = subsubsection; inactive; preserveAspect; startGroup] Let's check with octaves based in D. :[font = input; preserveAspect; endGroup; endGroup] d = 263 2^(2/12); Do[Play[Sin[2 Pi 2^i d t], {t, 0, 1}], {i, -1, 2}] :[font = subsection; inactive; preserveAspect; startGroup] 4) Mary Had a Little Lamb... :[font = subsubsection; inactive; preserveAspect; startGroup] Here are the tones that I'll need. :[font = input; preserveAspect] c = 263; d = 263 2^(2/12); e = 263 2^(4/12); g = 263 2^(7/12); :[font = input; preserveAspect; startGroup] e1 = Play[Sin[2 Pi e t], {t, 0, 0.4}] :[font = output; output; inactive; preserveAspect; endGroup] Sound["<<>>"] ;[o] -Sound- :[font = input; preserveAspect; startGroup] d1 = Play[Sin[2 Pi d t], {t, 0, 0.4}] :[font = output; output; inactive; preserveAspect; endGroup] Sound["<<>>"] ;[o] -Sound- :[font = input; preserveAspect; startGroup] c1 = Play[Sin[2 Pi c t], {t, 0, 0.4}] :[font = output; output; inactive; preserveAspect; endGroup] Sound["<<>>"] ;[o] -Sound- :[font = input; preserveAspect; startGroup] g1 = Play[Sin[2 Pi g t], {t, 0, 0.4}] :[font = output; output; inactive; preserveAspect; endGroup] Sound["<<>>"] ;[o] -Sound- :[font = input; preserveAspect; startGroup] d2 = Play[Sin[2 Pi d t], {t, 0, 0.8}] :[font = output; output; inactive; preserveAspect; endGroup] Sound["<<>>"] ;[o] -Sound- :[font = input; preserveAspect; startGroup] e2 = Play[Sin[2 Pi e t], {t, 0, 0.8}] :[font = output; output; inactive; preserveAspect; endGroup] Sound["<<>>"] ;[o] -Sound- :[font = input; preserveAspect; startGroup] g2 = Play[Sin[2 Pi g t], {t, 0, 0.8}] :[font = output; output; inactive; preserveAspect; endGroup] Sound["<<>>"] ;[o] -Sound- :[font = input; preserveAspect; startGroup] c3 = Play[Sin[2 Pi c t], {t, 0, 1.2}] :[font = output; output; inactive; preserveAspect; endGroup; endGroup] Sound["<<>>"] ;[o] -Sound- :[font = subsubsection; inactive; preserveAspect; endGroup; endGroup] And here's the song. (Before each pasted tone, is the note followed by a number representing the relative duration of the tone.) The tones should be pasted in in the following order: e1 - d1 - c1 - d1 - e1 - e1 - e2 - d1 - d1 - d2 - e1 - g1 - g2 - e1 - d1 - c1 - d1 - e1 - e1 - e1 - e1 - d1 - d1 - e1 - d1 - c3. :[font = section; inactive; Cclosed; preserveAspect; startGroup] ISSUES IN SOLUTION :[font = subsection; inactive; preserveAspect; endGroup; endGroup] This exercise may take a while to run on older computer systems. ^*)