Skip to content

Configure MIDI control code mapping #524

@dpwe

Description

@dpwe

AMY will accept MIDI commands to play notes. And we have an example, in midi_mappings.c that allows the Juno VCF base frequency and resonance to be set by MIDI control codes 0x70 and 0x71 on channel 1. But this feels pretty cursory and is of course dependent on the particular structure of the Juno patch, not universal.

Instead, it would be good to have a mechanism to configure the routing of MIDI control codes to arbitrary AMY parameters via an AMY wire code template. For instance,

ic<C>,<L>,<N>,<X>,<O>,<CODE>

where C= MIDI control code (0-127), L = log-scale flag (so the mapping is exponential if L == 1), N = min value for the control (corresponding to MIDI value 0), X = max value (for MIDI value 127), O = offset for log scale (so if L == 1, value = (min + offset) * exp(log(((max + offset)/(min + offset) * midi_value / 127) - offset), and CODE is a wire code string with %v as a placeholder for the value to be substituted (also %i for channel/synth number) and maybe %V to force an integer, for things like selecting wave, and maybe more.

So an entire command to set up the VCF control for the Juno patches on synth 1 (as in the current midi_mappings.c) would be:

i1ic112,1,20,8000,0,i%iv0F%vZ
i1ic113,1,0.5,16,0,i%iv0R%vZ

That would set MIDI CC 112 (0x70) to set the constant term of the filter_freq of the voice's osc 0 to vary from 20 to 8000 with log mapping, and MIDI CC 0x71 to vary the resonance from 0.5 to 16, also with log mapping.

(I'm not sure the message parser can currently handle mid-string Zs for commands including wire-command arguments, but the syntax is not ambiguous, even if it makes the parsing more context-dependent).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions