INVESTIGATIONING III

The Messages

Well first of all, we need a way to grab and format messages.


In [1]:
%cd -q '..'
import mido
import copy
from commons import mido_util

In [2]:
from commons import timers

We want a way to grab the messages with the appropriate time, put them in a list, also print them out as they arrive, except for the clock ones, which we don't want because they would spam the whole thing. Also maybe include a nice signal to terminate, such as the foot pedal or something.


In [3]:
from commons.messages import controlstate, controls

In [4]:
def collector(state=None):
    if state is None:
        newstate = controlstate.MidiControlState()
    else:
        newstate = copy.deepcopy(state)
    collection_list = []
    with mido.open_input("DGX-505 MIDI 1") as inport:
        timer = timers.offsetTimer()
        for msg in inport:
            msg.time = timer()
            wrapped = newstate.feed_message(msg)
            collection_list.append(wrapped)
            if msg.type != "clock":
                print(wrapped)
            if wrapped.wrap_type == controls.Control.PEDAL:
                break
    return newstate, collection_list

In [5]:
def writeout(outlist, outname):
    with open(outname, 'w') as outfile:
        for wrapped in outlist:
            outfile.write(str(wrapped.message)+'\n')

Now let's try it with the initial send after power on.


In [16]:
s, c = collector()


[SysEx 7E 7F 09 01]
[SysEx 43 10 4C 00 00 7E 00]
MIDI Master Tuning 0
Reverb Type 02(Hall2)
Chorus Type ---(Celeste)
8 Voice Volume 88
8 Modulation Wheel 0
8 Voice Pan 64
8 Expression 127
8 Voice Reverb Level 40
8 Voice Chorus Level 0
8 Harmonic Content 64
8 Release Time 64
8 Attack Time 64
8 Brightness 64
8 Bank MSB 127
8 Bank LSB 0
8 Program Change: [127,0,0] 122 Standard Kit 1 (DRUM KITS)
8 RPN MSB 0
8 RPN LSB 0
8 Data Entry MSB: Pitch Bend Range 2
8 RPN MSB 0
8 RPN LSB 1
8 Data Entry MSB: Channel Fine Tuning 64
8 RPN MSB 0
8 RPN LSB 2
8 Data Entry MSB: Channel Coarse Tuning 64
8 Pitch Bend 0
9 Voice Volume 86
9 Modulation Wheel 0
9 Voice Pan 64
9 Expression 127
9 Voice Reverb Level 20
9 Voice Chorus Level 0
9 Harmonic Content 64
9 Release Time 64
9 Attack Time 64
9 Brightness 64
9 Bank MSB 127
9 Bank LSB 0
9 Program Change: [127,0,27] 128 Dance Kit (DRUM KITS)
9 RPN MSB 0
9 RPN LSB 0
9 Data Entry MSB: Pitch Bend Range 2
9 RPN MSB 0
9 RPN LSB 1
9 Data Entry MSB: Channel Fine Tuning 64
9 RPN MSB 0
9 RPN LSB 2
9 Data Entry MSB: Channel Coarse Tuning 64
9 Pitch Bend 0
10 Voice Volume 81
10 Modulation Wheel 0
10 Voice Pan 64
10 Expression 127
10 Voice Reverb Level 0
10 Voice Chorus Level 20
10 Harmonic Content 64
10 Release Time 64
10 Attack Time 64
10 Brightness 64
10 Bank MSB 0
10 Bank LSB 112
10 Program Change: [0,112,33] 046 Finger Bass (BASS)
10 RPN MSB 0
10 RPN LSB 0
10 Data Entry MSB: Pitch Bend Range 2
10 RPN MSB 0
10 RPN LSB 1
10 Data Entry MSB: Channel Fine Tuning 64
10 RPN MSB 0
10 RPN LSB 2
10 Data Entry MSB: Channel Coarse Tuning 64
10 Pitch Bend 0
11 Voice Volume 56
11 Modulation Wheel 0
11 Voice Pan 38
11 Expression 127
11 Voice Reverb Level 30
11 Voice Chorus Level 30
11 Harmonic Content 64
11 Release Time 64
11 Attack Time 64
11 Brightness 64
11 Bank MSB 0
11 Bank LSB 117
11 Program Change: [0,117,27] 041 60's Clean Guitar (GUITAR)
11 RPN MSB 0
11 RPN LSB 0
11 Data Entry MSB: Pitch Bend Range 2
11 RPN MSB 0
11 RPN LSB 1
11 Data Entry MSB: Channel Fine Tuning 64
11 RPN MSB 0
11 RPN LSB 2
11 Data Entry MSB: Channel Coarse Tuning 64
11 Pitch Bend 0
12 Voice Volume 50
12 Modulation Wheel 0
12 Voice Pan 86
12 Expression 127
12 Voice Reverb Level 40
12 Voice Chorus Level 40
12 Harmonic Content 64
12 Release Time 64
12 Attack Time 64
12 Brightness 64
12 Bank MSB 0
12 Bank LSB 1
12 Program Change: [0,1,4] 146 Electric Piano 1 KSP (XG PIANO)
12 RPN MSB 0
12 RPN LSB 0
12 Data Entry MSB: Pitch Bend Range 2
12 RPN MSB 0
12 RPN LSB 1
12 Data Entry MSB: Channel Fine Tuning 64
12 RPN MSB 0
12 RPN LSB 2
12 Data Entry MSB: Channel Coarse Tuning 64
12 Pitch Bend 0
13 Voice Volume 52
13 Modulation Wheel 0
13 Voice Pan 68
13 Expression 127
13 Voice Reverb Level 68
13 Voice Chorus Level 0
13 Harmonic Content 64
13 Release Time 64
13 Attack Time 64
13 Brightness 52
13 Bank MSB 0
13 Bank LSB 0
13 Program Change: [0,0,51] 287 Synth Strings 2 (XG ENSEMBLE)
13 RPN MSB 0
13 RPN LSB 0
13 Data Entry MSB: Pitch Bend Range 2
13 RPN MSB 0
13 RPN LSB 1
13 Data Entry MSB: Channel Fine Tuning 64
13 RPN MSB 0
13 RPN LSB 2
13 Data Entry MSB: Channel Coarse Tuning 64
13 Pitch Bend 0
14 Voice Volume 127
14 Modulation Wheel 0
14 Voice Pan 64
14 Expression 127
14 Voice Reverb Level 40
14 Voice Chorus Level 0
14 Harmonic Content 64
14 Release Time 64
14 Attack Time 64
14 Brightness 64
14 Bank MSB 0
14 Bank LSB 0
14 Program Change: [0,0,0] 134 Grand Piano (XG PIANO)
14 RPN MSB 0
14 RPN LSB 0
14 Data Entry MSB: Pitch Bend Range 2
14 RPN MSB 0
14 RPN LSB 1
14 Data Entry MSB: Channel Fine Tuning 64
14 RPN MSB 0
14 RPN LSB 2
14 Data Entry MSB: Channel Coarse Tuning 64
14 Pitch Bend 0
15 Voice Volume 127
15 Modulation Wheel 0
15 Voice Pan 64
15 Expression 127
15 Voice Reverb Level 40
15 Voice Chorus Level 0
15 Harmonic Content 64
15 Release Time 64
15 Attack Time 64
15 Brightness 64
15 Bank MSB 0
15 Bank LSB 0
15 Program Change: [0,0,0] 134 Grand Piano (XG PIANO)
15 RPN MSB 0
15 RPN LSB 0
15 Data Entry MSB: Pitch Bend Range 2
15 RPN MSB 0
15 RPN LSB 1
15 Data Entry MSB: Channel Fine Tuning 64
15 RPN MSB 0
15 RPN LSB 2
15 Data Entry MSB: Channel Coarse Tuning 64
15 Pitch Bend 0
0 Bank MSB 0
0 Bank LSB 113
0 Program Change: [0,113,0] 001 Live! Grand Piano (PIANO)
1 Bank MSB 0
1 Bank LSB 112
1 Program Change: [0,112,48] 054 String Ensemble (STRINGS)
2 Bank MSB 0
2 Bank LSB 112
2 Program Change: [0,112,33] 046 Finger Bass (BASS)
0 Voice Volume 110
1 Voice Volume 36
2 Voice Volume 100
0 Voice Pan 64
1 Voice Pan 64
2 Voice Pan 64
0 Voice Reverb Level 20
1 Voice Reverb Level 50
2 Voice Reverb Level 8
0 Voice Chorus Level 0
1 Voice Chorus Level 0
2 Voice Chorus Level 0
0 RPN MSB 0
0 RPN LSB 0
0 Data Entry MSB: Pitch Bend Range 2
1 RPN MSB 0
1 RPN LSB 0
1 Data Entry MSB: Pitch Bend Range 2
2 RPN MSB 0
2 RPN LSB 0
2 Data Entry MSB: Pitch Bend Range 2
0 Pitch Bend 0
1 Pitch Bend 0
2 Pitch Bend 0
0 Release Time 64
1 Release Time 64
2 Release Time 64
0 Pedal Sustain ON

In [17]:
len(c)


Out[17]:
349

In [18]:
writeout(c, 'documents/data/initial_send.txt')

In [19]:
s._dump()


Local: None
Master volume: None
Master tuning: 0
Reverb type: 02(Hall2)
Chorus type: ---(Celeste)
CHANNEL: 0
Bank Program: (0, 113, 0)
Control.BANK_MSB: 0
Control.BANK_LSB: 113
Control.VOLUME: 110
Control.PAN: 64
Control.REVERB: 20
Control.CHORUS: 0
Control.PEDAL: ON
Control.RELEASE: 64
Control.MODULATION: None
Control.EXPRESSION: None
Control.PORTAMENTO_CTRL: None
Control.HARMONIC: None
Control.ATTACK: None
Control.BRIGHTNESS: None
Control.RPN_MSB: 0
Control.RPN_LSB: 0
Control.DATA_MSB: None
Control.DATA_LSB: None
Control.DATA_INC: None
Control.DATA_DEC: None
Control.SOUND_OFF: None
Control.SOUND_OFF_XMONO: None
Control.SOUND_OFF_XPOLY: None
Control.NOTES_OFF: None
Control.NOTES_OFF_XOMNIOFF: None
Control.NOTES_OFF_XOMNION: None
Control.RESET_CONTROLS: None
Control.LOCAL: None
Rpn.PITCH_BEND_RANGE: (2, None)
Rpn.FINE_TUNE: (None, None)
Rpn.COARSE_TUNE: (None, None)
Rpn.NULL: (None, None)
Pitchwheel: 0
CHANNEL: 1
Bank Program: (0, 112, 48)
Control.BANK_MSB: 0
Control.BANK_LSB: 112
Control.VOLUME: 36
Control.PAN: 64
Control.REVERB: 50
Control.CHORUS: 0
Control.PEDAL: None
Control.RELEASE: 64
Control.MODULATION: None
Control.EXPRESSION: None
Control.PORTAMENTO_CTRL: None
Control.HARMONIC: None
Control.ATTACK: None
Control.BRIGHTNESS: None
Control.RPN_MSB: 0
Control.RPN_LSB: 0
Control.DATA_MSB: None
Control.DATA_LSB: None
Control.DATA_INC: None
Control.DATA_DEC: None
Control.SOUND_OFF: None
Control.SOUND_OFF_XMONO: None
Control.SOUND_OFF_XPOLY: None
Control.NOTES_OFF: None
Control.NOTES_OFF_XOMNIOFF: None
Control.NOTES_OFF_XOMNION: None
Control.RESET_CONTROLS: None
Control.LOCAL: None
Rpn.PITCH_BEND_RANGE: (2, None)
Rpn.FINE_TUNE: (None, None)
Rpn.COARSE_TUNE: (None, None)
Rpn.NULL: (None, None)
Pitchwheel: 0
CHANNEL: 2
Bank Program: (0, 112, 33)
Control.BANK_MSB: 0
Control.BANK_LSB: 112
Control.VOLUME: 100
Control.PAN: 64
Control.REVERB: 8
Control.CHORUS: 0
Control.PEDAL: None
Control.RELEASE: 64
Control.MODULATION: None
Control.EXPRESSION: None
Control.PORTAMENTO_CTRL: None
Control.HARMONIC: None
Control.ATTACK: None
Control.BRIGHTNESS: None
Control.RPN_MSB: 0
Control.RPN_LSB: 0
Control.DATA_MSB: None
Control.DATA_LSB: None
Control.DATA_INC: None
Control.DATA_DEC: None
Control.SOUND_OFF: None
Control.SOUND_OFF_XMONO: None
Control.SOUND_OFF_XPOLY: None
Control.NOTES_OFF: None
Control.NOTES_OFF_XOMNIOFF: None
Control.NOTES_OFF_XOMNION: None
Control.RESET_CONTROLS: None
Control.LOCAL: None
Rpn.PITCH_BEND_RANGE: (2, None)
Rpn.FINE_TUNE: (None, None)
Rpn.COARSE_TUNE: (None, None)
Rpn.NULL: (None, None)
Pitchwheel: 0
CHANNEL: 3
Bank Program: (None, None, None)
Control.BANK_MSB: None
Control.BANK_LSB: None
Control.VOLUME: None
Control.PAN: None
Control.REVERB: None
Control.CHORUS: None
Control.PEDAL: None
Control.RELEASE: None
Control.MODULATION: None
Control.EXPRESSION: None
Control.PORTAMENTO_CTRL: None
Control.HARMONIC: None
Control.ATTACK: None
Control.BRIGHTNESS: None
Control.RPN_MSB: None
Control.RPN_LSB: None
Control.DATA_MSB: None
Control.DATA_LSB: None
Control.DATA_INC: None
Control.DATA_DEC: None
Control.SOUND_OFF: None
Control.SOUND_OFF_XMONO: None
Control.SOUND_OFF_XPOLY: None
Control.NOTES_OFF: None
Control.NOTES_OFF_XOMNIOFF: None
Control.NOTES_OFF_XOMNION: None
Control.RESET_CONTROLS: None
Control.LOCAL: None
Rpn.PITCH_BEND_RANGE: (None, None)
Rpn.FINE_TUNE: (None, None)
Rpn.COARSE_TUNE: (None, None)
Rpn.NULL: (None, None)
Pitchwheel: None
CHANNEL: 4
Bank Program: (None, None, None)
Control.BANK_MSB: None
Control.BANK_LSB: None
Control.VOLUME: None
Control.PAN: None
Control.REVERB: None
Control.CHORUS: None
Control.PEDAL: None
Control.RELEASE: None
Control.MODULATION: None
Control.EXPRESSION: None
Control.PORTAMENTO_CTRL: None
Control.HARMONIC: None
Control.ATTACK: None
Control.BRIGHTNESS: None
Control.RPN_MSB: None
Control.RPN_LSB: None
Control.DATA_MSB: None
Control.DATA_LSB: None
Control.DATA_INC: None
Control.DATA_DEC: None
Control.SOUND_OFF: None
Control.SOUND_OFF_XMONO: None
Control.SOUND_OFF_XPOLY: None
Control.NOTES_OFF: None
Control.NOTES_OFF_XOMNIOFF: None
Control.NOTES_OFF_XOMNION: None
Control.RESET_CONTROLS: None
Control.LOCAL: None
Rpn.PITCH_BEND_RANGE: (None, None)
Rpn.FINE_TUNE: (None, None)
Rpn.COARSE_TUNE: (None, None)
Rpn.NULL: (None, None)
Pitchwheel: None
CHANNEL: 5
Bank Program: (None, None, None)
Control.BANK_MSB: None
Control.BANK_LSB: None
Control.VOLUME: None
Control.PAN: None
Control.REVERB: None
Control.CHORUS: None
Control.PEDAL: None
Control.RELEASE: None
Control.MODULATION: None
Control.EXPRESSION: None
Control.PORTAMENTO_CTRL: None
Control.HARMONIC: None
Control.ATTACK: None
Control.BRIGHTNESS: None
Control.RPN_MSB: None
Control.RPN_LSB: None
Control.DATA_MSB: None
Control.DATA_LSB: None
Control.DATA_INC: None
Control.DATA_DEC: None
Control.SOUND_OFF: None
Control.SOUND_OFF_XMONO: None
Control.SOUND_OFF_XPOLY: None
Control.NOTES_OFF: None
Control.NOTES_OFF_XOMNIOFF: None
Control.NOTES_OFF_XOMNION: None
Control.RESET_CONTROLS: None
Control.LOCAL: None
Rpn.PITCH_BEND_RANGE: (None, None)
Rpn.FINE_TUNE: (None, None)
Rpn.COARSE_TUNE: (None, None)
Rpn.NULL: (None, None)
Pitchwheel: None
CHANNEL: 6
Bank Program: (None, None, None)
Control.BANK_MSB: None
Control.BANK_LSB: None
Control.VOLUME: None
Control.PAN: None
Control.REVERB: None
Control.CHORUS: None
Control.PEDAL: None
Control.RELEASE: None
Control.MODULATION: None
Control.EXPRESSION: None
Control.PORTAMENTO_CTRL: None
Control.HARMONIC: None
Control.ATTACK: None
Control.BRIGHTNESS: None
Control.RPN_MSB: None
Control.RPN_LSB: None
Control.DATA_MSB: None
Control.DATA_LSB: None
Control.DATA_INC: None
Control.DATA_DEC: None
Control.SOUND_OFF: None
Control.SOUND_OFF_XMONO: None
Control.SOUND_OFF_XPOLY: None
Control.NOTES_OFF: None
Control.NOTES_OFF_XOMNIOFF: None
Control.NOTES_OFF_XOMNION: None
Control.RESET_CONTROLS: None
Control.LOCAL: None
Rpn.PITCH_BEND_RANGE: (None, None)
Rpn.FINE_TUNE: (None, None)
Rpn.COARSE_TUNE: (None, None)
Rpn.NULL: (None, None)
Pitchwheel: None
CHANNEL: 7
Bank Program: (None, None, None)
Control.BANK_MSB: None
Control.BANK_LSB: None
Control.VOLUME: None
Control.PAN: None
Control.REVERB: None
Control.CHORUS: None
Control.PEDAL: None
Control.RELEASE: None
Control.MODULATION: None
Control.EXPRESSION: None
Control.PORTAMENTO_CTRL: None
Control.HARMONIC: None
Control.ATTACK: None
Control.BRIGHTNESS: None
Control.RPN_MSB: None
Control.RPN_LSB: None
Control.DATA_MSB: None
Control.DATA_LSB: None
Control.DATA_INC: None
Control.DATA_DEC: None
Control.SOUND_OFF: None
Control.SOUND_OFF_XMONO: None
Control.SOUND_OFF_XPOLY: None
Control.NOTES_OFF: None
Control.NOTES_OFF_XOMNIOFF: None
Control.NOTES_OFF_XOMNION: None
Control.RESET_CONTROLS: None
Control.LOCAL: None
Rpn.PITCH_BEND_RANGE: (None, None)
Rpn.FINE_TUNE: (None, None)
Rpn.COARSE_TUNE: (None, None)
Rpn.NULL: (None, None)
Pitchwheel: None
CHANNEL: 8
Bank Program: (127, 0, 0)
Control.BANK_MSB: 127
Control.BANK_LSB: 0
Control.VOLUME: 88
Control.PAN: 64
Control.REVERB: 40
Control.CHORUS: 0
Control.PEDAL: None
Control.RELEASE: 64
Control.MODULATION: 0
Control.EXPRESSION: 127
Control.PORTAMENTO_CTRL: None
Control.HARMONIC: 64
Control.ATTACK: 64
Control.BRIGHTNESS: 64
Control.RPN_MSB: 0
Control.RPN_LSB: 2
Control.DATA_MSB: None
Control.DATA_LSB: None
Control.DATA_INC: None
Control.DATA_DEC: None
Control.SOUND_OFF: None
Control.SOUND_OFF_XMONO: None
Control.SOUND_OFF_XPOLY: None
Control.NOTES_OFF: None
Control.NOTES_OFF_XOMNIOFF: None
Control.NOTES_OFF_XOMNION: None
Control.RESET_CONTROLS: None
Control.LOCAL: None
Rpn.PITCH_BEND_RANGE: (2, None)
Rpn.FINE_TUNE: (64, None)
Rpn.COARSE_TUNE: (64, None)
Rpn.NULL: (None, None)
Pitchwheel: 0
CHANNEL: 9
Bank Program: (127, 0, 27)
Control.BANK_MSB: 127
Control.BANK_LSB: 0
Control.VOLUME: 86
Control.PAN: 64
Control.REVERB: 20
Control.CHORUS: 0
Control.PEDAL: None
Control.RELEASE: 64
Control.MODULATION: 0
Control.EXPRESSION: 127
Control.PORTAMENTO_CTRL: None
Control.HARMONIC: 64
Control.ATTACK: 64
Control.BRIGHTNESS: 64
Control.RPN_MSB: 0
Control.RPN_LSB: 2
Control.DATA_MSB: None
Control.DATA_LSB: None
Control.DATA_INC: None
Control.DATA_DEC: None
Control.SOUND_OFF: None
Control.SOUND_OFF_XMONO: None
Control.SOUND_OFF_XPOLY: None
Control.NOTES_OFF: None
Control.NOTES_OFF_XOMNIOFF: None
Control.NOTES_OFF_XOMNION: None
Control.RESET_CONTROLS: None
Control.LOCAL: None
Rpn.PITCH_BEND_RANGE: (2, None)
Rpn.FINE_TUNE: (64, None)
Rpn.COARSE_TUNE: (64, None)
Rpn.NULL: (None, None)
Pitchwheel: 0
CHANNEL: 10
Bank Program: (0, 112, 33)
Control.BANK_MSB: 0
Control.BANK_LSB: 112
Control.VOLUME: 81
Control.PAN: 64
Control.REVERB: 0
Control.CHORUS: 20
Control.PEDAL: None
Control.RELEASE: 64
Control.MODULATION: 0
Control.EXPRESSION: 127
Control.PORTAMENTO_CTRL: None
Control.HARMONIC: 64
Control.ATTACK: 64
Control.BRIGHTNESS: 64
Control.RPN_MSB: 0
Control.RPN_LSB: 2
Control.DATA_MSB: None
Control.DATA_LSB: None
Control.DATA_INC: None
Control.DATA_DEC: None
Control.SOUND_OFF: None
Control.SOUND_OFF_XMONO: None
Control.SOUND_OFF_XPOLY: None
Control.NOTES_OFF: None
Control.NOTES_OFF_XOMNIOFF: None
Control.NOTES_OFF_XOMNION: None
Control.RESET_CONTROLS: None
Control.LOCAL: None
Rpn.PITCH_BEND_RANGE: (2, None)
Rpn.FINE_TUNE: (64, None)
Rpn.COARSE_TUNE: (64, None)
Rpn.NULL: (None, None)
Pitchwheel: 0
CHANNEL: 11
Bank Program: (0, 117, 27)
Control.BANK_MSB: 0
Control.BANK_LSB: 117
Control.VOLUME: 56
Control.PAN: 38
Control.REVERB: 30
Control.CHORUS: 30
Control.PEDAL: None
Control.RELEASE: 64
Control.MODULATION: 0
Control.EXPRESSION: 127
Control.PORTAMENTO_CTRL: None
Control.HARMONIC: 64
Control.ATTACK: 64
Control.BRIGHTNESS: 64
Control.RPN_MSB: 0
Control.RPN_LSB: 2
Control.DATA_MSB: None
Control.DATA_LSB: None
Control.DATA_INC: None
Control.DATA_DEC: None
Control.SOUND_OFF: None
Control.SOUND_OFF_XMONO: None
Control.SOUND_OFF_XPOLY: None
Control.NOTES_OFF: None
Control.NOTES_OFF_XOMNIOFF: None
Control.NOTES_OFF_XOMNION: None
Control.RESET_CONTROLS: None
Control.LOCAL: None
Rpn.PITCH_BEND_RANGE: (2, None)
Rpn.FINE_TUNE: (64, None)
Rpn.COARSE_TUNE: (64, None)
Rpn.NULL: (None, None)
Pitchwheel: 0
CHANNEL: 12
Bank Program: (0, 1, 4)
Control.BANK_MSB: 0
Control.BANK_LSB: 1
Control.VOLUME: 50
Control.PAN: 86
Control.REVERB: 40
Control.CHORUS: 40
Control.PEDAL: None
Control.RELEASE: 64
Control.MODULATION: 0
Control.EXPRESSION: 127
Control.PORTAMENTO_CTRL: None
Control.HARMONIC: 64
Control.ATTACK: 64
Control.BRIGHTNESS: 64
Control.RPN_MSB: 0
Control.RPN_LSB: 2
Control.DATA_MSB: None
Control.DATA_LSB: None
Control.DATA_INC: None
Control.DATA_DEC: None
Control.SOUND_OFF: None
Control.SOUND_OFF_XMONO: None
Control.SOUND_OFF_XPOLY: None
Control.NOTES_OFF: None
Control.NOTES_OFF_XOMNIOFF: None
Control.NOTES_OFF_XOMNION: None
Control.RESET_CONTROLS: None
Control.LOCAL: None
Rpn.PITCH_BEND_RANGE: (2, None)
Rpn.FINE_TUNE: (64, None)
Rpn.COARSE_TUNE: (64, None)
Rpn.NULL: (None, None)
Pitchwheel: 0
CHANNEL: 13
Bank Program: (0, 0, 51)
Control.BANK_MSB: 0
Control.BANK_LSB: 0
Control.VOLUME: 52
Control.PAN: 68
Control.REVERB: 68
Control.CHORUS: 0
Control.PEDAL: None
Control.RELEASE: 64
Control.MODULATION: 0
Control.EXPRESSION: 127
Control.PORTAMENTO_CTRL: None
Control.HARMONIC: 64
Control.ATTACK: 64
Control.BRIGHTNESS: 52
Control.RPN_MSB: 0
Control.RPN_LSB: 2
Control.DATA_MSB: None
Control.DATA_LSB: None
Control.DATA_INC: None
Control.DATA_DEC: None
Control.SOUND_OFF: None
Control.SOUND_OFF_XMONO: None
Control.SOUND_OFF_XPOLY: None
Control.NOTES_OFF: None
Control.NOTES_OFF_XOMNIOFF: None
Control.NOTES_OFF_XOMNION: None
Control.RESET_CONTROLS: None
Control.LOCAL: None
Rpn.PITCH_BEND_RANGE: (2, None)
Rpn.FINE_TUNE: (64, None)
Rpn.COARSE_TUNE: (64, None)
Rpn.NULL: (None, None)
Pitchwheel: 0
CHANNEL: 14
Bank Program: (0, 0, 0)
Control.BANK_MSB: 0
Control.BANK_LSB: 0
Control.VOLUME: 127
Control.PAN: 64
Control.REVERB: 40
Control.CHORUS: 0
Control.PEDAL: None
Control.RELEASE: 64
Control.MODULATION: 0
Control.EXPRESSION: 127
Control.PORTAMENTO_CTRL: None
Control.HARMONIC: 64
Control.ATTACK: 64
Control.BRIGHTNESS: 64
Control.RPN_MSB: 0
Control.RPN_LSB: 2
Control.DATA_MSB: None
Control.DATA_LSB: None
Control.DATA_INC: None
Control.DATA_DEC: None
Control.SOUND_OFF: None
Control.SOUND_OFF_XMONO: None
Control.SOUND_OFF_XPOLY: None
Control.NOTES_OFF: None
Control.NOTES_OFF_XOMNIOFF: None
Control.NOTES_OFF_XOMNION: None
Control.RESET_CONTROLS: None
Control.LOCAL: None
Rpn.PITCH_BEND_RANGE: (2, None)
Rpn.FINE_TUNE: (64, None)
Rpn.COARSE_TUNE: (64, None)
Rpn.NULL: (None, None)
Pitchwheel: 0
CHANNEL: 15
Bank Program: (0, 0, 0)
Control.BANK_MSB: 0
Control.BANK_LSB: 0
Control.VOLUME: 127
Control.PAN: 64
Control.REVERB: 40
Control.CHORUS: 0
Control.PEDAL: None
Control.RELEASE: 64
Control.MODULATION: 0
Control.EXPRESSION: 127
Control.PORTAMENTO_CTRL: None
Control.HARMONIC: 64
Control.ATTACK: 64
Control.BRIGHTNESS: 64
Control.RPN_MSB: 0
Control.RPN_LSB: 2
Control.DATA_MSB: None
Control.DATA_LSB: None
Control.DATA_INC: None
Control.DATA_DEC: None
Control.SOUND_OFF: None
Control.SOUND_OFF_XMONO: None
Control.SOUND_OFF_XPOLY: None
Control.NOTES_OFF: None
Control.NOTES_OFF_XOMNIOFF: None
Control.NOTES_OFF_XOMNION: None
Control.RESET_CONTROLS: None
Control.LOCAL: None
Rpn.PITCH_BEND_RANGE: (2, None)
Rpn.FINE_TUNE: (64, None)
Rpn.COARSE_TUNE: (64, None)
Rpn.NULL: (None, None)
Pitchwheel: 0

Hmmm, what about if we have a song selected instead of a style?


In [22]:
s1, c1 = collector(s)
writeout(c1, 'documents/data/initial_send_song1.txt')


[SysEx 7E 7F 09 01]
[SysEx 43 10 4C 00 00 7E 00]
MIDI Master Tuning 0
Reverb Type 03(Hall3)
Chorus Type ---(Celeste)
0 Bank MSB 0
0 Bank LSB 113
0 Program Change: [0,113,0] 001 Live! Grand Piano (PIANO)
1 Bank MSB 0
1 Bank LSB 112
1 Program Change: [0,112,48] 054 String Ensemble (STRINGS)
2 Bank MSB 0
2 Bank LSB 112
2 Program Change: [0,112,33] 046 Finger Bass (BASS)
0 Voice Volume 110
1 Voice Volume 36
2 Voice Volume 100
0 Voice Pan 64
1 Voice Pan 64
2 Voice Pan 64
0 Voice Reverb Level 20
1 Voice Reverb Level 50
2 Voice Reverb Level 8
0 Voice Chorus Level 0
1 Voice Chorus Level 0
2 Voice Chorus Level 0
0 RPN MSB 0
0 RPN LSB 0
0 Data Entry MSB: Pitch Bend Range 2
1 RPN MSB 0
1 RPN LSB 0
1 Data Entry MSB: Pitch Bend Range 2
2 RPN MSB 0
2 RPN LSB 0
2 Data Entry MSB: Pitch Bend Range 2
0 Pitch Bend 0
1 Pitch Bend 0
2 Pitch Bend 0
0 Release Time 64
1 Release Time 64
2 Release Time 64
0 Pedal Sustain ON

That's with song 001 selected.

How about a blank user song?


In [28]:
s2, c2 = collector(s1)
writeout(c2, 'documents/data/initial_send_user.txt')


[SysEx 7E 7F 09 01]
[SysEx 43 10 4C 00 00 7E 00]
MIDI Master Tuning 0
Reverb Type 01(Hall1)
Chorus Type ---(Celeste)
3 Bank MSB 0
3 Bank LSB 0
3 Program Change: [0,0,0] 134 Grand Piano (XG PIANO)
3 RPN MSB 0
3 RPN LSB 0
3 Data Entry MSB: Pitch Bend Range 2
3 RPN LSB 127
3 RPN MSB 127
3 Voice Reverb Level 40
3 Voice Chorus Level 0
3 Voice Volume 100
3 Voice Pan 64
3 Pedal Sustain OFF

Huh, it looks like it actually sends a pedal sustain for that. Let's use a note_on instead.


In [6]:
def collector(state=None):
    if state is None:
        newstate = controlstate.MidiControlState()
    else:
        newstate = copy.deepcopy(state)
    collection_list = []
    with mido.open_input("DGX-505 MIDI 1") as inport:
        timer = timers.offsetTimer()
        for msg in inport:
            msg.time = timer()
            wrapped = newstate.feed_message(msg)
            collection_list.append(wrapped)
            if msg.type != "clock":
                print(wrapped)
            if msg.type == "note_on":
                break
    return newstate, collection_list

In [30]:
s3, c2 = collector(s2)
writeout(c2, 'documents/data/initial_send_user.txt')


[SysEx 7E 7F 09 01]
[SysEx 43 10 4C 00 00 7E 00]
MIDI Master Tuning 0
Reverb Type 01(Hall1)
Chorus Type ---(Celeste)
3 Bank MSB 0
3 Bank LSB 0
3 Program Change: [0,0,0] 134 Grand Piano (XG PIANO)
3 RPN MSB 0
3 RPN LSB 0
3 Data Entry MSB: Pitch Bend Range 2
3 RPN LSB 127
3 RPN MSB 127
3 Voice Reverb Level 40
3 Voice Chorus Level 0
3 Voice Volume 100
3 Voice Pan 64
3 Pedal Sustain OFF
3 Modulation Wheel 0
3 Expression 127
3 Harmonic Content 64
3 Release Time 64
3 Attack Time 64
3 Brightness 64
3 Pitch Bend 0
4 Bank MSB 0
4 Bank LSB 0
4 Program Change: [0,0,0] 134 Grand Piano (XG PIANO)
4 RPN MSB 0
4 RPN LSB 0
4 Data Entry MSB: Pitch Bend Range 2
4 RPN LSB 127
4 RPN MSB 127
4 Voice Reverb Level 40
4 Voice Chorus Level 0
4 Voice Volume 100
4 Voice Pan 64
4 Pedal Sustain OFF
4 Modulation Wheel 0
4 Expression 127
4 Harmonic Content 64
4 Release Time 64
4 Attack Time 64
4 Brightness 64
4 Pitch Bend 0
5 Bank MSB 0
5 Bank LSB 0
5 Program Change: [0,0,0] 134 Grand Piano (XG PIANO)
5 RPN MSB 0
5 RPN LSB 0
5 Data Entry MSB: Pitch Bend Range 2
5 RPN LSB 127
5 RPN MSB 127
5 Voice Reverb Level 40
5 Voice Chorus Level 0
5 Voice Volume 100
5 Voice Pan 64
5 Pedal Sustain OFF
5 Modulation Wheel 0
5 Expression 127
5 Harmonic Content 64
5 Release Time 64
5 Attack Time 64
5 Brightness 64
5 Pitch Bend 0
6 Bank MSB 0
6 Bank LSB 0
6 Program Change: [0,0,0] 134 Grand Piano (XG PIANO)
6 RPN MSB 0
6 RPN LSB 0
6 Data Entry MSB: Pitch Bend Range 2
6 RPN LSB 127
6 RPN MSB 127
6 Voice Reverb Level 40
6 Voice Chorus Level 0
6 Voice Volume 100
6 Voice Pan 64
6 Pedal Sustain OFF
6 Modulation Wheel 0
6 Expression 127
6 Harmonic Content 64
6 Release Time 64
6 Attack Time 64
6 Brightness 64
6 Pitch Bend 0
7 Bank MSB 0
7 Bank LSB 0
7 Program Change: [0,0,0] 134 Grand Piano (XG PIANO)
7 RPN MSB 0
7 RPN LSB 0
7 Data Entry MSB: Pitch Bend Range 2
7 RPN LSB 127
7 RPN MSB 127
7 Voice Reverb Level 40
7 Voice Chorus Level 0
7 Voice Volume 100
7 Voice Pan 64
7 Pedal Sustain OFF
7 Modulation Wheel 0
7 Expression 127
7 Harmonic Content 64
7 Release Time 64
7 Attack Time 64
7 Brightness 64
7 Pitch Bend 0
8 Voice Volume 88
8 Modulation Wheel 0
8 Voice Pan 64
8 Expression 127
8 Voice Reverb Level 40
8 Voice Chorus Level 0
8 Harmonic Content 64
8 Release Time 64
8 Attack Time 64
8 Brightness 64
8 Bank MSB 127
8 Bank LSB 0
8 Program Change: [127,0,0] 122 Standard Kit 1 (DRUM KITS)
8 RPN MSB 0
8 RPN LSB 0
8 Data Entry MSB: Pitch Bend Range 2
8 RPN MSB 0
8 RPN LSB 1
8 Data Entry MSB: Channel Fine Tuning 64
8 RPN MSB 0
8 RPN LSB 2
8 Data Entry MSB: Channel Coarse Tuning 64
8 Pitch Bend 0
9 Voice Volume 86
9 Modulation Wheel 0
9 Voice Pan 64
9 Expression 127
9 Voice Reverb Level 20
9 Voice Chorus Level 0
9 Harmonic Content 64
9 Release Time 64
9 Attack Time 64
9 Brightness 64
9 Bank MSB 127
9 Bank LSB 0
9 Program Change: [127,0,27] 128 Dance Kit (DRUM KITS)
9 RPN MSB 0
9 RPN LSB 0
9 Data Entry MSB: Pitch Bend Range 2
9 RPN MSB 0
9 RPN LSB 1
9 Data Entry MSB: Channel Fine Tuning 64
9 RPN MSB 0
9 RPN LSB 2
9 Data Entry MSB: Channel Coarse Tuning 64
9 Pitch Bend 0
10 Voice Volume 81
10 Modulation Wheel 0
10 Voice Pan 64
10 Expression 127
10 Voice Reverb Level 0
10 Voice Chorus Level 20
10 Harmonic Content 64
10 Release Time 64
10 Attack Time 64
10 Brightness 64
10 Bank MSB 0
10 Bank LSB 112
10 Program Change: [0,112,33] 046 Finger Bass (BASS)
10 RPN MSB 0
10 RPN LSB 0
10 Data Entry MSB: Pitch Bend Range 2
10 RPN MSB 0
10 RPN LSB 1
10 Data Entry MSB: Channel Fine Tuning 64
10 RPN MSB 0
10 RPN LSB 2
10 Data Entry MSB: Channel Coarse Tuning 64
10 Pitch Bend 0
11 Voice Volume 56
11 Modulation Wheel 0
11 Voice Pan 38
11 Expression 127
11 Voice Reverb Level 30
11 Voice Chorus Level 30
11 Harmonic Content 64
11 Release Time 64
11 Attack Time 64
11 Brightness 64
11 Bank MSB 0
11 Bank LSB 117
11 Program Change: [0,117,27] 041 60's Clean Guitar (GUITAR)
11 RPN MSB 0
11 RPN LSB 0
11 Data Entry MSB: Pitch Bend Range 2
11 RPN MSB 0
11 RPN LSB 1
11 Data Entry MSB: Channel Fine Tuning 64
11 RPN MSB 0
11 RPN LSB 2
11 Data Entry MSB: Channel Coarse Tuning 64
11 Pitch Bend 0
12 Voice Volume 50
12 Modulation Wheel 0
12 Voice Pan 86
12 Expression 127
12 Voice Reverb Level 40
12 Voice Chorus Level 40
12 Harmonic Content 64
12 Release Time 64
12 Attack Time 64
12 Brightness 64
12 Bank MSB 0
12 Bank LSB 1
12 Program Change: [0,1,4] 146 Electric Piano 1 KSP (XG PIANO)
12 RPN MSB 0
12 RPN LSB 0
12 Data Entry MSB: Pitch Bend Range 2
12 RPN MSB 0
12 RPN LSB 1
12 Data Entry MSB: Channel Fine Tuning 64
12 RPN MSB 0
12 RPN LSB 2
12 Data Entry MSB: Channel Coarse Tuning 64
12 Pitch Bend 0
13 Voice Volume 52
13 Modulation Wheel 0
13 Voice Pan 68
13 Expression 127
13 Voice Reverb Level 68
13 Voice Chorus Level 0
13 Harmonic Content 64
13 Release Time 64
13 Attack Time 64
13 Brightness 52
13 Bank MSB 0
13 Bank LSB 0
13 Program Change: [0,0,51] 287 Synth Strings 2 (XG ENSEMBLE)
13 RPN MSB 0
13 RPN LSB 0
13 Data Entry MSB: Pitch Bend Range 2
13 RPN MSB 0
13 RPN LSB 1
13 Data Entry MSB: Channel Fine Tuning 64
13 RPN MSB 0
13 RPN LSB 2
13 Data Entry MSB: Channel Coarse Tuning 64
13 Pitch Bend 0
14 Voice Volume 127
14 Modulation Wheel 0
14 Voice Pan 64
14 Expression 127
14 Voice Reverb Level 40
14 Voice Chorus Level 0
14 Harmonic Content 64
14 Release Time 64
14 Attack Time 64
14 Brightness 64
14 Bank MSB 0
14 Bank LSB 0
14 Program Change: [0,0,0] 134 Grand Piano (XG PIANO)
14 RPN MSB 0
14 RPN LSB 0
14 Data Entry MSB: Pitch Bend Range 2
14 RPN MSB 0
14 RPN LSB 1
14 Data Entry MSB: Channel Fine Tuning 64
14 RPN MSB 0
14 RPN LSB 2
14 Data Entry MSB: Channel Coarse Tuning 64
14 Pitch Bend 0
15 Voice Volume 127
15 Modulation Wheel 0
15 Voice Pan 64
15 Expression 127
15 Voice Reverb Level 40
15 Voice Chorus Level 0
15 Harmonic Content 64
15 Release Time 64
15 Attack Time 64
15 Brightness 64
15 Bank MSB 0
15 Bank LSB 0
15 Program Change: [0,0,0] 134 Grand Piano (XG PIANO)
15 RPN MSB 0
15 RPN LSB 0
15 Data Entry MSB: Pitch Bend Range 2
15 RPN MSB 0
15 RPN LSB 1
15 Data Entry MSB: Channel Fine Tuning 64
15 RPN MSB 0
15 RPN LSB 2
15 Data Entry MSB: Channel Coarse Tuning 64
15 Pitch Bend 0
0 Bank MSB 0
0 Bank LSB 113
0 Program Change: [0,113,0] 001 Live! Grand Piano (PIANO)
1 Bank MSB 0
1 Bank LSB 112
1 Program Change: [0,112,48] 054 String Ensemble (STRINGS)
2 Bank MSB 0
2 Bank LSB 112
2 Program Change: [0,112,33] 046 Finger Bass (BASS)
0 Voice Volume 110
1 Voice Volume 36
2 Voice Volume 100
0 Voice Pan 64
1 Voice Pan 64
2 Voice Pan 64
0 Voice Reverb Level 20
1 Voice Reverb Level 50
2 Voice Reverb Level 8
0 Voice Chorus Level 0
1 Voice Chorus Level 0
2 Voice Chorus Level 0
0 RPN MSB 0
0 RPN LSB 0
0 Data Entry MSB: Pitch Bend Range 2
1 RPN MSB 0
1 RPN LSB 0
1 Data Entry MSB: Pitch Bend Range 2
2 RPN MSB 0
2 RPN LSB 0
2 Data Entry MSB: Pitch Bend Range 2
0 Pitch Bend 0
1 Pitch Bend 0
2 Pitch Bend 0
0 Release Time 64
1 Release Time 64
2 Release Time 64
0 Note On 100(E6)

In [31]:
s3._dump()


Local: None
Master volume: None
Master tuning: 0
Reverb type: 01(Hall1)
Chorus type: ---(Celeste)
CHANNEL: 0
Bank Program: (0, 113, 0)
Control.BANK_MSB: 0
Control.BANK_LSB: 113
Control.VOLUME: 110
Control.PAN: 64
Control.REVERB: 20
Control.CHORUS: 0
Control.PEDAL: ON
Control.RELEASE: 64
Control.MODULATION: None
Control.EXPRESSION: None
Control.PORTAMENTO_CTRL: None
Control.HARMONIC: None
Control.ATTACK: None
Control.BRIGHTNESS: None
Control.RPN_MSB: 0
Control.RPN_LSB: 0
Control.DATA_MSB: None
Control.DATA_LSB: None
Control.DATA_INC: None
Control.DATA_DEC: None
Control.SOUND_OFF: None
Control.SOUND_OFF_XMONO: None
Control.SOUND_OFF_XPOLY: None
Control.NOTES_OFF: None
Control.NOTES_OFF_XOMNIOFF: None
Control.NOTES_OFF_XOMNION: None
Control.RESET_CONTROLS: None
Control.LOCAL: None
Rpn.PITCH_BEND_RANGE: (2, None)
Rpn.FINE_TUNE: (None, None)
Rpn.COARSE_TUNE: (None, None)
Rpn.NULL: (None, None)
Pitchwheel: 0
CHANNEL: 1
Bank Program: (0, 112, 48)
Control.BANK_MSB: 0
Control.BANK_LSB: 112
Control.VOLUME: 36
Control.PAN: 64
Control.REVERB: 50
Control.CHORUS: 0
Control.PEDAL: None
Control.RELEASE: 64
Control.MODULATION: None
Control.EXPRESSION: None
Control.PORTAMENTO_CTRL: None
Control.HARMONIC: None
Control.ATTACK: None
Control.BRIGHTNESS: None
Control.RPN_MSB: 0
Control.RPN_LSB: 0
Control.DATA_MSB: None
Control.DATA_LSB: None
Control.DATA_INC: None
Control.DATA_DEC: None
Control.SOUND_OFF: None
Control.SOUND_OFF_XMONO: None
Control.SOUND_OFF_XPOLY: None
Control.NOTES_OFF: None
Control.NOTES_OFF_XOMNIOFF: None
Control.NOTES_OFF_XOMNION: None
Control.RESET_CONTROLS: None
Control.LOCAL: None
Rpn.PITCH_BEND_RANGE: (2, None)
Rpn.FINE_TUNE: (None, None)
Rpn.COARSE_TUNE: (None, None)
Rpn.NULL: (None, None)
Pitchwheel: 0
CHANNEL: 2
Bank Program: (0, 112, 33)
Control.BANK_MSB: 0
Control.BANK_LSB: 112
Control.VOLUME: 100
Control.PAN: 64
Control.REVERB: 8
Control.CHORUS: 0
Control.PEDAL: None
Control.RELEASE: 64
Control.MODULATION: None
Control.EXPRESSION: None
Control.PORTAMENTO_CTRL: None
Control.HARMONIC: None
Control.ATTACK: None
Control.BRIGHTNESS: None
Control.RPN_MSB: 0
Control.RPN_LSB: 0
Control.DATA_MSB: None
Control.DATA_LSB: None
Control.DATA_INC: None
Control.DATA_DEC: None
Control.SOUND_OFF: None
Control.SOUND_OFF_XMONO: None
Control.SOUND_OFF_XPOLY: None
Control.NOTES_OFF: None
Control.NOTES_OFF_XOMNIOFF: None
Control.NOTES_OFF_XOMNION: None
Control.RESET_CONTROLS: None
Control.LOCAL: None
Rpn.PITCH_BEND_RANGE: (2, None)
Rpn.FINE_TUNE: (None, None)
Rpn.COARSE_TUNE: (None, None)
Rpn.NULL: (None, None)
Pitchwheel: 0
CHANNEL: 3
Bank Program: (0, 0, 0)
Control.BANK_MSB: 0
Control.BANK_LSB: 0
Control.VOLUME: 100
Control.PAN: 64
Control.REVERB: 40
Control.CHORUS: 0
Control.PEDAL: OFF
Control.RELEASE: 64
Control.MODULATION: 0
Control.EXPRESSION: 127
Control.PORTAMENTO_CTRL: None
Control.HARMONIC: 64
Control.ATTACK: 64
Control.BRIGHTNESS: 64
Control.RPN_MSB: 127
Control.RPN_LSB: 127
Control.DATA_MSB: None
Control.DATA_LSB: None
Control.DATA_INC: None
Control.DATA_DEC: None
Control.SOUND_OFF: None
Control.SOUND_OFF_XMONO: None
Control.SOUND_OFF_XPOLY: None
Control.NOTES_OFF: None
Control.NOTES_OFF_XOMNIOFF: None
Control.NOTES_OFF_XOMNION: None
Control.RESET_CONTROLS: None
Control.LOCAL: None
Rpn.PITCH_BEND_RANGE: (2, None)
Rpn.FINE_TUNE: (None, None)
Rpn.COARSE_TUNE: (None, None)
Rpn.NULL: (None, None)
Pitchwheel: 0
CHANNEL: 4
Bank Program: (0, 0, 0)
Control.BANK_MSB: 0
Control.BANK_LSB: 0
Control.VOLUME: 100
Control.PAN: 64
Control.REVERB: 40
Control.CHORUS: 0
Control.PEDAL: OFF
Control.RELEASE: 64
Control.MODULATION: 0
Control.EXPRESSION: 127
Control.PORTAMENTO_CTRL: None
Control.HARMONIC: 64
Control.ATTACK: 64
Control.BRIGHTNESS: 64
Control.RPN_MSB: 127
Control.RPN_LSB: 127
Control.DATA_MSB: None
Control.DATA_LSB: None
Control.DATA_INC: None
Control.DATA_DEC: None
Control.SOUND_OFF: None
Control.SOUND_OFF_XMONO: None
Control.SOUND_OFF_XPOLY: None
Control.NOTES_OFF: None
Control.NOTES_OFF_XOMNIOFF: None
Control.NOTES_OFF_XOMNION: None
Control.RESET_CONTROLS: None
Control.LOCAL: None
Rpn.PITCH_BEND_RANGE: (2, None)
Rpn.FINE_TUNE: (None, None)
Rpn.COARSE_TUNE: (None, None)
Rpn.NULL: (None, None)
Pitchwheel: 0
CHANNEL: 5
Bank Program: (0, 0, 0)
Control.BANK_MSB: 0
Control.BANK_LSB: 0
Control.VOLUME: 100
Control.PAN: 64
Control.REVERB: 40
Control.CHORUS: 0
Control.PEDAL: OFF
Control.RELEASE: 64
Control.MODULATION: 0
Control.EXPRESSION: 127
Control.PORTAMENTO_CTRL: None
Control.HARMONIC: 64
Control.ATTACK: 64
Control.BRIGHTNESS: 64
Control.RPN_MSB: 127
Control.RPN_LSB: 127
Control.DATA_MSB: None
Control.DATA_LSB: None
Control.DATA_INC: None
Control.DATA_DEC: None
Control.SOUND_OFF: None
Control.SOUND_OFF_XMONO: None
Control.SOUND_OFF_XPOLY: None
Control.NOTES_OFF: None
Control.NOTES_OFF_XOMNIOFF: None
Control.NOTES_OFF_XOMNION: None
Control.RESET_CONTROLS: None
Control.LOCAL: None
Rpn.PITCH_BEND_RANGE: (2, None)
Rpn.FINE_TUNE: (None, None)
Rpn.COARSE_TUNE: (None, None)
Rpn.NULL: (None, None)
Pitchwheel: 0
CHANNEL: 6
Bank Program: (0, 0, 0)
Control.BANK_MSB: 0
Control.BANK_LSB: 0
Control.VOLUME: 100
Control.PAN: 64
Control.REVERB: 40
Control.CHORUS: 0
Control.PEDAL: OFF
Control.RELEASE: 64
Control.MODULATION: 0
Control.EXPRESSION: 127
Control.PORTAMENTO_CTRL: None
Control.HARMONIC: 64
Control.ATTACK: 64
Control.BRIGHTNESS: 64
Control.RPN_MSB: 127
Control.RPN_LSB: 127
Control.DATA_MSB: None
Control.DATA_LSB: None
Control.DATA_INC: None
Control.DATA_DEC: None
Control.SOUND_OFF: None
Control.SOUND_OFF_XMONO: None
Control.SOUND_OFF_XPOLY: None
Control.NOTES_OFF: None
Control.NOTES_OFF_XOMNIOFF: None
Control.NOTES_OFF_XOMNION: None
Control.RESET_CONTROLS: None
Control.LOCAL: None
Rpn.PITCH_BEND_RANGE: (2, None)
Rpn.FINE_TUNE: (None, None)
Rpn.COARSE_TUNE: (None, None)
Rpn.NULL: (None, None)
Pitchwheel: 0
CHANNEL: 7
Bank Program: (0, 0, 0)
Control.BANK_MSB: 0
Control.BANK_LSB: 0
Control.VOLUME: 100
Control.PAN: 64
Control.REVERB: 40
Control.CHORUS: 0
Control.PEDAL: OFF
Control.RELEASE: 64
Control.MODULATION: 0
Control.EXPRESSION: 127
Control.PORTAMENTO_CTRL: None
Control.HARMONIC: 64
Control.ATTACK: 64
Control.BRIGHTNESS: 64
Control.RPN_MSB: 127
Control.RPN_LSB: 127
Control.DATA_MSB: None
Control.DATA_LSB: None
Control.DATA_INC: None
Control.DATA_DEC: None
Control.SOUND_OFF: None
Control.SOUND_OFF_XMONO: None
Control.SOUND_OFF_XPOLY: None
Control.NOTES_OFF: None
Control.NOTES_OFF_XOMNIOFF: None
Control.NOTES_OFF_XOMNION: None
Control.RESET_CONTROLS: None
Control.LOCAL: None
Rpn.PITCH_BEND_RANGE: (2, None)
Rpn.FINE_TUNE: (None, None)
Rpn.COARSE_TUNE: (None, None)
Rpn.NULL: (None, None)
Pitchwheel: 0
CHANNEL: 8
Bank Program: (127, 0, 0)
Control.BANK_MSB: 127
Control.BANK_LSB: 0
Control.VOLUME: 88
Control.PAN: 64
Control.REVERB: 40
Control.CHORUS: 0
Control.PEDAL: None
Control.RELEASE: 64
Control.MODULATION: 0
Control.EXPRESSION: 127
Control.PORTAMENTO_CTRL: None
Control.HARMONIC: 64
Control.ATTACK: 64
Control.BRIGHTNESS: 64
Control.RPN_MSB: 0
Control.RPN_LSB: 2
Control.DATA_MSB: None
Control.DATA_LSB: None
Control.DATA_INC: None
Control.DATA_DEC: None
Control.SOUND_OFF: None
Control.SOUND_OFF_XMONO: None
Control.SOUND_OFF_XPOLY: None
Control.NOTES_OFF: None
Control.NOTES_OFF_XOMNIOFF: None
Control.NOTES_OFF_XOMNION: None
Control.RESET_CONTROLS: None
Control.LOCAL: None
Rpn.PITCH_BEND_RANGE: (2, None)
Rpn.FINE_TUNE: (64, None)
Rpn.COARSE_TUNE: (64, None)
Rpn.NULL: (None, None)
Pitchwheel: 0
CHANNEL: 9
Bank Program: (127, 0, 27)
Control.BANK_MSB: 127
Control.BANK_LSB: 0
Control.VOLUME: 86
Control.PAN: 64
Control.REVERB: 20
Control.CHORUS: 0
Control.PEDAL: None
Control.RELEASE: 64
Control.MODULATION: 0
Control.EXPRESSION: 127
Control.PORTAMENTO_CTRL: None
Control.HARMONIC: 64
Control.ATTACK: 64
Control.BRIGHTNESS: 64
Control.RPN_MSB: 0
Control.RPN_LSB: 2
Control.DATA_MSB: None
Control.DATA_LSB: None
Control.DATA_INC: None
Control.DATA_DEC: None
Control.SOUND_OFF: None
Control.SOUND_OFF_XMONO: None
Control.SOUND_OFF_XPOLY: None
Control.NOTES_OFF: None
Control.NOTES_OFF_XOMNIOFF: None
Control.NOTES_OFF_XOMNION: None
Control.RESET_CONTROLS: None
Control.LOCAL: None
Rpn.PITCH_BEND_RANGE: (2, None)
Rpn.FINE_TUNE: (64, None)
Rpn.COARSE_TUNE: (64, None)
Rpn.NULL: (None, None)
Pitchwheel: 0
CHANNEL: 10
Bank Program: (0, 112, 33)
Control.BANK_MSB: 0
Control.BANK_LSB: 112
Control.VOLUME: 81
Control.PAN: 64
Control.REVERB: 0
Control.CHORUS: 20
Control.PEDAL: None
Control.RELEASE: 64
Control.MODULATION: 0
Control.EXPRESSION: 127
Control.PORTAMENTO_CTRL: None
Control.HARMONIC: 64
Control.ATTACK: 64
Control.BRIGHTNESS: 64
Control.RPN_MSB: 0
Control.RPN_LSB: 2
Control.DATA_MSB: None
Control.DATA_LSB: None
Control.DATA_INC: None
Control.DATA_DEC: None
Control.SOUND_OFF: None
Control.SOUND_OFF_XMONO: None
Control.SOUND_OFF_XPOLY: None
Control.NOTES_OFF: None
Control.NOTES_OFF_XOMNIOFF: None
Control.NOTES_OFF_XOMNION: None
Control.RESET_CONTROLS: None
Control.LOCAL: None
Rpn.PITCH_BEND_RANGE: (2, None)
Rpn.FINE_TUNE: (64, None)
Rpn.COARSE_TUNE: (64, None)
Rpn.NULL: (None, None)
Pitchwheel: 0
CHANNEL: 11
Bank Program: (0, 117, 27)
Control.BANK_MSB: 0
Control.BANK_LSB: 117
Control.VOLUME: 56
Control.PAN: 38
Control.REVERB: 30
Control.CHORUS: 30
Control.PEDAL: None
Control.RELEASE: 64
Control.MODULATION: 0
Control.EXPRESSION: 127
Control.PORTAMENTO_CTRL: None
Control.HARMONIC: 64
Control.ATTACK: 64
Control.BRIGHTNESS: 64
Control.RPN_MSB: 0
Control.RPN_LSB: 2
Control.DATA_MSB: None
Control.DATA_LSB: None
Control.DATA_INC: None
Control.DATA_DEC: None
Control.SOUND_OFF: None
Control.SOUND_OFF_XMONO: None
Control.SOUND_OFF_XPOLY: None
Control.NOTES_OFF: None
Control.NOTES_OFF_XOMNIOFF: None
Control.NOTES_OFF_XOMNION: None
Control.RESET_CONTROLS: None
Control.LOCAL: None
Rpn.PITCH_BEND_RANGE: (2, None)
Rpn.FINE_TUNE: (64, None)
Rpn.COARSE_TUNE: (64, None)
Rpn.NULL: (None, None)
Pitchwheel: 0
CHANNEL: 12
Bank Program: (0, 1, 4)
Control.BANK_MSB: 0
Control.BANK_LSB: 1
Control.VOLUME: 50
Control.PAN: 86
Control.REVERB: 40
Control.CHORUS: 40
Control.PEDAL: None
Control.RELEASE: 64
Control.MODULATION: 0
Control.EXPRESSION: 127
Control.PORTAMENTO_CTRL: None
Control.HARMONIC: 64
Control.ATTACK: 64
Control.BRIGHTNESS: 64
Control.RPN_MSB: 0
Control.RPN_LSB: 2
Control.DATA_MSB: None
Control.DATA_LSB: None
Control.DATA_INC: None
Control.DATA_DEC: None
Control.SOUND_OFF: None
Control.SOUND_OFF_XMONO: None
Control.SOUND_OFF_XPOLY: None
Control.NOTES_OFF: None
Control.NOTES_OFF_XOMNIOFF: None
Control.NOTES_OFF_XOMNION: None
Control.RESET_CONTROLS: None
Control.LOCAL: None
Rpn.PITCH_BEND_RANGE: (2, None)
Rpn.FINE_TUNE: (64, None)
Rpn.COARSE_TUNE: (64, None)
Rpn.NULL: (None, None)
Pitchwheel: 0
CHANNEL: 13
Bank Program: (0, 0, 51)
Control.BANK_MSB: 0
Control.BANK_LSB: 0
Control.VOLUME: 52
Control.PAN: 68
Control.REVERB: 68
Control.CHORUS: 0
Control.PEDAL: None
Control.RELEASE: 64
Control.MODULATION: 0
Control.EXPRESSION: 127
Control.PORTAMENTO_CTRL: None
Control.HARMONIC: 64
Control.ATTACK: 64
Control.BRIGHTNESS: 52
Control.RPN_MSB: 0
Control.RPN_LSB: 2
Control.DATA_MSB: None
Control.DATA_LSB: None
Control.DATA_INC: None
Control.DATA_DEC: None
Control.SOUND_OFF: None
Control.SOUND_OFF_XMONO: None
Control.SOUND_OFF_XPOLY: None
Control.NOTES_OFF: None
Control.NOTES_OFF_XOMNIOFF: None
Control.NOTES_OFF_XOMNION: None
Control.RESET_CONTROLS: None
Control.LOCAL: None
Rpn.PITCH_BEND_RANGE: (2, None)
Rpn.FINE_TUNE: (64, None)
Rpn.COARSE_TUNE: (64, None)
Rpn.NULL: (None, None)
Pitchwheel: 0
CHANNEL: 14
Bank Program: (0, 0, 0)
Control.BANK_MSB: 0
Control.BANK_LSB: 0
Control.VOLUME: 127
Control.PAN: 64
Control.REVERB: 40
Control.CHORUS: 0
Control.PEDAL: None
Control.RELEASE: 64
Control.MODULATION: 0
Control.EXPRESSION: 127
Control.PORTAMENTO_CTRL: None
Control.HARMONIC: 64
Control.ATTACK: 64
Control.BRIGHTNESS: 64
Control.RPN_MSB: 0
Control.RPN_LSB: 2
Control.DATA_MSB: None
Control.DATA_LSB: None
Control.DATA_INC: None
Control.DATA_DEC: None
Control.SOUND_OFF: None
Control.SOUND_OFF_XMONO: None
Control.SOUND_OFF_XPOLY: None
Control.NOTES_OFF: None
Control.NOTES_OFF_XOMNIOFF: None
Control.NOTES_OFF_XOMNION: None
Control.RESET_CONTROLS: None
Control.LOCAL: None
Rpn.PITCH_BEND_RANGE: (2, None)
Rpn.FINE_TUNE: (64, None)
Rpn.COARSE_TUNE: (64, None)
Rpn.NULL: (None, None)
Pitchwheel: 0
CHANNEL: 15
Bank Program: (0, 0, 0)
Control.BANK_MSB: 0
Control.BANK_LSB: 0
Control.VOLUME: 127
Control.PAN: 64
Control.REVERB: 40
Control.CHORUS: 0
Control.PEDAL: None
Control.RELEASE: 64
Control.MODULATION: 0
Control.EXPRESSION: 127
Control.PORTAMENTO_CTRL: None
Control.HARMONIC: 64
Control.ATTACK: 64
Control.BRIGHTNESS: 64
Control.RPN_MSB: 0
Control.RPN_LSB: 2
Control.DATA_MSB: None
Control.DATA_LSB: None
Control.DATA_INC: None
Control.DATA_DEC: None
Control.SOUND_OFF: None
Control.SOUND_OFF_XMONO: None
Control.SOUND_OFF_XPOLY: None
Control.NOTES_OFF: None
Control.NOTES_OFF_XOMNIOFF: None
Control.NOTES_OFF_XOMNION: None
Control.RESET_CONTROLS: None
Control.LOCAL: None
Rpn.PITCH_BEND_RANGE: (2, None)
Rpn.FINE_TUNE: (64, None)
Rpn.COARSE_TUNE: (64, None)
Rpn.NULL: (None, None)
Pitchwheel: 0

With a blank user song, it looks like there are more of the settings set (to defaults?)

How about if we have an initial send, but with the song out OFF?


In [32]:
s4, c4 = collector(s3)
writeout(c4, 'documents/data/initial_send_songoff.txt')


[SysEx 7E 7F 09 01]
[SysEx 43 10 4C 00 00 7E 00]
MIDI Master Tuning 0
Reverb Type 01(Hall1)
Chorus Type ---(Celeste)
8 Voice Volume 88
8 Modulation Wheel 0
8 Voice Pan 64
8 Expression 127
8 Voice Reverb Level 40
8 Voice Chorus Level 0
8 Harmonic Content 64
8 Release Time 64
8 Attack Time 64
8 Brightness 64
8 Bank MSB 127
8 Bank LSB 0
8 Program Change: [127,0,0] 122 Standard Kit 1 (DRUM KITS)
8 RPN MSB 0
8 RPN LSB 0
8 Data Entry MSB: Pitch Bend Range 2
8 RPN MSB 0
8 RPN LSB 1
8 Data Entry MSB: Channel Fine Tuning 64
8 RPN MSB 0
8 RPN LSB 2
8 Data Entry MSB: Channel Coarse Tuning 64
8 Pitch Bend 0
9 Voice Volume 86
9 Modulation Wheel 0
9 Voice Pan 64
9 Expression 127
9 Voice Reverb Level 20
9 Voice Chorus Level 0
9 Harmonic Content 64
9 Release Time 64
9 Attack Time 64
9 Brightness 64
9 Bank MSB 127
9 Bank LSB 0
9 Program Change: [127,0,27] 128 Dance Kit (DRUM KITS)
9 RPN MSB 0
9 RPN LSB 0
9 Data Entry MSB: Pitch Bend Range 2
9 RPN MSB 0
9 RPN LSB 1
9 Data Entry MSB: Channel Fine Tuning 64
9 RPN MSB 0
9 RPN LSB 2
9 Data Entry MSB: Channel Coarse Tuning 64
9 Pitch Bend 0
10 Voice Volume 81
10 Modulation Wheel 0
10 Voice Pan 64
10 Expression 127
10 Voice Reverb Level 0
10 Voice Chorus Level 20
10 Harmonic Content 64
10 Release Time 64
10 Attack Time 64
10 Brightness 64
10 Bank MSB 0
10 Bank LSB 112
10 Program Change: [0,112,33] 046 Finger Bass (BASS)
10 RPN MSB 0
10 RPN LSB 0
10 Data Entry MSB: Pitch Bend Range 2
10 RPN MSB 0
10 RPN LSB 1
10 Data Entry MSB: Channel Fine Tuning 64
10 RPN MSB 0
10 RPN LSB 2
10 Data Entry MSB: Channel Coarse Tuning 64
10 Pitch Bend 0
11 Voice Volume 56
11 Modulation Wheel 0
11 Voice Pan 38
11 Expression 127
11 Voice Reverb Level 30
11 Voice Chorus Level 30
11 Harmonic Content 64
11 Release Time 64
11 Attack Time 64
11 Brightness 64
11 Bank MSB 0
11 Bank LSB 117
11 Program Change: [0,117,27] 041 60's Clean Guitar (GUITAR)
11 RPN MSB 0
11 RPN LSB 0
11 Data Entry MSB: Pitch Bend Range 2
11 RPN MSB 0
11 RPN LSB 1
11 Data Entry MSB: Channel Fine Tuning 64
11 RPN MSB 0
11 RPN LSB 2
11 Data Entry MSB: Channel Coarse Tuning 64
11 Pitch Bend 0
12 Voice Volume 50
12 Modulation Wheel 0
12 Voice Pan 86
12 Expression 127
12 Voice Reverb Level 40
12 Voice Chorus Level 40
12 Harmonic Content 64
12 Release Time 64
12 Attack Time 64
12 Brightness 64
12 Bank MSB 0
12 Bank LSB 1
12 Program Change: [0,1,4] 146 Electric Piano 1 KSP (XG PIANO)
12 RPN MSB 0
12 RPN LSB 0
12 Data Entry MSB: Pitch Bend Range 2
12 RPN MSB 0
12 RPN LSB 1
12 Data Entry MSB: Channel Fine Tuning 64
12 RPN MSB 0
12 RPN LSB 2
12 Data Entry MSB: Channel Coarse Tuning 64
12 Pitch Bend 0
13 Voice Volume 52
13 Modulation Wheel 0
13 Voice Pan 68
13 Expression 127
13 Voice Reverb Level 68
13 Voice Chorus Level 0
13 Harmonic Content 64
13 Release Time 64
13 Attack Time 64
13 Brightness 52
13 Bank MSB 0
13 Bank LSB 0
13 Program Change: [0,0,51] 287 Synth Strings 2 (XG ENSEMBLE)
13 RPN MSB 0
13 RPN LSB 0
13 Data Entry MSB: Pitch Bend Range 2
13 RPN MSB 0
13 RPN LSB 1
13 Data Entry MSB: Channel Fine Tuning 64
13 RPN MSB 0
13 RPN LSB 2
13 Data Entry MSB: Channel Coarse Tuning 64
13 Pitch Bend 0
14 Voice Volume 127
14 Modulation Wheel 0
14 Voice Pan 64
14 Expression 127
14 Voice Reverb Level 40
14 Voice Chorus Level 0
14 Harmonic Content 64
14 Release Time 64
14 Attack Time 64
14 Brightness 64
14 Bank MSB 0
14 Bank LSB 0
14 Program Change: [0,0,0] 134 Grand Piano (XG PIANO)
14 RPN MSB 0
14 RPN LSB 0
14 Data Entry MSB: Pitch Bend Range 2
14 RPN MSB 0
14 RPN LSB 1
14 Data Entry MSB: Channel Fine Tuning 64
14 RPN MSB 0
14 RPN LSB 2
14 Data Entry MSB: Channel Coarse Tuning 64
14 Pitch Bend 0
15 Voice Volume 127
15 Modulation Wheel 0
15 Voice Pan 64
15 Expression 127
15 Voice Reverb Level 40
15 Voice Chorus Level 0
15 Harmonic Content 64
15 Release Time 64
15 Attack Time 64
15 Brightness 64
15 Bank MSB 0
15 Bank LSB 0
15 Program Change: [0,0,0] 134 Grand Piano (XG PIANO)
15 RPN MSB 0
15 RPN LSB 0
15 Data Entry MSB: Pitch Bend Range 2
15 RPN MSB 0
15 RPN LSB 1
15 Data Entry MSB: Channel Fine Tuning 64
15 RPN MSB 0
15 RPN LSB 2
15 Data Entry MSB: Channel Coarse Tuning 64
15 Pitch Bend 0
0 Bank MSB 0
0 Bank LSB 113
0 Program Change: [0,113,0] 001 Live! Grand Piano (PIANO)
1 Bank MSB 0
1 Bank LSB 112
1 Program Change: [0,112,48] 054 String Ensemble (STRINGS)
2 Bank MSB 0
2 Bank LSB 112
2 Program Change: [0,112,33] 046 Finger Bass (BASS)
0 Voice Volume 110
1 Voice Volume 36
2 Voice Volume 100
0 Voice Pan 64
1 Voice Pan 64
2 Voice Pan 64
0 Voice Reverb Level 20
1 Voice Reverb Level 50
2 Voice Reverb Level 8
0 Voice Chorus Level 0
1 Voice Chorus Level 0
2 Voice Chorus Level 0
0 RPN MSB 0
0 RPN LSB 0
0 Data Entry MSB: Pitch Bend Range 2
1 RPN MSB 0
1 RPN LSB 0
1 Data Entry MSB: Pitch Bend Range 2
2 RPN MSB 0
2 RPN LSB 0
2 Data Entry MSB: Pitch Bend Range 2
0 Pitch Bend 0
1 Pitch Bend 0
2 Pitch Bend 0
0 Release Time 64
1 Release Time 64
2 Release Time 64
0 Note On 108(C7)

And how about song and style out OFF?


In [33]:
s5, c5 = collector(s4)
writeout(c5, 'documents/data/initial_send_stylesongoff.txt')


[SysEx 7E 7F 09 01]
[SysEx 43 10 4C 00 00 7E 00]
MIDI Master Tuning 0
Reverb Type 02(Hall2)
Chorus Type ---(Celeste)
0 Bank MSB 0
0 Bank LSB 113
0 Program Change: [0,113,0] 001 Live! Grand Piano (PIANO)
1 Bank MSB 0
1 Bank LSB 112
1 Program Change: [0,112,48] 054 String Ensemble (STRINGS)
2 Bank MSB 0
2 Bank LSB 112
2 Program Change: [0,112,33] 046 Finger Bass (BASS)
0 Voice Volume 110
1 Voice Volume 36
2 Voice Volume 100
0 Voice Pan 64
1 Voice Pan 64
2 Voice Pan 64
0 Voice Reverb Level 20
1 Voice Reverb Level 50
2 Voice Reverb Level 8
0 Voice Chorus Level 0
1 Voice Chorus Level 0
2 Voice Chorus Level 0
0 RPN MSB 0
0 RPN LSB 0
0 Data Entry MSB: Pitch Bend Range 2
1 RPN MSB 0
1 RPN LSB 0
1 Data Entry MSB: Pitch Bend Range 2
2 RPN MSB 0
2 RPN LSB 0
2 Data Entry MSB: Pitch Bend Range 2
0 Pitch Bend 0
1 Pitch Bend 0
2 Pitch Bend 0
0 Release Time 64
1 Release Time 64
2 Release Time 64
0 Note On 095(B5)

I guess with voice out OFF it wouldn't send that either


In [34]:
s6, c6 = collector(s5)
writeout(c6, 'documents/data/initial_send_alloff.txt')


[SysEx 7E 7F 09 01]
[SysEx 43 10 4C 00 00 7E 00]
MIDI Master Tuning 0
Reverb Type 02(Hall2)
Chorus Type ---(Celeste)
0 Note On 086(D5)

Whoops on that one, I needed to turn keyboard OUT back on to send the note. Ah well.

Now for some QUESTIONS.

Sending messages doesn't change the internal instrument thing, so it shouldn't affect the initial send thing at all.


In [35]:
s6


Out[35]:
<commons.messages.controlstate.MidiControlState at 0x7f7fc4096710>

In [40]:
s6._channels[0].control_value(controls.Control.VOLUME)


Out[40]:
110

In [41]:
with mido.open_output('DGX-505 MIDI 1') as outport:
    for i in range(16):
        outport.send(controls.cc(controls.Control.VOLUME, channel=i, value=1))

In [42]:
s7, c7 = collector(s6)


[SysEx 7E 7F 09 01]
[SysEx 43 10 4C 00 00 7E 00]
MIDI Master Tuning 0
Reverb Type 01(Hall1)
Chorus Type ---(Celeste)
3 Bank MSB 0
3 Bank LSB 0
3 Program Change: [0,0,0] 134 Grand Piano (XG PIANO)
3 RPN MSB 0
3 RPN LSB 0
3 Data Entry MSB: Pitch Bend Range 2
3 RPN LSB 127
3 RPN MSB 127
3 Voice Reverb Level 40
3 Voice Chorus Level 0
3 Voice Volume 100
3 Voice Pan 64
3 Pedal Sustain OFF
3 Modulation Wheel 0
3 Expression 127
3 Harmonic Content 64
3 Release Time 64
3 Attack Time 64
3 Brightness 64
3 Pitch Bend 0
4 Bank MSB 0
4 Bank LSB 0
4 Program Change: [0,0,0] 134 Grand Piano (XG PIANO)
4 RPN MSB 0
4 RPN LSB 0
4 Data Entry MSB: Pitch Bend Range 2
4 RPN LSB 127
4 RPN MSB 127
4 Voice Reverb Level 40
4 Voice Chorus Level 0
4 Voice Volume 100
4 Voice Pan 64
4 Pedal Sustain OFF
4 Modulation Wheel 0
4 Expression 127
4 Harmonic Content 64
4 Release Time 64
4 Attack Time 64
4 Brightness 64
4 Pitch Bend 0
5 Bank MSB 0
5 Bank LSB 0
5 Program Change: [0,0,0] 134 Grand Piano (XG PIANO)
5 RPN MSB 0
5 RPN LSB 0
5 Data Entry MSB: Pitch Bend Range 2
5 RPN LSB 127
5 RPN MSB 127
5 Voice Reverb Level 40
5 Voice Chorus Level 0
5 Voice Volume 100
5 Voice Pan 64
5 Pedal Sustain OFF
5 Modulation Wheel 0
5 Expression 127
5 Harmonic Content 64
5 Release Time 64
5 Attack Time 64
5 Brightness 64
5 Pitch Bend 0
6 Bank MSB 0
6 Bank LSB 0
6 Program Change: [0,0,0] 134 Grand Piano (XG PIANO)
6 RPN MSB 0
6 RPN LSB 0
6 Data Entry MSB: Pitch Bend Range 2
6 RPN LSB 127
6 RPN MSB 127
6 Voice Reverb Level 40
6 Voice Chorus Level 0
6 Voice Volume 100
6 Voice Pan 64
6 Pedal Sustain OFF
6 Modulation Wheel 0
6 Expression 127
6 Harmonic Content 64
6 Release Time 64
6 Attack Time 64
6 Brightness 64
6 Pitch Bend 0
7 Bank MSB 0
7 Bank LSB 0
7 Program Change: [0,0,0] 134 Grand Piano (XG PIANO)
7 RPN MSB 0
7 RPN LSB 0
7 Data Entry MSB: Pitch Bend Range 2
7 RPN LSB 127
7 RPN MSB 127
7 Voice Reverb Level 40
7 Voice Chorus Level 0
7 Voice Volume 100
7 Voice Pan 64
7 Pedal Sustain OFF
7 Modulation Wheel 0
7 Expression 127
7 Harmonic Content 64
7 Release Time 64
7 Attack Time 64
7 Brightness 64
7 Pitch Bend 0
8 Voice Volume 54
8 Modulation Wheel 0
8 Voice Pan 64
8 Expression 127
8 Voice Reverb Level 42
8 Voice Chorus Level 0
8 Harmonic Content 64
8 Release Time 64
8 Attack Time 64
8 Brightness 64
8 Bank MSB 127
8 Bank LSB 0
8 Program Change: [127,0,0] 122 Standard Kit 1 (DRUM KITS)
8 RPN MSB 0
8 RPN LSB 0
8 Data Entry MSB: Pitch Bend Range 2
8 RPN MSB 0
8 RPN LSB 1
8 Data Entry MSB: Channel Fine Tuning 64
8 RPN MSB 0
8 RPN LSB 2
8 Data Entry MSB: Channel Coarse Tuning 64
8 Pitch Bend 0
9 Voice Volume 90
9 Modulation Wheel 0
9 Voice Pan 64
9 Expression 127
9 Voice Reverb Level 50
9 Voice Chorus Level 0
9 Harmonic Content 64
9 Release Time 64
9 Attack Time 64
9 Brightness 64
9 Bank MSB 127
9 Bank LSB 0
9 Program Change: [127,0,25] 127 Analog Kit (DRUM KITS)
9 RPN MSB 0
9 RPN LSB 0
9 Data Entry MSB: Pitch Bend Range 2
9 RPN MSB 0
9 RPN LSB 1
9 Data Entry MSB: Channel Fine Tuning 64
9 RPN MSB 0
9 RPN LSB 2
9 Data Entry MSB: Channel Coarse Tuning 64
9 Pitch Bend 0
10 Voice Volume 94
10 Modulation Wheel 0
10 Voice Pan 64
10 Expression 127
10 Voice Reverb Level 0
10 Voice Chorus Level 0
10 Harmonic Content 0
10 Release Time 64
10 Attack Time 64
10 Brightness 46
10 Bank MSB 0
10 Bank LSB 0
10 Program Change: [0,0,33] 236 Finger Bass (XG BASS)
10 RPN MSB 0
10 RPN LSB 0
10 Data Entry MSB: Pitch Bend Range 12
10 RPN MSB 0
10 RPN LSB 1
10 Data Entry MSB: Channel Fine Tuning 64
10 RPN MSB 0
10 RPN LSB 2
10 Data Entry MSB: Channel Coarse Tuning 64
10 Pitch Bend 0
11 Voice Volume 74
11 Modulation Wheel 0
11 Voice Pan 74
11 Expression 127
11 Voice Reverb Level 30
11 Voice Chorus Level 48
11 Harmonic Content 60
11 Release Time 64
11 Attack Time 64
11 Brightness 70
11 Bank MSB 0
11 Bank LSB 1
11 Program Change: [0,1,5] 149 Electric Piano 2 KSP (XG PIANO)
11 RPN MSB 0
11 RPN LSB 0
11 Data Entry MSB: Pitch Bend Range 2
11 RPN MSB 0
11 RPN LSB 1
11 Data Entry MSB: Channel Fine Tuning 64
11 RPN MSB 0
11 RPN LSB 2
11 Data Entry MSB: Channel Coarse Tuning 64
11 Pitch Bend 0
12 Voice Volume 60
12 Modulation Wheel 0
12 Voice Pan 44
12 Expression 127
12 Voice Reverb Level 42
12 Voice Chorus Level 15
12 Harmonic Content 64
12 Release Time 64
12 Attack Time 64
12 Brightness 55
12 Bank MSB 0
12 Bank LSB 0
12 Program Change: [0,0,24] 209 Nylon Guitar (XG GUITAR)
12 RPN MSB 0
12 RPN LSB 0
12 Data Entry MSB: Pitch Bend Range 2
12 RPN MSB 0
12 RPN LSB 1
12 Data Entry MSB: Channel Fine Tuning 64
12 RPN MSB 0
12 RPN LSB 2
12 Data Entry MSB: Channel Coarse Tuning 64
12 Pitch Bend 0
13 Voice Volume 74
13 Modulation Wheel 0
13 Voice Pan 64
13 Expression 127
13 Voice Reverb Level 80
13 Voice Chorus Level 30
13 Harmonic Content 51
13 Release Time 64
13 Attack Time 64
13 Brightness 46
13 Bank MSB 0
13 Bank LSB 3
13 Program Change: [0,3,49] 282 Stereo Slow Strings (XG ENSEMBLE)
13 RPN MSB 0
13 RPN LSB 0
13 Data Entry MSB: Pitch Bend Range 2
13 RPN MSB 0
13 RPN LSB 1
13 Data Entry MSB: Channel Fine Tuning 64
13 RPN MSB 0
13 RPN LSB 2
13 Data Entry MSB: Channel Coarse Tuning 64
13 Pitch Bend 0
14 Voice Volume 57
14 Modulation Wheel 0
14 Voice Pan 82
14 Expression 127
14 Voice Reverb Level 38
14 Voice Chorus Level 40
14 Harmonic Content 64
14 Release Time 64
14 Attack Time 64
14 Brightness 72
14 Bank MSB 0
14 Bank LSB 112
14 Program Change: [0,112,28] 042 Muted Guitar (GUITAR)
14 RPN MSB 0
14 RPN LSB 0
14 Data Entry MSB: Pitch Bend Range 2
14 RPN MSB 0
14 RPN LSB 1
14 Data Entry MSB: Channel Fine Tuning 64
14 RPN MSB 0
14 RPN LSB 2
14 Data Entry MSB: Channel Coarse Tuning 64
14 Pitch Bend 0
15 Voice Volume 127
15 Modulation Wheel 0
15 Voice Pan 64
15 Expression 127
15 Voice Reverb Level 40
15 Voice Chorus Level 0
15 Harmonic Content 64
15 Release Time 64
15 Attack Time 64
15 Brightness 64
15 Bank MSB 0
15 Bank LSB 0
15 Program Change: [0,0,0] 134 Grand Piano (XG PIANO)
15 RPN MSB 0
15 RPN LSB 0
15 Data Entry MSB: Pitch Bend Range 2
15 RPN MSB 0
15 RPN LSB 1
15 Data Entry MSB: Channel Fine Tuning 64
15 RPN MSB 0
15 RPN LSB 2
15 Data Entry MSB: Channel Coarse Tuning 64
15 Pitch Bend 0
0 Bank MSB 0
0 Bank LSB 113
0 Program Change: [0,113,0] 001 Live! Grand Piano (PIANO)
1 Bank MSB 0
1 Bank LSB 112
1 Program Change: [0,112,48] 054 String Ensemble (STRINGS)
2 Bank MSB 0
2 Bank LSB 112
2 Program Change: [0,112,33] 046 Finger Bass (BASS)
0 Voice Volume 110
1 Voice Volume 36
2 Voice Volume 100
0 Voice Pan 64
1 Voice Pan 64
2 Voice Pan 64
0 Voice Reverb Level 20
1 Voice Reverb Level 50
2 Voice Reverb Level 8
0 Voice Chorus Level 0
1 Voice Chorus Level 0
2 Voice Chorus Level 0
0 RPN MSB 0
0 RPN LSB 0
0 Data Entry MSB: Pitch Bend Range 2
1 RPN MSB 0
1 RPN LSB 0
1 Data Entry MSB: Pitch Bend Range 2
2 RPN MSB 0
2 RPN LSB 0
2 Data Entry MSB: Pitch Bend Range 2
0 Pitch Bend 0
1 Pitch Bend 0
2 Pitch Bend 0
0 Release Time 64
1 Release Time 64
2 Release Time 64
0 Note On 095(B5)

Yep, that does nothing.

... wait, have i got the chorus type wrong this whole time?


In [43]:
s8, c8 = collector(s7)


Chorus Type 2(Chorus2)
Chorus Type ---(Celeste)
Chorus Type 5(Off)
Chorus Type ---(Celeste)
Chorus Type 2(Chorus2)
Chorus Type 3(Flanger1)
Chorus Type 4(Flanger2)
Chorus Type 5(Off)
Chorus Type ---(Celeste)
Chorus Type 2(Chorus2)
Chorus Type 3(Flanger1)
Chorus Type 4(Flanger2)
Chorus Type 5(Off)
Chorus Type ---(Celeste)
Chorus Type 2(Chorus2)
Chorus Type 3(Flanger1)
Chorus Type 4(Flanger2)
Chorus Type 5(Off)
Chorus Type ---(Celeste)
0 Release Time 110
1 Release Time 110
2 Release Time 110
0 Release Time 64
1 Release Time 64
2 Release Time 64
Reverb Type 02(Hall2)
Reverb Type 03(Hall3)
Reverb Type 04(Room1)
Reverb Type 05(Room2)
Reverb Type 06(Stage1)
Reverb Type 07(Stage2)
Reverb Type 08(Plate1)
Reverb Type 09(Plate2)
Reverb Type 10(Off)
Reverb Type 01(Hall1)
Reverb Type 02(Hall2)
Reverb Type 03(Hall3)
Reverb Type 04(Room1)
Reverb Type 05(Room2)
Reverb Type 06(Stage1)
0 Note On 084(C5)

Okay, i've stuffed something up here.


In [46]:
cc8 = [x for x in c8 if x.message.type != "clock"]

In [47]:
cc8


