Sign up ×

I am making an application similar to Tonematrix, and I was wondering what scale it uses, and how it generates its sounds. So here's a few questions I need answered that I haven't been able to find answers to on my own.

Is it chromatic? What frequencies are used? And what happens to the frequency if (for instance) a 400 Hz and a 800 Hz beep are played in the same track at the same time to the overall frequency? Is the resulting frequency 1200 Hz?

I'm such a noob at audio in general although I do have a sense of music. I'm a good programmer though, and I was hoping that you could help me.

Edit Here's a link that might help. Somebody deciphered the math behind it.

share|improve this question

migrated from Jan 24 '14 at 12:01


1 Answer 1

up vote 5 down vote accepted

how it generates its sounds

This depends on various factors. It can use samples, or a basic synthesizer algorithm, a table etc. Only the authors will know for sure. To me it sounded like low-resolution samples (or heavily compressed mp3), but my mini laptop does not work well for sound analysis.

How to technically generate the sounds depends on which platform it uses and what that platform offer to generate sound. For Flash see this documentation for ActionScript.

Is it chromatic?

From what I can hear it uses standard chromatic table.

What frequencies are used?

Here is a table with standard frequencies.

Basically it doubles the frequency for each octave up and each octave has 12 steps. The math is simple.


No, you will have two different frequencies played at the same time. This is how chords and poly-tones works.

The amplitude however will be affected and your software you need to take height for out-of-range amplitudes to avoid distortion (cropped tops/bottoms).

The reason for this is that if you mix two samples that have the same sign, f.ex. positive, they will add to each other and if you don't average (or use another method) to reduce the sum, the sum may exceed the max value of whatever signed bit-range you use (16/24-bit etc). You can for example use Float internally and implement a look-ahead routine which compress the audio (as in amplitude, not file size), but explaining that would be out-of-scope for this answer.

Besides from that, the program you link to works as a standard running step-sequencer where the resolution is quantized to 16 beats which gives you 4 bars with a 4/4 signature. Pretty standard in other words.

Update: to show visually what happen when you add two waves together we can take a look at this illustration -

made by Abdias

Lets say we have two waves as the first green one (these are identical but they don't have to be).

When we add these together their amplitude values, in this case ranging from -10 to +10, are added together. As they both have the amplitude at max at the same location the resulting sum will be +20 (or -20 for the negative ones) exceeding the max allowed values in this case which happen to be -10 to +10. instead of getting a new wave as represented by the orange top, the wave form is clipped shown with the resulting red wave (notice the flat red lines top and bottom). This is called clipping and is neither good for loudspeakers nor ears.

To avoid this we need to either reduce both waves to half the amplitude ("volume" is technically wrong as it's a logarithmic scale, so lets use the actual value of the amplitude) and then add them, or use an algorithm that can analyze them in a more complex way to give a result that won't sound like it has low volume (as it would by just reducing the amplitude to half on two different waves). Such analysis can be performed by the means of a compressor and limiter.

In the "real" (digital) world the values would of course be different, 16-bit waves would have a instead of -10 to +10, a range between -32768 to +32767, 24-bit a range between -16,777,215 to + 16,777,216 (IIRC) etc. This doesn't mean the volume is louder in 24-bit, but you can describe more details in the wave form which will result in better quality. This as a side note.

Bottom line is, that adding waves is just about the simplest of math (adding the values together). To avoid clipping you need to make sure that math works within the bounds of a defined range.

share|improve this answer
Woah, really nice stuff. Can I somehow figure out which frequencies tones in the tonematrix are in reality by measuring it? Which software can I use for that? –  Mathias Lykkegaard Lorenzen Nov 6 '12 at 5:30
You can use a guitar tuner (f.ex. and compare A (440 Hz). If they are in tune you will know the other frequencies (see table in my answer). With the tuner you can also find pitch offset if the A is not perfect 440 Hz (which is ok too, you will still be able to calculate the other frequencies). Hope this helps! –  Ken Fyrstenberg Nov 6 '12 at 6:58
One last thing. Can you help me understand what happens to the amplitude when combining tones? Can you visualize it somehow? –  Mathias Lykkegaard Lorenzen Nov 17 '12 at 23:14
Done. I'm really appreciating the help you're giving me. –  Mathias Lykkegaard Lorenzen Nov 18 '12 at 7:34
Wow. You are unbelievably awesome! Thanks! Can I donate somehow? Also, is the concept the same if I add 3 tones? –  Mathias Lykkegaard Lorenzen Nov 18 '12 at 16:34

Your Answer

