Jump to content

Softpots on BeatRepeat


cimo
 Share

Recommended Posts

hallo

i thought i could use the spectrasymbol soft pots to trigger the BeatRepeater in Ableton with a single touch.

To achieve that i need to:

1- read the pot movement and send the CC

void AIN_NotifyChange(unsigned char pin, unsigned int pin_value) __wparam
{
  // a pot has been moved, send CC# at channel 1
  MIOS_MIDI_TxBufferPut(0xb0); // CC at channel 1
  MIOS_MIDI_TxBufferPut(pin);  // pin number corresponds to CC number
  MIOS_MIDI_TxBufferPut(MIOS_AIN_Pin7bitGet(pin));   // don't send 10bit pin_value,
                                                     // but 7bit value
}
2- set a note ON message if the CC value is >0 (finger(or whatever) on softpot) 3- set a note OFF message if the CC value is =0 i thought i could transform the CC to Velocity and insert the ASM code for double note (with the proper adaptation) as found in the Meta Handler example in MB64
MB64E_META_Handler_DoubleNote

	call	MIOS_MIDI_BeginStream	; begin stream



	;; branch depending on content of MIDI_EVNT_VALUE

	movf	MIDI_EVNT_VALUE, W		; get MIDI_EVNT_VALUE value

	bz	MB64E_META_Handler_DoubleNoteOff	; when Zero (enc value = 00 or button released): send Note Off



MB64E_META_Handler_DoubleNoteOn

	;; NOTE ON

	movlw	0x90		; send 0x90 (Note On Header, channel 0)

	call	MIOS_MIDI_TxBufferPut

	movlw	0x00		; send 0x00 (C-0) -- cakewalk needs this as MIDI Remote indicator

	call	MIOS_MIDI_TxBufferPut

	movlw	0x7f		; send 0x7F (velocity)

	call	MIOS_MIDI_TxBufferPut



	movf	MIDI_EVNT1, W	; send content of second byte (08-0f)

	call	MIOS_MIDI_TxBufferPut

	movlw	0x7f		; send 0x7F (velocity)

	call	MIOS_MIDI_TxBufferPut



	rgoto	MB64E_META_Handler_DoubleNoteEnd

... am i in the right direction?

simone

Link to comment
Share on other sites

Cimo - I'm a C head as you know so I'm sticking to what I know - why don't you stick an if statement to check that the Pot is coming in on the correct AIN pin  for the softpot you wish to control, and then fire off the 2 midi notes within the if statement?

something like:

void AIN_NotifyChange(unsigned char pin, unsigned int pin_value) __wparam

{

      if (pin == 1){

          //fire off note on or CC info here

      }

}

Also why are you trying to send 2 midi notes? Beat repeat only requires 1 note to turn on the "power switch".

Also instead of sending a CC - why not send a note on?

Let me know if you need some more help....

Link to comment
Share on other sites

hi david

i don t want to send 2 notes, i thought i could use that code to "double" the midi event

-input: CC  ----> -output CC (unchanged) + ON/OFF event (depending on CC value: 0=OFF, >0=ON)

or maybe i could use the button event as "toggle"

Link to comment
Share on other sites

ok so:

void AIN_NotifyChange(unsigned char pin, unsigned int pin_value) __wparam
{
  // a pot has been moved, send CC# at channel 1
  MIOS_MIDI_TxBufferPut(0xb0); // CC at channel 1
  MIOS_MIDI_TxBufferPut(pin);  // pin number corresponds to CC number
  MIOS_MIDI_TxBufferPut(MIOS_AIN_Pin7bitGet(pin));   // don't send 10bit                                                                   
                                                     //pin_value,but 7bit value
   
{
      if (pin == 0){
           //fire off note OFF 
   
      else if (pin > 0)
           //fire off note ON

  }
 }
}

- how do i fire off a note on ? void DIN_NotifyToggle(unsigned char pin, unsigned char pin_value) is supposed to be called by MIOS when a button is depressed, what to do in this case?

-what about the syntax?  ::)

Link to comment
Share on other sites

hehe - you've had a deep dark insight to my coding notes to myself there....

