Live data from Hacker News

Show HN: 19 Tone Equal Temperament Piano in Web Audio

academo.org

11–20 of 25 posts

Re: Show HN: 19 Tone Equal Temperament Piano in Web Audio

#11
post #9
post #2

Is there something that makes 12 special? I am no expert in music theory, but I can imagine that it could be useful that 12 has many factors: 12 = 2x2x3. Since 19 is prime, would that be a bad choice?

There are some mathematical reasons. In particular, the two most consonant (best-sounding) intervals are the octave and the fifth. The frequencies of the two pitches in an octave have a ratio of 2.0, and the frequencies of the two pitches in a pure fifth have a ratio of 1.5. We would like the pitches we obtain from powers of these two ratios (stacking these intervals on top of each other) to be the same. However, sin…

This is a great explanation. To add onto this, I would imagine a lot of non-musicians would wonder whether there's a good reason for equal temperament, as most songs in every genre utilize it instead of more consonant scales (e.g., just intonation).

There are two main reasons. The first is a matter of switching between scales, as in, many songs will modulate to out-of-scale-but-mathematically-related chords. As 12TET has each scale using the same notes, one doesn't have to tiptoe around shared notes which are 'slightly' off. The second is pure convenience: using a set of notes for each key (or pushing the root note a few Hz up or down) would be a laborious process.

With that being said, an interesting direction some electronic producers take is to experiment with scales, given how ubiquitous waveforms with integer harmonics are. Here's an example from Richard D James: https://youtu.be/pTn1tmhA8L8

Re: Show HN: 19 Tone Equal Temperament Piano in Web Audio

#12
post #2

Is there something that makes 12 special? I am no expert in music theory, but I can imagine that it could be useful that 12 has many factors: 12 = 2x2x3. Since 19 is prime, would that be a bad choice?

There's a great description here: http://www.math.uwaterloo.ca/~mrubinst/tuning/12.html

It's too in-depth to summarize, but worth a read.

Re: Show HN: 19 Tone Equal Temperament Piano in Web Audio

#13
post #6

I tried this on my phone (via Chrome for Android). The keys didn't do anything when I pressed them.

If you just want to play around, I wrote a keyboard that works in Chrome as well as Firefox on Android back in November.

http://s.codepen.io/SeanMcBeth/debug/meaQvj

Re: Show HN: 19 Tone Equal Temperament Piano in Web Audio

#15
post #2

Is there something that makes 12 special? I am no expert in music theory, but I can imagine that it could be useful that 12 has many factors: 12 = 2x2x3. Since 19 is prime, would that be a bad choice?

If you have time, this is an excellent article that describes where the "12" comes from and the derivation of the chromatic scale and just intonation scales.

http://arxiv.org/html/1202.4212v1

Re: Show HN: 19 Tone Equal Temperament Piano in Web Audio

#17
post #2

Is there something that makes 12 special? I am no expert in music theory, but I can imagine that it could be useful that 12 has many factors: 12 = 2x2x3. Since 19 is prime, would that be a bad choice?

12 tone is a historical scale. Initially (Pythagoras) the scale was based on perfect fifths. Over time the notes in between the diatonic scale note were added. Tuning started becoming a big deal because if you tune all your fifths to be perfect, some intervals outside of the scale got really weird. Equal temperament was the compromise solution.

Instead of tuning perfect fifths, you just make every half step the same. That means that your other intervals are all out of tune, but it is small enough that you don't have some keys that are horrible. Bach's 24 preludes and fugues (in each major and minor key) was partly a demonstration of a similar tuning system--well tempered, also known as Werkmeister.

Other music traditions such as indian classical/raga, use different tunings.

I'll also add that the all-key tunings like equal and well tempered are hugely important for the development of music from back to today, its not mere esoterica. Look at something like a late Beethoven piano sonata. In the course of a single piece, it may modulate a hundred times through a half dozen keys. The development of all key tunings, while they made 5ths worse, made it possible for a pieces of music on a fixed tuning instrument like a piano to range through any key, and that was huge to the development of music.

Re: Show HN: 19 Tone Equal Temperament Piano in Web Audio

#18
post #4
post #2

Is there something that makes 12 special? I am no expert in music theory, but I can imagine that it could be useful that 12 has many factors: 12 = 2x2x3. Since 19 is prime, would that be a bad choice?

Related, why you can't tuna fish, or tune a piano: [Minute Physics] https://www.youtube.com/watch?v=1Hqm0dYKUx4

Thanks for this. I was unfamiliar with Henry Reich's videos.

Re: Show HN: 19 Tone Equal Temperament Piano in Web Audio

#19
post #9
post #2

Is there something that makes 12 special? I am no expert in music theory, but I can imagine that it could be useful that 12 has many factors: 12 = 2x2x3. Since 19 is prime, would that be a bad choice?

There are some mathematical reasons. In particular, the two most consonant (best-sounding) intervals are the octave and the fifth. The frequencies of the two pitches in an octave have a ratio of 2.0, and the frequencies of the two pitches in a pure fifth have a ratio of 1.5. We would like the pitches we obtain from powers of these two ratios (stacking these intervals on top of each other) to be the same. However, sin…

The TED video on the pentatonic scale by Bobby McFerrin is worth watching. Only 3 minutes long: http://youtu.be/ne6tB2KiZuk

Re: Show HN: 19 Tone Equal Temperament Piano in Web Audio

#20
post #8

Very cool. You might consider adding a short (a few ms is enough) fade in/out when toggling notes to avoid clickiness.

A few samples is enough, actually. Just enough to prevent the sudden change from high to low, which is what causes the click.

You don't even need to compute new samples. Merely repeat the last sample while lowering its volume until you reach zero.

Post reply on HN