WebAudioAPI

The Supercollider kickdrum sound in timbre.js

So it looks like while timbre.js has some documentation, the documentation is really much sparser than I’d like it to be. But at least the examples work so it’s possible to figure things out. The first example I tried to translate was the kickdrum sound from Rumble-san’s Drum Sounds in SuperCollider (Part 1). Basing off an example in timbre.js’s documentation on T("env"), I managed to come up with this translation (which is almost identical to one of the examples for T("env")):
T("env", {table:[1, [0, 1000]]}, T("sin", {freq:60})).on("ended", function() {
    this.pause();
}).bang().play();
There are some obvious questions here: Why is env used this way? What exactly is the syntax for the table parameter? What exactly is the purpose of the bang() message? We can sort of deduce the syntax of the table paramter from the code, but the existing documentation does not seem to provide any answers.

tuna.js

While I was trying to figure out how to use timbre.js I ran into Tuna. It looked like a much simpler library that might solve some immediate problems, so I spent some time trying to get it to work. The odd thing is that even though people have been talking about the library, there is practically no documentation. I couldn’t figure out how to use it. So back to timbre.js. I’ve also found the Git repository for subcollider.js (a library related to and tightly coupled with timbre.js) that looks like it will be immensely useful.

coming full circle, back to SuperCollider

I was wondering if there’s a way to do timbre in WebAudioAPI (actually, in retrospect I now remember there’s a way) and what did Google find? It found mohayonao’s timbre.js. What’s bizarre about this piece of code is that to use it, you use a syntax that’s clearly derived from SuperCollider. I won’t have enough time to learn to use this right away, but I’m now seeing myself make what’s essentially a U-turn, back to what I explored a year and a half ago.

That is why they do it in SuperCollider

So this is why they use SuperCollider for sonification, I think. First a lot of things like metronome beats are just one line of code. And second how do you record something written in WebAudioAPI? If I did this in SC that would be one line of code (I have already forgotten what that one line was but I remember it was just one line), but since I did this in WebAudioAPI I’m still scratching my head. And I don’t even have a lot of time left. I basically have to get up at 5am tomorrow, which means I have to sleep at 9pm or something today…
Syndicate content