alda icon indicating copy to clipboard operation
alda copied to clipboard

Using program change number to select instrument

Open wiwikuan opened this issue 3 years ago • 1 comments

🔧 Feature request 🔧

Description

For now we have to select instruments by saying something like midi-steel-drums: or midi-brass-section: etc., which I think is cumbersome in some situations. There are already "program change" numbers in General MIDI, it would be nice if we can also say program 1: for piano, program 12: for vibraphone, etc. (see here)

Also, there are nine standard drum kits/sets in the General MIDI 2 specification (see here, and also Roland GS and Yamaha XG), and most MIDI equipments/general-purpose soundfonts support that. So instead of saying midi-percussion:, it would be nicer if we can say drum-kit standard:, drum-kit power: and drum-kit brush: etc. to switch to different drum kits.

Examples

To select piano: program 1: o4 c8 d e f g2

To select the "Power" drum kit (which is program number 17): drum-kit power: o2 c4 e c8 c e4

or

drum-kit 17: o2 c4 e c8 c e4

wiwikuan avatar Aug 08 '21 12:08 wiwikuan

I like this idea. It's similar in spirit to #386 , providing functions in Alda for using the features of MIDI at a lower level.

I think we could implement this as another function, e.g.:

(program-change 1)
(program-change 1 "my-piano")

Which would be equivalent to:

midi-acoustic-grand-piano:
midi-acoustic-grand-piano "my-piano":

This wouldn't be flexible enough to express groups of parts (e.g. the equivalent of piano/bassoon "my-group":), but I think that's an acceptable trade-off. (And if needed, in the future, we could perhaps add something like a group function that takes an alias and an arbitrary number of parts and returns a part group declaration.


I'm not sure, off-hand, if the Java VM MIDI synth supports those alternative drum kits. Will have to try that out and see if it works. I see that the Wikipedia article has some instructions on what CC and PC messages to send in order to select another drum kit. It seems like you would still need to do this on channel 10 or 11 (the percussion channels), so it might make sense for this to be a function that you call after declaring a percussion instrument, like:

midi-percussion:
  (use-kit 9)

And/or perhaps:

midi-percussion:
  (use-kit 'room)

daveyarwood avatar Aug 08 '21 14:08 daveyarwood