Hi all,
currently I am developing a filter application that changes certain MIDI CCs into NRPNs and vice versa. For this I am planning to use two core modules, one for each direction of MIDI stream. These will be placed between a Peavey StudioMix and Cubase SX. The one in between the MIDI cable from the StudioMix to the Sequencer will also be provided with a “jitter eater” algorithm, which shall save the system from fader jitter.
Now, as a first step I spiced up the basic routine provided by Thorsten so that some of the CCs are transformed into NRPNs. I noticed that all Note On, Note Off messages (and some others, too) are sent twice by the filter circuit, like once being actively echoed in the “proc.inc” part, and once being echoed somewhere else. The modification of MIDI data works fine, so CCs are coming in, and NRPNs are going out, and only once. Any ideas?
The section of code I changed (sorry, I am a beginner and don’t know how to work with tables…) ist this. The rest of the code remains unaltered. Anything I am doing wrong, or is there something wrong with the section that Thorsten provided?
;; --------------------------------------------------------------------------
;; PROC Received Bn: called on a Controller Event
;; In: MIDI_LASTEVENT0: Bn, n = midi channel
;; MIDI_LASTEVENT1: CC number
;; MIDI_LASTEVENT2: CC value
;; --------------------------------------------------------------------------
PROC_ReceivedBn
;; branch if CC number is 0x17 (dec23 Fader M)
movf MIDI_LASTEVENT1, W
xorlw 0x17
bz PROC_ReceivedBn17
;; branch if CC number is 0x2C (dec44 Fader 1)
movf MIDI_LASTEVENT1, W
xorlw 0x2C
bz PROC_ReceivedBn2C
;; branch if CC number is 0x2D (dec45 Fader 2)
movf MIDI_LASTEVENT1, W
xorlw 0x2D
bz PROC_ReceivedBn2D
;; branch if CC number is 0x2E (dec46 Fader 3)
movf MIDI_LASTEVENT1, W
xorlw 0x2E
bz PROC_ReceivedBn2E
;; branch if CC number is 0x2F (dec47 Fader 4)
movf MIDI_LASTEVENT1, W
xorlw 0x2F
bz PROC_ReceivedBn2F
;; branch if CC number is 0x30 (dec48 Fader 5)
movf MIDI_LASTEVENT1, W
xorlw 0x30
bz PROC_ReceivedBn30
;; branch if CC number is 0x31 (dec49 Fader6)
movf MIDI_LASTEVENT1, W
xorlw 0x31
bz PROC_ReceivedBn31
;; branch if CC number is 0x32 (dec50 Fader 7)
movf MIDI_LASTEVENT1, W
xorlw 0x32
bz PROC_ReceivedBn32
;; branch if CC number is 0x33 (dec51 Fader 8)
movf MIDI_LASTEVENT1, W
xorlw 0x33
bz PROC_ReceivedBn33
movf MIDI_LASTEVENT0, W
call MIDI_SendByte
movf MIDI_LASTEVENT1, W
call MIDI_SendByte
movf MIDI_LASTEVENT2, W
call MIDI_SendByte
return
PROC_ReceivedBn17
movlw 0x23
movwf W_TMP
movlw 0x17 ; NRPN LSB = 0x17, Fader M
goto PROC_ReceivedFader_SendNRPN ; continue here
PROC_ReceivedBn2C
movlw 0x1B
movwf W_TMP
movlw 0x2C ; NRPN LSB = 0x2C, Fader 1
goto PROC_ReceivedFader_SendNRPN ; continue here
PROC_ReceivedBn2D
movlw 0x1B
movwf W_TMP
movlw 0x2D ; NRPN LSB = 0x2D, Fader 2
goto PROC_ReceivedFader_SendNRPN ; continue here
PROC_ReceivedBn2E
movlw 0x1B
movwf W_TMP
movlw 0x2E ; NRPN LSB = 0x2E, Fader 3
goto PROC_ReceivedFader_SendNRPN ; continue here
PROC_ReceivedBn2F
movlw 0x1B
movwf W_TMP
movlw 0x2F ; NRPN LSB = 0x2F, Fader 4
goto PROC_ReceivedFader_SendNRPN ; continue here
PROC_ReceivedBn30
movlw 0x1B
movwf W_TMP
movlw 0x30 ; NRPN LSB = 0x30, Fader 5
goto PROC_ReceivedFader_SendNRPN ; continue here
PROC_ReceivedBn31
movlw 0x1B
movwf W_TMP
movlw 0x31 ; NRPN LSB = 0x31, Fader 6
goto PROC_ReceivedFader_SendNRPN ; continue here
PROC_ReceivedBn32
movlw 0x1B
movwf W_TMP
movlw 0x32 ; NRPN LSB = 0x32, Fader 7
goto PROC_ReceivedFader_SendNRPN ; continue here
PROC_ReceivedBn33
movlw 0x1B
movwf W_TMP
movlw 0x33 ; NRPN LSB = 0x33, Fader 8
;; goto PROC_ReceivedFader_SendNRPN ; continue here
PROC_ReceivedFader_SendNRPN
movwf TMP1 ; store number in temp. register
movf MIDI_LASTEVENT0, W ; send Bn
call MIDI_SendByte
movlw 0x63 ; Send NRPN MSB <W_TMP> (0x63 <W_TMP>)
call MIDI_SendByte
movf W_TMP, W
call MIDI_SendByte
movf MIDI_LASTEVENT0, W ; send Bn
call MIDI_SendByte
movlw 0x62 ; SEND NRPN Address LSB <TMP1> (0x62 <TMP1>)
call MIDI_SendByte
movf TMP1, W
call MIDI_SendByte
movf MIDI_LASTEVENT0, W ; send Bn
call MIDI_SendByte
movlw 0x06 ; send NRPN Value MSB (06 <MIDI_LASTEVENT2>)
call MIDI_SendByte
movf MIDI_LASTEVENT2, W
call MIDI_SendByte
movf MIDI_LASTEVENT0, W ; send Bn
call MIDI_SendByte
movlw 0x26 ; send NRPN LSB value (26 40)
call MIDI_SendByte
movlw 0x40
call MIDI_SendByte
return
Thanks, ilmenator