my goal is to build a midi recorder, like the 'midi accumulator' but with syncable lengths. the piano roll would be an alternative but I want it without the editor and cpu light instead. it should be as cpu light as the internal recorder of the xy interface module.
- any general tips?
- want to tackle the sync problem first:
tried to understand the 'midi delay' script which has the sync div param I am looking for, and the 'data delay' script which is easier.
Code: Select all
///////////////////////////////////////////////////
// DATA Delay
// Like an audio delay but works with DATA flows
//////////////////////////////////////////////////
// parameters declaration
var input : Tparameter;
var output : Tparameter;
var delay : TParameter;
const N_BLOC_DELAY = 1000;
var TabDelay : array of Single;
// initialisation : create parameters
procedure init;
begin
Input := CreateParam('in',ptDataField);
Output := CreateParam('out',ptDataField);
delay := CreateParam('delay',ptDataFader);
SetIsInput(Output,false);
SetIsOutPut(Input,false);
SetIsOutPut(delay,false);
SetFormat(delay,'%.0f');
SetMin(delay,0);
SetMax(delay,BlocDuration*(N_BLOC_DELAY-2));
SetSymbol(delay,'ms');
SetValue(delay,100);
SetScale(delay,lsLog);
SetArraylength(TabDelay,N_BLOC_DELAY);
SetLength(outPut,1);
end;
// Global variables
var tmp : Single;
var writepos : integer;
var readpos : integer;
//////////////////////////////
// main proc
//////////////////////////////
begin
readpos := (readpos+1) mod N_BLOC_DELAY;
writepos := (readpos+Trunc(GetValue(delay)/Blocduration)) mod N_BLOC_DELAY;
TabDelay [writePos] := GetValue(input);
tmp := TabDelay[readPos];
SetValue(output,tmp); // set output value
end.Code: Select all
SetMax(delay,BlocDuration*(N_BLOC_DELAY-2));Code: Select all
readpos := (readpos+1) mod N_BLOC_DELAY;
writepos := (readpos+Trunc(GetValue(delay)/Blocduration)) mod N_BLOC_DELAY;why is midi delay based on PPQ values? would it be easier if i connect a local sync module as a script module input?
thanks for help.