Out[47]:
[<Chorus Type 2(Chorus2) <message sysex data=(67,16,76,2,1,32,65,2) time=2.630009147000237>>,
 <Chorus Type ---(Celeste) <message sysex data=(67,16,76,2,1,32,66,17) time=4.349999486001252>>,
 <Chorus Type 5(Off) <message sysex data=(67,16,76,2,1,32,0,0) time=5.791061604000788>>,
 <Chorus Type ---(Celeste) <message sysex data=(67,16,76,2,1,32,66,17) time=7.089836037999703>>,
 <Chorus Type 2(Chorus2) <message sysex data=(67,16,76,2,1,32,65,2) time=7.539973680000912>>,
 <Chorus Type 3(Flanger1) <message sysex data=(67,16,76,2,1,32,67,8) time=7.9398248640009115>>,
 <Chorus Type 4(Flanger2) <message sysex data=(67,16,76,2,1,32,67,17) time=8.309797896001328>>,
 <Chorus Type 5(Off) <message sysex data=(67,16,76,2,1,32,0,0) time=8.690824854000311>>,
 <Chorus Type ---(Celeste) <message sysex data=(67,16,76,2,1,32,66,17) time=9.069776480000655>>,
 <Chorus Type 2(Chorus2) <message sysex data=(67,16,76,2,1,32,65,2) time=9.51991687699956>>,
 <Chorus Type 3(Flanger1) <message sysex data=(67,16,76,2,1,32,67,8) time=9.940788104000603>>,
 <Chorus Type 4(Flanger2) <message sysex data=(67,16,76,2,1,32,67,17) time=10.428737461999845>>,
 <Chorus Type 5(Off) <message sysex data=(67,16,76,2,1,32,0,0) time=10.909726179001154>>,
 <Chorus Type ---(Celeste) <message sysex data=(67,16,76,2,1,32,66,17) time=11.918711055999665>>,
 <Chorus Type 2(Chorus2) <message sysex data=(67,16,76,2,1,32,65,2) time=12.308835637000811>>,
 <Chorus Type 3(Flanger1) <message sysex data=(67,16,76,2,1,32,67,8) time=12.528917835999891>>,
 <Chorus Type 4(Flanger2) <message sysex data=(67,16,76,2,1,32,67,17) time=12.7398508389997>>,
 <Chorus Type 5(Off) <message sysex data=(67,16,76,2,1,32,0,0) time=12.959965264000857>>,
 <Chorus Type ---(Celeste) <message sysex data=(67,16,76,2,1,32,66,17) time=13.658779874000174>>,
 <0 Release Time 110 <message control_change channel=0 control=72 value=110 time=16.916625596000813>>,
 <1 Release Time 110 <message control_change channel=1 control=72 value=110 time=16.917588453999997>>,
 <2 Release Time 110 <message control_change channel=2 control=72 value=110 time=16.918561406000663>>,
 <0 Release Time 64 <message control_change channel=0 control=72 value=64 time=17.27656428299997>>,
 <1 Release Time 64 <message control_change channel=1 control=72 value=64 time=17.277558572001>>,
 <2 Release Time 64 <message control_change channel=2 control=72 value=64 time=17.27854593899974>>,
 <Reverb Type 02(Hall2) <message sysex data=(67,16,76,2,1,0,1,16) time=19.458480219000194>>,
 <Reverb Type 03(Hall3) <message sysex data=(67,16,76,2,1,0,1,17) time=19.718666750999546>>,
 <Reverb Type 04(Room1) <message sysex data=(67,16,76,2,1,0,2,17) time=19.89847636000013>>,
 <Reverb Type 05(Room2) <message sysex data=(67,16,76,2,1,0,2,19) time=20.49847401199986>>,
 <Reverb Type 06(Stage1) <message sysex data=(67,16,76,2,1,0,3,16) time=20.918484382000315>>,
 <Reverb Type 07(Stage2) <message sysex data=(67,16,76,2,1,0,3,17) time=21.157583227999567>>,
 <Reverb Type 08(Plate1) <message sysex data=(67,16,76,2,1,0,4,16) time=21.34744437399968>>,
 <Reverb Type 09(Plate2) <message sysex data=(67,16,76,2,1,0,4,17) time=21.539438388001145>>,
 <Reverb Type 10(Off) <message sysex data=(67,16,76,2,1,0,0,0) time=21.677499171000818>>,
 <Reverb Type 01(Hall1) <message sysex data=(67,16,76,2,1,0,1,0) time=21.8074632200005>>,
 <Reverb Type 02(Hall2) <message sysex data=(67,16,76,2,1,0,1,16) time=21.988409241001136>>,
 <Reverb Type 03(Hall3) <message sysex data=(67,16,76,2,1,0,1,17) time=22.138417837000816>>,
 <Reverb Type 04(Room1) <message sysex data=(67,16,76,2,1,0,2,17) time=22.31740799200088>>,
 <Reverb Type 05(Room2) <message sysex data=(67,16,76,2,1,0,2,19) time=22.46840489799979>>,
 <Reverb Type 06(Stage1) <message sysex data=(67,16,76,2,1,0,3,16) time=22.647407700000258>>,
 <0 Note On 084(C5) <message note_on channel=0 note=84 velocity=82 time=23.895374871000968>>]

In [60]:
" ".join(format(x, "02X") for x in (cc8[1].message.data))


Out[60]:
'43 10 4C 02 01 20 42 11'

In [72]:
%load_ext autoreload
%autoreload


The autoreload extension is already loaded. To reload it, use:
  %reload_ext autoreload

In [4]:
from commons.messages import wrappers
from commons import enums

In [81]:
wrappers.wrap(cc8[1].message)


Out[81]:
<Chorus Type 1(Chorus1) <message sysex data=(67,16,76,2,1,32,66,17) time=4.349999486001252>>

Ok, so that's fixed.

I've noticed that the GM SYSTEM ON resets some things on the panel. Could it reset some other stuff as well? Here we have the reverb type and chorus type set to weird things, and for good measure let's also change the pitch bend range and the panel sustain and other stuff:


In [84]:
ns, nsc = collector(s8)


[SysEx 7E 7F 09 01]
[SysEx 43 10 4C 00 00 7E 00]
MIDI Master Tuning 1
Reverb Type 06(Stage1)
Chorus Type 4(Flanger2)
3 Bank MSB 0
3 Bank LSB 0
3 Program Change: [0,0,0] 134 Grand Piano (XG PIANO)
3 RPN MSB 0
3 RPN LSB 0
3 Data Entry MSB: Pitch Bend Range 2
3 RPN LSB 127
3 RPN MSB 127
3 Voice Reverb Level 40
3 Voice Chorus Level 0
3 Voice Volume 100
3 Voice Pan 64
3 Pedal Sustain OFF
3 Modulation Wheel 0
3 Expression 127
3 Harmonic Content 64
3 Release Time 64
3 Attack Time 64
3 Brightness 64
3 Pitch Bend 0
4 Bank MSB 0
4 Bank LSB 0
4 Program Change: [0,0,0] 134 Grand Piano (XG PIANO)
4 RPN MSB 0
4 RPN LSB 0
4 Data Entry MSB: Pitch Bend Range 2
4 RPN LSB 127
4 RPN MSB 127
4 Voice Reverb Level 40
4 Voice Chorus Level 0
4 Voice Volume 100
4 Voice Pan 64
4 Pedal Sustain OFF
4 Modulation Wheel 0
4 Expression 127
4 Harmonic Content 64
4 Release Time 64
4 Attack Time 64
4 Brightness 64
4 Pitch Bend 0
5 Bank MSB 0
5 Bank LSB 0
5 Program Change: [0,0,0] 134 Grand Piano (XG PIANO)
5 RPN MSB 0
5 RPN LSB 0
5 Data Entry MSB: Pitch Bend Range 2
5 RPN LSB 127
5 RPN MSB 127
5 Voice Reverb Level 40
5 Voice Chorus Level 0
5 Voice Volume 100
5 Voice Pan 64
5 Pedal Sustain OFF
5 Modulation Wheel 0
5 Expression 127
5 Harmonic Content 64
5 Release Time 64
5 Attack Time 64
5 Brightness 64
5 Pitch Bend 0
6 Bank MSB 0
6 Bank LSB 0
6 Program Change: [0,0,0] 134 Grand Piano (XG PIANO)
6 RPN MSB 0
6 RPN LSB 0
6 Data Entry MSB: Pitch Bend Range 2
6 RPN LSB 127
6 RPN MSB 127
6 Voice Reverb Level 40
6 Voice Chorus Level 0
6 Voice Volume 100
6 Voice Pan 64
6 Pedal Sustain OFF
6 Modulation Wheel 0
6 Expression 127
6 Harmonic Content 64
6 Release Time 64
6 Attack Time 64
6 Brightness 64
6 Pitch Bend 0
7 Bank MSB 0
7 Bank LSB 0
7 Program Change: [0,0,0] 134 Grand Piano (XG PIANO)
7 RPN MSB 0
7 RPN LSB 0
7 Data Entry MSB: Pitch Bend Range 2
7 RPN LSB 127
7 RPN MSB 127
7 Voice Reverb Level 40
7 Voice Chorus Level 0
7 Voice Volume 100
7 Voice Pan 64
7 Pedal Sustain OFF
7 Modulation Wheel 0
7 Expression 127
7 Harmonic Content 64
7 Release Time 64
7 Attack Time 64
7 Brightness 64
7 Pitch Bend 0
8 Voice Volume 54
8 Modulation Wheel 0
8 Voice Pan 64
8 Expression 127
8 Voice Reverb Level 42
8 Voice Chorus Level 0
8 Harmonic Content 64
8 Release Time 64
8 Attack Time 64
8 Brightness 64
8 Bank MSB 127
8 Bank LSB 0
8 Program Change: [127,0,0] 122 Standard Kit 1 (DRUM KITS)
8 RPN MSB 0
8 RPN LSB 0
8 Data Entry MSB: Pitch Bend Range 2
8 RPN MSB 0
8 RPN LSB 1
8 Data Entry MSB: Channel Fine Tuning 64
8 RPN MSB 0
8 RPN LSB 2
8 Data Entry MSB: Channel Coarse Tuning 64
8 Pitch Bend 0
9 Voice Volume 90
9 Modulation Wheel 0
9 Voice Pan 64
9 Expression 127
9 Voice Reverb Level 50
9 Voice Chorus Level 0
9 Harmonic Content 64
9 Release Time 64
9 Attack Time 64
9 Brightness 64
9 Bank MSB 127
9 Bank LSB 0
9 Program Change: [127,0,25] 127 Analog Kit (DRUM KITS)
9 RPN MSB 0
9 RPN LSB 0
9 Data Entry MSB: Pitch Bend Range 2
9 RPN MSB 0
9 RPN LSB 1
9 Data Entry MSB: Channel Fine Tuning 64
9 RPN MSB 0
9 RPN LSB 2
9 Data Entry MSB: Channel Coarse Tuning 64
9 Pitch Bend 0
10 Voice Volume 94
10 Modulation Wheel 0
10 Voice Pan 64
10 Expression 127
10 Voice Reverb Level 0
10 Voice Chorus Level 0
10 Harmonic Content 0
10 Release Time 64
10 Attack Time 64
10 Brightness 46
10 Bank MSB 0
10 Bank LSB 0
10 Program Change: [0,0,33] 236 Finger Bass (XG BASS)
10 RPN MSB 0
10 RPN LSB 0
10 Data Entry MSB: Pitch Bend Range 12
10 RPN MSB 0
10 RPN LSB 1
10 Data Entry MSB: Channel Fine Tuning 64
10 RPN MSB 0
10 RPN LSB 2
10 Data Entry MSB: Channel Coarse Tuning 64
10 Pitch Bend 0
11 Voice Volume 74
11 Modulation Wheel 0
11 Voice Pan 74
11 Expression 127
11 Voice Reverb Level 30
11 Voice Chorus Level 48
11 Harmonic Content 60
11 Release Time 64
11 Attack Time 64
11 Brightness 70
11 Bank MSB 0
11 Bank LSB 1
11 Program Change: [0,1,5] 149 Electric Piano 2 KSP (XG PIANO)
11 RPN MSB 0
11 RPN LSB 0
11 Data Entry MSB: Pitch Bend Range 2
11 RPN MSB 0
11 RPN LSB 1
11 Data Entry MSB: Channel Fine Tuning 64
11 RPN MSB 0
11 RPN LSB 2
11 Data Entry MSB: Channel Coarse Tuning 64
11 Pitch Bend 0
12 Voice Volume 60
12 Modulation Wheel 0
12 Voice Pan 44
12 Expression 127
12 Voice Reverb Level 42
12 Voice Chorus Level 15
12 Harmonic Content 64
12 Release Time 64
12 Attack Time 64
12 Brightness 55
12 Bank MSB 0
12 Bank LSB 0
12 Program Change: [0,0,24] 209 Nylon Guitar (XG GUITAR)
12 RPN MSB 0
12 RPN LSB 0
12 Data Entry MSB: Pitch Bend Range 2
12 RPN MSB 0
12 RPN LSB 1
12 Data Entry MSB: Channel Fine Tuning 64
12 RPN MSB 0
12 RPN LSB 2
12 Data Entry MSB: Channel Coarse Tuning 64
12 Pitch Bend 0
13 Voice Volume 74
13 Modulation Wheel 0
13 Voice Pan 64
13 Expression 127
13 Voice Reverb Level 80
13 Voice Chorus Level 30
13 Harmonic Content 51
13 Release Time 64
13 Attack Time 64
13 Brightness 46
13 Bank MSB 0
13 Bank LSB 3
13 Program Change: [0,3,49] 282 Stereo Slow Strings (XG ENSEMBLE)
13 RPN MSB 0
13 RPN LSB 0
13 Data Entry MSB: Pitch Bend Range 2
13 RPN MSB 0
13 RPN LSB 1
13 Data Entry MSB: Channel Fine Tuning 64
13 RPN MSB 0
13 RPN LSB 2
13 Data Entry MSB: Channel Coarse Tuning 64
13 Pitch Bend 0
14 Voice Volume 57
14 Modulation Wheel 0
14 Voice Pan 82
14 Expression 127
14 Voice Reverb Level 38
14 Voice Chorus Level 40
14 Harmonic Content 64
14 Release Time 64
14 Attack Time 64
14 Brightness 72
14 Bank MSB 0
14 Bank LSB 112
14 Program Change: [0,112,28] 042 Muted Guitar (GUITAR)
14 RPN MSB 0
14 RPN LSB 0
14 Data Entry MSB: Pitch Bend Range 2
14 RPN MSB 0
14 RPN LSB 1
14 Data Entry MSB: Channel Fine Tuning 64
14 RPN MSB 0
14 RPN LSB 2
14 Data Entry MSB: Channel Coarse Tuning 64
14 Pitch Bend 0
15 Voice Volume 127
15 Modulation Wheel 0
15 Voice Pan 64
15 Expression 127
15 Voice Reverb Level 40
15 Voice Chorus Level 0
15 Harmonic Content 64
15 Release Time 64
15 Attack Time 64
15 Brightness 64
15 Bank MSB 0
15 Bank LSB 0
15 Program Change: [0,0,0] 134 Grand Piano (XG PIANO)
15 RPN MSB 0
15 RPN LSB 0
15 Data Entry MSB: Pitch Bend Range 2
15 RPN MSB 0
15 RPN LSB 1
15 Data Entry MSB: Channel Fine Tuning 64
15 RPN MSB 0
15 RPN LSB 2
15 Data Entry MSB: Channel Coarse Tuning 64
15 Pitch Bend 0
0 Bank MSB 0
0 Bank LSB 113
0 Program Change: [0,113,0] 001 Live! Grand Piano (PIANO)
1 Bank MSB 0
1 Bank LSB 112
1 Program Change: [0,112,48] 054 String Ensemble (STRINGS)
2 Bank MSB 0
2 Bank LSB 112
2 Program Change: [0,112,33] 046 Finger Bass (BASS)
0 Voice Volume 110
1 Voice Volume 36
2 Voice Volume 99
0 Voice Pan 78
1 Voice Pan 64
2 Voice Pan 64
0 Voice Reverb Level 40
1 Voice Reverb Level 50
2 Voice Reverb Level 8
0 Voice Chorus Level 50
1 Voice Chorus Level 6
2 Voice Chorus Level 0
0 RPN MSB 0
0 RPN LSB 0
0 Data Entry MSB: Pitch Bend Range 6
1 RPN MSB 0
1 RPN LSB 0
1 Data Entry MSB: Pitch Bend Range 6
2 RPN MSB 0
2 RPN LSB 0
2 Data Entry MSB: Pitch Bend Range 6
0 Pitch Bend 0
1 Pitch Bend 0
2 Pitch Bend 0
0 Release Time 110
1 Release Time 110
2 Release Time 110
0 Note On 091(G5)

Now we do GM_SYSTEM ON


In [85]:
with mido.open_output('DGX-505 MIDI 1') as outport:
     outport.send(controls.gm_on())

In [86]:
rs, rsc = collector(ns)


[SysEx 7E 7F 09 01]
[SysEx 43 10 4C 00 00 7E 00]
MIDI Master Tuning 1
Reverb Type 01(Hall1)
Chorus Type ---(Chorus)
3 Bank MSB 0
3 Bank LSB 0
3 Program Change: [0,0,0] 134 Grand Piano (XG PIANO)
3 RPN MSB 0
3 RPN LSB 0
3 Data Entry MSB: Pitch Bend Range 2
3 RPN LSB 127
3 RPN MSB 127
3 Voice Reverb Level 40
3 Voice Chorus Level 0
3 Voice Volume 100
3 Voice Pan 64
3 Pedal Sustain OFF
3 Modulation Wheel 0
3 Expression 127
3 Harmonic Content 64
3 Release Time 64
3 Attack Time 64
3 Brightness 64
3 Pitch Bend 0
4 Bank MSB 0
4 Bank LSB 0
4 Program Change: [0,0,0] 134 Grand Piano (XG PIANO)
4 RPN MSB 0
4 RPN LSB 0
4 Data Entry MSB: Pitch Bend Range 2
4 RPN LSB 127
4 RPN MSB 127
4 Voice Reverb Level 40
4 Voice Chorus Level 0
4 Voice Volume 100
4 Voice Pan 64
4 Pedal Sustain OFF
4 Modulation Wheel 0
4 Expression 127
4 Harmonic Content 64
4 Release Time 64
4 Attack Time 64
4 Brightness 64
4 Pitch Bend 0
5 Bank MSB 0
5 Bank LSB 0
5 Program Change: [0,0,0] 134 Grand Piano (XG PIANO)
5 RPN MSB 0
5 RPN LSB 0
5 Data Entry MSB: Pitch Bend Range 2
5 RPN LSB 127
5 RPN MSB 127
5 Voice Reverb Level 40
5 Voice Chorus Level 0
5 Voice Volume 100
5 Voice Pan 64
5 Pedal Sustain OFF
5 Modulation Wheel 0
5 Expression 127
5 Harmonic Content 64
5 Release Time 64
5 Attack Time 64
5 Brightness 64
5 Pitch Bend 0
6 Bank MSB 0
6 Bank LSB 0
6 Program Change: [0,0,0] 134 Grand Piano (XG PIANO)
6 RPN MSB 0
6 RPN LSB 0
6 Data Entry MSB: Pitch Bend Range 2
6 RPN LSB 127
6 RPN MSB 127
6 Voice Reverb Level 40
6 Voice Chorus Level 0
6 Voice Volume 100
6 Voice Pan 64
6 Pedal Sustain OFF
6 Modulation Wheel 0
6 Expression 127
6 Harmonic Content 64
6 Release Time 64
6 Attack Time 64
6 Brightness 64
6 Pitch Bend 0
7 Bank MSB 0
7 Bank LSB 0
7 Program Change: [0,0,0] 134 Grand Piano (XG PIANO)
7 RPN MSB 0
7 RPN LSB 0
7 Data Entry MSB: Pitch Bend Range 2
7 RPN LSB 127
7 RPN MSB 127
7 Voice Reverb Level 40
7 Voice Chorus Level 0
7 Voice Volume 100
7 Voice Pan 64
7 Pedal Sustain OFF
7 Modulation Wheel 0
7 Expression 127
7 Harmonic Content 64
7 Release Time 64
7 Attack Time 64
7 Brightness 64
7 Pitch Bend 0
8 Voice Volume 54
8 Modulation Wheel 0
8 Voice Pan 64
8 Expression 127
8 Voice Reverb Level 42
8 Voice Chorus Level 0
8 Harmonic Content 64
8 Release Time 64
8 Attack Time 64
8 Brightness 64
8 Bank MSB 127
8 Bank LSB 0
8 Program Change: [127,0,0] 122 Standard Kit 1 (DRUM KITS)
8 RPN MSB 0
8 RPN LSB 0
8 Data Entry MSB: Pitch Bend Range 2
8 RPN MSB 0
8 RPN LSB 1
8 Data Entry MSB: Channel Fine Tuning 64
8 RPN MSB 0
8 RPN LSB 2
8 Data Entry MSB: Channel Coarse Tuning 64
8 Pitch Bend 0
9 Voice Volume 90
9 Modulation Wheel 0
9 Voice Pan 64
9 Expression 127
9 Voice Reverb Level 50
9 Voice Chorus Level 0
9 Harmonic Content 64
9 Release Time 64
9 Attack Time 64
9 Brightness 64
9 Bank MSB 127
9 Bank LSB 0
9 Program Change: [127,0,25] 127 Analog Kit (DRUM KITS)
9 RPN MSB 0
9 RPN LSB 0
9 Data Entry MSB: Pitch Bend Range 2
9 RPN MSB 0
9 RPN LSB 1
9 Data Entry MSB: Channel Fine Tuning 64
9 RPN MSB 0
9 RPN LSB 2
9 Data Entry MSB: Channel Coarse Tuning 64
9 Pitch Bend 0
10 Voice Volume 94
10 Modulation Wheel 0
10 Voice Pan 64
10 Expression 127
10 Voice Reverb Level 0
10 Voice Chorus Level 0
10 Harmonic Content 0
10 Release Time 64
10 Attack Time 64
10 Brightness 46
10 Bank MSB 0
10 Bank LSB 0
10 Program Change: [0,0,33] 236 Finger Bass (XG BASS)
10 RPN MSB 0
10 RPN LSB 0
10 Data Entry MSB: Pitch Bend Range 12
10 RPN MSB 0
10 RPN LSB 1
10 Data Entry MSB: Channel Fine Tuning 64
10 RPN MSB 0
10 RPN LSB 2
10 Data Entry MSB: Channel Coarse Tuning 64
10 Pitch Bend 0
11 Voice Volume 74
11 Modulation Wheel 0
11 Voice Pan 74
11 Expression 127
11 Voice Reverb Level 30
11 Voice Chorus Level 48
11 Harmonic Content 60
11 Release Time 64
11 Attack Time 64
11 Brightness 70
11 Bank MSB 0
11 Bank LSB 1
11 Program Change: [0,1,5] 149 Electric Piano 2 KSP (XG PIANO)
11 RPN MSB 0
11 RPN LSB 0
11 Data Entry MSB: Pitch Bend Range 2
11 RPN MSB 0
11 RPN LSB 1
11 Data Entry MSB: Channel Fine Tuning 64
11 RPN MSB 0
11 RPN LSB 2
11 Data Entry MSB: Channel Coarse Tuning 64
11 Pitch Bend 0
12 Voice Volume 60
12 Modulation Wheel 0
12 Voice Pan 44
12 Expression 127
12 Voice Reverb Level 42
12 Voice Chorus Level 15
12 Harmonic Content 64
12 Release Time 64
12 Attack Time 64
12 Brightness 55
12 Bank MSB 0
12 Bank LSB 0
12 Program Change: [0,0,24] 209 Nylon Guitar (XG GUITAR)
12 RPN MSB 0
12 RPN LSB 0
12 Data Entry MSB: Pitch Bend Range 2
12 RPN MSB 0
12 RPN LSB 1
12 Data Entry MSB: Channel Fine Tuning 64
12 RPN MSB 0
12 RPN LSB 2
12 Data Entry MSB: Channel Coarse Tuning 64
12 Pitch Bend 0
13 Voice Volume 74
13 Modulation Wheel 0
13 Voice Pan 64
13 Expression 127
13 Voice Reverb Level 80
13 Voice Chorus Level 30
13 Harmonic Content 51
13 Release Time 64
13 Attack Time 64
13 Brightness 46
13 Bank MSB 0
13 Bank LSB 3
13 Program Change: [0,3,49] 282 Stereo Slow Strings (XG ENSEMBLE)
13 RPN MSB 0
13 RPN LSB 0
13 Data Entry MSB: Pitch Bend Range 2
13 RPN MSB 0
13 RPN LSB 1
13 Data Entry MSB: Channel Fine Tuning 64
13 RPN MSB 0
13 RPN LSB 2
13 Data Entry MSB: Channel Coarse Tuning 64
13 Pitch Bend 0
14 Voice Volume 57
14 Modulation Wheel 0
14 Voice Pan 82
14 Expression 127
14 Voice Reverb Level 38
14 Voice Chorus Level 40
14 Harmonic Content 64
14 Release Time 64
14 Attack Time 64
14 Brightness 72
14 Bank MSB 0
14 Bank LSB 112
14 Program Change: [0,112,28] 042 Muted Guitar (GUITAR)
14 RPN MSB 0
14 RPN LSB 0
14 Data Entry MSB: Pitch Bend Range 2
14 RPN MSB 0
14 RPN LSB 1
14 Data Entry MSB: Channel Fine Tuning 64
14 RPN MSB 0
14 RPN LSB 2
14 Data Entry MSB: Channel Coarse Tuning 64
14 Pitch Bend 0
15 Voice Volume 127
15 Modulation Wheel 0
15 Voice Pan 64
15 Expression 127
15 Voice Reverb Level 40
15 Voice Chorus Level 0
15 Harmonic Content 64
15 Release Time 64
15 Attack Time 64
15 Brightness 64
15 Bank MSB 0
15 Bank LSB 0
15 Program Change: [0,0,0] 134 Grand Piano (XG PIANO)
15 RPN MSB 0
15 RPN LSB 0
15 Data Entry MSB: Pitch Bend Range 2
15 RPN MSB 0
15 RPN LSB 1
15 Data Entry MSB: Channel Fine Tuning 64
15 RPN MSB 0
15 RPN LSB 2
15 Data Entry MSB: Channel Coarse Tuning 64
15 Pitch Bend 0
0 Bank MSB 0
0 Bank LSB 113
0 Program Change: [0,113,0] 001 Live! Grand Piano (PIANO)
1 Bank MSB 0
1 Bank LSB 112
1 Program Change: [0,112,48] 054 String Ensemble (STRINGS)
2 Bank MSB 0
2 Bank LSB 112
2 Program Change: [0,112,33] 046 Finger Bass (BASS)
0 Voice Volume 110
1 Voice Volume 36
2 Voice Volume 99
0 Voice Pan 78
1 Voice Pan 64
2 Voice Pan 64
0 Voice Reverb Level 40
1 Voice Reverb Level 50
2 Voice Reverb Level 8
0 Voice Chorus Level 50
1 Voice Chorus Level 6
2 Voice Chorus Level 0
0 RPN MSB 0
0 RPN LSB 0
0 Data Entry MSB: Pitch Bend Range 6
1 RPN MSB 0
1 RPN LSB 0
1 Data Entry MSB: Pitch Bend Range 6
2 RPN MSB 0
2 RPN LSB 0
2 Data Entry MSB: Pitch Bend Range 6
0 Pitch Bend 0
1 Pitch Bend 0
2 Pitch Bend 0
0 Release Time 110
1 Release Time 110
2 Release Time 110
0 Note On 096(C6)

In [91]:
def nonclock(l):
    return (x for x in l if x.message.type != 'clock')
for n, r in zip(nonclock(nsc), nonclock(rsc)):
    if str(n) != str(r):
        print(n, r)


Reverb Type 06(Stage1) Reverb Type 01(Hall1)
Chorus Type 4(Flanger2) Chorus Type ---(Chorus)
0 Note On 091(G5) 0 Note On 096(C6)

It looks like the GM_ON reset only affects the reverb and chorus panel settings. nice to know.


In [95]:
with mido.open_output('DGX-505 MIDI 1') as outport:
    for i in range(16):
        outport.send(controls.cc(controls.Control.VOLUME, channel=i, value=1))

In [96]:
with mido.open_output('DGX-505 MIDI 1') as outport:
    for i in range(16):
        outport.send(controls.cc(controls.Control.RESET_CONTROLS, channel=i, value=1))

In [97]:
with mido.open_output('DGX-505 MIDI 1') as outport:
    for i in range(16):
        outport.send(controls.cc(controls.Control.VOLUME, channel=i, value=127))

Huh, it looks like Reset Controllers does nothing to volume either.


In [98]:
with mido.open_output('DGX-505 MIDI 1') as outport:
    for i in range(16):
        outport.send(controls.cc(controls.Control.MODULATION, channel=i, value=127))

In [99]:
with mido.open_output('DGX-505 MIDI 1') as outport:
    for i in range(16):
        outport.send(controls.cc(controls.Control.RESET_CONTROLS, channel=i, value=1))

But it works with Modulation for some reason. hmmmmmm.


In [101]:
outport = mido.open_output('DGX-505 MIDI 1')

In [103]:
outport.send(controls.gm_on())
outport.send(controls.local(False))

Let's start from the top: voice volume.


In [104]:
cc = controls.cc
C = controls.Control

In [105]:
outport.send(cc(C.VOLUME, 0))

No sound.


In [107]:
outport.send(cc(C.RESET_CONTROLS, 64))

Still no sound.


In [108]:
outport.send(cc(C.VOLUME, 64))

In [122]:
outport.send(controls.gm_on())

In [113]:
outport.send(cc(C.VOLUME, 110))

We can conclude that RESET_CONTROLS does nothing to voice volume, and I have no idea what GM_ON resets it to.


In [118]:
outport.send(cc(C.PAN, 0))

All sound on the left.


In [120]:
outport.send(cc(C.RESET_CONTROLS, 42))

All sound still on the left.

Just checking if i'm not missing anything:


In [121]:
for i in range(128):
    outport.send(cc(C.RESET_CONTROLS, i))

Nope, the reset doesn't work for pan either.


In [123]:
outport.send(controls.gm_on())
outport.send(cc(C.REVERB, 127))

In [124]:
outport.send(cc(C.RESET_CONTROLS, 42))

Still reverby.


In [127]:
outport.send(controls.gm_on())
outport.send(cc(C.CHORUS, 127))

In [128]:
outport.send(cc(C.RESET_CONTROLS, 3))

Neither does the chorus


In [131]:
outport.send(controls.gm_on())
outport.send(cc(C.PEDAL, 127))

Pedal


In [132]:
outport.send(cc(C.RESET_CONTROLS, 3))

Hey, it does work for pedal! Turns it OFF.


In [133]:
outport.send(cc(C.RELEASE, 127))

In [134]:
outport.send(cc(C.RESET_CONTROLS, 3))

Also Panel Sustain, that is, release time


In [135]:
outport.send(cc(C.RELEASE, 0))

In [136]:
outport.send(cc(C.RESET_CONTROLS, 3))

In [137]:
outport.send(controls.gm_on())

I think the default is 0x40, probably.


In [138]:
outport.send(cc(C.MODULATION, 127))

In [144]:
outport.send(cc(C.RESET_CONTROLS, 3))

In [143]:
outport.send(cc(C.MODULATION, 0))

The modulation wheel, I guess, is reset to zero.


In [154]:
outport.send(cc(C.EXPRESSION, 127))

In [153]:
outport.send(cc(C.EXPRESSION, 64))

In [155]:
outport.send(cc(C.RESET_CONTROLS, 3))

Expression can be reset as well. Dunno what the default is.


In [159]:
outport.send(cc(C.PORTAMENTO_CTRL, 12))

I don't even know what portamento even does.


In [160]:
outport.send(cc(0x05, 127))

Later

