OCTAVE Musical Exponents: Modeling in music with exponentials BRIEF ABSTRACT Here's a fun classroom exercise to introduce exponential functions as an application to music. GENERAL INFORMATION FileName: OCTAVE Full title: Musical Exponents: Modeling in music with exponentials Last Update: 6/6/96 Developer: Aaron D. Klebanoff, Department of Mathematics, Rose-Hulman Institute of Technology, Terre Haute IN 47803 USA. 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. 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. STATEMENT OF PROBLEM 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 two octaves above middle C vibrates at 1052 Hz. Below is a table which shows how the frequency changes as a function of the number, n, of octaves above middle C. MatrixForm[Table[{{" n", "freq(n)"}, {"----", "--------"}, {-3, 32.875}, {-2, 65.75}, {-1, 131.5}, {0, 263}, {1, 526}, {2, 1052}, {3, 2104}, {4, 4208}}]] n freq(n) ---- -------- -3 32.875 -2 65.75 -1 131.5 0 263 1 526 2 1052 3 2104 4 4208 1) Graph the frequency as a function of n. 2) The data graphed in #1 should appear exponential. The general form of an exponential function is: F(x) = a bx where b>0 is the base of the exponent and a is an arbitrary constant. Exponential data has the property that the ratio of the output for equally spaced input is a constant. Show that freq(n) is an exponential function of n and find the function. 3) Graph the function and the data on the same graph. The following problems can only be done if you have a machine that will play audible frequencies such as any modern computer running Mathematica using the Play[] command. The problems that follow are modeled for Mathematica. 4) Use Mathematica's Play[] command to verify that the frequencies given in the table do increase by musical octaves. Note that frequencies are given in cycles per second, so you'll have to make sure you're using the correct frequency. For example, the following command plays a tone at 500 cycles per second for 3 seconds since Sin[t] has a frequency of (1 cycle)/(2 Pi seconds). Play[Sin[2*Pi*500*t], {t, 0, 3}] -Sound- 5) Choose any audible frequency that you haven't played yet. Using the same base b that you found in #2, use Mathematica's Play[] command to see if the octaves still increase by n. The next problem is more of a trig/frequency review than an exponential problem. 6) Make Mathematica play a varying range of frequencies between 200 and 400 Hz over a 1 second period. KEYWORDS Exponential functions, curve fitting data, frequency, music. TEACHER NOTES ISSUES RELATED TO THE PROBLEM This is a fun problem to do in class. It gets noisy, but since there are infinitely many frequency choices, the students can each find their own unique tunes. Prerequisites Students should be familiar with frequency in trigonometric functions. Time allotment - time management If done in class (recommended), this can be one of two examples of exponential functions or the sole problem of the day depending on how much you want the students to explore and how many parts of the problem you wish to complete. Expectations Expect the students to have fun! Expect a noisy class! There is typically some difficulty in finding a and b for the exponential function from the data. As such, this should not be the only example that you use. It is unlikely that students will know how to make the frequency vary as desired in number 6 especially since knowledge of derivatives is NOT a prerequisite for this problem. However, take the opportunity to give the students another reason to learn about derivatives. (The frequency is a rate of oscillation -- and thus the derivative of the input to oscillatory functions.) Future payoffs Students are given a reason to like exponential functions. This problem provides a nice opportunity to review trigonometry even though its main focus is on introducing exponential functions. Extensions This could be extended to a project or extra credit by having students explore various types of musical scales and tones. For example, find a relationship between tones that sound good together and tones that do not. References and Sources Hughes-Hallett, Gleason, et al. 1994. Calculus. Wiley, New York, NY, p. 18. POSSIBLE SOLUTION(S) 1) Graph the frequency as a function of n. In[2]:= freq = {32.875, 65.75, 131.5, 263, 526, 1052, 2104, 4208}; In[3]:= data = Table[{k-4, freq[[k]]}, {k, 1, 8}] Out[3]= {{-3, 32.875}, {-2, 65.75}, {-1, 131.5}, {0, 263}, {1, 526}, {2, 1052}, {3, 2104}, {4, 4208}} In[4]:= lp = ListPlot[data, AxesLabel -> {"n", "freq(n)"}, Prolog -> PointSize[0.032]] Out[4]= -Graphics- 2) Show that freq(n) is an exponential function of n by finding the function. Let's find the ratio of the outputs (frequencies) from one octave to the next. In[5]:= Table[freq[[k+1]]/freq[[k]], {k, 1, 7}] Out[5]= {2., 2., 2., 2, 2, 2, 2} Since the ratios are all the same, the frequencies must be exponentially related to the octave. Furthermore, the base b must be 2. So, freq(n) = a 2n. But when n = 0, we know that freq(0) = 263, so a = 263. Since we've already used the function name, freq, in this notebook, we'll call our frequency function f[n]. In[6]:= f[n_] = 263 2^n Out[6]= n 263 2 3) Graph the function and the data on the same graph. In[7]:= cp = Plot[f[n], {n, -3, 4}] Out[7]= -Graphics- In[8]:= Show[lp, cp] Out[8]= -Graphics- 4) Use Mathematica's Play[] command to verify that the frequencies given in the table do increase by musical octaves. (This is all done by ear! "Animate" the Sound.) Do[Play[Sin[2 Pi freq[[n]] t], {t, 0, 1}], {n, 1, 8}] 5) Choose any audible frequency that you haven't played yet. Using the same base b that you found in #2, use Mathematica's Play[] command to see if the octaves still increase by n. I'll present enough cases to be convincing. The answer is YES, the octaves always increase by n. A base of 300 Hz a = 300; freq300 = Table[a 2^n, {n, -1, 3}] {150, 300, 600, 1200, 2400} Do[Play[Sin[2 Pi freq300[[n]] t], {t, 0, 1}], {n, 1, 5}] A base of 340 Hz a = 340; freq340 = Table[a 2^n, {n, -1, 3}] {170, 340, 680, 1360, 2720} Do[Play[Sin[2 Pi freq340[[n]] t], {t, 0, 1}], {n, 1, 5}] A base of 360 Hz a = 360; freq360 = Table[a 2^n, {n, -1, 3}] {180, 360, 720, 1440, 2880} Do[Play[Sin[2 Pi freq360[[n]] t], {t, 0, 1}], {n, 1, 5}] 6) The key to making the frequencies do what you want them to do is to recognize that the frequency [cycles/second] is given by taking the derivative of the input to Sin[] or Cos[] and then dividing by 2 Pi. Thus, to find w that makes the Sin[2 Pi w t] oscillate with frequency Hz, you must solve the differential equation: (w[t] t)' = Hz In the following, we simply increase the frequency linearly between 200 and 400 Hz. In[9]:= Hz = 200 + 200 t; In[10]:= Plot[Hz, {t, 0, 1}, AxesLabel -> {"sec", "freq"}] Out[10]= -Graphics- In[11]:= w = Simplify[Integrate[Hz, t]/t] Out[11]= 100 (2 + t) Play[Sin[2 Pi w t], {t, 0, 1}] -Sound- In the next example, we oscillate between 200 and 400 Hz. In[12]:= Hz = 300 - 100 Sin[2 Pi t] Out[12]= 300 - 100 Sin[2 Pi t] In[13]:= Plot[Hz, {t, 0, 1}, AxesLabel -> {"sec", "freq"}] Out[13]= -Graphics- In[14]:= w = Simplify[Integrate[Hz, t]/t] Out[14]= 50 Cos[2 Pi t] 300 + -------------- Pi t Play[Sin[2 Pi w t], {t, 0, 1}] -Sound- ISSUES IN SOLUTION It's recommended to help students with the Mathematica syntax. That should not be a hurdle with this problem. Furthermore, students should already be familiar with Mathematica's Plot[] command before attempting this problem. Students need not use Do[] loops to build their animations. If they run one at a time and then collect the Sound out put in one cell, they can "animate" it. In problem #6, students should not be expected to know how to make the change in a predictable fashion as shown in the solution above. However, it is hoped that better students will recognize that the frequency of oscillation is NOT the coefficient of t inside the Sin[ ] or Cos[ ] function and will be interested to find out why not.