diff --git a/images/apple/DHGR-BIGSHOW.PO b/images/apple/DHGR-BIGSHOW.PO index 0f3b351..2c1c74a 100644 Binary files a/images/apple/DHGR-BIGSHOW.PO and b/images/apple/DHGR-BIGSHOW.PO differ diff --git a/src/dhgr.tk/utils/dhgrrgb.pla b/src/dhgr.tk/utils/dhgrrgb.pla index 6749c7c..5f4f88d 100644 --- a/src/dhgr.tk/utils/dhgrrgb.pla +++ b/src/dhgr.tk/utils/dhgrrgb.pla @@ -535,5 +535,5 @@ if ^arg fin return 0 fin -puts("Usage: DHGRRGB [-B#] [-E#] [-G#] [-T#] RGBFILE [DHGRFILE]\n") +puts("Usage: DHGRRGB [-B#] -C#] [-E#] [-G#] [-M] [-T#] RGBFILE [DHGRFILE]\n") done diff --git a/src/mockingboard/cvtmid.py b/src/mockingboard/cvtmid.py index f50034f..087ae68 100755 --- a/src/mockingboard/cvtmid.py +++ b/src/mockingboard/cvtmid.py @@ -7,6 +7,7 @@ import mido optarg = 1 timescale = 16.0 # Scale time to 16th of a second extperchan = 9 # Default to standard MIDI channel 10 for extra percussion +channels = [] if len(sys.argv) == 1: print('Usage:', sys.argv[0], '[-p extra_percussion_channel] [-t timescale] MIDI_file') sys.exit(0) @@ -16,19 +17,24 @@ while optarg < (len(sys.argv) - 1): timescale = float(sys.argv[optarg + 1]) * 16.0 optarg += 2 if sys.argv[optarg] == '-p': # Add extra percussion channel - extperchan = int(sys.argv[optarg + 1]) - 1 + extperchan = int(sys.argv[optarg + 1]) + channels.append(extperchan) optarg += 2 + if sys.argv[optarg][0] == '+': # Enable channel + channels.append(int(sys.argv[optarg][1])) + optarg += 1 mid = mido.MidiFile(sys.argv[optarg]) timeshift = timescale -totaltime = 0 +#totaltime = 0.0 eventtime = 0.0 for msg in mid: eventtime += msg.time * timeshift + #totaltime += eventtime + deltatime = int(round(eventtime)) #print '; time = ', msg.time if msg.type == 'note_on' or msg.type == 'note_off': #if eventtime > 0.0 and eventtime < 0.5: # eventtime = 0.5 - deltatime = int(round(eventtime)) octave = int(msg.note / 12 - 1) onote = int(msg.note % 12) lrchan = int(msg.channel & 1) @@ -39,22 +45,22 @@ for msg in mid: vol = 0 if octave < 0: octave = 0 - totaltime += deltatime - if msg.channel == 9 or msg.channel == extperchan: - # - # Percussion - # - if vol > 0: - print('\t!BYTE\t${0:02X}, ${1:02X}, ${2:02X}\t; Percussion {3:d} Chan {4:d} Dur {5:d}'.format(deltatime, msg.note ^ 0x40, (lrchan << 7) | vol, msg.note, msg.channel + 1, vol)) - if extperchan == 9: # Play percussion on both channels if no extended percussion - print('\t!BYTE\t${0:02X}, ${1:02X}, ${2:02X}\t; Percussion {3:d} Chan {4:d} Dur {5:d}'.format(0, msg.note ^ 0x40, vol, msg.note, msg.channel + 1, vol)) + if msg.channel in channels: + if msg.channel == 9 or msg.channel == extperchan: + # + # Percussion + # + if vol > 0: + print('\t!BYTE\t${0:02X}, ${1:02X}, ${2:02X}\t; Percussion {3:d} Chan {4:d} Dur {5:d}'.format(deltatime, msg.note ^ 0x40, (lrchan << 7) | vol, msg.note, msg.channel, vol)) + if extperchan == 9: # Play percussion on both channels if no extended percussion + print('\t!BYTE\t${0:02X}, ${1:02X}, ${2:02X}\t; Percussion {3:d} Chan {4:d} Dur {5:d}'.format(0, msg.note ^ 0x40, vol, msg.note, msg.channel, vol)) + eventtime = 0.0 + else: + # + # Note + # + print('\t!BYTE\t${0:02X}, ${1:02X}, ${2:02X}\t; Note {3:d} Chan {4:d} Vol {5:d}'.format(deltatime, 0x80 | (octave << 4) | onote, (lrchan << 7) | vol, msg.note, msg.channel, vol)) eventtime = 0.0 - else: - # - # Note - # - print('\t!BYTE\t${0:02X}, ${1:02X}, ${2:02X}\t; Note {3:d} Chan {4:d} Vol {5:d}'.format(deltatime, 0x80 | (octave << 4) | onote, (lrchan << 7) | vol, msg.note, msg.channel + 1, vol)) - eventtime = 0.0 elif msg.type == 'set_tempo': pass #timeshift = msg.tempo / 500000.0 * timescale @@ -62,7 +68,7 @@ for msg in mid: elif msg.type == 'time_signature': pass elif msg.type == 'control_chage': - pass + print('; Control change Chan {0:d}'.format(msg.channel)) elif msg.type == 'program_change': - pass + print('; Program change Chan {0:d}'.format(msg.channel)) print('\t!BYTE\t${0:02X}, $00, $00'.format(int(eventtime + 0.5)))