joyjam
joyjam

Reputation: 1

What do the numbers in the 'value' argument mean in the control change message in mido (regarding bank changes) in python?

I've written a program that successfully writes midi files, and opens them in Logic Pro X on my computer (this program is for personal use only btw, so I'm not worried about it not working on other devices.) I have two questions.

Firstly, I'd like to know if it is even possible for me to assign midi bank numbers/program change numbers to the instruments in folders of patches that I have in logic, so that I can use these banks and programs in my code and have it open with the correct instruments playing. (Or maybe I need to create some kind of virtual midi instrument and assign the instruments/banks within that?)

Next, regardless of whether or not that's possible, I think I was able to successfully change banks with this code:

track.append(Message('control_change', control =  0, value = 0x79, channel = 0, time = 1233))
track.append(Message('control_change', control = 32, value = 0x05, channel = 0, time = 1233))
track.append(Message('program_change', program = 0x7a, channel = 0, time = 1234))

Which I found in this post answered by this user.

But besides understanding that the control 0 and 32 messages indicate the bank change, I don't understand the significance of '0x79' '0x05' or '0x7a'.

I have a very basic idea of how midi works, using hexidecimal and ultimately being bytes in binary, but if someone who does understand could explain this I'd really appreciate it.

Upvotes: 0

Views: 145

Answers (1)

drewbob01
drewbob01

Reputation: 3

With regard to the second question, '0x79' '0x05' or '0x7a' are simply hexadecimal representations of the range of options for most MIDI messages (0-127). '0x7a', for instance, equates to 122 in decimal. So, in the instance of choosing an instrument bank, value represents the bank you've chosen (option 122 in this case, presumably the next bank).

For more info, SOS has a good series on MIDI Basics; this video on MIDI messages may also prove helpful.

To assign numbers to each instrument within a bank, you can assign each instrument's file path to a variable and then call that variable where appropriate in your program.

Upvotes: 0

Related Questions