PlaySound is not implemented i the Javascript version of GeoGebra yet.
For that reason, the applets on this page are not functional.


music 1
Download from GeoGebra-tube: The sound of a sine wave
Listen to the sine wave for various frequencies 440·f. Change the volume A.

The note A (A4) has the frequency \(f=440\) Hz, which means that it has the angular frequency \(\omega = 440\cdot 2\pi \) rad/s. If you want to play sine waves, you can use that frequency as a base, as in the applet above. Note that if the functions \(f\) and \(g\) have different frequencies, then you can clearly hear that the wave \(h\) is made of two waves.

Play music in GeoGebra

As of version 4.0, you can play music in GeoGebra. You can play music from a so called MIDI file and play notes using various instruments. Apart from that, you can play the sound of a function. The function is assumed to be a function of time and the function values must be between -1 and 1. To play the function \(h\) between 0 and 15 seconds, you enter the code:


The command PlaySound can be used as an "On Click" event to a button. Enter a button using the tool Insert Button icon. Write the command in the box called "GeoGebra Script". You can also enter the code after the button has been created, open the properties window and choose the Scripting tab.


To turn off the sound being played, use the command PlaySound[false].

The frequencies of the notes

An octave is a doubling of frequencies. When the frequency 440 Hz is doubled to 880 Hz, you go from the note A4 to the note A5, where A5 is in the next octave. An octave is divided into twelve notes, seven of these are C, D, E, F, G, A, B; the white keys on a piano. Some countries use other names for the notes.

The frequencies of the twelve notes are in a geometric progression. This means that the ratio of the frequency of two consecutive notes is constant. When going from the frequency of one note to the next, you multiply with the same factor for all notes. After 12 such multiplications, you should have doubled the frequency. If that factor is denoted by \(a\), we can find the factor from:

\[a^{12}=2 \Leftrightarrow a=2^{\frac{1}{12}}\]

music 2
Download from GeoGebra-tube: Frequencies of notes
Change the slider n to see the notes and their frequencies, and listen to their sound.

Some countries use other notations for the notes than the ones seen below the blue arrow in the applet above.


The reason why different instruments sound different when playing the same note, is that they don't play one single sine wave. An instrument in general also plays a number of overtones, and these overtones may vary between different instruments. An overtone is a tone having a higher frequency than the note being played.

If you consider a string of a guitar, then the length of the string (measured by where you hold down a finger) decides what frequencies you hear since the string is attached at both ends. Mathematically, this corresponds to dividing half a period by an integer, which means multiplying the angular frequency by an integer.


In the applet below you can add three overtones by letting their respective amplitude increase from zero.

music 2
Download from GeoGebra-tube: Play overtones
Increase the amplitudes of the overtones to hear various sounds when playing the note A.


The command PlaySound from http://wiki.geogebra.org/en/Manual:PlaySound_Command

by Malin Christersson under a Creative Commons Attribution-Noncommercial-Share Alike 2.5 Sweden License