I've been reading through the MIDI Specs. Things to note:

  • The MIDI implementation chart is dated 1 December 2003
  • The keyboard implements General MIDI Level 1
  • And also Yamaha's XGLite.

The specification for XG 2.0 can be found through http://www.jososoft.dk/yamaha/docs_specs.htm dated April 2001. XGLite is a subset of this specification.

Interesting Things From The XG Spec

I'm going to assume that the implementation of XGLite is like XG, only with a whole lot fewer controls and voices available, so no super fancy stuff. Nevertheless, we do have our 16 channel multi timbral tone generator (with 32 note polyphony).

3.1.2 Program Change

There are melody voices and there are rhythym voices (drum kits).

The specification says:

If the tone generator does not have a drum kit corresponding to the specified program number, it will ignore the message and continue to use the current drum kit.

If Program change makes a change from normal voice to drum kit, the part mode shall revert to what it was before normal mode was invoked. Upon receipt of XG System ON, the system shall virtually set this "revert-to" mode to Drum Setup 2 for all Parts 1 to 16, except for Part 10.

3.1.6.1 Bank Select MSB/LSB

Bank MSB:

MSB
00 Melody voice
013F Model-exclusive area
40 SFX voice
4177 Reserved for XG extensions
78 GM L2 Rhythm Kit
79 GM L2 Melody voice
7A7D Reserved for XG extensions
7E SFX kit
7F Rhythm kit

Bank LSB is an extension area.

If support is included for one or more voices in an extension bank, then all the other program change numbers in that bank are filled with the corresponding voices of Bank 0 (basic voices)

Note 1: By default, channel 10 plays rhythm voices while other channels use bank 0 melody voices (as in GM Level 1)

Note 2: If the new Bank Select MSB is 00 (melody voice) but the tone generator does not support the melody voice corresponding to the last recieved Bank Select LSB, the channel reverts to the Bank Select LSB corresponding to its most recently played melody voice.

Note 3: If the new Bank Select MSB is 7F (rhythm voice) the tone generator unconditionally uses LSB 00 without using the most recently received Bank Select LSB. If the tone generator does not support a drum kit corresponding to the channel's most recently received Program Change, the channel will revert to the Program Change corresponding to its most recently played rhythm kit.

Note 4: If a Bank Select MSB value of 0177 or 7A7E (model-exclusive area, SFX voice, or XG extension voice) is received and the tone generator does not have a voice corresponding to the last received LSB and Program change, the tone generator shall produce no sound for that channel regardless of subsequent Key On messages.

In the case where a melody voice is being changed first to a voice in bank-LSB A and then to a voice in bank-LSB B, and the change to A is possible but the change to B is not possible, A will be used as the substitute for B. If neither the change to A nor the change to B is possible, the voice of the previous bank will [be] substituted for A and B.

In the case where a rhythm voice is being changed first program number kit A and then to program number kit B, and the change to A is possible but the change to B is not possible, A will be used as the substitute for B. If neither the change to A nor the change to B is possible, the voice of the previous bank will [be] substituted for A and B.

3.1.6.2 Modulation

Control 01, defaults to 00

By default, this message controls vibrato depth only

3.1.6.3 Portamento Time

Has no effect on portamento control. Turns out those things aren't the same thing? Is this a difference in the MIDI Spec?

3.1.6.4 Data Entry MSB / LSB

06 and 26, as usual

3.1.6.5 Main Volume

Control 07, default 64 In the DGX-505 chart this is called "Part Volume".

3.1.6.6 Panpot

Control 0A, default 40 Apparently 00 and 01 are the same (L63)... it goes from there up as you would expect to 7F being R63.

Also, that's what Pan stands for?

3.1.6.7 Expression

Control 0B. default 7F

3.1.6.8 Sustain (Hold)

Control 40. OFF/ON. default 00 (OFF).

This setting also affects the release part of the sound following note-off (after-damper effect).

3.1.6.9–11 Portamento, Sostenuto, Soft Pedal

Not supported by 505.

3.1.6.12–15 Harmonic Content, Release Time, Attack Time, Brightness

Controls 47, 48, 49, 4A respectively

Range 00:-64, 40:0, 7F:+63; default 40 (0)

On some voices, the effective range is narrower than the range which can be set.

Harmonic content adjusts resonance, release/attack adjusts the envelope, brightness adjusts the filter cutoff frequency. Controls are relative to the default 40.

3.1.6.16 Portamento Control

Control 54.

Portamento time is always 0.

... So, what, it just does the portamento instantly or something?

3.1.6.17 Effect Send 1 (Reverb)

Control 5B. Default 28

3.1.6.18 Effect Send 3 (Chorus)

Control 5D. Default 00

3.1.6.19 Effect Send 4 (Variation)

Not supported by 505

3.1.6.20 Data Increment/Decrement

Controls 60, 61.

The data byte is ignored.

3.1.6.21 NRPN

Not supported by 505. This is full of complex stuff for the full XG I suppose.

3.1.6.22 RPN

LSB on 64, MSB on 65. Default: 7F 7F. The order here is LSB MSB, but the instrument transmits in MSB LSB order.

Pitch Bend Sensitivity

MSB LSB: 00 00. Data on MSB, default 02. LSB ignored.

[Channel] Fine Tune & Coarse Tune

MSB LSB: 00 01, 00 02 respectively. Data on MSB, with range 00:-64, 40:0, 7F:+63. Default 40.

Looks like LSB is probably ignored here too.

3.1.7.1 All Sound Off

Control 78, with data 00. Silences all notes on the channel, but does not reset stuff that was set by channel messages

3.1.7.2 Reset All Controllers

Control 79, with data 00.

Resets to default:

  • Pitch Bend
  • Modulation
  • Expression
  • Sustain
  • (Portamento, Sostenuto, Soft Pedal)
  • Registed Parameter Number.

It also sets off reception of Portamento Control. It does not reset the Portamento source key.

Huh, so how does the portamento control work? Must consult the MIDI spec?

3.1.7.3 All Notes Off

Control 7B, data 00 Turns all notes that are ON, OFF. Doesn't stop playing if in sustain or sostenuto phase until those phases become off as well.

3.1.7.4–7 Omni ON/OFF/Mono/Poly

