# Tone (Beta)

In the Desmos Graphing Calculator, Desmos Geometry Tool, and Desmos 3D, you can now use the tone function to bring sound to your graph.

### Frequency and Gain

Tone takes frequency and gain as inputs. To get started, all you need is a frequency. The inputs for frequency range from 20Hz to 20000Hz, but these frequencies may not all be audible. In a new expression line, try typing tone$$(a)$$. This will prompt you to create a slider for $$a$$, with a default range from $$110$$ to $$880$$.

When you introduce a tone expression, you will see a sound wave icon to the left of your expression and a mute button at the top of your expression list. The graph will always start muted. Pressing the mute button at the top of the expression list or pressing ALT + M will unmute every tone that is set to play sound. To toggle an individual tone’s sound on and off, press the sound wave icon in that expression line or press ALT + SHIFT + H.

You can also use a gain argument in your tone function. Gain is a multiplier on the amplitude of the sound wave. Larger amplitudes sound louder to our ears. In Desmos, gain is generally going to fall in a range between $$0$$ and $$1$$, but the right sounding gain depends on frequency. For very low frequencies, we allow gain to go as high as 10. For high frequencies, we clamp it down further, to protect your ears and those of your beloved pets. Try typing tone$$(440,b)$$. This will prompt you to create a slider for $$b$$ with a default range from $$0$$ to $$1$$ automatically. You can start playing with the frequency and tone examples in our introduction to tone example graph.

We determine the maximum gain with the following formula: $$Max$$ $$gain = min(10, 660/frequency)$$

 Frequency Maximum allowed gain 66 or below 10 115 4 330 2 660 1 1320 0.5 6600 0.1

### Getting Started: Making Music with Tone (Beta)

With frequency, you can create musical notes in the calculator. On a piano, 440Hz is the frequency for A4 (the A right above the middle of the keyboard). In the western music scale, there are 12 half steps in an octave and the frequencies follow a logarithmic relationship. In other words, the scale is multiplicative instead of additive like we would see with a linear relationship. So, to go up an octave we multiply the frequency by 2, and to go down an octave, we divide the frequency by 2.

One helpful equation for this scale is $$f\left(x\right)=440\cdot2^{ x/12}$$. When $$x=0$$, you will hear A4. Then, each whole number represents a half step up on the keyboard. $$x=1$$ is B flat, $$x=2$$ is B, $$x=3$$ is C, and so on. Once you get back to $$x=12$$, you will have A5, which is one octave above A4. You can explore this relationship between frequency and musical notes in our playing with notes on a piano example graph.

Note: This is just one way to build a scale. With the relationship between notes and frequencies, you can build any scale using the tone expression.