Jump to content

127 buttons+1 sustain pedal OK, code for 1 foot controller still missing


audioworld

Recommended Posts

dear forum,

after the first success with a MB CORE (up and running in a few hours), it took me SIX MONTHS to assemble the surrounding parts:

4x DIN, 127 switches on one Eurocard size PCB, and hundreds of little wires going from the DIN pins to the switch assembly (you know what I am talking about...).

I will show you pictures of my controller soon, it is used for Ableton Live Clip triggering and KONTAKT sample playback (with the sustain pedal for live soundscape creation). I put a LOT of thinking in the button layout (STRYD: it will also be used for sequencer programming as we spoke six months ago), but the mechanical finish is SUCH crap that I am ashamed to show it at this stage...

Everything works nicely, I mounted the CORE together with the power supply and a USB MIDI interface in a 1HE 19" rack. So I run only a thin and flexible 5-pin connector to the actual switch assembly, and can hold 128 switches conveniently in my hands in the style of MONOME or Tenori-On. There are ZERO problems with the short cable from the CORE to the DIN`s, I was very much afraid that this would ruin my concept, but I am fine... phhh....

what I still would like but do not know how to achieve:

I need some velocity control while I am pressing the switches, so I can play one sample with low velocity, hold it, and then press another switch to mix in another sample with a higher velocity.

So I thought about a foot controller on one Analog In, and the value of this controller should be the actual velocity of the MIDI note ON which is sent out when I press a switch. At the moment I use the MIDIO128 code, but the veolcity is hardcoded there, I think it would be necessary to use a variable for velocity and insert the value of the AIN at the moment the switch is pressed.

I would be very thankfull for pointers if and how this can be done,

thank you so much for your efforts, I already had many hours of fun with my MB,

karl.

Link to comment
Share on other sites

Hi Karl,

here is a quick&dirty solution: just overwrite the velocity with the 7bit value of the analog input whenever a MIDI event is sent. In order to differ between "foot controlled", and "hardcoded" velocity, you could use an unused value (like 0x01) to differ between the two modes.

Events are sent from the MIDIO_MIDI_SendDINEvent function in midio_midi.inc, it has to be changed the following way:


;; --------------------------------------------------------------------------
;;  This function sends a DIN event
;;  Input: number of DIN in MIDIO_CURRENT_DIN
;; --------------------------------------------------------------------------
MIDIO_MIDI_SendDINEvent
        rcall   MIDIO_MIDI_PrepareDINEvent

;; check for velcocity == 1
movf MIDI_EVNT_VALUE, W
xorlw 0x01
bnz MIDIO_MIDI_SendDINEvent_NoPot
MIDIO_MIDI_SendDINEvent_Pot
;; get current 7bit value of first pot
movlw   0
call MIOS_AIN_Pin7bitGet
;; and copy it into MIDI_EVNT_VALUE
movwf  MIDI_EVNT_VALUE
MIDIO_MIDI_SendDINEvent_NoPot

        ;; if meta event: branch to meta handler, else to MIDI sender
        movf    MIDI_EVNT0, W
        andlw   0xf0
        xorlw   0xf0
        skpnz
        goto    MIDIO_META_Handler_DIN
        goto    MIDI_EVNT_Send
[/code] Now you only need to enable the AIN handler in USER_Init (-> main.asm) Just add following code below the USER_Init label:
[code]
USER_Init
        ;; initialize the AIN driver
        movlw   1  ; pot
        call    MIOS_AIN_NumberSet
        call    MIOS_AIN_UnMuxed

        movlw   7 ; +/- 7 is recommented for 7bit values
        call    MIOS_AIN_DeadbandSet

Best Regards, Thorsten.

Link to comment
Share on other sites

hi thorsten,

thanks for taking the time to reply so fast: "quick&dirty" is exactly what I need at the moment (after so many hours of soldering wires...). I will try this ASAP, just to make sure I understand it correctly:

1) a value of 0x01 as velocity in the midio128.syx list would mean "take the AIN value". Any other value would mean "forget AIN and take what is hardcoded"?

so for the first switch, if I want the actual foot controller value, the line would read:

1 =  90 30 01  90 30 00  @OnOff

2) how does the value of the variable "MIDI_EVNT_VALUE" end up as the velocity byte in the outgoing NOTE ON message? or is this variable treating just any outgoing message, no matter if it is the note number, the velocity or a controller number?

mhh, thinking about this: why is 0x01 unused? the MIDI range goes from 0x00 to 0x7F, no? so maybe I could use 0x80? (sorry if this is a dumb question).

thank you so much,

karl.

Link to comment
Share on other sites

Hi Karl,

1) a value of 0x01 as velocity in the midio128.syx list would mean "take the AIN value". Any other value would mean "forget AIN and take what is hardcoded"?

so for the first switch, if I want the actual foot controller value, the line would read:

1 =  90 30 01   90 30 00   @OnOff

yes

2) how does the value of the variable "MIDI_EVNT_VALUE" end up as the velocity byte in the outgoing NOTE ON message? or is this variable treating just any outgoing message, no matter if it is the note number, the velocity or a controller number?

correct, it's a parameter of the generic MIDI_EVNT_Send routine, which is located in midi_evnt.inc (see the comments there)

mhh, thinking about this: why is 0x01 unused? the MIDI range goes from 0x00 to 0x7F, no? so maybe I could use 0x80? (sorry if this is a dumb question).

the configuration data is part of a SysEx stream, and within such a stream it isn't allowed to use values >= 0x80. Therefore I proposed 0x01 (or any other value which you don't use in your configuration).

Alternatively you could use meta events - thats a proper solution, but it requires better programming skills.

Best Regards, Thorsten.

Link to comment
Share on other sites

  • 2 weeks later...

if you look in the user project you will notice i made a 64 keyboard based on the TK design (scan matrix). i added an encoder in order to choose the value of the velocity (when in note mode) ; if you change a little the code, and replace what is for the encoder and put it in the AIN section, maybe you can do what you want. code is rather ugly, but it works. you can use a potentiometer like the one of a wha wha pedal and control is value by the position of the pedal (am i clear ??)

Link to comment
Share on other sites

  • 1 month later...

julien,

thank you for the hint, yes, it is clear.

I followed the developments in your thread closely. Unfortunately I cannot use it for the current project, as my 128 buttons are HARDWIRED (soldered) to my DIN ports already...

I will use your matrix code for my next MB project, thank you.

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...
×
×
  • Create New...