Welcome to %s forums

BrainModular Users Forum

Login Register

MIDI rechannel

Discussions about add-ons, announcements
Post Reply
kara
Member
Posts: 106
Location: France - Bretagne
Contact:

Unread post by kara » 07 Aug 2009, 13:32

I noticed that in the add-ons there is a MIDI rechannel patch based on modules.
This is version based on a script, don't know if it usefull enough to put it in the add-on section, I've just made this one for my own user purposes.

Code: Select all

//////////////////////////
// Rechannel MIDI messages
/////////////////////////
// parameters declaration
var MidiIn 	: Tparameter;
var MidiOut	: Tparameter;
var Newchannel	: Tparameter;

// initialisation : create parameters
procedure init;
begin  
	MidiIn 		:= CreateParam('In',ptMidi);
	MidiOut 	:= CreateParam('Out',ptMidi);
	Newchannel	:= CreateParam('Newchannel',ptDataFader);

	SetIsInput(MidiOut,false);
	SetIsOutput(MidiIn,false);
	SetIsOutput(Newchannel,false);
	SetMin(Newchannel,1);
	SetMax(Newchannel,16);
	SetFormat(Newchannel,'%.0f');
	SetDefaultValue(Newchannel,1);
end;

// Global variables
var cnt			: integer;
var lngthMidi		: integer;
var ReceivedMidi	: TMidi;
var Newc		: single;

//////////////////////////////
// main proc
//////////////////////////////
begin

  lngthMidi := GetLength(MidiIn);
  if lngthMidi > 0
  then begin
	SetLength(MidiOut,lngthMidi);
	NewC := getvalue(NewChannel);
	for cnt := 0 to lngthMidi-1
	do begin
		 GetMidiArrayValue(MidiIn,cnt,ReceivedMidi);
		 ReceivedMidi.Channel := trunc(NewC);
		
		SetMidiArrayValue(MidiOut,cnt,ReceivedMidi);
	end;
  end
  else SetLength(MidiOut,0);

end.
k
Free samples-vsti's-artist hosting at www.kara-moon.com
Music forum at www.kara-moon.com/forum

Did I mention how great Usine is ?

User avatar
senso
Site Admin
Posts: 4424
Location: France
Contact:

Unread post by senso » 07 Aug 2009, 14:45

thanks
I think that it a good idea to put it in the add-ons section?

kara
Member
Posts: 106
Location: France - Bretagne
Contact:

Unread post by kara » 07 Aug 2009, 15:03

ok, i've added it :)

k
Free samples-vsti's-artist hosting at www.kara-moon.com
Music forum at www.kara-moon.com/forum

Did I mention how great Usine is ?

amiga909
Member
Posts: 324
Contact:

Unread post by amiga909 » 08 Aug 2009, 13:09

thanks for the addon :)

not tested, there might be small error in the script.
it should be:
NewC := getvalue(NewChannel) - 1;


check here for reference discussion:
http://www.sensomusic.com/forums/viewtopic.php?id=1449

jeanrene
Member
Posts: 91
Location: Caen Normandy France
Contact:

Unread post by jeanrene » 25 Oct 2011, 10:59

"midi transf" replace this script.
PatcherKit at work.

Post Reply

Who is online

Users browsing this forum: No registered users and 50 guests