Musical Ratios

Hello! I have created a simple project, that estimates what certain musical ratios would sound like as chords. Since I haven't found a way to make snap play chords, I have to arpeggiate like they did in the 70's and 80's synthesizers. Basically, a musical ratio is when two frequencies play together, matching a certain ratio. For example, a valid 4:5 ratio is the tones 444 Hz, and 555 Hz playing together, because a 444:555 ratio is the same as a 4:5 ratio. This project calculates ratios by using a constant 440 Hz tone, and having a 440 * a/b Hz tone, where the ratio is a:b. You can choose what the maximum value a and b can go to, by entering the number when it asks you for a "threshold". Anyway, that's it for this post. Bye!

Oh yeah, since I forgot to post the link to the project, here it is: Snap! Build Your Own Blocks.
Woopsie!

Nice.

IIRC, it's only PLAY FREQUENCY that can't be done in multiple threads. If you made a sine wave Sound, you could play several together.

play frequency () Hz is actually sprite specific, so you can use clones to play multiple frequencies at the same time. Here's a little script to demonstrate this.

Thanks!

I had no Idea.

This is because every sprite has its own audio context (Web Audio API - MDN Web Docs). That's also how sprites can play sounds at different volumes and balance (panning).

More info

I'm actually making a library that utilizes this - it applies effects to all of the sound nodes, which means you can add an echo effect without using repeat and wait, a pitch and formant effect, etc. :slight_smile: Expect a post about it this or next week!

This has nothing to do with javascript's audio api, it's just because there is a single object that handles playing a single frequency on each sprite.

Also, I'm not surprised about all this, and I've known about this for ages.