Hacker News new | ask | show | jobs
by errozero 317 days ago
Hey, I made this a few years ago. I'm suprised to see it posted here today.

It was never finished and I was meaning to add a polyfill for the missing cancelAndHoldAtTime function for Firefox.

Edit: I've just hacked in a quick polyfill

14 comments

Sorry, I'll implement it, I had forgotten we didn't do it for erm... 9 years.

https://bugzilla.mozilla.org/show_bug.cgi?id=1308431

For a while I have been curious about the intended uses for xAtTime functions (like cancelAndHoldAtTime) in Web Audio. As far as I understand it, calls to them suffer from lag due to main JavaScript thread and audio thread communication, which makes sample precision unachievable—and precision is quite important in music.

Is it mostly for emulating slow-moving changes on fixed timelines, a la automation tracks in traditional DAWs like Logic and Ableton? Is design rationale documented somewhere?

Those methods are sub-sample accurate, granted you call them a bit in advance to account for the cross-thread communication, as you say. But yes, in general this was designed (prior to me becoming an editor) with scheduling in mind, not with low-latency interactivity. That said, it goes quite far.

Other systems go further, such as Web Audio Modules (that builds on top of AudioWorklet) implement sample-accurate parameter change from within the rendering thread, using wait-free ring-buffers. That requires `SharedArrayBuffer` but works great, and is the lowest latency possible (since it uses atomic loads and stores from e.g. the main thread to the rendering thread).

This is the best thread
Thank you!
This is really lush. Instantly it brightened up my evening. This kind of experimentation is always amazing to see.

As many seem to have mentioned below, it brings back memories of Rebirth in some ways. What it also reminds me of is the beautiful results you could have by plugging some simple modules together to create soundscapes. The limits are the things that provide some semblance of freedom and this is no different. Greetings from a fellow UK acid (techno) head! :P

I've just updated this to make it a little bit easier to use on a phone. The knobs are now a bit chunkier and should respond better to touch and the instruments sit vertically instead of horizontally.
I was randomly going over my past HN activity and bumped over this gem from here https://news.ycombinator.com/item?id=38624968 and posted :)
Ah, I was wondering how it ended up posted here. Thanks!
this brought a little more joy to my day, thank you
Hey if you don't mind updating this, can you please allow the tempo to be as high as 150 bpm?
Hey, sure! I forgot it was limited to 130, it's been a few years! I've just updated it.
That might tickle your tinrib. If you want to stay up forever, maybe go to 160 bpm. Or even some industrial strength 200 bpm.
And also, different tempos per instrument :)
this is awesome. would suggest not randomizing the tempo on regenerate, and if it was already playing, when hitting regenerate, keep it playing. that would make it easy to quickly audition loops at a given tempo with a single click
This is fantastic errozero nicely done! It's very musical, the drone is a nice touch and really glues it all together in a subtle way.
@errorzero - if you have the time would you be able to give more information on the Scales? This section is very interesting.
Hey, the scales are just an array of numbers like this

    ['Darkness', [0, 1, 3]],
    ['Darkness2', [0, 1]],
    ['Single', [3]],
    ['Locrian', [0, 1, 3, 5, 6, 8, 10]],
    ['Aeolian', [0, 2, 3, 5, 7, 8, 10]],
    ['Mixolydian', [0, 2, 4, 5, 7, 9, 10]],
    ...
A scale is randomly selected at the start and then notes are randomly selected from that scale in the pattern generation, plus the root note number is added to each one.

So if you had the 'Darkness' scale selected and had the root dropdown set to 0, the notes in this scale would be C, C#, D# which is 0, 1, 3 if you count the keys on a keyboard. If you changed the root to 2, then it would become D, D#, F (2, 3, 5).

Hope that makes sense.

That does make sense, thanks! Very simple and effective.
This is amazing. Thanks for making it.
Are you interested in open sourcing? I'd love to learn about how this was done.
Update: The wav export feature now renders with all parameter changes, and I've fixed a bug that excluded the drone from the export.
How do I export/save a pattern I like?
Currently, all you can do is save the url which contains all of the initial randomisation settings when a pattern generates. It doesn't update when moving sliders or anything, it's just the intial settings.

I'll look into adding a wav export feature.

Yes. Export please!
It now has a simple wav export feature. Details here: https://news.ycombinator.com/item?id=44824142
Update: wav export now added
this thing is great. you got a version that can run as a vst or plugin?