let's step back a second - how do the softpots connect to the core, AIN or DIN?

ignore that last code snippett - I didn't check it properly for errors - was psuedo code...

void AIN_NotifyChange(unsigned char pin, unsigned int pin_value) __wparam

{

  // a pot has been moved, send CC# at channel 1

  MIOS_MIDI_TxBufferPut(0xb0); // CC at channel 1

  MIOS_MIDI_TxBufferPut(pin);  // pin number corresponds to CC number

  MIOS_MIDI_TxBufferPut(MIOS_AIN_Pin7bitGet(pin));  // don't send 10bit                                                                 

                                                    //pin_value,but 7bit value

 

      if (pin == 0) {

            MIOS_MIDI_BeginStream();

            MIOS_MIDI_TxBufferPut(0x90); // Note at channel 1

            MIOS_MIDI_TxBufferPut(pin);  // pin number corresponds to note number

            MIOS_MIDI_TxBufferPut(0 ? 0x00 : 0x7f); // buttons are high-active                                 

            MIOS_MIDI_EndStream();

      }

 

      else if (pin > 0) {

            MIOS_MIDI_BeginStream();

            MIOS_MIDI_TxBufferPut(0x90); // Note at channel 1

            MIOS_MIDI_TxBufferPut(pin);  // pin number corresponds to note number

            MIOS_MIDI_TxBufferPut(127 ? 0x00 : 0x7f); // buttons are high-active                                 

            MIOS_MIDI_EndStream();

      }

}

that SHOULD work - i.e. not tested

keep an eye on the values in bold, they might not be right - a little digging / experimentation will tell you....

Link to comment
Share on other sites

mmm

i was just wondering.. Ableton responds to notes ON/OFF, i mean you send and ON/OFF and it will turn on the effect, you send an ON/OFF again, you turn it off.I don t know how it reacts when you send first a note ON event and then a note OFF.

Also since the softpot will send 2 events at the same time, i need some trick to assign the parameter to Ableton, for example i can use an "assign" button that will send the same note.Too bad you can t assign parameters on a table as in the generic remote in cubase.

Thanks for the input!

What i don tunderstand is why you used the

MIOS_MIDI_BeginStream()

function, isn t that something you use only in linked cores?

ah there was a bit of irony here:

- how do i fire off a note on ?

  ;)

Link to comment
Share on other sites

i was just wondering.. Ableton responds to notes ON/OFF, i mean you send and ON/OFF and it will turn on the effect, you send an ON/OFF again, you turn it off.I don t know how it reacts when you send first a note ON event and then a note OFF.

mmm, good point - try it and see, I know the dBLive is sending a Note on and Off for each button press

so I guess it's being set by the note on?

Also since the softpot will send 2 events at the same time, i need some trick to assign the parameter to Ableton, for example i can use an "assign" button that will send the same note.Too bad you can t assign parameters on a table as in the generic remote in cubase.

well you can re-assign the pin or anything else in MIOS, so I would turn off one of the values being out-putted - set ableton, turn and then do it the other way round for the 2nd value....

or you could do a midi remote script

Link to comment
Share on other sites

;D ;D ;D

here it is:

void AIN_NotifyChange(unsigned char pin, unsigned int pin_value) __wparam

{

  // a pot has been moved, send CC# at channel 1

  MIOS_MIDI_TxBufferPut(0xb0); // CC at channel 1

  MIOS_MIDI_TxBufferPut(pin);  // pin number corresponds to CC number

  MIOS_MIDI_TxBufferPut(MIOS_AIN_Pin7bitGet(pin));  // don't send 10bit                                                                 

                                                    //pin_value,but 7bit value

 

      if (MIOS_AIN_Pin7bitGet(pin) == 0) {

           

            MIOS_MIDI_TxBufferPut(0x90); // Note at channel 1

            MIOS_MIDI_TxBufferPut(pin);  // pin number corresponds to note number

            MIOS_MIDI_TxBufferPut(0x00); // buttons are high-active                               

           

      }

 

      else if (MIOS_AIN_Pin7bitGet(pin) > 0) {

           

            MIOS_MIDI_TxBufferPut(0x90); // Note at channel 1

            MIOS_MIDI_TxBufferPut(pin);  // pin number corresponds to note number

            MIOS_MIDI_TxBufferPut(0x7f); // buttons are high-active                               

           

      }

}

Link to comment
Share on other sites

..getting better and better but what i ve feared about Ableton behavior s actually happened: it s waiting for a ON/OFF to turn on and ON/OFF again to turn off.It gets tricky to get the proper behavior, anyway here is the latest code (note i use 13 as a switch value cause the pot wont go under that value for some reason, probably construction/hardware.

void AIN_NotifyChange(unsigned char pin, unsigned int pin_value) __wparam

{

  // a pot has been moved, send CC# at channel 1

  MIOS_MIDI_TxBufferPut(0xb0); // CC at channel 1

  MIOS_MIDI_TxBufferPut(50);  // pin number corresponds to CC number

  MIOS_MIDI_TxBufferPut(MIOS_AIN_Pin7bitGet(pin));  // don't send 10bit                                                                 

                                                    //pin_value,but 7bit value

      if (MIOS_AIN_Pin7bitGet(pin) < 13) {

           

            MIOS_MIDI_TxBufferPut(0x90); // Note at channel 1

            MIOS_MIDI_TxBufferPut(pin);  // pin number corresponds to note number

            MIOS_MIDI_TxBufferPut(0x00); // buttons are high-active                               

           

MIOS_MIDI_TxBufferPut(0x90); // Note at channel 1

            MIOS_MIDI_TxBufferPut(pin);  // pin number corresponds to note number

            MIOS_MIDI_TxBufferPut(0x7f); // buttons are high-active

      }

 

      else if (MIOS_AIN_Pin7bitGet(pin) > 13) {

           

MIOS_MIDI_TxBufferPut(0x90); // Note at channel 1

            MIOS_MIDI_TxBufferPut(pin);  // pin number corresponds to note number

            MIOS_MIDI_TxBufferPut(0x00); // buttons are high-active

            MIOS_MIDI_TxBufferPut(0x90); // Note at channel 1

            MIOS_MIDI_TxBufferPut(pin);  // pin number corresponds to note number

            MIOS_MIDI_TxBufferPut(0x7f); // buttons are high-active                               

}

}

still the behavior is erratic , need to figure something else out.

Link to comment
Share on other sites

..maybe..

i need to scan the state of the MIDI coming from Ableton

dunno if with USER_MPROC_NotifyReceivedEvent or MIOS_DOUT_PinGet

so: if BeatRepeat is OFF and cc>0 then send note ON/OFF

    else if BeatRepeat is ON and cc==0 then send note ON/OFF

    else if BeatRepeat is OFF and cc==0 then do nothing

    else if BeatRepeat is ON and cc>0 then do nothing

what do you think?

Link to comment
Share on other sites

.. me again, sooo easy, get ableton 6 or 7 and you can just assign the softpot to both plugin-on/off button and grid value, then in the MIDI mappings just set minimum at around 3 and max at 127.that s it.

Still i am interested to finish that code cause i don t have a no-demo 6 or 7 ableton version.And for learning too.

tx

it s quite a funny toy!

Link to comment
Share on other sites

i will chime in for a second here on a coding issue (don't know live so can't help there...)

this

if (MIOS_AIN_Pin7bitGet(pin) == 0) 
{
	...
}
else if (MIOS_AIN_Pin7bitGet(pin) > 0) 
{
	...
}
would be better like this (for both code and execution efficiency):
if (MIOS_AIN_Pin7bitGet(pin) == 0)
{
	...
}
else
{
	...
}
on the other hand this:
if (MIOS_AIN_Pin7bitGet(pin) < 13)
{
	...
}
else if (MIOS_AIN_Pin7bitGet(pin) > 13)
{
	...
}
actually skips the value 13 as well, which i think you didn't intend, so would be much better this way:
if (MIOS_AIN_Pin7bitGet(pin) < 13)
{
	...
}
else
{
	...
}

hope that helps...

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...