15 comments

[ 2.7 ms ] story [ 50.2 ms ] thread
Anyone have some audio samples generated with this? As a 303 junkie, I would love to hear how closely it resembles a real 303.
Huh. I wrote this code back in 2000 or so. Didnt realize someone had ripped it.

https://github.com/a1k0n/gsynth/blob/master/modules/tb303/tb...

It doesn't sound very much like a real tb303 whatsoever. I'm working on a JavaScript one based on an x0xb0x I built, but it has a long way to go.

https://www.a1k0n.net/code/x0x/

Your Javascript 303 sounds really good! Are you planning to turn it into a full web app?
Some day, perhaps, but the code is MIT license and anyone is welcome to collaborate. (FWIW, @pcgregory turned my fasttracker 2 player into a full fledged tracker: https://wetracker.herokuapp.com/) I'm busy with other projects now; this is something I keep coming back to once in a while, and if I do it'll be to improve the fidelity before I make a pretty frontend...

It still needs accent emulation which is a bit of work, high pass output filter (it's bassier than a real 303 because there's some capacitors between the filter output and the amplifier I'm not emulating), the knob ranges / nonlinearities aren't quite right...

edit: And it also needs the square wave, which is super weird on the 303, as you're aware (yours has a sample for it I think)

oh right, you wrote the other 303 web app! I was kinda mad because you stole my thunder while I was working on this one. :)
Haha, sorry about that. I think your preview sounds a lot better than my version and the code is impressive. I need to make a few changes to my app, one of the main ones is the fact that you cant adjust the cutoff whilst the envelope is in progress but I have recently come across this technique which I am going to implement: http://stackoverflow.com/questions/30019666/web-audio-synthe...

My Acid Machine app has been built in a way so that all of the instruments are self contained modules, you could possibly create an instrument that would be compatible with the whole UI and step sequencer etc of my app quite easily.

Well, in your case you're using the webkit exponentialRampToValueAtTime or whatever it's called, so you could just recompute the envelope (it's an exponential sweep... actually it's sort of double-exponential, which is another thing I need to fix in mine) and issue new filter sweeps every time the knobs move, right? you could set it based on when the envelope was triggered in the past and it should work fine.

edit: nevermind, I thought you could specify a startTime in addition to endTime but you can't. so you'd have to use audioContext.currentTime to figure out where the sweep should be now, ramp to there, and exponential sweep down to the final value at the end time.

I've not tried the technique linked to yet but it makes it sound like you don't need to make any calculations yourself if you connect a gain node to the filter input and adjust that instead of directly adjusting the filter. I'm guessing it takes that input and adds it to the current value of the envelope.
Having owned 2 tb303s and currently a modded x0x, it is as close as you will get reliably. The tb303 doesent even always sound like a tb303.
Hacker News is full of journalists who think they can code. It's hilarious.