defaultxr / cl-patterns

Library for writing patterns to generate or process (a)musical sequences of mathematically (un)related (non-)compound values in Lisp.
https://w.struct.ws/cl-patterns
MIT License
77 stars 10 forks source link

Support :pan as a midi event key #2

Closed azimut closed 6 years ago

azimut commented 6 years ago

This can be controlled sending a MIDI control event type 10 http://nickfever.com/music/midi-cc-list the value can be interpolated for this as with :amp

I have looked cl-alsaseq and couldn't find an easy way to do this. If it can be added might be other type of values/keys can be supported too, like pitch or reverb.

defaultxr commented 6 years ago

You're right, it looks like there is no control change event built in to cl-alsaseq yet. I don't think it would be too hard to add it, but I would need to look into it. After that, it should be easy to add other CC messages as well.

defaultxr commented 6 years ago

I've added the CC message to cl-alsaseq and :pan support to cl-patterns. I haven't added any other CCs yet but I will probably do that soon.

defaultxr commented 6 years ago

I added more CC mapping functionality in d426cfb65abdf6ead660d56dea8b11347948ce60 . Once the MIDI backend is enabled, the following event keys will be mapped by default to MIDI CC messages:

For :release through :phaser, I'm not sure what range to map from, so you should just specify the MIDI value directly (0..127). But for :pan and :res you can use -1..1 or 0..1 like normal.

If you want to add your own MIDI mapping not covered by those, you can use the exported set-cc-mapping function to define a mapping. If :pan wasn't predefined, for example, it could be added like this:

(set-cc-mapping 10 "Pan" :pan 'bipolar-1-to-midi)

The bipolar-1-to-midi is the function called to remap the range from -1..1 to 0..127. There are also other exported functions you can use instead:

I'm closing this issue for now but if you have any other suggestions or want any other functionality just let me know.