Not particularly relevant, as instrument only supports mode 3. Thus, these just act as notes/sound off messages (depending on type: 7C, 7D as Notes Off and 7E, 7F as Sound Off.

Interestingly according to the spec OMNI ON does not implement OMNI ON.

3.2.1 XG System Exclusive Messages

Parameter Change

Apparently in XG, special parameters can be set with

F0 43 1n 4C aa aa aa dd .. dd F7.

n is the device number, 4C the model ID, aa aa aa the address hi/mid/lo, dd .. dd the data.

A single message shall be used to set the data value, even if the value's data size consists of multiple bytes. The tone generator shall not accept the message if the number of sent data bytes is less than the required number of data bytes. It shall not be possible, when sending data for a multibyte parameter (such as master tuning), to send the high-order byte only.

Note that during the Initial Send, a sysEx message is recieved:

F0 43 10 4C 00 00 7E 00 F7

So now we have some idea of what this is: Device 0, set parameter address 00 00 7E to value 00.

Bulk Dump

Sets parameters as a block

F0 43 0n 4C bb bb aa aa aa dd .. dd cc F7

Here, bb bb are Byte Count MSB/LSB, which corresponds to the "TOTAL SIZE" figures in Attached Chart 5 of the spec.

cc is a checksum, such that low-order 7 bits of sum of byte count, address, data, checksum itself = 0.

If sending consecutive bulk dumps, leave an interval of about 10ms between the F7 and the next F0.

Parameter Request

Optional: has no meaning on tone generators without MIDI OUT

Gets the value of a specified parameter

F0 43 4n 4C aa aa aa F7

Dump Request

Optional, as above

F0 43 2n 4C aa aa aa F7

3.2.1.1 System Data Parameters

There are ten zillion of these, which probably aren't implemented in XGLite.

3.2.1.1.1 Master Tuning

Address 00 00 00, data aa bb cc dd, default 00 04 00 00

Master tuning as aa×1000 + bb×0100 + cc×0010 + dd×0001 - 0400 in units of 0.1 cents.

Note: This is not the "MIDI Master Tuning" SysEx message

F0 43 1n 27 30 00 00 mm ll cc F7

3.2.1.1.2 Master Volume

Address 00 00 04, data dd, default 7F.

This parameter value can also be changed by the Universal SysEx Master Volume message

F0 7F 7F 04 01 ll mm F7,

which is documented in the DGX-505 manual (ll ignored)

3.2.1.1.3 Master Attenuator

Address 00 00 05, data dd, default 00. Optional.

3.2.1.1.4 Master Transpose

Address 00 00 06, data dd, default 40, range 2858 (-24 to +24)

3.2.1.1.5 Drum Setup Reset

Address 00 00 7D, data dd, default --, range 00–(Drum setup count - 1). Initialises drum setup parameters, but doesn't change kit number.

3.2.1.1.6 XG System ON

Address 00 00 7E, data dd. If data is 00, resets tone generator to XG initial state.

Aha, now this is what our message F0 43 10 4C 00 00 7E 00 F7 is.

3.2.1.1.7 All Parameter Reset

Address 00 00 7F, data dd, If data is 00, resets tone generator mode to factory defaults

3.2.1.3 Multi Effect Data Parameters

These are for the Reverb and Chorus (and Variation, but not supported?) Types. Effect type is set by MSB and LSB.

For unsupported MSB, No Effect is used, which is 0.

For unsupported LSB, older models change non-supported LSBs to 0, while newer models calculate

Substitute LSB = Integer part of (given LSB/32) × 32

ending up with 0, 32, 64, or 96. Considering that the DGX-505 does not support any LSB greater than 32, I think having it be 0 is kind of the same thing.

3.2.2 Yamaha System Exclusive

Optional, for the purpose of compatibility with pre-XG models. Just the one message:

3.2.2.1 MIDI Master Tuning

F0 43 1n 27 30 00 00 0m 0l cc F7

The DGX-505 implements this one.

3.2.3 Universal System Exclusive

3.2.3.1 GM System ON

F0 7E 7F 09 01 F7

Resets all settings besides MIDI Master Tuning to default. Acts on MIDI Master Tuning "the same" as XG System ON.

The DGX-505 implements this one.

3.2.3.2 Midi Master Volume

F0 7F 7F 04 01 ll mm F7

The DGX-505 implements this one, ignoring ll.

4.1 Master Tuning

XG has 3 ways of changing master tuning:

  1. XG Master Tuning, for tuning of the song
  2. MIDI Master Tuning, for tuning the system
  3. Panel Settings, for tuning the system

2 and 3 are the same thing, of which latest setting is effective. XG System ON / GM System ON would return the tuning to the most recent 2 or 3 value, while All Parameter Rest / Factory Set would reset everything including 2 and 3.

Relevant Parts From The MIDI Spec

These are documents from the official MIDI specifications, available at https://www.midi.org/specifications (a signup required). There's a whole bunch of documents, which include the complete MIDI 1.0 Specification (v4.2, Februrary 1996) and a whole bunch of recommended practices (RPs) and assorted updates since then.

Running Status

Interesting, but apparently (from some Googling) not supported by USB-MIDI and quite possibly undone by the operating system libraries. So not particularly relevant to us, outside of clearing up some of the examples in the specs themselves. Mido doesn't seem to support parsing it.

Note Off

Note On with velocity 0 is equivalent to Note Off (and useful for Running Status), but a separate Note Off is also provided with its own velocity for devices to use if they want. The DGX505 says it doesn't recognise Note Off velocity (it recognises Note Off messages, as a good implementer would).

Controller Numbers

Range
001F MSB for most continuous Controller Data
203F optional LSB for the controllers 001F
4045 Single byte, usually switches/pedals
464F Single byte, Sound control
505A Other single byte
5B5F Single byte, External effect depth
6065 Inc/Dec, Parameters
6677 Undefined, as of 1996

78 to 7F are technically Channel Mode messages, not Control Change messages, but mido doesn't care.

The way MSB/LSB are supposed to work: LSB is optional. Once MSB is sent, then the LSB can be adjusted without sending another MSB message (as long as we don't need to change the MSB, obviously). When setting MSB, the LSB is implicitly set to zero.

Question: Does this apply to Bank MSB/LSB, which falls in the 003F range? How about Data Entry MSB/LSB?

The switches work on 003F as OFF, 407F as ON. An instrument does not technically have to interpret them as switches, and can interpret a non-switch as a switch, if it wants to. The spec recommends values of 00 and 7F for OFF and ON.

General Purpose Controllers

1013 (with LSB 3033), and 5053 (single byte) are the General Purpose Controllers, with manufacturer defined purpose. We don't use any of them.

Bank Select

MIDI transmitters must transmit MSB and LSB as a pair immediately followed by Program Change, as to not confuse if another message is inserted in a gap.

Sound Controllers

46 through 4A. All except the first are implemented by DGX505. (see the XG section).

4B through 4F have no specified defaults (i.e. up to manufacturer, with no suggestion from the association).

Portamento Controller

54. This is the complicated one, introduced for legato with portamento on POLY mode.

When a Note On is recieved after a Portamento Control, the voice pitch should glide from that specified in the Portamento Control (the pitch reference) to the new Note On, at a rate set by the Portamento Time Controller, ignoring Portamento ON/OFF (which I gather is for some other mode). It only affects the next Note-On on its channel, and does not affect any other notes that are sounding when it is recieved or overlapped (at least for Poly mode), with the exception of the reference note on that channel if it is already on. Note-Off must match the Note-On message, not the Portamento Controller message.

Okay, since the Portamento Time is set to 0 for this purpose in XG, I suppose this means that Portamento Control is only used for legato and not for slower sweeps.

RPN and NRPN

RPN are agreed by the Association, NRPN are manufacturer specific. NRPN reception should be disabled by default on startup. When reception of RPN/NRPN is enabled, devices should wait until both MSB and LSB have been set.

Recievers should work with only LSB or MSB set messages, but transmitters should send both just in case each time it is changed.

RPN (MSB LSB) parameter
00 00 Pitch Bend Sensitivity (MSB = semitones, LSB = cents)
00 01 Fine Tuning
00 02 Coarse Tuning
00 03 Tuning Program Select
00 04 Tuning Bank Select

Additional RPNs have since been registered since 1996 as well, specified in the other documents.

Data Inc and Dec

The behaviour was vague in the 1996 spec, so a Recommended Practice document was issued (RP-018, Response to Data Inc/Dec Controllers, approved October 1997):

The value byte is ignored in Data Inc/Dec messages.

For RPN 0 and 1 (Pitch Bend Sensitivity and Fine Tuning), Inc/Dec should adjust the LSB primarily (changing the MSB on overflow). Because Pitch Bend Sensitivity works in cents, it overflows at 100 instead of 128.

For RPN 2, 3, 4, Inc/Dec works on the MSB.

For devices which don't support LSB for Pitch Bend Sensitivity / Fine Tuning, the number of Inc/Dec should be kept track of anyway so the overflow should be made at the right time (for example it should take 100 Incs to change 1 semitone, regardless of whether the sensitivity actually changes inbetween).

Aftertouch

Not implemented on the DGX505. Mido has these as 'aftertouch' for the channel pressure and 'polytouch' for the polyphonic pressure.

Channel Mode Messages

These are the All Notes Off/ Sound Off / Omni / Poly as well as Reset All Controllers and Local Control. These are supposed to be recognised only when sent on the Basic Channel, and affect all the notes on the channels controlled by that Channel. I think the DGX-505 counts as 16 different instruments for this purpose, each their own Basic Channel??

Reset All Controllers

This message should "reset the condition" of all continuous and switch controllers, pitch bend etc to an ideal initial state. This is a little vague in the 1996 spec, so a Recommended Practice was issued (RP-015, Response to Reset All Controllers, approved May 1999), which specifies what should be set default:

Control/setting default
0B Expression 7F
01 Modulation 00
4043 Pedals 00
6265 (N)RPN 7F (null)
Pitch Bend 00 40 (centre)
Channel pressure 0
Polyphonic pressure 0

And what should not be set default:

  • 07 Volume
  • 0A Pan
  • 464F Sound controllers
  • 5B5F Effect controllers
  • 787F Channel Mode messages
  • 00&20 Bank Select
  • Program Change
  • (N)RPN parameters

This pretty much lines up with the XG spec.

General MIDI ON should perform this as well alongside anything else necessary (so I suppose it would also reset the things that wouldn't normally be reset).

Local Control

Interrupts the "internal control path" from keyboard to sound generator.

System Real-Time

Clock messages F8 are sent 24 times per quarternote; Start FA and Stop FC are self explanatory. FB is the Continue command, which is used in conjuction with the song position/select messages which aren't implemented by the DGX505.

End Of Exclusive

Exclusive messages can apparently end with any Non-Real-Time Status Byte (with real-time messages inbetween), but F7 should be sent at the end of all SysEx messages. This is possibly unsupported or abstracted away by USB-MIDI.

Active Sensing

FE is sent at least every 300 milliseconds if there is no other data.

System Reset

FF resets everything to power-on. Not implemented by DGX505.

Universal System Exclusive

F0 <id> <device id> <sub id 1> <sub id 2> .. F7

<id> is 7E for Non-Real Time Universal SysEx, and 7F for real time.

<device id> is a byte that should specify the physical device in most cases (as opposed to a channel or virtual device), except for when you need to address the parts separately. 7F is the "all-call" broadcast address.

<sub id> parts are for specifying what type of Universal SysEx message it is.

There's a whole protocol for exchanging files and what not over universal system exclusive messages, with handshakes etc. From inspecting the messages exchanged while transferring MIDI files using Musicsoft Downloader, the DGX-505 does not use this (it uses some Yamaha specific protocol) but it might be similar. Something to investigate later, perhaps.

Interestingly, the way that this protocol "7-bit-izes" octets is different from the way that the DGX-505 uses for its bulk dump: the leading bits are transmitted before the rest instead of afterward. This avoids the need for padding at the end.

There's a whole thing for microtuning and sample banks and dumps.

There's also a message for turning General MIDI OFF, F0 7E <id> 09 02 F7 if the device supports it.

Questions

Now I've read through the spec, we still have some Questions:

  • Does the DGX-505 support any of the more advanced XG settings beyond those listed in the manual?

  • What's the deal with LSB when MSB is set for bank and data entry? Does adjusting the LSB use the MSB previously set or will it jump somehow to the last one used, even for a different RPN?

  • Does DGX-505 (and/or XG(Lite) in general) have the proper behaviour for Data Inc/Dec as specified in RPN-018?

  • What is up with the Basic Channel?

  • What, exactly, does Portamento Control do?

Let's do these in reverse order. First up, Portamento Control.


In [5]:
import time

In [78]:
outport = mido.open_output('DGX-505 MIDI 1')

In [79]:
# Let's use a square lead on channel 5, everyone's favourite channel
controls.multisend(outport, controls.set_voice_numbers(101, 5))

In [169]:
outport.send(mido.Message('note_on', channel=5, note=64))
time.sleep(0.5)
outport.send(mido.Message('note_on', channel=5, note=68))
time.sleep(0.5)
outport.send(mido.Message('note_off', channel=5, note=68))
time.sleep(0.5)
outport.send(mido.Message('note_off', channel=5, note=64))
time.sleep(0.5)

Both notes turn on, and both notes have to be turned off.


In [170]:
outport.send(controls.cc(controls.Control.PORTAMENTO_CTRL, channel=5, value=64))
outport.send(mido.Message('note_on', channel=5, note=68))
time.sleep(0.5)
outport.send(mido.Message('note_off', channel=5, note=68))

I hear no difference, but PTC should have one extra effect:


In [172]:
outport.send(mido.Message('note_on', channel=5, note=64))
time.sleep(0.5)
outport.send(controls.cc(controls.Control.PORTAMENTO_CTRL, channel=5, value=64))
outport.send(mido.Message('note_on', channel=5, note=68))
time.sleep(0.5)
outport.send(mido.Message('note_off', channel=5, note=68))

Now the first note switches off as soon as the second comes on, and doesn't need to be switched off separately.


In [264]:
outport.send(mido.Message('note_on', channel=5, note=64))
outport.send(mido.Message('note_on', channel=5, note=68))
outport.send(mido.Message('note_on', channel=5, note=71))
time.sleep(0.5)
outport.send(controls.cc(controls.Control.PORTAMENTO_CTRL, channel=5, value=68))
outport.send(mido.Message('note_on', channel=5, note=56))
time.sleep(0.5)
outport.send(controls.cc(controls.Control.PORTAMENTO_CTRL, channel=5, value=64))
outport.send(mido.Message('note_on', channel=5, note=56))
time.sleep(0.5)
outport.send(controls.cc(controls.Control.PORTAMENTO_CTRL, channel=5, value=71))
outport.send(mido.Message('note_on', channel=5, note=56))
time.sleep(0.5)
outport.send(controls.cc(controls.Control.SOUND_OFF_XPOLY, channel=5, value=0))

In [265]:
outport.send(mido.Message('note_on', channel=5, note=64, velocity=64))
time.sleep(0.5)
outport.send(controls.cc(controls.Control.PORTAMENTO_CTRL, channel=5, value=64))
outport.send(mido.Message('note_on', channel=5, note=68, velocity=1))
time.sleep(0.5)
outport.send(mido.Message('note_on', channel=5, note=68, velocity=0))

Okay, I think I have a grip on what Portamento Control does. Also, the channel mode messages act on each channel separately, it seems


In [7]:
def panic():
    for i in range(16):
        outport.send(controls.cc(controls.Control.SOUND_OFF, channel=i, value=0))

Now, let's try pitch bend.


In [376]:
def pb(iv=0.5):
    outport.send(mido.Message('pitchwheel', channel=5, pitch=0))
    outport.send(mido.Message('note_on', channel=5, note=64))
    time.sleep(iv)
    outport.send(mido.Message('pitchwheel', channel=5, pitch=+8191))
    time.sleep(iv)
    outport.send(mido.Message('note_off', channel=5, note=64))
    time.sleep(iv)

Let's set RPN:


In [6]:
C = controls.Control
cc = controls.cc

In [330]:
outport.send(cc(C.RPN_MSB, channel=5, value=0))
outport.send(cc(C.RPN_LSB, channel=5, value=0))

and decrement:


In [341]:
outport.send(cc(C.DATA_DEC, channel=5, value=0))

In [342]:
pb()

Hmm, no change.

How about setting?


In [343]:
outport.send(cc(C.DATA_MSB, channel=5, value=12))

In [372]:
pb()

In [371]:
outport.send(cc(C.DATA_DEC, channel=5, value=0))

In [379]:
outport.send(cc(C.DATA_MSB, channel=5, value=0))
for i in range(12):
    outport.send(cc(C.DATA_INC, channel=5, value=0))
    pb(0.15)

That's definitely incrementing by semitones, there.

What if we change the RPN and back?


In [380]:
outport.send(cc(C.RPN_LSB, channel=5, value=1))
outport.send(cc(C.RPN_LSB, channel=5, value=0))
for i in range(12):
    outport.send(cc(C.DATA_INC, channel=5, value=0))
    pb(0.15)

In [381]:
outport.send(cc(C.DATA_MSB, channel=5, value=0))
pb()

In [398]:
outport.send(cc(C.DATA_MSB, channel=5, value=0))
for i in range(1):
    outport.send(cc(C.DATA_INC, channel=5, value=0))
    pb(0.15)
outport.send(cc(C.RPN_LSB, channel=5, value=1))
for i in range(1):
    pb(0.15)
outport.send(cc(C.RPN_LSB, channel=5, value=0))
for i in range(1):
    outport.send(cc(C.DATA_INC, channel=5, value=0))
    pb(0.15)
outport.send(cc(C.RPN_MSB, channel=5, value=1))
for i in range(1):
    outport.send(cc(C.DATA_INC, channel=5, value=0))
    pb(0.15)
outport.send(cc(C.RPN_MSB, channel=5, value=0))

outport.send(cc(C.RPN_MSB, channel=5, value=0x7F))
outport.send(cc(C.RPN_LSB, channel=5, value=0x7F))


for i in range(4):
    outport.send(cc(C.DATA_INC, channel=5, value=0))
    pb(0.15)
outport.send(cc(C.RPN_MSB, channel=5, value=0))
outport.send(cc(C.RPN_LSB, channel=5, value=0))
for i in range(4):
    outport.send(cc(C.DATA_INC, channel=5, value=0))
    pb(0.15)

Okay, that's some weird stuff.


In [399]:
outport.send(controls.gm_on())

In [487]:
def pb(iv=0.1):
    outport.send(mido.Message('pitchwheel', pitch=0))
    outport.send(mido.Message('note_on', note=64, velocity=90))
    time.sleep(iv)
    outport.send(mido.Message('pitchwheel', pitch=+8191))
    time.sleep(iv)
    outport.send(mido.Message('note_off', note=64))
    time.sleep(iv)

Hypothesis: INC/DEC doesn't do anything until MSB/LSB has at least been set once. Even if that setting doesn't actually do anything.


In [468]:
XGRESET = mido.Message.from_hex("F0 43 10 4C 00 00 7E 00 F7")

In [494]:
outport.send(controls.gm_on()) # reset all

outport.send(cc(C.DATA_MSB, value=0))  # MSB = 0
pb()  # PBS == 2
for i in range(2):
    outport.send(cc(C.DATA_INC, value=0)) # MSB = 2
pb() # PBS == 2
outport.send(cc(C.RPN_MSB, value=0))
outport.send(cc(C.RPN_LSB, value=0))  # RPN -> PBS
pb() # PBS == 2
#outport.send(cc(C.DATA_MSB, value=0))
outport.send(cc(C.DATA_INC, value=0)) # MSB = 3, PBS = MSB
pb()  # PBS == 3

outport.send(controls.gm_on())
# reset, RPN -> NULL, PBS = 2, but MSB stays 3 (?!)
pb() # PBS == 2
outport.send(cc(C.DATA_INC, value=0))  # MSB = 4
outport.send(cc(C.RPN_MSB, value=0))  # RPN -> PBS
outport.send(cc(C.RPN_LSB, value=0))
pb() # PBS == 2
outport.send(cc(C.DATA_INC, value=0)) # MSB = 5
pb()  # PBS == 5

outport.send(cc(C.RPN_MSB, value=127))
outport.send(cc(C.RPN_LSB, value=127)) # RPN -> NULL

for i in range(4):
    outport.send(cc(C.DATA_DEC, value=0)) # MSB = 1
outport.send(cc(C.RPN_MSB, value=0))
outport.send(cc(C.RPN_LSB, value=0))  # RPN -> PBS
pb() # PBS == 5
outport.send(cc(C.DATA_DEC, value=0)) # MSB = 0
pb() # PBS == 0

outport.send(mido.Message.from_hex("F0 43 10 4C 00 00 7E 00 F7"))
# XG ON
pb() # PBS == 2
outport.send(cc(C.RPN_MSB, value=0))
outport.send(cc(C.RPN_LSB, value=0)) # RPN -> PBS
outport.send(cc(C.DATA_INC, value=0)) # MSB = 1
pb() # PBS == 1

outport.send(mido.Message.from_hex("F0 43 10 4C 00 00 7F 00 F7"))
# XG Reset
pb() # PBS == 2
outport.send(cc(C.DATA_INC, value=0)) # MSB = 2

outport.send(cc(C.RPN_MSB, value=0))
outport.send(cc(C.RPN_LSB, value=0)) # RPN -> PBS
outport.send(cc(C.DATA_INC, value=0)) # MSB = 3
pb() # PBS == 3

outport.send(mido.Message.from_hex("F0 43 10 4C 00 00 7F 00 F7"))
# XG Reset, RPN -> NULL
pb() # PBS == 2
outport.send(cc(C.DATA_MSB, value=12)) # MSB = 12
pb() # PBS == 2
outport.send(cc(C.RPN_MSB, value=0))
outport.send(cc(C.RPN_LSB, value=0)) # RPN -> PBS
outport.send(cc(C.DATA_DEC, value=0)) # MSB = 11
pb() # PBS == 11

I've annotated the above with the results of the experiment and what I think's going on. Internally, INC/DEC seem to alter the value of an MSB variable, then set the MSB of the current RPN to what the value is now. It's the same variable, no matter which RPN is currently active; it doesn't get reset on GM_ON or XG ON or XG reset (which actually seems to work otherwise). The lesson: always set the MSB before using the INC/DEC, because weird things happen; it's definitely not the behaviour recommended in RPN-018.

Also, weird things happen if you go below zero, and above 127?? Might need even more testing!


In [525]:
outport.send(controls.gm_on()) # reset all
pb() # PBS == 2
outport.send(cc(C.RPN_MSB, value=0))
outport.send(cc(C.RPN_LSB, value=0))  # RPN -> PBS
outport.send(cc(C.DATA_MSB, value=0)) # MSB = 0
pb() # PBS == 0
outport.send(cc(C.DATA_DEC, value=0)) # MSB = 0? -1?
pb() # PBS == 0
outport.send(cc(C.DATA_DEC, value=0)) # MSB = 0? -1?
pb() # PBS == 0
outport.send(cc(C.DATA_INC, value=0)) # MSB = 1
pb() # PBS == 1

outport.send(cc(C.RPN_LSB, value=1)) # RPN -> Fine Tune
pb() # PBS == 1
outport.send(cc(C.DATA_DEC, value=0)) # MSB = 0
pb() # PBS == 1, but we've jumped down a semitone
outport.send(cc(C.RPN_LSB, value=0)) # RPN -> PBS
pb() # PBS == 1
outport.send(cc(C.DATA_DEC, value=0)) # MSB = 0? -1 ? 
pb() # PBS == 1
outport.send(cc(C.DATA_DEC, value=0)) # MSB = 0? -1 ? 
pb() # PBS == 1
outport.send(cc(C.DATA_DEC, value=0)) # MSB = 0? -1 ? 
pb() # PBS == 1
outport.send(cc(C.DATA_INC, value=0)) # MSB = 1 ? 
pb() # PBS == 1
outport.send(cc(C.DATA_INC, value=0)) # MSB = 2 ? 
pb() # PBS == 2

In [540]:
outport.send(controls.gm_on()) # reset all
pb() # PBS == 2
outport.send(cc(C.RPN_MSB, value=0))
outport.send(cc(C.RPN_LSB, value=0))  # RPN -> PBS
outport.send(cc(C.DATA_MSB, value=4)) # MSB = 4
pb() # PBS == 4
outport.send(cc(C.RPN_LSB, value=1)) # RPN -> Fine Tune
pb() # PBS == 4
outport.send(cc(C.DATA_DEC, value=0)) # MSB = 4
pb() # PBS == 4, but we've jumped down almost a semitone
outport.send(cc(C.DATA_DEC, value=0)) # MSB = 3
outport.send(cc(C.DATA_DEC, value=0)) # MSB = 2
outport.send(cc(C.DATA_DEC, value=0)) # MSB = 1
outport.send(cc(C.DATA_DEC, value=0)) # MSB = 0
pb() # PBS == 4,

outport.send(cc(C.RPN_LSB, value=0)) # RPN -> PBS
pb() # PBS == 4
outport.send(cc(C.DATA_DEC, value=0)) # MSB = 0
pb() # PBS == 4
outport.send(cc(C.DATA_DEC, value=0)) # MSB = 0
pb() # PBS == 4
outport.send(cc(C.DATA_DEC, value=0)) # MSB = 0
pb() # PBS == 4
outport.send(cc(C.DATA_INC, value=0)) # MSB = 1
pb() # PBS == 1
outport.send(cc(C.DATA_INC, value=0)) # MSB = 2
pb() # PBS == 2

In [547]:
outport.send(controls.gm_on()) # reset all
pb() # PBS == 2
outport.send(cc(C.RPN_MSB, value=0))
outport.send(cc(C.RPN_LSB, value=1))  # RPN -> Fine Tune
outport.send(cc(C.DATA_MSB, value=127)) # MSB = 127
pb() # PBS == 2, but we've jumped up a semitone
outport.send(cc(C.RPN_LSB, value=0)) # RPN -> PBS
pb() # PBS == 2
outport.send(cc(C.DATA_INC, value=0)) # MSB = 127
pb() # PBS == 2
outport.send(cc(C.DATA_DEC, value=0)) # MSB = 126
pb() # PBS == 126 (it gets clamped to 24 in the tone generator)

Okay, so now it looks like if you go below 0 to "-1", you reach a state where it doesn't actually change the value anymore until you INC, and then it jumps to 1. So it's something like:

upon recieving DATA_DEC:
    if MSB > 0:
        MSB -= 1
        set RPN data to MSB

upon receiving DATA_INC:
    if MSB < 127:
        MSB += 1
        set RPN data to MSB


As a result if we change RPNs while MSB is at 0 already, then another DATA_DEC doesn't actually change the RPN data, which causes this odd behaviour; a DATA_INC increases the MSB to 1 and then sets the RPN data to 1, the second-lowest possible value. A weird edge case.

Does changing the RPN MSB also set the RPN LSB to zero?


In [573]:
outport.send(controls.gm_on()) # reset all
pb() # PBS == 2
outport.send(cc(C.RPN_MSB, value=0))
outport.send(cc(C.RPN_LSB, value=2))  # RPN -> Coarse Tune
outport.send(cc(C.DATA_MSB, value=62)) # MSB = 62
pb() # PBS == 2, down 2 semitones
outport.send(cc(C.RPN_MSB, value=1))
outport.send(cc(C.DATA_DEC, value=0)) # MSB = 61
pb() # PBS == 2, down 2 semitones

outport.send(cc(C.RPN_MSB, value=0)) # RPN -> Coarse Tune again
pb() # PBS == 2, down 2 semitones
outport.send(cc(C.DATA_DEC, value=0)) # MSB = 60
pb() # PBS == 2, down 4 semitones
outport.send(cc(C.DATA_DEC, value=0)) # MSB = 59
pb() # PBS == 2, down 5 semitones

No, it does not.

Does setting the LSB change the decrement?


In [575]:
outport.send(controls.gm_on()) # reset all
pb() # PBS == 2
outport.send(cc(C.RPN_MSB, value=0))
outport.send(cc(C.RPN_LSB, value=2))  # RPN -> Coarse Tune
outport.send(cc(C.DATA_MSB, value=62)) # MSB = 62
pb() # PBS == 2, down 2 semitones
outport.send(cc(C.DATA_LSB, value=32))
pb() # PBS == 2, down 2 semitones
outport.send(cc(C.DATA_DEC, value=0)) # MSB = 60
pb() # PBS == 2, down 4 semitones
outport.send(cc(C.DATA_DEC, value=0)) # MSB = 59
pb() # PBS == 2, down 5 semitones

No.

Does setting the LSB drag the MSB along with it?


In [581]:
outport.send(controls.gm_on()) # reset all
pb() # PBS == 2
outport.send(cc(C.RPN_MSB, value=0))
outport.send(cc(C.RPN_LSB, value=2))  # RPN -> Coarse Tune
outport.send(cc(C.DATA_MSB, value=65)) # MSB = 62
pb() # PBS == 2, up 1 semitone
outport.send(cc(C.RPN_LSB, value=0))  # RPN -> PBS
pb() # PBS ==2, up 1 semitone
outport.send(cc(C.DATA_LSB, value=42)) # LSB = 42
pb() # PBS == 2, still
outport.send(cc(C.DATA_DEC, value=0)) # MSB = 41
pb() # PBS == 41 (clamped to 24)

No.

F0 43 1n 4C aa aa aa dd .. dd F7

Parameter settings.


In [606]:
outport.send(controls.gm_on()) # reset all
pb() 
outport.send(mido.Message.from_hex(
    "F0 43 10 4C 00 00 04 03 F7"))
pb() # XG volume
outport.send(mido.Message.from_hex(
"F0 7F 7F 04 01 00 48 F7"))
pb() # USE volume
outport.send(mido.Message.from_hex(
    "F0 43 11 4C 00 00 7F 00 F7"))
pb() # XG Reset

Seems like the only one that works is the XG Resets.

Does the DGX-505 respond to XG parameter requests?


In [607]:
inport = mido.open_input('DGX-505 MIDI 1')

In [634]:
list(inport.iter_pending())


Out[634]:
[<message note_on channel=0 note=103 velocity=92 time=0>,
 <message note_on channel=0 note=103 velocity=0 time=0>]

In [635]:
outport.send(mido.Message.from_hex(
    "F0 43 40 4C 00 00 00 F7")) # request
outport.send(mido.Message.from_hex(
    "F0 43 20 4C 00 00 01 F7")) # dump request

In [636]:
list(inport.iter_pending())


Out[636]:
[]

Nope.


In [637]:
inport.close()

In [638]:
outport.close()

What about when we just power on?


In [657]:
outport = mido.open_output('DGX-505 MIDI 1')

In [658]:
pb() # MSB = 0, probably

In [659]:
outport.send(cc(C.DATA_INC, value=0)) # MSB = 1
pb() # PBS == 2

In [660]:
outport.send(cc(C.RPN_MSB, value=0))
outport.send(cc(C.RPN_LSB, value=0)) # RPN -> PBS

In [661]:
outport.send(cc(C.DATA_INC, value=0)) # MSB = 2
pb() # PBS == 2

In [662]:
outport.send(cc(C.DATA_INC, value=0)) # MSB = 3
pb() # PBS == 3

I guess MSB starts at 0.


In [663]:
outport.close()

In [ ]:
# power on
outport = mido.open_output('DGX-505 MIDI 1')
pb()
outport.send(cc(C.RPN_MSB, value=0))
outport.send(cc(C.RPN_LSB, value=2)) # RPN -> Coarse Tuning
outport.send(cc(C.DATA_DEC, value=0)) # MSB = 0
pb() # Coarse Tuning = 64
outport.send(cc(C.DATA_INC, value=0)) # MSB

Testing Continues

I suppose now we need to test some other stuff.


In [3]:
o = mido.open_output('DGX-505 MIDI 1')

In [9]:
def pulse(port, sleep=0.5, note=60, velocity=100, channel=0):
    port.send(mido.Message('note_on', note=note, velocity=velocity, channel=channel))
    time.sleep(sleep)
    o.send(mido.Message('note_on', note=note, velocity=0, channel=channel))
    time.sleep(sleep)

In [44]:
pulse(o)

In [53]:
# Pitch Bend
o.send(controls.gm_on())
pulse(o)
o.send(mido.Message('pitchwheel', pitch=-8192))
pulse(o)
o.send(cc(C.RESET_CONTROLS, value=0))
pulse(o)

Pitch bend: check.


In [147]:
def pulsetest(port, m, channel=0, reset=True, voice=None, *args, **kwargs):
    if reset:
        port.send(controls.gm_on())
    if voice is not None:
        controls.multisend(port, controls.set_voice_numbers(voice, channel=channel))
    pulse(port, channel=channel, *args, **kwargs)
    port.send(m)
    pulse(port, channel=channel, *args, **kwargs)
    port.send(cc(C.RESET_CONTROLS, value=0, channel=channel))
    pulse(port, channel=channel, *args, **kwargs)

In [151]:
pulsetest(o, cc(C.RELEASE, value=0), voice=103)

Release time: check


In [166]:
pulsetest(o, cc(C.ATTACK, value=80), voice=103)

In [167]:
pulsetest(o, cc(C.ATTACK, value=80), voice=120)

Attack time, check


In [180]:
pulsetest(o, cc(C.HARMONIC, value=127), voice=103)

Harmonic, check


In [187]:
pulsetest(o, cc(C.BRIGHTNESS, value=0), voice=1)

Now for Portamento Control


In [216]:
def porta(port, sleep=0.5, note1=60, note2=64, velocity=100, channel=0, reset=True, voice=None):
    if reset:
        port.send(controls.gm_on())
    if voice is not None:
        controls.multisend(port, controls.set_voice_numbers(voice, channel=channel))
        
    port.send(mido.Message('note_on', note=note1, velocity=velocity, channel=channel))
    time.sleep(sleep)
    port.send(cc(C.PORTAMENTO_CTRL, value=note1))
    port.send(mido.Message('note_on', note=note2, velocity=1, channel=channel))
    time.sleep(sleep)
    port.send(mido.Message('note_on', note=note2, velocity=0, channel=channel))
    time.sleep(sleep)
    port.send(mido.Message('note_on', note=note1, velocity=0, channel=channel))
    time.sleep(sleep)
    
    port.send(mido.Message('note_on', note=note1, velocity=velocity, channel=channel))
    time.sleep(sleep)
    port.send(cc(C.PORTAMENTO_CTRL, value=note1))
    port.send(cc(C.RESET_CONTROLS, value=0, channel=channel))
    port.send(mido.Message('note_on', note=note2, velocity=1, channel=channel))
    time.sleep(sleep)
    port.send(mido.Message('note_on', note=note2, velocity=0, channel=channel))
    time.sleep(sleep)
    port.send(mido.Message('note_on', note=note1, velocity=0, channel=channel))
    time.sleep(sleep)

    port.send(mido.Message('note_on', note=note1, velocity=velocity, channel=channel))
    time.sleep(sleep)
    port.send(cc(C.PORTAMENTO_CTRL, value=note1))
    port.send(mido.Message('note_on', note=note2, velocity=1, channel=channel))
    port.send(cc(C.RESET_CONTROLS, value=0, channel=channel))
    time.sleep(sleep)
    port.send(mido.Message('note_on', note=note2, velocity=0, channel=channel))
    time.sleep(sleep)
    port.send(mido.Message('note_on', note=note1, velocity=0, channel=channel))
    time.sleep(sleep)

In [226]:
porta(o, voice=24)

In [769]:
def pbp(port, sleep=0.1, channel=0, note=64, velocity=100):
    port.send(mido.Message('pitchwheel', pitch=0, channel=channel))
    port.send(mido.Message('note_on', note=note, velocity=velocity, channel=channel))
    time.sleep(sleep)
    port.send(mido.Message('pitchwheel', pitch=+8191, channel=channel))
    time.sleep(sleep)
    port.send(mido.Message('note_off', note=note,channel=channel))
    time.sleep(sleep)

In [281]:
o.send(controls.gm_on())
controls.multisend(o, controls.set_voice_numbers(1))

o.send(cc(C.RPN_MSB, value=0))
o.send(cc(C.RPN_LSB, value=2))

pbp(o)

o.send(cc(C.DATA_MSB, value=65))

pbp(o)

o.send(cc(C.RESET_CONTROLS, value=0))

pbp(o)


pbp(o)

o.send(cc(C.RPN_MSB, value=0))
o.send(cc(C.DATA_INC, value=0))

pbp(o)

o.send(cc(C.RPN_LSB, value=2))
o.send(cc(C.DATA_INC, value=0))

pbp(o)

In [283]:
i = mido.open_input('DGX-505 MIDI 1')

In [285]:
list(i.iter_pending())


Out[285]:
[]

In [286]:
d1 = list(i.iter_pending())

In [291]:
cs = controlstate.MidiControlState()

In [294]:
def grab():
    return list(cs.feed_message(m) for m in i.iter_pending())

In [296]:
w1 = [cs.feed_message(m) for m in d1]

In [298]:
o.send(controls.master_vol(2))

In [303]:
w2 = grab()

In [305]:
all(a.message == b.message for a, b in zip(w1, w2))


Out[305]:
True

In [306]:
grab()


Out[306]:
[<MIDI Master Tuning -1 <message sysex data=(67,16,39,48,0,0,7,15,0) time=0>>,
 <MIDI Master Tuning -2 <message sysex data=(67,16,39,48,0,0,7,14,0) time=0>>,
 <MIDI Master Tuning -3 <message sysex data=(67,16,39,48,0,0,7,13,0) time=0>>,
 <0 Voice Chorus Level 29 <message control_change channel=0 control=93 value=29 time=0>>,
 <0 Voice Chorus Level 28 <message control_change channel=0 control=93 value=28 time=0>>,
 <0 Voice Chorus Level 27 <message control_change channel=0 control=93 value=27 time=0>>,
 <0 Voice Chorus Level 26 <message control_change channel=0 control=93 value=26 time=0>>,
 <1 Voice Volume 81 <message control_change channel=1 control=7 value=81 time=0>>,
 <1 Voice Volume 82 <message control_change channel=1 control=7 value=82 time=0>>,
 <1 Voice Volume 83 <message control_change channel=1 control=7 value=83 time=0>>,
 <1 Voice Volume 84 <message control_change channel=1 control=7 value=84 time=0>>,
 <1 Voice Pan 65 <message control_change channel=1 control=10 value=65 time=0>>,
 <1 Voice Reverb Level 29 <message control_change channel=1 control=91 value=29 time=0>>,
 <1 Voice Reverb Level 28 <message control_change channel=1 control=91 value=28 time=0>>,
 <1 Voice Reverb Level 27 <message control_change channel=1 control=91 value=27 time=0>>,
 <2 Voice Volume 99 <message control_change channel=2 control=7 value=99 time=0>>,
 <2 Voice Volume 98 <message control_change channel=2 control=7 value=98 time=0>>,
 <2 Voice Volume 97 <message control_change channel=2 control=7 value=97 time=0>>,
 <Chorus Type 1(Chorus1) <message sysex data=(67,16,76,2,1,32,66,17) time=0>>,
 <Chorus Type 2(Chorus2) <message sysex data=(67,16,76,2,1,32,65,2) time=0>>,
 <Chorus Type 3(Flanger1) <message sysex data=(67,16,76,2,1,32,67,8) time=0>>,
 <Reverb Type 10(Off) <message sysex data=(67,16,76,2,1,0,0,0) time=0>>,
 <Reverb Type 09(Plate2) <message sysex data=(67,16,76,2,1,0,4,17) time=0>>,
 <0 Release Time 110 <message control_change channel=0 control=72 value=110 time=0>>,
 <1 Release Time 110 <message control_change channel=1 control=72 value=110 time=0>>,
 <2 Release Time 110 <message control_change channel=2 control=72 value=110 time=0>>]

In [307]:
w3 = grab()

In [309]:
[(a, b) for a, b in zip(w2, w3) if a.message != b.message]


Out[309]:
[(<MIDI Master Tuning 0 <message sysex data=(67,16,39,48,0,0,8,0,0) time=0>>,
  <MIDI Master Tuning -3 <message sysex data=(67,16,39,48,0,0,7,13,0) time=0>>),
 (<Reverb Type 01(Hall1) <message sysex data=(67,16,76,2,1,0,1,0) time=0>>,
  <Reverb Type 09(Plate2) <message sysex data=(67,16,76,2,1,0,4,17) time=0>>),
 (<Chorus Type ---(Chorus) <message sysex data=(67,16,76,2,1,32,65,0) time=0>>,
  <Chorus Type 3(Flanger1) <message sysex data=(67,16,76,2,1,32,67,8) time=0>>),
 (<1 Voice Volume 80 <message control_change channel=1 control=7 value=80 time=0>>,
  <1 Voice Volume 84 <message control_change channel=1 control=7 value=84 time=0>>),
 (<2 Voice Volume 100 <message control_change channel=2 control=7 value=100 time=0>>,
  <2 Voice Volume 97 <message control_change channel=2 control=7 value=97 time=0>>),
 (<1 Voice Pan 64 <message control_change channel=1 control=10 value=64 time=0>>,
  <1 Voice Pan 65 <message control_change channel=1 control=10 value=65 time=0>>),
 (<1 Voice Reverb Level 30 <message control_change channel=1 control=91 value=30 time=0>>,
  <1 Voice Reverb Level 27 <message control_change channel=1 control=91 value=27 time=0>>),
 (<0 Voice Chorus Level 30 <message control_change channel=0 control=93 value=30 time=0>>,
  <0 Voice Chorus Level 26 <message control_change channel=0 control=93 value=26 time=0>>),
 (<0 Release Time 64 <message control_change channel=0 control=72 value=64 time=0>>,
  <0 Release Time 110 <message control_change channel=0 control=72 value=110 time=0>>),
 (<1 Release Time 64 <message control_change channel=1 control=72 value=64 time=0>>,
  <1 Release Time 110 <message control_change channel=1 control=72 value=110 time=0>>),
 (<2 Release Time 64 <message control_change channel=2 control=72 value=64 time=0>>,
  <2 Release Time 110 <message control_change channel=2 control=72 value=110 time=0>>)]

In [310]:
o.send(mido.Message.from_hex("F0 43 10 4C 00 00 7E 00 F7")) # XG ON

In [311]:
w4 = grab()

In [312]:
[(a, b) for a, b in zip(w3, w4) if a.message != b.message]


Out[312]:
[(<Reverb Type 09(Plate2) <message sysex data=(67,16,76,2,1,0,4,17) time=0>>,
  <Reverb Type 01(Hall1) <message sysex data=(67,16,76,2,1,0,1,0) time=0>>),
 (<Chorus Type 3(Flanger1) <message sysex data=(67,16,76,2,1,32,67,8) time=0>>,
  <Chorus Type ---(Chorus) <message sysex data=(67,16,76,2,1,32,65,0) time=0>>)]

In [313]:
grab()


Out[313]:
[<0 Release Time 64 <message control_change channel=0 control=72 value=64 time=0>>,
 <1 Release Time 64 <message control_change channel=1 control=72 value=64 time=0>>,
 <2 Release Time 64 <message control_change channel=2 control=72 value=64 time=0>>,
 <Chorus Type 1(Chorus1) <message sysex data=(67,16,76,2,1,32,66,17) time=0>>,
 <Reverb Type 10(Off) <message sysex data=(67,16,76,2,1,0,0,0) time=0>>,
 <Reverb Type 09(Plate2) <message sysex data=(67,16,76,2,1,0,4,17) time=0>>,
 <Reverb Type 08(Plate1) <message sysex data=(67,16,76,2,1,0,4,16) time=0>>,
 <Reverb Type 07(Stage2) <message sysex data=(67,16,76,2,1,0,3,17) time=0>>,
 <Reverb Type 06(Stage1) <message sysex data=(67,16,76,2,1,0,3,16) time=0>>,
 <Chorus Type 2(Chorus2) <message sysex data=(67,16,76,2,1,32,65,2) time=0>>,
 <Chorus Type 3(Flanger1) <message sysex data=(67,16,76,2,1,32,67,8) time=0>>,
 <Chorus Type 4(Flanger2) <message sysex data=(67,16,76,2,1,32,67,17) time=0>>,
 <Chorus Type 5(Off) <message sysex data=(67,16,76,2,1,32,0,0) time=0>>,
 <Chorus Type 1(Chorus1) <message sysex data=(67,16,76,2,1,32,66,17) time=0>>,
 <Chorus Type 2(Chorus2) <message sysex data=(67,16,76,2,1,32,65,2) time=0>>,
 <Chorus Type 3(Flanger1) <message sysex data=(67,16,76,2,1,32,67,8) time=0>>,
 <Chorus Type 4(Flanger2) <message sysex data=(67,16,76,2,1,32,67,17) time=0>>,
 <Chorus Type 5(Off) <message sysex data=(67,16,76,2,1,32,0,0) time=0>>,
 <Reverb Type 05(Room2) <message sysex data=(67,16,76,2,1,0,2,19) time=0>>,
 <Reverb Type 04(Room1) <message sysex data=(67,16,76,2,1,0,2,17) time=0>>,
 <Reverb Type 03(Hall3) <message sysex data=(67,16,76,2,1,0,1,17) time=0>>,
 <Reverb Type 02(Hall2) <message sysex data=(67,16,76,2,1,0,1,16) time=0>>,
 <Reverb Type 01(Hall1) <message sysex data=(67,16,76,2,1,0,1,0) time=0>>,
 <Reverb Type 10(Off) <message sysex data=(67,16,76,2,1,0,0,0) time=0>>,
 <Reverb Type 09(Plate2) <message sysex data=(67,16,76,2,1,0,4,17) time=0>>,
 <Reverb Type 10(Off) <message sysex data=(67,16,76,2,1,0,0,0) time=0>>]

In [314]:
w5 = grab()

In [315]:
[(a, b) for a, b in zip(w4, w5) if a.message != b.message]


Out[315]:
[(<Reverb Type 01(Hall1) <message sysex data=(67,16,76,2,1,0,1,0) time=0>>,
  <Reverb Type 10(Off) <message sysex data=(67,16,76,2,1,0,0,0) time=0>>),
 (<Chorus Type ---(Chorus) <message sysex data=(67,16,76,2,1,32,65,0) time=0>>,
  <Chorus Type 5(Off) <message sysex data=(67,16,76,2,1,32,0,0) time=0>>),
 (<0 Release Time 110 <message control_change channel=0 control=72 value=110 time=0>>,
  <0 Release Time 64 <message control_change channel=0 control=72 value=64 time=0>>),
 (<1 Release Time 110 <message control_change channel=1 control=72 value=110 time=0>>,
  <1 Release Time 64 <message control_change channel=1 control=72 value=64 time=0>>),
 (<2 Release Time 110 <message control_change channel=2 control=72 value=110 time=0>>,
  <2 Release Time 64 <message control_change channel=2 control=72 value=64 time=0>>)]

In [316]:
o.send(mido.Message.from_hex("F0 43 10 4C 00 00 7F 00 F7")) # XG RESET

In [317]:
w6 = grab()

In [318]:
[(a, b) for a, b in zip(w5, w6) if a.message != b.message]


Out[318]:
[(<MIDI Master Tuning -3 <message sysex data=(67,16,39,48,0,0,7,13,0) time=0>>,
  <MIDI Master Tuning 0 <message sysex data=(67,16,39,48,0,0,8,0,0) time=0>>),
 (<Reverb Type 10(Off) <message sysex data=(67,16,76,2,1,0,0,0) time=0>>,
  <Reverb Type 01(Hall1) <message sysex data=(67,16,76,2,1,0,1,0) time=0>>),
 (<Chorus Type 5(Off) <message sysex data=(67,16,76,2,1,32,0,0) time=0>>,
  <Chorus Type ---(Chorus) <message sysex data=(67,16,76,2,1,32,65,0) time=0>>)]

Hmmm, it looks like XG reset also resets the MIDI Master Tuning, as well!


In [320]:
o.send(controls.master_tune_val(100))

In [321]:
o.send(controls.gm_on())

In [322]:
o.send(mido.Message.from_hex("F0 43 10 4C 00 00 7E 00 F7")) # XG ON

In [326]:
o.send(mido.Message.from_hex("F0 43 10 4C 00 00 7F 00 F7")) # XG RESET

Seems to be the only difference


In [327]:
grab()


Out[327]:
[<0 RPN MSB 0 <message control_change channel=0 control=101 value=0 time=0>>,
 <0 RPN LSB 0 <message control_change channel=0 control=100 value=0 time=0>>,
 <0 Data Entry MSB: Pitch Bend Range 3 <message control_change channel=0 control=6 value=3 time=0>>,
 <1 RPN MSB 0 <message control_change channel=1 control=101 value=0 time=0>>,
 <1 RPN LSB 0 <message control_change channel=1 control=100 value=0 time=0>>,
 <1 Data Entry MSB: Pitch Bend Range 3 <message control_change channel=1 control=6 value=3 time=0>>,
 <2 RPN MSB 0 <message control_change channel=2 control=101 value=0 time=0>>,
 <2 RPN LSB 0 <message control_change channel=2 control=100 value=0 time=0>>,
 <2 Data Entry MSB: Pitch Bend Range 3 <message control_change channel=2 control=6 value=3 time=0>>,
 <0 RPN MSB 0 <message control_change channel=0 control=101 value=0 time=0>>,
 <0 RPN LSB 0 <message control_change channel=0 control=100 value=0 time=0>>,
 <0 Data Entry MSB: Pitch Bend Range 2 <message control_change channel=0 control=6 value=2 time=0>>,
 <1 RPN MSB 0 <message control_change channel=1 control=101 value=0 time=0>>,
 <1 RPN LSB 0 <message control_change channel=1 control=100 value=0 time=0>>,
 <1 Data Entry MSB: Pitch Bend Range 2 <message control_change channel=1 control=6 value=2 time=0>>,
 <2 RPN MSB 0 <message control_change channel=2 control=101 value=0 time=0>>,
 <2 RPN LSB 0 <message control_change channel=2 control=100 value=0 time=0>>,
 <2 Data Entry MSB: Pitch Bend Range 2 <message control_change channel=2 control=6 value=2 time=0>>,
 <0 Note On 069(A3) <message note_on channel=0 note=69 velocity=26 time=0>>,
 <0 Note Off 069(A3) <message note_on channel=0 note=69 velocity=0 time=0>>,
 <0 Release Time 110 <message control_change channel=0 control=72 value=110 time=0>>,
 <1 Release Time 110 <message control_change channel=1 control=72 value=110 time=0>>,
 <2 Release Time 110 <message control_change channel=2 control=72 value=110 time=0>>,
 <0 Release Time 64 <message control_change channel=0 control=72 value=64 time=0>>,
 <1 Release Time 64 <message control_change channel=1 control=72 value=64 time=0>>,
 <2 Release Time 64 <message control_change channel=2 control=72 value=64 time=0>>]

What About The Bank


In [328]:
i.close()

Let's review:

3.1.2 Program Change

There are melody voices and there are rhythym voices (drum kits).

The specification says:

If the tone generator does not have a drum kit corresponding to the specified program number, it will ignore the message and continue to use the current drum kit.

If Program change makes a change from normal voice to drum kit, the part mode shall revert to what it was before normal mode was invoked. Upon receipt of XG System ON, the system shall virtually set this "revert-to" mode to Drum Setup 2 for all Parts 1 to 16, except for Part 10.

3.1.6.1 Bank Select MSB/LSB

Bank MSB:

MSB
00 Melody voice
013F Model-exclusive area
40 SFX voice
4177 Reserved for XG extensions
78 GM L2 Rhythm Kit
79 GM L2 Melody voice
7A7D Reserved for XG extensions
7E SFX kit
7F Rhythm kit

Bank LSB is an extension area.

If support is included for one or more voices in an extension bank, then all the other program change numbers in that bank are filled with the corresponding voices of Bank 0 (basic voices)

Note 1: By default, channel 10 plays rhythm voices while other channels use bank 0 melody voices (as in GM Level 1)

Note 2: If the new Bank Select MSB is 00 (melody voice) but the tone generator does not support the melody voice corresponding to the last recieved Bank Select LSB, the channel reverts to the Bank Select LSB corresponding to its most recently played melody voice.

Note 3: If the new Bank Select MSB is 7F (rhythm voice) the tone generator unconditionally uses LSB 00 without using the most recently received Bank Select LSB. If the tone generator does not support a drum kit corresponding to the channel's most recently received Program Change, the channel will revert to the Program Change corresponding to its most recently played rhythm kit.

Note 4: If a Bank Select MSB value of 0177 or 7A7E (model-exclusive area, SFX voice, or XG extension voice) is received and the tone generator does not have a voice corresponding to the last received LSB and Program change, the tone generator shall produce no sound for that channel regardless of subsequent Key On messages.

In the case where a melody voice is being changed first to a voice in bank-LSB A and then to a voice in bank-LSB B, and the change to A is possible but the change to B is not possible, A will be used as the substitute for B. If neither the change to A nor the change to B is possible, the voice of the previous bank will [be] substituted for A and B.

In the case where a rhythm voice is being changed first program number kit A and then to program number kit B, and the change to A is possible but the change to B is not possible, A will be used as the substitute for B. If neither the change to A nor the change to B is possible, the voice of the previous bank will [be] substituted for A and B.

We have the following supported kits:

No. Name MSB LSB Prog Note 40
122 Standard Kit 1 127 0 0 Snare H Hard
123 Standard Kit 2 127 0 1 Snare H Hard 2
124 Room Kit 127 0 8 SD Room H
125 Rock Kit 127 0 16 SD Rock Rim
126 Electronic Kit 127 0 24 SD Rock H
127 Analog Kit 127 0 25 Analog Snare 2
128 Dance Kit 127 0 27 AnSD Ana+Acoustic
129 Jazz Kit 127 0 32 SD Jazz M
130 Brush Kit 127 0 40 Brush Tap
131 Symphony Kit 127 0 48 Marching Sn H
132 SFX Kit 1 126 0 0
133 SFX Kit 2 126 0 1 Scratch

Note 40 is different for each of them.


In [330]:
i = mido.open_input('DGX-505 MIDI 1')

In [335]:
grab()


Out[335]:
[<0 Note On 040(E1) <message note_on channel=0 note=40 velocity=58 time=0>>,
 <0 Note Off 040(E1) <message note_on channel=0 note=40 velocity=0 time=0>>,
 <0 Bank MSB 127 <message control_change channel=0 control=0 value=127 time=0>>,
 <0 Bank LSB 0 <message control_change channel=0 control=32 value=0 time=0>>,
 <0 Program Change: [127,0,0] 122 Standard Kit 1 (DRUM KITS) <message program_change channel=0 program=0 time=0>>,
 <1 Bank MSB 0 <message control_change channel=1 control=0 value=0 time=0>>,
 <1 Bank LSB 112 <message control_change channel=1 control=32 value=112 time=0>>,
 <1 Program Change: [0,112,48] 054 String Ensemble (STRINGS) <message program_change channel=1 program=48 time=0>>,
 <0 Voice Volume 104 <message control_change channel=0 control=7 value=104 time=0>>,
 <0 Voice Reverb Level 28 <message control_change channel=0 control=91 value=28 time=0>>,
 <1 Voice Volume 100 <message control_change channel=1 control=7 value=100 time=0>>,
 <1 Voice Reverb Level 40 <message control_change channel=1 control=91 value=40 time=0>>,
 <0 Note On 040(E1) <message note_on channel=0 note=40 velocity=69 time=0>>,
 <0 Note Off 040(E1) <message note_on channel=0 note=40 velocity=0 time=0>>,
 <0 Bank MSB 127 <message control_change channel=0 control=0 value=127 time=0>>,
 <0 Bank LSB 0 <message control_change channel=0 control=32 value=0 time=0>>,
 <0 Program Change: [127,0,1] 123 Standard Kit 2 (DRUM KITS) <message program_change channel=0 program=1 time=0>>,
 <0 Voice Reverb Level 26 <message control_change channel=0 control=91 value=26 time=0>>,
 <0 Note On 040(E1) <message note_on channel=0 note=40 velocity=65 time=0>>,
 <0 Note Off 040(E1) <message note_on channel=0 note=40 velocity=0 time=0>>,
 <0 Bank MSB 127 <message control_change channel=0 control=0 value=127 time=0>>,
 <0 Bank LSB 0 <message control_change channel=0 control=32 value=0 time=0>>,
 <0 Program Change: [127,0,8] 124 Room Kit (DRUM KITS) <message program_change channel=0 program=8 time=0>>,
 <0 Voice Reverb Level 20 <message control_change channel=0 control=91 value=20 time=0>>,
 <0 Note On 040(E1) <message note_on channel=0 note=40 velocity=72 time=0>>,
 <0 Note Off 040(E1) <message note_on channel=0 note=40 velocity=0 time=0>>,
 <0 Bank MSB 127 <message control_change channel=0 control=0 value=127 time=0>>,
 <0 Bank LSB 0 <message control_change channel=0 control=32 value=0 time=0>>,
 <0 Program Change: [127,0,16] 125 Rock Kit (DRUM KITS) <message program_change channel=0 program=16 time=0>>,
 <0 Voice Reverb Level 40 <message control_change channel=0 control=91 value=40 time=0>>,
 <0 Note On 040(E1) <message note_on channel=0 note=40 velocity=49 time=0>>,
 <0 Note Off 040(E1) <message note_on channel=0 note=40 velocity=0 time=0>>,
 <0 Bank MSB 127 <message control_change channel=0 control=0 value=127 time=0>>,
 <0 Bank LSB 0 <message control_change channel=0 control=32 value=0 time=0>>,
 <0 Program Change: [127,0,24] 126 Electronic Kit (DRUM KITS) <message program_change channel=0 program=24 time=0>>,
 <0 Voice Reverb Level 28 <message control_change channel=0 control=91 value=28 time=0>>,
 <0 Note On 040(E1) <message note_on channel=0 note=40 velocity=66 time=0>>,
 <0 Note Off 040(E1) <message note_on channel=0 note=40 velocity=0 time=0>>,
 <0 Bank MSB 127 <message control_change channel=0 control=0 value=127 time=0>>,
 <0 Bank LSB 0 <message control_change channel=0 control=32 value=0 time=0>>,
 <0 Program Change: [127,0,25] 127 Analog Kit (DRUM KITS) <message program_change channel=0 program=25 time=0>>,
 <0 Voice Reverb Level 20 <message control_change channel=0 control=91 value=20 time=0>>,
 <0 Note On 040(E1) <message note_on channel=0 note=40 velocity=47 time=0>>,
 <0 Note Off 040(E1) <message note_on channel=0 note=40 velocity=0 time=0>>,
 <0 Bank MSB 127 <message control_change channel=0 control=0 value=127 time=0>>,
 <0 Bank LSB 0 <message control_change channel=0 control=32 value=0 time=0>>,
 <0 Program Change: [127,0,27] 128 Dance Kit (DRUM KITS) <message program_change channel=0 program=27 time=0>>,
 <0 Voice Reverb Level 18 <message control_change channel=0 control=91 value=18 time=0>>,
 <0 Note On 040(E1) <message note_on channel=0 note=40 velocity=66 time=0>>,
 <0 Note Off 040(E1) <message note_on channel=0 note=40 velocity=0 time=0>>,
 <0 Bank MSB 127 <message control_change channel=0 control=0 value=127 time=0>>,
 <0 Bank LSB 0 <message control_change channel=0 control=32 value=0 time=0>>,
 <0 Program Change: [127,0,32] 129 Jazz Kit (DRUM KITS) <message program_change channel=0 program=32 time=0>>,
 <0 Voice Reverb Level 28 <message control_change channel=0 control=91 value=28 time=0>>,
 <0 Note On 040(E1) <message note_on channel=0 note=40 velocity=64 time=0>>,
 <0 Note Off 040(E1) <message note_on channel=0 note=40 velocity=0 time=0>>,
 <0 Bank MSB 127 <message control_change channel=0 control=0 value=127 time=0>>,
 <0 Bank LSB 0 <message control_change channel=0 control=32 value=0 time=0>>,
 <0 Program Change: [127,0,40] 130 Brush Kit (DRUM KITS) <message program_change channel=0 program=40 time=0>>,
 <0 Note On 040(E1) <message note_on channel=0 note=40 velocity=68 time=0>>,
 <0 Note Off 040(E1) <message note_on channel=0 note=40 velocity=0 time=0>>,
 <0 Bank MSB 127 <message control_change channel=0 control=0 value=127 time=0>>,
 <0 Bank LSB 0 <message control_change channel=0 control=32 value=0 time=0>>,
 <0 Program Change: [127,0,48] 131 Symphony Kit (DRUM KITS) <message program_change channel=0 program=48 time=0>>,
 <0 Voice Reverb Level 40 <message control_change channel=0 control=91 value=40 time=0>>,
 <0 Note On 040(E1) <message note_on channel=0 note=40 velocity=69 time=0>>,
 <0 Note Off 040(E1) <message note_on channel=0 note=40 velocity=0 time=0>>,
 <0 Bank MSB 126 <message control_change channel=0 control=0 value=126 time=0>>,
 <0 Bank LSB 0 <message control_change channel=0 control=32 value=0 time=0>>,
 <0 Program Change: [126,0,0] 132 SFX Kit 1 (DRUM KITS) <message program_change channel=0 program=0 time=0>>,
 <0 Voice Reverb Level 28 <message control_change channel=0 control=91 value=28 time=0>>,
 <0 Note On 040(E1) <message note_on channel=0 note=40 velocity=72 time=0>>,
 <0 Note Off 040(E1) <message note_on channel=0 note=40 velocity=0 time=0>>,
 <0 Bank MSB 126 <message control_change channel=0 control=0 value=126 time=0>>,
 <0 Bank LSB 0 <message control_change channel=0 control=32 value=0 time=0>>,
 <0 Program Change: [126,0,1] 133 SFX Kit 2 (DRUM KITS) <message program_change channel=0 program=1 time=0>>,
 <0 Note On 040(E1) <message note_on channel=0 note=40 velocity=78 time=0>>,
 <0 Note Off 040(E1) <message note_on channel=0 note=40 velocity=0 time=0>>,
 <0 Bank MSB 0 <message control_change channel=0 control=0 value=0 time=0>>,
 <0 Bank LSB 0 <message control_change channel=0 control=32 value=0 time=0>>,
 <0 Program Change: [0,0,0] 134 Grand Piano (XG PIANO) <message program_change channel=0 program=0 time=0>>,
 <0 Voice Volume 127 <message control_change channel=0 control=7 value=127 time=0>>,
 <1 Voice Volume 70 <message control_change channel=1 control=7 value=70 time=0>>,
 <1 Voice Reverb Level 32 <message control_change channel=1 control=91 value=32 time=0>>,
 <0 Note On 052(E2) <message note_on channel=0 note=52 velocity=69 time=0>>,
 <0 Note Off 052(E2) <message note_on channel=0 note=52 velocity=0 time=0>>]

In [361]:
progs = (0,1,8,16,24,25,27,32,40,48)

In [341]:
o.send(cc(C.BANK_MSB, value=127))

In [343]:
o.send(mido.Message('program_change', program=0))

In [488]:
for p in progs:
    o.send(mido.Message('program_change', program=p))
    
    o.send(mido.Message('note_on', note=40, velocity=33))
    
    time.sleep(0.2)

In [ ]:
o.send(cc(C.BANK_LSB, value=127))

In [8]:
from commons.messages import voices

In [402]:
def voice_list(prog):
    v = []
    for l in range(128):
        try:
            v.append(voices.from_bank_program(0, l, prog))
        except KeyError:
            pass
    return v

In [396]:
[voice_list(x) for x in progs]


Out[396]:
[[Voice(number=134, name='Grand Piano', category='XG PIANO', msb=0, lsb=0, prog=0),
  Voice(number=135, name='Grand Piano KSP', category='XG PIANO', msb=0, lsb=1, prog=0),
  Voice(number=136, name='Piano Strings', category='XG PIANO', msb=0, lsb=40, prog=0),
  Voice(number=137, name='Dream', category='XG PIANO', msb=0, lsb=41, prog=0),
  Voice(number=3, name='Grand Piano', category='PIANO', msb=0, lsb=112, prog=0),
  Voice(number=1, name='Live! Grand Piano', category='PIANO', msb=0, lsb=113, prog=0),
  Voice(number=2, name='Live! Warm Grand Piano', category='PIANO', msb=0, lsb=114, prog=0)],
 [Voice(number=138, name='Bright Piano', category='XG PIANO', msb=0, lsb=0, prog=1),
  Voice(number=139, name='Bright Piano KSP', category='XG PIANO', msb=0, lsb=1, prog=1),
  Voice(number=4, name='Bright Piano', category='PIANO', msb=0, lsb=112, prog=1)],
 [Voice(number=157, name='Celesta', category='XG CHROMATIC', msb=0, lsb=0, prog=8),
  Voice(number=118, name='Celesta', category='PERCUSSION', msb=0, lsb=112, prog=8)],
 [Voice(number=176, name='DrawOrg', category='XG ORGAN', msb=0, lsb=0, prog=16),
  Voice(number=177, name='Detuned DrawOrg', category='XG ORGAN', msb=0, lsb=32, prog=16),
  Voice(number=178, name="60's DrawOrg 1", category='XG ORGAN', msb=0, lsb=33, prog=16),
  Voice(number=179, name="60's DrawOrg 2", category='XG ORGAN', msb=0, lsb=34, prog=16),
  Voice(number=180, name="70's DrawOrg 1", category='XG ORGAN', msb=0, lsb=35, prog=16),
  Voice(number=181, name="60's DrawOrg 3", category='XG ORGAN', msb=0, lsb=37, prog=16),
  Voice(number=182, name="16+2'2/3", category='XG ORGAN', msb=0, lsb=40, prog=16),
  Voice(number=183, name='Organ Bass', category='XG ORGAN', msb=0, lsb=64, prog=16),
  Voice(number=184, name="70's DrawOrg 2", category='XG ORGAN', msb=0, lsb=65, prog=16),
  Voice(number=185, name='Cheezy Organ', category='XG ORGAN', msb=0, lsb=66, prog=16),
  Voice(number=186, name='DrawOrg 3', category='XG ORGAN', msb=0, lsb=67, prog=16),
  Voice(number=19, name='Jazz Organ 1', category='ORGAN', msb=0, lsb=112, prog=16),
  Voice(number=20, name='Jazz Organ 2', category='ORGAN', msb=0, lsb=113, prog=16),
  Voice(number=27, name='Theater Organ', category='ORGAN', msb=0, lsb=114, prog=16),
  Voice(number=22, name='Bright Organ', category='ORGAN', msb=0, lsb=116, prog=16),
  Voice(number=25, name="16'+2' Organ", category='ORGAN', msb=0, lsb=118, prog=16),
  Voice(number=26, name="16'+4' Organ", category='ORGAN', msb=0, lsb=119, prog=16)],
 [Voice(number=209, name='Nylon Guitar', category='XG GUITAR', msb=0, lsb=0, prog=24),
  Voice(number=210, name='Velocity Guitar Harmonics', category='XG GUITAR', msb=0, lsb=43, prog=24),
  Voice(number=211, name='Ukulele', category='XG GUITAR', msb=0, lsb=96, prog=24),
  Voice(number=35, name='Classical Guitar', category='GUITAR', msb=0, lsb=112, prog=24)],
 [Voice(number=212, name='Steel Guitar', category='XG GUITAR', msb=0, lsb=0, prog=25),
  Voice(number=213, name='12-string Guitar', category='XG GUITAR', msb=0, lsb=35, prog=25),
  Voice(number=214, name='Nylon & Steel Guitar', category='XG GUITAR', msb=0, lsb=40, prog=25),
  Voice(number=215, name='Steel Guitar with Body Sound', category='XG GUITAR', msb=0, lsb=41, prog=25),
  Voice(number=216, name='Mandolin', category='XG GUITAR', msb=0, lsb=96, prog=25),
  Voice(number=36, name='Folk Guitar', category='GUITAR', msb=0, lsb=112, prog=25),
  Voice(number=37, name='12Strings Guitar', category='GUITAR', msb=0, lsb=113, prog=25)],
 [Voice(number=219, name='Clean Guitar', category='XG GUITAR', msb=0, lsb=0, prog=27),
  Voice(number=220, name='Chorus Guitar', category='XG GUITAR', msb=0, lsb=32, prog=27),
  Voice(number=40, name='Clean Guitar', category='GUITAR', msb=0, lsb=112, prog=27),
  Voice(number=41, name="60's Clean Guitar", category='GUITAR', msb=0, lsb=117, prog=27)],
 [Voice(number=233, name='Acoustic Bass', category='XG BASS', msb=0, lsb=0, prog=32),
  Voice(number=234, name='Jazz Rhythm', category='XG BASS', msb=0, lsb=40, prog=32),
  Voice(number=235, name='Velocity Crossfade Upright Bass', category='XG BASS', msb=0, lsb=45, prog=32),
  Voice(number=45, name='Acoustic Bass', category='BASS', msb=0, lsb=112, prog=32)],
 [Voice(number=261, name='Violin', category='XG STRING', msb=0, lsb=0, prog=40),
  Voice(number=262, name='Slow Violin', category='XG STRING', msb=0, lsb=8, prog=40),
  Voice(number=60, name='Violin', category='STRINGS', msb=0, lsb=112, prog=40)],
 [Voice(number=273, name='Strings 1', category='XG ENSEMBLE', msb=0, lsb=0, prog=48),
  Voice(number=274, name='Stereo Strings', category='XG ENSEMBLE', msb=0, lsb=3, prog=48),
  Voice(number=275, name='Slow Strings', category='XG ENSEMBLE', msb=0, lsb=8, prog=48),
  Voice(number=276, name="60's Strings", category='XG ENSEMBLE', msb=0, lsb=35, prog=48),
  Voice(number=277, name='Orchestra', category='XG ENSEMBLE', msb=0, lsb=40, prog=48),
  Voice(number=278, name='Orchestra 2', category='XG ENSEMBLE', msb=0, lsb=41, prog=48),
  Voice(number=279, name='Tremolo Orchestra', category='XG ENSEMBLE', msb=0, lsb=42, prog=48),
  Voice(number=280, name='Velocity Strings', category='XG ENSEMBLE', msb=0, lsb=45, prog=48),
  Voice(number=54, name='String Ensemble', category='STRINGS', msb=0, lsb=112, prog=48)]]

In [517]:
organvoices = voice_list(16)
print('\n'.join(x.voice_string_extended() for x in organvoices))


[0,0,16] 176 DrawOrg (XG ORGAN)
[0,32,16] 177 Detuned DrawOrg (XG ORGAN)
[0,33,16] 178 60's DrawOrg 1 (XG ORGAN)
[0,34,16] 179 60's DrawOrg 2 (XG ORGAN)
[0,35,16] 180 70's DrawOrg 1 (XG ORGAN)
[0,37,16] 181 60's DrawOrg 3 (XG ORGAN)
[0,40,16] 182 16+2'2/3 (XG ORGAN)
[0,64,16] 183 Organ Bass (XG ORGAN)
[0,65,16] 184 70's DrawOrg 2 (XG ORGAN)
[0,66,16] 185 Cheezy Organ (XG ORGAN)
[0,67,16] 186 DrawOrg 3 (XG ORGAN)
[0,112,16] 019 Jazz Organ 1 (ORGAN)
[0,113,16] 020 Jazz Organ 2 (ORGAN)
[0,114,16] 027 Theater Organ (ORGAN)
[0,116,16] 022 Bright Organ (ORGAN)
[0,118,16] 025 16'+2' Organ (ORGAN)
[0,119,16] 026 16'+4' Organ (ORGAN)

There are a lot of different organ voices for program 16, MSB 0.

MSB 127 program 16 is the Rock Kit.

Let's set channel 1 to the DrawOrg, Channel 2 to the Jazz Organ 1.


In [418]:
controls.multisend(o, controls.set_voice_numbers(176, channel=1))
controls.multisend(o, controls.set_voice_numbers(19, channel=2))

In [540]:
pulse(o, channel=1, note=40)

In [506]:
pulse(o, channel=2, note=40)

In [497]:
o.send(mido.Message('program_change', program=16, channel=0))

Let's set Channel 0 to the rock kit, program 16:


In [498]:
pulse(o, channel=0, note=40)

Now, Bank LSB should be totally ignored for drum kits.


In [516]:
o.send(cc(C.BANK_MSB, value=127, channel=0))
o.send(cc(C.BANK_LSB, value=0, channel=0))
o.send(mido.Message('program_change', program=16, channel=0))
pulse(o, channel=0, note=40)
o.send(cc(C.BANK_LSB, value=112, channel=0))
o.send(mido.Message('program_change', program=16, channel=0))
pulse(o, channel=0, note=40)
o.send(cc(C.BANK_MSB, value=0, channel=0))
o.send(mido.Message('program_change', program=16, channel=0))
pulse(o, channel=0, note=40)
o.send(cc(C.BANK_MSB, value=127, channel=0))
o.send(mido.Message('program_change', program=16, channel=0))
pulse(o, channel=0, note=40)
o.send(cc(C.BANK_MSB, value=0, channel=0))
o.send(mido.Message('program_change', program=16, channel=0))
pulse(o, channel=0, note=40)

In [514]:

The Bank LSB is treated as 0 (or at least not recognised for the drum kits), but it is still remembered so that if we change the MSB, the LSB value is used then. Setting the MSB does not reset the LSB to zero.


In [518]:
olsbs = [v.lsb for v in organvoices]

In [519]:
olsbs


Out[519]:
[0, 32, 33, 34, 35, 37, 40, 64, 65, 66, 67, 112, 113, 114, 116, 118, 119]

In [538]:
o.send(cc(C.BANK_LSB, value=114, channel=0))
o.send(mido.Message('program_change', program=16, channel=0))
pulse(o, sleep=0.2, channel=0, note=40)
o.send(cc(C.BANK_LSB, value=115, channel=0))
o.send(mido.Message('program_change', program=16, channel=0))
pulse(o, sleep=0.2, channel=0, note=40)

In [676]:
o.send(cc(C.BANK_MSB, value=0, channel=0))
for l in range(120):
    print(l, end=" ")
    o.send(cc(C.BANK_LSB, value=l, channel=0))
    o.send(mido.Message('program_change', program=16, channel=0))
    pulse(o, sleep=0.1, channel=0, note=40)


0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 

It seems like when the LSB is not supported, it falls back to zero, but I'm willing to bet it still remembers it.


In [702]:
o.send(cc(C.BANK_LSB, value=0, channel=0))
o.send(mido.Message('program_change', program=16, channel=0))
pulse(o, sleep=0.2, channel=0, note=40)
o.send(cc(C.BANK_LSB, value=8, channel=0))
o.send(mido.Message('program_change', program=16, channel=0))
pulse(o, sleep=0.2, channel=0, note=40)
o.send(cc(C.BANK_LSB, value=32, channel=0))
o.send(mido.Message('program_change', program=16, channel=0))
pulse(o, sleep=0.2, channel=0, note=40)
o.send(cc(C.BANK_LSB, value=8, channel=0))
o.send(mido.Message('program_change', program=16, channel=0))
pulse(o, sleep=0.2, channel=0, note=40)

# change to violins
o.send(mido.Message('program_change', program=40, channel=0))
pulse(o, sleep=0.2, channel=0, note=40)
o.send(cc(C.BANK_LSB, value=0, channel=0))
o.send(mido.Message('program_change', program=40, channel=0))
pulse(o, sleep=0.2, channel=0, note=40)
o.send(cc(C.BANK_LSB, value=8, channel=0))
o.send(mido.Message('program_change', program=40, channel=0))
pulse(o, sleep=0.2, channel=0, note=40)

Yep, it seems like it.


In [553]:
o.send(cc(C.BANK_LSB, value=114, channel=0))
o.send(mido.Message('program_change', program=16, channel=0))
pulse(o, sleep=0.2, channel=0, note=40)
o.send(cc(C.RESET_CONTROLS, value=0, channel=0))
o.send(mido.Message('program_change', program=16, channel=0))
pulse(o, sleep=0.2, channel=0, note=40)

Yep, and the bank doesn't get reset either.

What about unsupported banks?


In [677]:
o.send(cc(C.BANK_MSB, value=0, channel=0))
o.send(cc(C.BANK_LSB, value=114, channel=0))
o.send(mido.Message('program_change', program=16, channel=0))
pulse(o, sleep=0.2, channel=0, note=40)
o.send(cc(C.BANK_MSB, value=62, channel=0))
o.send(mido.Message('program_change', program=16, channel=0))
pulse(o, sleep=0.2, channel=0, note=40)
o.send(cc(C.BANK_LSB, value=116, channel=0))
o.send(mido.Message('program_change', program=16, channel=0))
pulse(o, sleep=0.2, channel=0, note=40)
o.send(cc(C.BANK_MSB, value=0, channel=0))
o.send(mido.Message('program_change', program=16, channel=0))
pulse(o, sleep=0.2, channel=0, note=40)
o.send(cc(C.BANK_LSB, value=114, channel=0))
o.send(mido.Message('program_change', program=16, channel=0))
pulse(o, sleep=0.2, channel=0, note=40)

They're silent.


In [577]:
allvoices = [voices.from_number(x) for x in range(1, 495)]

In [605]:
zerovoices = sorted((v for v in allvoices if v.lsb == 0), key=lambda v: (v.msb, v.prog))

In [587]:
zerovoices


Out[587]:
[Voice(number=134, name='Grand Piano', category='XG PIANO', msb=0, lsb=0, prog=0),
 Voice(number=138, name='Bright Piano', category='XG PIANO', msb=0, lsb=0, prog=1),
 Voice(number=140, name='Electric Grand Piano', category='XG PIANO', msb=0, lsb=0, prog=2),
 Voice(number=143, name='Honky-tonk Piano', category='XG PIANO', msb=0, lsb=0, prog=3),
 Voice(number=145, name='Electric Piano 1', category='XG PIANO', msb=0, lsb=0, prog=4),
 Voice(number=148, name='Electric Piano 2', category='XG PIANO', msb=0, lsb=0, prog=5),
 Voice(number=152, name='Harpsichord', category='XG PIANO', msb=0, lsb=0, prog=6),
 Voice(number=155, name='Clavi', category='XG PIANO', msb=0, lsb=0, prog=7),
 Voice(number=157, name='Celesta', category='XG CHROMATIC', msb=0, lsb=0, prog=8),
 Voice(number=158, name='Glockenspiel', category='XG CHROMATIC', msb=0, lsb=0, prog=9),
 Voice(number=159, name='Music Box', category='XG CHROMATIC', msb=0, lsb=0, prog=10),
 Voice(number=161, name='Vibraphone', category='XG CHROMATIC', msb=0, lsb=0, prog=11),
 Voice(number=163, name='Marimba', category='XG CHROMATIC', msb=0, lsb=0, prog=12),
 Voice(number=168, name='Xylophone', category='XG CHROMATIC', msb=0, lsb=0, prog=13),
 Voice(number=169, name='Tubular Bells', category='XG CHROMATIC', msb=0, lsb=0, prog=14),
 Voice(number=172, name='Dulcimer', category='XG CHROMATIC', msb=0, lsb=0, prog=15),
 Voice(number=176, name='DrawOrg', category='XG ORGAN', msb=0, lsb=0, prog=16),
 Voice(number=187, name='Percussive Organ', category='XG ORGAN', msb=0, lsb=0, prog=17),
 Voice(number=192, name='Rock Organ', category='XG ORGAN', msb=0, lsb=0, prog=18),
 Voice(number=196, name='Church Organ', category='XG ORGAN', msb=0, lsb=0, prog=19),
 Voice(number=202, name='Reed Organ', category='XG ORGAN', msb=0, lsb=0, prog=20),
 Voice(number=204, name='Accordion', category='XG ORGAN', msb=0, lsb=0, prog=21),
 Voice(number=205, name='Harmonica', category='XG ORGAN', msb=0, lsb=0, prog=22),
 Voice(number=207, name='Tango Accordion', category='XG ORGAN', msb=0, lsb=0, prog=23),
 Voice(number=209, name='Nylon Guitar', category='XG GUITAR', msb=0, lsb=0, prog=24),
 Voice(number=212, name='Steel Guitar', category='XG GUITAR', msb=0, lsb=0, prog=25),
 Voice(number=217, name='Jazz Guitar', category='XG GUITAR', msb=0, lsb=0, prog=26),
 Voice(number=219, name='Clean Guitar', category='XG GUITAR', msb=0, lsb=0, prog=27),
 Voice(number=221, name='Muted Guitar', category='XG GUITAR', msb=0, lsb=0, prog=28),
 Voice(number=225, name='Overdriven Guitar', category='XG GUITAR', msb=0, lsb=0, prog=29),
 Voice(number=227, name='Distortion Guitar', category='XG GUITAR', msb=0, lsb=0, prog=30),
 Voice(number=230, name='Guitar Harmonics', category='XG GUITAR', msb=0, lsb=0, prog=31),
 Voice(number=233, name='Acoustic Bass', category='XG BASS', msb=0, lsb=0, prog=32),
 Voice(number=236, name='Finger Bass', category='XG BASS', msb=0, lsb=0, prog=33),
 Voice(number=242, name='Pick Bass', category='XG BASS', msb=0, lsb=0, prog=34),
 Voice(number=244, name='Fretless Bass', category='XG BASS', msb=0, lsb=0, prog=35),
 Voice(number=248, name='Slap Bass 1', category='XG BASS', msb=0, lsb=0, prog=36),
 Voice(number=250, name='Slap Bass 2', category='XG BASS', msb=0, lsb=0, prog=37),
 Voice(number=252, name='Synth Bass 1', category='XG BASS', msb=0, lsb=0, prog=38),
 Voice(number=254, name='Synth Bass 2', category='XG BASS', msb=0, lsb=0, prog=39),
 Voice(number=261, name='Violin', category='XG STRING', msb=0, lsb=0, prog=40),
 Voice(number=263, name='Viola', category='XG STRING', msb=0, lsb=0, prog=41),
 Voice(number=264, name='Cello', category='XG STRING', msb=0, lsb=0, prog=42),
 Voice(number=265, name='Contrabass', category='XG STRING', msb=0, lsb=0, prog=43),
 Voice(number=266, name='Tremolo Strings', category='XG STRING', msb=0, lsb=0, prog=44),
 Voice(number=269, name='Pizzicato Strings', category='XG STRING', msb=0, lsb=0, prog=45),
 Voice(number=270, name='Orchestral Harp', category='XG STRING', msb=0, lsb=0, prog=46),
 Voice(number=272, name='Timpani', category='XG STRING', msb=0, lsb=0, prog=47),
 Voice(number=273, name='Strings 1', category='XG ENSEMBLE', msb=0, lsb=0, prog=48),
 Voice(number=281, name='Strings 2', category='XG ENSEMBLE', msb=0, lsb=0, prog=49),
 Voice(number=286, name='Synth Strings 1', category='XG ENSEMBLE', msb=0, lsb=0, prog=50),
 Voice(number=287, name='Synth Strings 2', category='XG ENSEMBLE', msb=0, lsb=0, prog=51),
 Voice(number=288, name='Choir Aahs ', category='XG ENSEMBLE', msb=0, lsb=0, prog=52),
 Voice(number=292, name='Voice Oohs', category='XG ENSEMBLE', msb=0, lsb=0, prog=53),
 Voice(number=293, name='Synth Voice', category='XG ENSEMBLE', msb=0, lsb=0, prog=54),
 Voice(number=297, name='Orchestra Hit', category='XG ENSEMBLE', msb=0, lsb=0, prog=55),
 Voice(number=300, name='Trumpet ', category='XG BRASS', msb=0, lsb=0, prog=56),
 Voice(number=302, name='Trombone', category='XG BRASS', msb=0, lsb=0, prog=57),
 Voice(number=304, name='Tuba', category='XG BRASS', msb=0, lsb=0, prog=58),
 Voice(number=305, name='Muted Trumpet', category='XG BRASS', msb=0, lsb=0, prog=59),
 Voice(number=306, name='French Horn', category='XG BRASS', msb=0, lsb=0, prog=60),
 Voice(number=310, name='Brass Section', category='XG BRASS', msb=0, lsb=0, prog=61),
 Voice(number=312, name='Synth Brass 1', category='XG BRASS', msb=0, lsb=0, prog=62),
 Voice(number=314, name='Synth Brass 2', category='XG BRASS', msb=0, lsb=0, prog=63),
 Voice(number=317, name='Soprano Sax', category='XG REED', msb=0, lsb=0, prog=64),
 Voice(number=318, name='Alto Sax', category='XG REED', msb=0, lsb=0, prog=65),
 Voice(number=320, name='Tenor Sax', category='XG REED', msb=0, lsb=0, prog=66),
 Voice(number=322, name='Baritone Sax', category='XG REED', msb=0, lsb=0, prog=67),
 Voice(number=323, name='Oboe', category='XG REED', msb=0, lsb=0, prog=68),
 Voice(number=324, name='English Horn', category='XG REED', msb=0, lsb=0, prog=69),
 Voice(number=325, name='Bassoon', category='XG REED', msb=0, lsb=0, prog=70),
 Voice(number=326, name='Clarinet', category='XG REED', msb=0, lsb=0, prog=71),
 Voice(number=327, name='Piccolo', category='XG PIPE', msb=0, lsb=0, prog=72),
 Voice(number=328, name='Flute', category='XG PIPE', msb=0, lsb=0, prog=73),
 Voice(number=329, name='Recorder', category='XG PIPE', msb=0, lsb=0, prog=74),
 Voice(number=330, name='Pan Flute', category='XG PIPE', msb=0, lsb=0, prog=75),
 Voice(number=331, name='Blown Bottle', category='XG PIPE', msb=0, lsb=0, prog=76),
 Voice(number=332, name='Shakuhachi', category='XG PIPE', msb=0, lsb=0, prog=77),
 Voice(number=333, name='Whistle', category='XG PIPE', msb=0, lsb=0, prog=78),
 Voice(number=334, name='Ocarina', category='XG PIPE', msb=0, lsb=0, prog=79),
 Voice(number=335, name='Square Lead', category='XG SYNTH LEAD', msb=0, lsb=0, prog=80),
 Voice(number=343, name='Sawtooth Lead', category='XG SYNTH LEAD', msb=0, lsb=0, prog=81),
 Voice(number=350, name='Calliope Lead', category='XG SYNTH LEAD', msb=0, lsb=0, prog=82),
 Voice(number=352, name='Chiff Lead', category='XG SYNTH LEAD', msb=0, lsb=0, prog=83),
 Voice(number=353, name='Charang Lead', category='XG SYNTH LEAD', msb=0, lsb=0, prog=84),
 Voice(number=355, name='Voice Lead', category='XG SYNTH LEAD', msb=0, lsb=0, prog=85),
 Voice(number=356, name='Fifths Lead', category='XG SYNTH LEAD', msb=0, lsb=0, prog=86),
 Voice(number=358, name='Bass & Lead', category='XG SYNTH LEAD', msb=0, lsb=0, prog=87),
 Voice(number=362, name='New Age Pad', category='XG SYNTH PAD', msb=0, lsb=0, prog=88),
 Voice(number=364, name='Warm Pad', category='XG SYNTH PAD', msb=0, lsb=0, prog=89),
 Voice(number=365, name='Poly Synth Pad', category='XG SYNTH PAD', msb=0, lsb=0, prog=90),
 Voice(number=366, name='Choir Pad', category='XG SYNTH PAD', msb=0, lsb=0, prog=91),
 Voice(number=368, name='Bowed Pad', category='XG SYNTH PAD', msb=0, lsb=0, prog=92),
 Voice(number=369, name='Metallic Pad', category='XG SYNTH PAD', msb=0, lsb=0, prog=93),
 Voice(number=370, name='Halo Pad', category='XG SYNTH PAD', msb=0, lsb=0, prog=94),
 Voice(number=371, name='Sweep Pad', category='XG SYNTH PAD', msb=0, lsb=0, prog=95),
 Voice(number=372, name='Rain', category='XG SYNTH EFFECTS', msb=0, lsb=0, prog=96),
 Voice(number=375, name='Sound Track', category='XG SYNTH EFFECTS', msb=0, lsb=0, prog=97),
 Voice(number=377, name='Crystal', category='XG SYNTH EFFECTS', msb=0, lsb=0, prog=98),
 Voice(number=389, name='Atmosphere', category='XG SYNTH EFFECTS', msb=0, lsb=0, prog=99),
 Voice(number=396, name='Brightness', category='XG SYNTH EFFECTS', msb=0, lsb=0, prog=100),
 Voice(number=397, name='Goblins', category='XG SYNTH EFFECTS', msb=0, lsb=0, prog=101),
 Voice(number=405, name='Echoes', category='XG SYNTH EFFECTS', msb=0, lsb=0, prog=102),
 Voice(number=406, name='Sci-Fi', category='XG SYNTH EFFECTS', msb=0, lsb=0, prog=103),
 Voice(number=407, name='Sitar', category='XG WORLD', msb=0, lsb=0, prog=104),
 Voice(number=411, name='Banjo', category='XG WORLD', msb=0, lsb=0, prog=105),
 Voice(number=416, name='Shamisen', category='XG WORLD', msb=0, lsb=0, prog=106),
 Voice(number=417, name='Koto', category='XG WORLD', msb=0, lsb=0, prog=107),
 Voice(number=420, name='Kalimba', category='XG WORLD', msb=0, lsb=0, prog=108),
 Voice(number=421, name='Bagpipe', category='XG WORLD', msb=0, lsb=0, prog=109),
 Voice(number=422, name='Fiddle', category='XG WORLD', msb=0, lsb=0, prog=110),
 Voice(number=423, name='Shanai', category='XG WORLD', msb=0, lsb=0, prog=111),
 Voice(number=424, name='Tinkle Bell', category='XG PERCUSSIVE', msb=0, lsb=0, prog=112),
 Voice(number=430, name='Agogo', category='XG PERCUSSIVE', msb=0, lsb=0, prog=113),
 Voice(number=431, name='Steel Drums', category='XG PERCUSSIVE', msb=0, lsb=0, prog=114),
 Voice(number=434, name='Woodblock', category='XG PERCUSSIVE', msb=0, lsb=0, prog=115),
 Voice(number=436, name='Taiko Drum', category='XG PERCUSSIVE', msb=0, lsb=0, prog=116),
 Voice(number=438, name='Melodic Tom', category='XG PERCUSSIVE', msb=0, lsb=0, prog=117),
 Voice(number=442, name='Synth Drum', category='XG PERCUSSIVE', msb=0, lsb=0, prog=118),
 Voice(number=445, name='Reverse Cymbal', category='XG PERCUSSIVE', msb=0, lsb=0, prog=119),
 Voice(number=446, name='Fret Noise', category='XG SOUND EFFECTS', msb=0, lsb=0, prog=120),
 Voice(number=447, name='Breath Noise', category='XG SOUND EFFECTS', msb=0, lsb=0, prog=121),
 Voice(number=448, name='Seashore', category='XG SOUND EFFECTS', msb=0, lsb=0, prog=122),
 Voice(number=449, name='Bird Tweet', category='XG SOUND EFFECTS', msb=0, lsb=0, prog=123),
 Voice(number=450, name='Telephone Ring', category='XG SOUND EFFECTS', msb=0, lsb=0, prog=124),
 Voice(number=451, name='Helicopter', category='XG SOUND EFFECTS', msb=0, lsb=0, prog=125),
 Voice(number=452, name='Applause', category='XG SOUND EFFECTS', msb=0, lsb=0, prog=126),
 Voice(number=453, name='Gunshot', category='XG SOUND EFFECTS', msb=0, lsb=0, prog=127),
 Voice(number=454, name='Cutting Noise', category='XG SOUND EFFECTS', msb=64, lsb=0, prog=0),
 Voice(number=455, name='Cutting Noise 2', category='XG SOUND EFFECTS', msb=64, lsb=0, prog=1),
 Voice(number=456, name='String Slap', category='XG SOUND EFFECTS', msb=64, lsb=0, prog=3),
 Voice(number=457, name='Flute Key Click', category='XG SOUND EFFECTS', msb=64, lsb=0, prog=16),
 Voice(number=458, name='Shower', category='XG SOUND EFFECTS', msb=64, lsb=0, prog=32),
 Voice(number=459, name='Thunder', category='XG SOUND EFFECTS', msb=64, lsb=0, prog=33),
 Voice(number=460, name='Wind', category='XG SOUND EFFECTS', msb=64, lsb=0, prog=34),
 Voice(number=461, name='Stream', category='XG SOUND EFFECTS', msb=64, lsb=0, prog=35),
 Voice(number=462, name='Bubble', category='XG SOUND EFFECTS', msb=64, lsb=0, prog=36),
 Voice(number=463, name='Feed', category='XG SOUND EFFECTS', msb=64, lsb=0, prog=37),
 Voice(number=464, name='Dog', category='XG SOUND EFFECTS', msb=64, lsb=0, prog=48),
 Voice(number=465, name='Horse', category='XG SOUND EFFECTS', msb=64, lsb=0, prog=49),
 Voice(number=466, name='Bird Tweet 2', category='XG SOUND EFFECTS', msb=64, lsb=0, prog=50),
 Voice(number=467, name='Maou', category='XG SOUND EFFECTS', msb=64, lsb=0, prog=55),
 Voice(number=468, name='Phone Call', category='XG SOUND EFFECTS', msb=64, lsb=0, prog=64),
 Voice(number=469, name='Door Squeak', category='XG SOUND EFFECTS', msb=64, lsb=0, prog=65),
 Voice(number=470, name='Door Slam', category='XG SOUND EFFECTS', msb=64, lsb=0, prog=66),
 Voice(number=471, name='Scratch Cut', category='XG SOUND EFFECTS', msb=64, lsb=0, prog=67),
 Voice(number=472, name='Scratch Split', category='XG SOUND EFFECTS', msb=64, lsb=0, prog=68),
 Voice(number=473, name='Wind Chime', category='XG SOUND EFFECTS', msb=64, lsb=0, prog=69),
 Voice(number=474, name='Telephone Ring 2', category='XG SOUND EFFECTS', msb=64, lsb=0, prog=70),
 Voice(number=475, name='Car Engine Ignition', category='XG SOUND EFFECTS', msb=64, lsb=0, prog=80),
 Voice(number=476, name='Car Tires Squeal', category='XG SOUND EFFECTS', msb=64, lsb=0, prog=81),
 Voice(number=477, name='Car Passing', category='XG SOUND EFFECTS', msb=64, lsb=0, prog=82),
 Voice(number=478, name='Car Crash', category='XG SOUND EFFECTS', msb=64, lsb=0, prog=83),
 Voice(number=479, name='Siren', category='XG SOUND EFFECTS', msb=64, lsb=0, prog=84),
 Voice(number=480, name='Train', category='XG SOUND EFFECTS', msb=64, lsb=0, prog=85),
 Voice(number=481, name='Jet Plane', category='XG SOUND EFFECTS', msb=64, lsb=0, prog=86),
 Voice(number=482, name='Starship', category='XG SOUND EFFECTS', msb=64, lsb=0, prog=87),
 Voice(number=483, name='Burst', category='XG SOUND EFFECTS', msb=64, lsb=0, prog=88),
 Voice(number=484, name='Roller Coaster', category='XG SOUND EFFECTS', msb=64, lsb=0, prog=89),
 Voice(number=485, name='Submarine', category='XG SOUND EFFECTS', msb=64, lsb=0, prog=90),
 Voice(number=486, name='Laugh', category='XG SOUND EFFECTS', msb=64, lsb=0, prog=96),
 Voice(number=487, name='Scream', category='XG SOUND EFFECTS', msb=64, lsb=0, prog=97),
 Voice(number=488, name='Punch', category='XG SOUND EFFECTS', msb=64, lsb=0, prog=98),
 Voice(number=489, name='Heartbeat', category='XG SOUND EFFECTS', msb=64, lsb=0, prog=99),
 Voice(number=490, name='Footsteps', category='XG SOUND EFFECTS', msb=64, lsb=0, prog=100),
 Voice(number=491, name='Machine Gun', category='XG SOUND EFFECTS', msb=64, lsb=0, prog=112),
 Voice(number=492, name='Laser Gun', category='XG SOUND EFFECTS', msb=64, lsb=0, prog=113),
 Voice(number=493, name='Explosion', category='XG SOUND EFFECTS', msb=64, lsb=0, prog=114),
 Voice(number=494, name='Firework', category='XG SOUND EFFECTS', msb=64, lsb=0, prog=115),
 Voice(number=132, name='SFX Kit 1', category='DRUM KITS', msb=126, lsb=0, prog=0),
 Voice(number=133, name='SFX Kit 2', category='DRUM KITS', msb=126, lsb=0, prog=1),
 Voice(number=122, name='Standard Kit 1', category='DRUM KITS', msb=127, lsb=0, prog=0),
 Voice(number=123, name='Standard Kit 2', category='DRUM KITS', msb=127, lsb=0, prog=1),
 Voice(number=124, name='Room Kit', category='DRUM KITS', msb=127, lsb=0, prog=8),
 Voice(number=125, name='Rock Kit', category='DRUM KITS', msb=127, lsb=0, prog=16),
 Voice(number=126, name='Electronic Kit', category='DRUM KITS', msb=127, lsb=0, prog=24),
 Voice(number=127, name='Analog Kit', category='DRUM KITS', msb=127, lsb=0, prog=25),
 Voice(number=128, name='Dance Kit', category='DRUM KITS', msb=127, lsb=0, prog=27),
 Voice(number=129, name='Jazz Kit', category='DRUM KITS', msb=127, lsb=0, prog=32),
 Voice(number=130, name='Brush Kit', category='DRUM KITS', msb=127, lsb=0, prog=40),
 Voice(number=131, name='Symphony Kit', category='DRUM KITS', msb=127, lsb=0, prog=48)]

In [592]:
for v in allvoices:
    try:
        voices.from_bank_program(v.msb, 0, v.prog)
    except KeyError:
        print(v)

In [606]:
sorted((v for v in allvoices if v.msb != 0 and v.lsb != 0), key=lambda v: (v.msb, v.lsb, v.prog))


Out[606]:
[]

MSB 0 always has a fallback voice for any program.

What if the program is not supported?


In [706]:
o.send(cc(C.BANK_MSB, value=127, channel=0))
for p in range(128):
    print(p, end=" ")
    o.send(mido.Message('program_change', program=p, channel=0))
    pulse(o, sleep=0.1, channel=0, note=40)


0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 

In [707]:
o.send(cc(C.BANK_MSB, value=126, channel=0))
o.send(cc(C.BANK_LSB, value=0, channel=0))
for p in range(128):
    print(p, end=" ")
    o.send(mido.Message('program_change', program=p, channel=0))
    pulse(o, sleep=0.05, channel=0, note=84)


0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 

In [596]:
progs


Out[596]:
(0, 1, 8, 16, 24, 25, 27, 32, 40, 48)

In [638]:
o.send(cc(C.BANK_MSB, value=127, channel=0))
o.send(mido.Message('program_change', program=0, channel=0))
pulse(o, sleep=0.2, channel=0, note=40)
o.send(mido.Message('program_change', program=3, channel=0))
pulse(o, sleep=0.2, channel=0, note=40)
o.send(mido.Message('program_change', program=16, channel=0))
pulse(o, sleep=0.2, channel=0, note=40)
o.send(mido.Message('program_change', program=3, channel=0))
pulse(o, sleep=0.2, channel=0, note=40)

If the program is not supported for drum kit, it just won't change the program.


In [670]:
o.send(cc(C.BANK_MSB, value=126, channel=0))
o.send(cc(C.BANK_LSB, value=0, channel=0))

o.send(mido.Message('program_change', program=0, channel=0))
pulse(o, sleep=0.2, channel=0, note=84)
o.send(mido.Message('program_change', program=6, channel=0))
pulse(o, sleep=0.2, channel=0, note=84)
o.send(mido.Message('program_change', program=1, channel=0))
pulse(o, sleep=0.2, channel=0, note=84)
o.send(mido.Message('program_change', program=3, channel=0))
pulse(o, sleep=0.2, channel=0, note=84 )

If the program is not supported for SFX kit, it just won't play at all.


In [635]:
voice_list(40)


Out[635]:
[Voice(number=261, name='Violin', category='XG STRING', msb=0, lsb=0, prog=40),
 Voice(number=262, name='Slow Violin', category='XG STRING', msb=0, lsb=8, prog=40),
 Voice(number=60, name='Violin', category='STRINGS', msb=0, lsb=112, prog=40)]

In [651]:
o.send(cc(C.BANK_MSB, value=64, channel=0))
for p in range(128):
    print(p, end=" ")
    o.send(mido.Message('program_change', program=p, channel=0))
    pulse(o, sleep=0.05, channel=0, note=40)


0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 

In [674]:
o.send(cc(C.BANK_MSB, value=64, channel=0))
o.send(cc(C.BANK_LSB, value=0, channel=0))

o.send(mido.Message('program_change', program=70, channel=0))
pulse(o, sleep=0.2, channel=0, note=84)
o.send(mido.Message('program_change', program=71, channel=0))
pulse(o, sleep=0.2, channel=0, note=84)
o.send(mido.Message('program_change', program=64, channel=0))
pulse(o, sleep=0.2, channel=0, note=84)
o.send(mido.Message('program_change', program=71, channel=0))
pulse(o, sleep=0.2, channel=0, note=84 )

And it seems like that for the SFX voices as well.


In [659]:
o.send(cc(C.BANK_MSB, value=64, channel=0))
for l in range(128):
    print(l, end=" ")
    o.send(cc(C.BANK_LSB, value=l, channel=0))
    o.send(mido.Message('program_change', program=70, channel=0))
    pulse(o, sleep=0.1, channel=0, note=40)


0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 

The LSB fallback works. for SFX voices.


In [673]:
o.send(cc(C.BANK_MSB, value=126, channel=0))
for l in range(10):
    print(l, end=" ")
    o.send(cc(C.BANK_LSB, value=l, channel=0))
    o.send(mido.Message('program_change', program=0, channel=0))
    pulse(o, sleep=0.1, channel=0, note=84)


0 1 2 3 4 5 6 7 8 9 

In [675]:
o.send(cc(C.BANK_MSB, value=126, channel=0))
o.send(cc(C.BANK_LSB, value=1, channel=0))

o.send(mido.Message('program_change', program=0, channel=0))
pulse(o, sleep=0.2, channel=0, note=84)
o.send(mido.Message('program_change', program=6, channel=0))
pulse(o, sleep=0.2, channel=0, note=84)
o.send(mido.Message('program_change', program=1, channel=0))
pulse(o, sleep=0.2, channel=0, note=84)
o.send(mido.Message('program_change', program=3, channel=0))
pulse(o, sleep=0.2, channel=0, note=84 )

but not for SFX kits.


In [743]:
o.send(controls.gm_on())
pulse(o, sleep=0.2, channel=0, note=60)

o.send(mido.Message('program_change', program=16, channel=0))
pulse(o, sleep=0.2, channel=0, note=60)

o.send(cc(C.BANK_LSB, value=113, channel=0))
o.send(mido.Message('program_change', program=16, channel=0))
pulse(o, sleep=0.2, channel=0, note=60)


o.send(cc(C.BANK_LSB, value=0, channel=0))
o.send(mido.Message('program_change', program=16, channel=0))
pulse(o, sleep=0.2, channel=0, note=60)

# drum channel 
pulse(o, sleep=0.2, channel=9, note=40)

o.send(mido.Message('program_change', program=16, channel=9))
pulse(o, sleep=0.2, channel=9, note=40)

o.send(mido.Message('program_change', program=0, channel=9))
pulse(o, sleep=0.2, channel=9, note=40)



o.send(mido.Message.from_hex("F0 43 10 4C 00 00 7E 00 F7")) # XG ON
pulse(o, sleep=0.2, channel=0, note=60)

o.send(mido.Message('program_change', program=16, channel=0))
pulse(o, sleep=0.2, channel=0, note=60)

o.send(cc(C.BANK_LSB, value=113, channel=0))
o.send(mido.Message('program_change', program=16, channel=0))
pulse(o, sleep=0.2, channel=0, note=60)


o.send(cc(C.BANK_LSB, value=0, channel=0))
o.send(mido.Message('program_change', program=16, channel=0))
pulse(o, sleep=0.2, channel=0, note=60)

# drum channel 
pulse(o, sleep=0.2, channel=9, note=40)

o.send(mido.Message('program_change', program=16, channel=9))
pulse(o, sleep=0.2, channel=9, note=40)

o.send(mido.Message('program_change', program=0, channel=9))
pulse(o, sleep=0.2, channel=9, note=40)



o.send(mido.Message.from_hex("F0 43 10 4C 00 00 7F 00 F7")) # XG RESET
pulse(o, sleep=0.2, channel=0, note=60)

o.send(mido.Message('program_change', program=16, channel=0))
pulse(o, sleep=0.2, channel=0, note=60)

o.send(cc(C.BANK_LSB, value=113, channel=0))
o.send(mido.Message('program_change', program=16, channel=0))
pulse(o, sleep=0.2, channel=0, note=60)


o.send(cc(C.BANK_LSB, value=0, channel=0))
o.send(mido.Message('program_change', program=16, channel=0))
pulse(o, sleep=0.2, channel=0, note=60)

# drum channel 
pulse(o, sleep=0.2, channel=9, note=40)

o.send(mido.Message('program_change', program=16, channel=9))
pulse(o, sleep=0.2, channel=9, note=40)

o.send(mido.Message('program_change', program=0, channel=9))
pulse(o, sleep=0.2, channel=9, note=40)

Does the INC DEC weirdness leak across channels.


In [782]:
o.send(controls.gm_on())
controls.multisend(o, controls.set_voice_numbers(1))
pbp(o)
o.send(cc(C.DATA_MSB, value=59))

o.send(cc(C.RPN_MSB, value=0))
o.send(cc(C.RPN_LSB, value=2))


pbp(o)
o.send(cc(C.DATA_INC, value=0))

pbp(o)

controls.multisend(o, controls.set_voice_numbers(1, channel=2))
pbp(o, channel=2)
#o.send(cc(C.DATA_MSB, value=59, channel=1))

o.send(cc(C.RPN_MSB, value=0, channel=2))
o.send(cc(C.RPN_LSB, value=2, channel=2))


pbp(o, channel=2)
o.send(cc(C.DATA_INC, value=0, channel=2))

pbp(o, channel=2)

No, each channel has its own weirdness variable completely separate.

Even More!


In [9]:
controls.xg_on()


Out[9]:
<message sysex data=(67,16,76,0,0,126,0) time=0>

In [17]:
ii = mido.open_input('DGX-505 MIDI 1')

In [21]:
def grabm(p):
    return list(p.iter_pending())

In [11]:
o = mido.open_output('DGX-505 MIDI 1')

In [66]:
for i in range(16):
    o.send(controls.master_tune_val(-100))    
    controls.multisend(o, controls.set_voice_numbers(60))
    pulse(o, 0.1)
    o.send(controls.xg_parameter_change(0, 0, 0x7E, 0, n=i))
    pulse(o, 0.1)
    o.send(controls.xg_parameter_change(0, 0, 0x7F, 0, n=i))
    pulse(o, 0.1)

In [60]:
grabm(ii)


Out[60]:
[]

In [68]:
o.send(controls.cc(controls.Control.LOCAL, value=0x70, channel=15))

In [67]:
o.send(controls.gm_on())

LOCAL is not reset by XG on, GM on, or XG Reset

What's the default for Master Volume? I assume 7F


In [76]:
o.send(controls.master_vol(100))
pulse(o, 0.1)
o.send(controls.xg_parameter_change(0, 0, 0x7E, 0, n=i))
pulse(o, 0.1)
o.send(controls.master_vol(127))
pulse(o, 0.1)
o.send(controls.xg_parameter_change(0, 0, 0x7E, 0, n=i))
pulse(o, 0.1)

How does portamento control work with changed voices or drum kits?


In [204]:
o.send(controls.xg_reset())
controls.multisend(o, controls.set_voice_numbers(60))
o.send(mido.Message('note_on', note=60))
time.sleep(0.5)
o.send(controls.cc(controls.Control.PORTAMENTO_CTRL, value=60))
o.send(mido.Message('note_on', note=60))
#o.send(mido.Message('note_on', note=61))
time.sleep(0.5)
o.send(mido.Message('note_off', note=60))
o.send(mido.Message('note_off', note=60))
#o.send(mido.Message('note_off', note=61))

Sending the same note seems to require turning the note off twice.


In [ ]:


In [162]:
o.send(controls.xg_reset())
controls.multisend(o, controls.set_voice_numbers(60))
o.send(mido.Message('note_on', note=60))
time.sleep(0.5)
controls.multisend(o, controls.set_voice_numbers(101))

o.send(mido.Message('note_on', note=60))
time.sleep(0.5)
o.send(controls.cc(controls.Control.PORTAMENTO_CTRL, value=60))

o.send(mido.Message('note_on', note=61))
time.sleep(0.5)
o.send(controls.cc(controls.Control.PORTAMENTO_CTRL, value=60))

o.send(mido.Message('note_on', note=61))
time.sleep(0.5)
o.send(mido.Message('note_off', note=61))
time.sleep(0.5)

o.send(mido.Message('note_off', note=61))

In [81]:
o.send(controls.xg_reset())
controls.multisend(o, controls.set_voice_numbers(122))
o.send(mido.Message('note_on', note=29))
time.sleep(0.5)

o.send(controls.cc(controls.Control.PORTAMENTO_CTRL, value=29))
o.send(mido.Message('note_on', note=28))

time.sleep(0.5)
o.send(mido.Message('note_off', note=28))

Portamento does not work with drum kits.


In [82]:
o.send(controls.xg_reset())
controls.multisend(o, controls.set_voice_numbers(133))
o.send(mido.Message('note_on', note=36))
time.sleep(0.5)

o.send(controls.cc(controls.Control.PORTAMENTO_CTRL, value=36))
o.send(mido.Message('note_on', note=37))

time.sleep(0.5)




o.send(mido.Message('note_off', note=37))

Or SFX kits.


In [125]:
o.send(controls.xg_reset())
controls.multisend(o, controls.set_voice_numbers(474))
o.send(mido.Message('note_on', note=36))
time.sleep(0.1)

o.send(controls.cc(controls.Control.PORTAMENTO_CTRL, value=36))
o.send(mido.Message('note_on', note=37))

time.sleep(0.5)




o.send(mido.Message('note_off', note=37))

SFX voices seem fine, though.


In [127]:
o.send(controls.xg_reset())
controls.multisend(o, controls.set_voice_numbers(434))
o.send(mido.Message('note_on', note=60, velocity=127))
time.sleep(0.2)

o.send(controls.cc(controls.Control.PORTAMENTO_CTRL, value=60))
o.send(mido.Message('note_on', note=61, velocity=127))
time.sleep(0.5)

o.send(mido.Message('note_off', note=61))

time.sleep(1)
o.send(cc(C.ATTACK, value=50))
o.send(cc(C.BRIGHTNESS, value=127))

o.send(cc(C.RELEASE, value=127))
o.send(mido.Message('note_on', note=60, velocity=127))
time.sleep(0.2)

o.send(controls.cc(controls.Control.PORTAMENTO_CTRL, value=60))
o.send(mido.Message('note_on', note=61, velocity=127))
time.sleep(0.5)

o.send(mido.Message('note_off', note=61))

In [71]:
voices.from_number(434)


Out[71]:
Voice(number=434, name='Woodblock', category='XG PERCUSSIVE', msb=0, lsb=0, prog=115)

I suppose if the note runs out it also doesn't apply? I dunno.


In [ ]: