Kontakt multiscript needed for fixing velocity and changing midi channels.

Sampler and Sampling discussion (techniques, tips and tricks, etc.)
Post Reply New Topic
RELATED
PRODUCTS

Post

Hello there guys

I was wondering if there is a multiscript available that lets you set the velocity of every note on a specific midi channel to what ever you want it to be.

E.g. every note on port A channel 3 could be fixed at 100 instead of varying the way it does at input.

Also I wanted to have one more adjustment made to the 'Transformer' multiscript that lets you change the midi channel the way it does with all its other functions.

E.g. A note input on port A channel 1 could be transformed into a note output on port B midi channel 5.

Are there any scripts for these functions available?

Thanks

N

Post

Try this... I've not actually run it, just written it. It extends Transformer to add the Note as a target and should let you do what you've asked.

Code: Select all

{***********************************************
	Transformer
	Multi Version
	Author: Native Instruments
	Written by: Nicki Marinic
	Modified: September 19, 2009
	--
	Modified: 17 January 2015 Peter L Jones
*************************************************}

on init
	message("")
	set_script_title("Transformer")
	set_ui_height(2)
	declare $count

	declare ui_menu $channel_1
	add_menu_item ($channel_1,"As Played",-1)
	$count := 0
	while ($count < 64)
		select ($count)
			case 0 to 15
				add_menu_item ($channel_1,"Midi Ch: [A] " & ($count mod 16) + 1,$count)
			case 16 to 31
				add_menu_item ($channel_1,"Midi Ch: [B] " & ($count mod 16) + 1,$count)
			case 32 to 47
				add_menu_item ($channel_1,"Midi Ch: [C] " & ($count mod 16) + 1,$count)
			case 48 to 63
				add_menu_item ($channel_1,"Midi Ch: [D] " & ($count mod 16) + 1,$count)
		end select
		inc($count)
	end while
	make_persistent ($channel_1)

	declare ui_menu $channel_2
	add_menu_item ($channel_2,"As Played",-1)
	$count := 0
	while ($count < 64)
		select ($count)
			case 0 to 15
				add_menu_item ($channel_2,"Midi Ch: [A] " & ($count mod 16) + 1,$count)
			case 16 to 31
				add_menu_item ($channel_2,"Midi Ch: [B] " & ($count mod 16) + 1,$count)
			case 32 to 47
				add_menu_item ($channel_2,"Midi Ch: [C] " & ($count mod 16) + 1,$count)
			case 48 to 63
				add_menu_item ($channel_2,"Midi Ch: [D] " & ($count mod 16) + 1,$count)
		end select
		inc($count)
	end while
	make_persistent ($channel_2)

	declare ui_label $label_1 (2,1)
	set_text ($label_1,"Transform")

	declare ui_label $label_2 (1,1)
	set_text ($label_2,"of Midi Channel")

	declare ui_label $label_3 (2,1)
	set_text ($label_3,"into")

	declare ui_label $label_4 (1,1)
	set_text ($label_4,"of Midi Channel")

	declare ui_menu $menu_1
	add_menu_item($menu_1,"Notes",1)
	add_menu_item($menu_1,"Controller",2)
	add_menu_item($menu_1,"Pitch Bend",3)
	add_menu_item($menu_1,"Mono AT",4)
	add_menu_item($menu_1,"Poly AT",5)
	add_menu_item($menu_1,"Prog Change",6)
	make_persistent ($menu_1)

	declare ui_menu $menu_2
	add_menu_item($menu_2,"Notes",1)
	add_menu_item($menu_2,"Controller",2)
	add_menu_item($menu_2,"Pitch Bend",3)
	add_menu_item($menu_2,"Mono AT",4)
	add_menu_item($menu_2,"Poly AT",5)
	add_menu_item($menu_2,"Prog Change",6)
	make_persistent ($menu_2)


	declare ui_value_edit $cc_number_1 (0,127,1)
	set_text ($cc_number_1,"CC #")
	make_persistent ($cc_number_1)

	declare ui_value_edit $poly_number_1 (0,127,$VALUE_EDIT_MODE_NOTE_NAMES)
	$poly_number_1 := 36
	set_text ($poly_number_1,"Note")
	make_persistent ($poly_number_1)

	declare ui_value_edit $velocity_2 (-1,127,1)
	set_text ($velocity_2,"Vel #")
	make_persistent ($velocity_2)

	declare ui_value_edit $cc_number_2 (0,127,1)
	set_text ($cc_number_2,"CC #")
	make_persistent ($cc_number_2)

	declare ui_value_edit $poly_number_2 (0,127,$VALUE_EDIT_MODE_NOTE_NAMES)
	$poly_number_2 := 36
	set_text ($poly_number_2,"Note")
	make_persistent ($poly_number_2)

	move_control ($label_1,1,2)
	move_control ($menu_1,1,3)
	move_control ($cc_number_1,0,0)
	move_control ($poly_number_1,0,0)
	move_control ($label_2,3,2)
	move_control ($channel_1,3,3)
	move_control ($label_3,4,2)
	move_control ($menu_2,4,3)
	move_control ($velocity_2,0,0)
	move_control ($cc_number_2,0,0)
	move_control ($poly_number_2,0,0)
	move_control ($label_4,6,2)
	move_control ($channel_2,6,3)

	set_control_help ($label_1,"Transform: Choose which MIDI events will be transformed into other MIDI events.")
	set_control_help ($menu_1,"Transform: Choose which MIDI events will be transformed into other MIDI events.")
	set_control_help ($cc_number_1,"CC #: Sets the Controller Number which will be transformed into other MIDI events.")
	set_control_help ($poly_number_1,"Note: Sets the Poly Aftertouch Note which will be transformed into other MIDI events.")
	set_control_help ($label_2,"Sets the MIDI Channel and port of the incoming MIDI events.")
	set_control_help ($channel_1,"Sets the MIDI Channel and port of the incoming MIDI events.")
	set_control_help ($label_3,"Sets the MIDI event to which the incoming events are transformed.")
	set_control_help ($menu_2,"Sets the MIDI event to which the incoming events are transformed.")
	set_control_help ($cc_number_2,"CC #: Sets the Controller Number of the outgoing MIDI event.")
	set_control_help ($poly_number_2,"Note: Sets the Poly Aftertouch Note of the outgoing MIDI event.")
	set_control_help ($label_4,"Sets the MIDI Channel and port of the outgoing MIDI events.")
	set_control_help ($channel_2,"Sets the MIDI Channel and port of the outgoing MIDI events.")

	read_persistent_var($menu_1)
	select ($menu_1)
		case 2 {cc}
			move_control ($cc_number_1,2,3)
		case 5 {Poly AT}
			move_control ($poly_number_1,2,3)
	end select

	read_persistent_var($menu_2)
	select ($menu_2)
		case 1 {Notes}
			move_control ($velocity_2,5,3)
		case 2 {cc}
			move_control ($cc_number_2,5,3)
		case 5 {Poly AT}
			move_control ($poly_number_2,5,3)
	end select
end on


on ui_control ($menu_1)
	move_control ($cc_number_1,0,0)
	move_control ($poly_number_1,0,0)
	select ($menu_1)
		case 2 {cc}
			move_control ($cc_number_1,2,3)
		case 5 {Poly AT}
			move_control ($poly_number_1,2,3)
	end select
end on


on ui_control ($menu_2)
	move_control ($velocity_2,0,0)
	move_control ($cc_number_2,0,0)
	move_control ($poly_number_2,0,0)
	select ($menu_2)
		case 1 {Notes}
			move_control ($velocity_2,5,3)
		case 2 {cc}
			move_control ($cc_number_2,5,3)
		case 5 {Poly AT}
			move_control ($poly_number_2,5,3)
	end select
end on



on midi_in
	if ($MIDI_CHANNEL # $channel_1 and $channel_1 # -1)
		exit
	end if

	select ($menu_1)

		case 1 {Notes}
			if ($MIDI_COMMAND = $MIDI_COMMAND_NOTE_ON or $MIDI_COMMAND = $MIDI_COMMAND_NOTE_OFF)
				ignore_midi
				select ($menu_2)
					case 1 {Notes}
						if ($velocity_2 # -1)
							if ($channel_2 # -1)
								set_midi($channel_2,$MIDI_COMMAND,$MIDI_BYTE_1,$velocity_2)
							else
								set_midi($MIDI_CHANNEL,$MIDI_COMMAND,$MIDI_BYTE_1,$velocity_2)
							end if
						else
							if ($channel_2 # -1)
								set_midi($channel_2,$MIDI_COMMAND,$MIDI_BYTE_1,$MIDI_BYTE_2)
							else
								set_midi($MIDI_CHANNEL,$MIDI_COMMAND,$MIDI_BYTE_1,$MIDI_BYTE_2)
							end if
						end if
					case 2 {Controller}
						if ($channel_2 = -1)
							set_midi($MIDI_CHANNEL,$MIDI_COMMAND_CC,$cc_number_2,$MIDI_BYTE_1)
						else
							set_midi($channel_2,$MIDI_COMMAND_CC,$cc_number_2,$MIDI_BYTE_1)
						end if
					case 3 {Pitch Bend}
						if ($channel_2 = -1)
							set_midi($MIDI_CHANNEL,$MIDI_COMMAND_PITCH_BEND,0,$MIDI_BYTE_1)
						else
							set_midi($channel_2,$MIDI_COMMAND_PITCH_BEND,0,$MIDI_BYTE_1)
						end if
					case 4 {Mono AT}
						if ($channel_2 = -1)
							set_midi($MIDI_CHANNEL,$MIDI_COMMAND_MONO_AT,$MIDI_BYTE_1,0)
						else
							set_midi($channel_2,$MIDI_COMMAND_MONO_AT,$MIDI_BYTE_1,0)
						end if
					case 5 {Poly AT}
						if ($channel_2 = -1)
							set_midi($MIDI_CHANNEL,$MIDI_COMMAND_POLY_AT,$poly_number_2,$MIDI_BYTE_1)
						else
							set_midi($channel_2,$MIDI_COMMAND_POLY_AT,$poly_number_2,$MIDI_BYTE_1)
						end if
					case 6 {PC}
						if ($channel_2 = -1)
							set_midi($MIDI_CHANNEL,$MIDI_COMMAND_PROGRAM_CHANGE,$MIDI_BYTE_1,0)
						else
							set_midi($channel_2,$MIDI_COMMAND_PROGRAM_CHANGE,$MIDI_BYTE_1,0)
						end if
				end select
			end if

		case 2 {Controller}
			if ($MIDI_COMMAND = $MIDI_COMMAND_CC and $MIDI_BYTE_1 = $cc_number_1)
				ignore_midi
				select ($menu_2)
					case 1 {Notes}
						if ($velocity_2 # -1)
							if ($channel_2 # -1)
								set_midi($channel_2,$MIDI_COMMAND_NOTE_ON,$MIDI_BYTE_1,$velocity_2)
							else
								set_midi($MIDI_CHANNEL,$MIDI_COMMAND_NOTE_ON,$MIDI_BYTE_1,$velocity_2)
							end if
						else
							if ($channel_2 # -1)
								set_midi($channel_2,$MIDI_COMMAND_NOTE_ON,$MIDI_BYTE_1,$MIDI_BYTE_2)
							else
								set_midi($MIDI_CHANNEL,$MIDI_COMMAND_NOTE_ON,$MIDI_BYTE_1,$MIDI_BYTE_2)
							end if
						end if
					case 2 {Controller}
						if ($channel_2 = -1)
							set_midi($MIDI_CHANNEL,$MIDI_COMMAND_CC,$cc_number_2,$MIDI_BYTE_2)
						else
							set_midi($channel_2,$MIDI_COMMAND_CC,$cc_number_2,$MIDI_BYTE_2)
						end if
					case 3 {Pitch Bend}
						if ($channel_2 = -1)
							set_midi($MIDI_CHANNEL,$MIDI_COMMAND_PITCH_BEND,0,$MIDI_BYTE_2)
						else
							set_midi($channel_2,$MIDI_COMMAND_PITCH_BEND,0,$MIDI_BYTE_2)
						end if
					case 4 {Mono AT}
						if ($channel_2 = -1)
							set_midi($MIDI_CHANNEL,$MIDI_COMMAND_MONO_AT,$MIDI_BYTE_2,0)
						else
							set_midi($channel_2,$MIDI_COMMAND_MONO_AT,$MIDI_BYTE_2,0)
						end if
					case 5 {Poly AT}
						if ($channel_2 = -1)
							set_midi($MIDI_CHANNEL,$MIDI_COMMAND_POLY_AT,$poly_number_2,$MIDI_BYTE_2)
						else
							set_midi($channel_2,$MIDI_COMMAND_POLY_AT,$poly_number_2,$MIDI_BYTE_2)
						end if
					case 6 {PC}
						if ($channel_2 = -1)
							set_midi($MIDI_CHANNEL,$MIDI_COMMAND_PROGRAM_CHANGE,$MIDI_BYTE_2,0)
						else
							set_midi($channel_2,$MIDI_COMMAND_PROGRAM_CHANGE,$MIDI_BYTE_2,0)
						end if
				end select
			end if

		case 3 {Pitch Bend}
			if ($MIDI_COMMAND = $MIDI_COMMAND_PITCH_BEND)
				ignore_midi
				select ($menu_2)
					case 1 {Notes}
						if ($velocity_2 # -1)
							if ($channel_2 # -1)
								set_midi($channel_2,$MIDI_COMMAND_NOTE_ON,$MIDI_BYTE_1,$velocity_2)
							else
								set_midi($MIDI_CHANNEL,$MIDI_COMMAND_NOTE_ON,$MIDI_BYTE_1,$velocity_2)
							end if
						else
							if ($channel_2 # -1)
								set_midi($channel_2,$MIDI_COMMAND_NOTE_ON,$MIDI_BYTE_1,$MIDI_BYTE_2)
							else
								set_midi($MIDI_CHANNEL,$MIDI_COMMAND_NOTE_ON,$MIDI_BYTE_1,$MIDI_BYTE_2)
							end if
						end if
					case 2 {Controller}
						if ($channel_2 = -1)
							set_midi($MIDI_CHANNEL,$MIDI_COMMAND_CC,$cc_number_2,$MIDI_BYTE_2)
						else
							set_midi($channel_2,$MIDI_COMMAND_CC,$cc_number_2,$MIDI_BYTE_2)
						end if
					case 3 {Pitch Bend}
						if ($channel_2 = -1)
							set_midi($MIDI_CHANNEL,$MIDI_COMMAND_PITCH_BEND,0,$MIDI_BYTE_2)
						else
							set_midi($channel_2,$MIDI_COMMAND_PITCH_BEND,0,$MIDI_BYTE_2)
						end if
					case 4 {Mono AT}
						if ($channel_2 = -1)
							set_midi($MIDI_CHANNEL,$MIDI_COMMAND_MONO_AT,$MIDI_BYTE_2,0)
						else
							set_midi($channel_2,$MIDI_COMMAND_MONO_AT,$MIDI_BYTE_2,0)
						end if
					case 5 {Poly AT}
						if ($channel_2 = -1)
							set_midi($MIDI_CHANNEL,$MIDI_COMMAND_POLY_AT,$poly_number_2,$MIDI_BYTE_2)
						else
							set_midi($channel_2,$MIDI_COMMAND_POLY_AT,$poly_number_2,$MIDI_BYTE_2)
						end if
					case 6 {PC}
						if ($channel_2 = -1)
							set_midi($MIDI_CHANNEL,$MIDI_COMMAND_PROGRAM_CHANGE,$MIDI_BYTE_2,0)
						else
							set_midi($channel_2,$MIDI_COMMAND_PROGRAM_CHANGE,$MIDI_BYTE_2,0)
						end if
				end select
			end if

		case 4 {Mono AT}
			if ($MIDI_COMMAND = $MIDI_COMMAND_MONO_AT)
				ignore_midi
				select ($menu_2)
					case 1 {Notes}
						if ($velocity_2 # -1)
							if ($channel_2 # -1)
								set_midi($channel_2,$MIDI_COMMAND_NOTE_ON,$MIDI_BYTE_1,$velocity_2)
							else
								set_midi($MIDI_CHANNEL,$MIDI_COMMAND_NOTE_ON,$MIDI_BYTE_1,$velocity_2)
							end if
						else
							if ($channel_2 # -1)
								set_midi($channel_2,$MIDI_COMMAND_NOTE_ON,$MIDI_BYTE_1,$MIDI_BYTE_2)
							else
								set_midi($MIDI_CHANNEL,$MIDI_COMMAND_NOTE_ON,$MIDI_BYTE_1,$MIDI_BYTE_2)
							end if
						end if
					case 2 {Controller}
						if ($channel_2 = -1)
							set_midi($MIDI_CHANNEL,$MIDI_COMMAND_CC,$cc_number_2,$MIDI_BYTE_1)
						else
							set_midi($channel_2,$MIDI_COMMAND_CC,$cc_number_2,$MIDI_BYTE_1)
						end if
					case 3 {Pitch Bend}
						if ($channel_2 = -1)
							set_midi($MIDI_CHANNEL,$MIDI_COMMAND_PITCH_BEND,0,$MIDI_BYTE_1)
						else
							set_midi($channel_2,$MIDI_COMMAND_PITCH_BEND,0,$MIDI_BYTE_1)
						end if
					case 4 {Mono AT}
						if ($channel_2 = -1)
							set_midi($MIDI_CHANNEL,$MIDI_COMMAND_MONO_AT,$MIDI_BYTE_1,0)
						else
							set_midi($channel_2,$MIDI_COMMAND_MONO_AT,$MIDI_BYTE_1,0)
						end if
					case 5 {Poly AT}
						if ($channel_2 = -1)
							set_midi($MIDI_CHANNEL,$MIDI_COMMAND_POLY_AT,$poly_number_2,$MIDI_BYTE_1)
						else
							set_midi($channel_2,$MIDI_COMMAND_POLY_AT,$poly_number_2,$MIDI_BYTE_1)
						end if
					case 6 {PC}
						if ($channel_2 = -1)
							set_midi($MIDI_CHANNEL,$MIDI_COMMAND_PROGRAM_CHANGE,$MIDI_BYTE_1,0)
						else
							set_midi($channel_2,$MIDI_COMMAND_PROGRAM_CHANGE,$MIDI_BYTE_1,0)
						end if
				end select
			end if

		case 5 {Poly AT}
			if ($MIDI_COMMAND = $MIDI_COMMAND_POLY_AT and $MIDI_BYTE_1 = $poly_number_1)
				ignore_midi
				select ($menu_2)
					case 1 {Notes}
						if ($velocity_2 # -1)
							if ($channel_2 # -1)
								set_midi($channel_2,$MIDI_COMMAND_NOTE_ON,$MIDI_BYTE_1,$velocity_2)
							else
								set_midi($MIDI_CHANNEL,$MIDI_COMMAND_NOTE_ON,$MIDI_BYTE_1,$velocity_2)
							end if
						else
							if ($channel_2 # -1)
								set_midi($channel_2,$MIDI_COMMAND_NOTE_ON,$MIDI_BYTE_1,$MIDI_BYTE_2)
							else
								set_midi($MIDI_CHANNEL,$MIDI_COMMAND_NOTE_ON,$MIDI_BYTE_1,$MIDI_BYTE_2)
							end if
						end if
					case 2 {Controller}
						if ($channel_2 = -1)
							set_midi($MIDI_CHANNEL,$MIDI_COMMAND_CC,$cc_number_2,$MIDI_BYTE_2)
						else
							set_midi($channel_2,$MIDI_COMMAND_CC,$cc_number_2,$MIDI_BYTE_2)
						end if
					case 3 {Pitch Bend}
						if ($channel_2 = -1)
							set_midi($MIDI_CHANNEL,$MIDI_COMMAND_PITCH_BEND,0,$MIDI_BYTE_2)
						else
							set_midi($channel_2,$MIDI_COMMAND_PITCH_BEND,0,$MIDI_BYTE_2)
						end if
					case 4 {Mono AT}
						if ($channel_2 = -1)
							set_midi($MIDI_CHANNEL,$MIDI_COMMAND_MONO_AT,$MIDI_BYTE_2,0)
						else
							set_midi($channel_2,$MIDI_COMMAND_MONO_AT,$MIDI_BYTE_2,0)
						end if
					case 5 {Poly AT}
						if ($channel_2 = -1)
							set_midi($MIDI_CHANNEL,$MIDI_COMMAND_POLY_AT,$poly_number_2,$MIDI_BYTE_2)
						else
							set_midi($channel_2,$MIDI_COMMAND_POLY_AT,$poly_number_2,$MIDI_BYTE_2)
						end if
					case 6 {PC}
						if ($channel_2 = -1)
							set_midi($MIDI_CHANNEL,$MIDI_COMMAND_PROGRAM_CHANGE,$MIDI_BYTE_2,0)
						else
							set_midi($channel_2,$MIDI_COMMAND_PROGRAM_CHANGE,$MIDI_BYTE_2,0)
						end if
				end select
			end if

		case 6 {Program Change}
			if ($MIDI_COMMAND = $MIDI_COMMAND_PROGRAM_CHANGE)
				ignore_midi
				select ($menu_2)
					case 1 {Notes}
						if ($velocity_2 # -1)
							if ($channel_2 # -1)
								set_midi($channel_2,$MIDI_COMMAND_NOTE_ON,$MIDI_BYTE_1,$velocity_2)
							else
								set_midi($MIDI_CHANNEL,$MIDI_COMMAND_NOTE_ON,$MIDI_BYTE_1,$velocity_2)
							end if
						else
							if ($channel_2 # -1)
								set_midi($channel_2,$MIDI_COMMAND_NOTE_ON,$MIDI_BYTE_1,$MIDI_BYTE_2)
							else
								set_midi($MIDI_CHANNEL,$MIDI_COMMAND_NOTE_ON,$MIDI_BYTE_1,$MIDI_BYTE_2)
							end if
						end if
					case 2 {Controller}
						if ($channel_2 = -1)
							set_midi($MIDI_CHANNEL,$MIDI_COMMAND_CC,$cc_number_2,$MIDI_BYTE_1)
						else
							set_midi($channel_2,$MIDI_COMMAND_CC,$cc_number_2,$MIDI_BYTE_1)
						end if
					case 3 {Pitch Bend}
						if ($channel_2 = -1)
							set_midi($MIDI_CHANNEL,$MIDI_COMMAND_PITCH_BEND,0,$MIDI_BYTE_1)
						else
							set_midi($channel_2,$MIDI_COMMAND_PITCH_BEND,0,$MIDI_BYTE_1)
						end if
					case 4 {Mono AT}
						if ($channel_2 = -1)
							set_midi($MIDI_CHANNEL,$MIDI_COMMAND_MONO_AT,$MIDI_BYTE_1,0)
						else
							set_midi($channel_2,$MIDI_COMMAND_MONO_AT,$MIDI_BYTE_1,0)
						end if
					case 5 {Poly AT}
						if ($channel_2 = -1)
							set_midi($MIDI_CHANNEL,$MIDI_COMMAND_POLY_AT,$poly_number_2,$MIDI_BYTE_1)
						else
							set_midi($channel_2,$MIDI_COMMAND_POLY_AT,$poly_number_2,$MIDI_BYTE_1)
						end if
					case 6 {PC}
						if ($channel_2 = -1)
							set_midi($MIDI_CHANNEL,$MIDI_COMMAND_PROGRAM_CHANGE,$MIDI_BYTE_1,0)
						else
							set_midi($channel_2,$MIDI_COMMAND_PROGRAM_CHANGE,$MIDI_BYTE_1,0)
						end if
				end select
			end if
	end select
end on
EDIT: See below.
Last edited by pljones on Sun Jan 18, 2015 8:43 pm, edited 2 times in total.

Post

Bloody Hell :)

That was fast :D

Thank you so very much, you're a star .

I hate to push my luck but could you add just one more function (button) that let's me just turn off/on the velocity fixing part but still lets me remap the notes played?

Or if that's too much then just a version that lets me remap the notes only, no velocity fixing.

Thanks again.

N

Post

normanlevene wrote:Bloody Hell :)

That was fast :D

Thank you so very much, you're a star .

I hate to push my luck but could you add just one more function (button) that let's me just turn off/on the velocity fixing part but still lets me remap the notes played?

Or if that's too much then just a version that lets me remap the notes only, no velocity fixing.

Thanks again.

N
I needed something to keep me occupied whilst eating my lunch...

If you set the velocity to -1, it leave it alone. Or it's meant to. I should have mentioned that bit :).

Post

Might need tweaking / testing a bit.

Not seeing any 'note off' messages and the velocity at -1 is still fixed. :/

Post

OK, I'll take a look. I'd have been rather surprised if it had been perfect ;).

-EDIT-
OK, I've updated it and it works as well as I'd expect. It allows Note Off to do what it should do.

Now, you can transform other events into Note events... but you need to take care, as there's no in-built way of generating a note off for the transformed note on.
Last edited by pljones on Sat Jan 17, 2015 9:36 pm, edited 1 time in total.

Post

I wrote this script for changing instruments while playing, it will route notes between channels.
Here: http://waveforms.fairlyconfusing.net/20 ... cript.html
If it's more or less something you're after, I can add velocity fix functionality, it should be quite simple, if I understand correctly...

Post

PLJones, the script is now PERFECT. :)

Thanks once again.

Also a big thanks to Zombie Queen, I can definitely use the script you have posted for controlling drum loops and bass sounds from a single keyboard so I'll be exploring it later. I'll let you know how I get on.

N.

Post

Hate to do this but is there any chance someone could add a function to this whereby the PL Jones script (Which is perfect!) only works for notes from C2 and higher but ignores all notes below that pitch.

:)

Post

I just checked and it (script that PL Jones posted) and it works fine for any notes. The problem must be elsewhere.

Post

You can also try this:
http://www.fairlyconfusing.net/docs/cha ... uter_b.txt

I added some simple 'note on' velocity processor to the router, you can scale or limit velocity to defined range. If you set minimum and maximum to the same value, velocity will be fixed. If anyone will be trying this out, please tell me, if it seem to function properly.

Post

Thanks Zombie Queen but I'm struggling a bit with how to use your script.

Perhaps I should explain what I'm doing.

I have a kontakt instrument that is split into 2 parts. A bass keyboard and a drum loops player.

The lower half of the keyboard from midi note B1 (47) downwards plays a bass sound and the top half from midi note C2 (48 upwards) plays drum loops.

On this midi channel I wanted all the note velocities from note C2 (value 48 one octave below middle C) and higher to be fixed at 100 so that all the drum loops have the same volume and all the notes played below note C2 to play with their original input velocities. To basically remain unaltered.

Hope this explains

Post

You didn't say you want to fix velocity for a key range, you only mentioned midi channel.
There you go, fix velocity for selected port, channel and keyboard range:

Code: Select all

on init

	message(" ")
	
	declare $check
	
	declare ui_menu $in_port
	add_menu_item ($in_port, "input: any port",-1)
	add_menu_item ($in_port, "input: port A",0)
	add_menu_item ($in_port, "input: port B",1)
	add_menu_item ($in_port, "input: port C",2)
	add_menu_item ($in_port, "input: port D",3)
	
	declare ui_menu $in_ch
	add_menu_item ($in_ch, "any channel",-1)
	add_menu_item ($in_ch, "channel 1",0)
	add_menu_item ($in_ch, "channel 2",1 )
	add_menu_item ($in_ch, "channel 3",2 )
	add_menu_item ($in_ch, "channel 4",3 )
	add_menu_item ($in_ch, "channel 5",4 )
	add_menu_item ($in_ch, "channel 6",5 )
	add_menu_item ($in_ch, "channel 7",6 )
	add_menu_item ($in_ch, "channel 8",7 )
	add_menu_item ($in_ch, "channel 9",8 )
	add_menu_item ($in_ch, "channel 10",9 )
	add_menu_item ($in_ch, "channel 11",10)
	add_menu_item ($in_ch, "channel 12",11)
	add_menu_item ($in_ch, "channel 13",12)
	add_menu_item ($in_ch, "channel 14",13)
	add_menu_item ($in_ch, "channel 15",14)
	add_menu_item ($in_ch, "channel 16",14)
	
	declare ui_value_edit $key_low(0,127,1)
	$key_low := 48
	
	declare ui_value_edit $key_high(0,127,1)
	$key_high := 127
	
	declare ui_value_edit $velocity(0,127,1)
	$velocity := 100

	{--- save values}
	{-----------------}	
	make_persistent ($in_port)
	make_persistent ($in_ch)
	make_persistent ($key_low)
	make_persistent ($key_high)
	make_persistent ($velocity)
	
end on



{----------------------------}
{ process incoming midi data }
{----------------------------}

on midi_in
	
	{if the command is note on}
	if($MIDI_COMMAND =144)
	
		{check if midi port and channel match the input setting}
		$check := 0
		if($in_port = -1)
			if($in_ch = -1)
				$check := 1
			else
				if($MIDI_CHANNEL mod 16 = $in_ch)
					$check := 1
				end if
			end if
		else
			if($in_ch = -1 and $in_port = $MIDI_CHANNEL /16)
				$check := 1
			else
				if($MIDI_CHANNEL mod 16 = $in_ch and $in_port = $MIDI_CHANNEL /16)
					$check := 1
				end if
			end if
		end if
		
		{fix velocity for keyboard range}
		if($check =1 and $MIDI_BYTE_1 >= $key_low and $MIDI_BYTE_1 <= $key_high)
			ignore_midi
			set_midi($MIDI_CHANNEL,$MIDI_COMMAND,$MIDI_BYTE_1,$velocity)
		end if
		
	end if
end on

{correct range input}
on ui_control ($key_low)
	if($key_low > $key_high)
		$key_low := $key_high
	end if
end on
on ui_control ($key_high)
	if($key_high < $key_low)
		$key_high := $key_low
	end if
end on
Channel router script has quite other purpose, to be able to switch instruments by midi note. So you can load different instruments to different channels and switch between them while you are playing.

Post

My apologies for that and thanks once again.
I'll tesdt this as soon as possible and let you know how I get on.

:)

Post

Zombie Queen wrote:You can also try this:
http://www.fairlyconfusing.net/docs/cha ... uter_b.txt

I added some simple 'note on' velocity processor to the router, you can scale or limit velocity to defined range. If you set minimum and maximum to the same value, velocity will be fixed. If anyone will be trying this out, please tell me, if it seem to function properly.
Thanks for this script.
+ de 500 Tutoriels MAO :

http://www.tuto-mao-guitare.com

Post Reply

Return to “Samplers, Sampling & Sample Libraries”