The Soniccouture Backend consists of some parts that are generic to any backend, along with some instrument-specific logic:
The red patch cabels are patcher configuration; the blue patch cables are MIDI processing. We will consider both in turn.
The scale selector needs to know the
"natural" (non-transposed) value of the doum and of the root of the scale;
for the mk1
this is 65 (F3) and 69 (A3) respectively, and for the mk2
this
is 62 (D3) and 69 (A3). The output of the scale selector is a list of MIDI
notes, starting with the doum and followed by the notes of the selected scale,
with any transpositions applied.
The retuner needs to know the selected scale, as well as the natural tuning of the selected handpan. It uses this to map incoming MIDI notes to a transposition value: "if the natural tuning of the second tone field is a D, but we want it to be an E, then better transpose that tone field up two semitones".
MIDI notes are processed in three steps:
- Parsing
- Issue key-switching commands
- Issue the note itself.
Incoming MIDI notes are first parsed:
We separate out the MIDI note and it's velocity, and then run the note through the frontend decoder, which recognizes the MIDI layout generated in the frontend. The decoder outputs two things:
-
On the second output, it outputs a "retuning index", which is passed to the retuner to look up how much we should transpose the note. The index will be 0 for the doum, 1..9 for the tone fields, and 0 for the percussive elements (which are therefore transposed along with the doum).
-
On the first output, it outputs a
(category, index)
pair, which corresponds directory to the MIDI layout: the category is 0 for percussion, 1 for melodic elements and 2 for ghost notes; the index is the index within that category as per the layout specification.For a pair
(x, y)
, thep nth
subpatcher then turns this into annth x (y + 1)
message, which will be used to index acoll
(see below). The(y + 1)
is necessary becausecoll
uses 1-based indexing for lists.
The velocity coming from the parser is routed straight to a pack
object, to
be combined in the final stage with the note will we will issue.
Then the retuning index is sent to the retuner
, which will output a
transposition value. This value is then turned into a MIDI "transpose"
key-switch command for our
custom Soniccouture instrument:
the key-switch command to transpose by n
is the pair (3, 64 + n)
, i.e.,
MIDI note 3 ("D#-2") with velocity 64 + n
.
Finally, the (category, index)
pair is sent two two collections: one that
tells us which strike
articulation we should be using, and which MIDI note
by the instrument for this doum/tonefield/percussive element. We have one
such pair of collections for both sampled instruments (the first generation
hang and the second generation hang).
We index the strike
collection first, turning this into another key-switch
command (1, c)
, where the "volume" c
denotes the value we want to
chain selector to have.
When both key-switch commands have been issued, we know that the instrument will correctly interpret the note we will send it, and so we can now issue the actual note.