Jump to content

MIDI Filter v1.4


ilmenator
 Share

Recommended Posts

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

Link to comment
Share on other sites

Hi Ilmenator,

a nice application for the filter! Hope that you will publish the final source code, so that other people can use it as template to solve their problems :)

I don't expect that the second event is sent by the filter. Maybe from the StudioMix? Does it come with a MIDI Merger? This would explain why the NRPNs (the "used" values) will not be forwarded... how did you connect the MIDI INs/MIDI OUTs? Are you using 2 MIDI INs on your PC?

Best Regards, Thorsten.

Link to comment
Share on other sites

Hi Thorsten,

you are right about your suspicion, the second MIDI event was sent by the new keyboard I tested the code with... Well, never try to verify something when you have two unknowns in your setup!

The code will be published, but I don't have a site, so yours would be the ideal place. Still, there are some things missing, most of all a second core module to test the system as a whole. Otherwise, transformation in both directions works properly (NRPN to CC and vice versa), but jitter eating seems to make only sense when applying it to the NRPN values, which means working with 16 bit data. Here, I will have to do some more digging in the literature...

Thanks a lot for the great platform you created,

ilmenator

Link to comment
Share on other sites

  • 2 years later...

Hello, did you ever finish this projct?

I´ve been wondering if I could manage to do the same thing, and I´d relly like to learn from your experiences and maybe even get the source code.

Thanks alot in advance

js

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...