web synth docs

2021-04-16

MAIN GOAL: MIDI recording planning

We're already implemented this once for the the original [midi-editor], but I don't event want to look at the code for that.

We have an input MIDI node through which we have access to all incoming MIDI events. Before activating recording mode via the toolbar, we need to check that there is no active playing going on. We should deny recording with an error message popup if there is no connected input MIDI node. Assuming that we're good to start recording, we can begin capturing + processing the incoming MIDI events from the source [[midi-node]].

I'm considering if we want to be able to record only with local tempo or with global playback as well, and I'm thinking that we want to support both. In order to facilitate live looping-like functionality, we almost certainly want to be able to record while playing back everything else.

So, when the "record" button is clicked, we're either going to start playing back from scratch or start recording from the main timer loop. It doesn't matter very much either way; we can store the beat timer source and deterministically get the current beat at the moment a MIDI event comes through. That's all we really need to facilitate recording; we just need to be able to get the current beat to know where to place notes.

So when recording, we'll have some recording state that is a mapping from currently held midi number to a NoteBox that we've already added to the scene. We'll register an animation callback so that we can update note lengths constantly for all currently held notes. We will test if notes can be validly placed when the note is first pressed as well as every tick; it is a very inexpensive operation and we should treat all operations on the backing store as highly optimized because they are. The instant a note becomes invalid by intersecting some other note, we discard it. The use-case of recording over already drawn notes is pretty niche and I don't care about it that much.

2021-04-16