ArrayArrayArray BrainModular BrainModular Users Forum 2008-11-21T21:45:30+02:00 https://brainmodular.org/forums/app.php/feed/topic/1158 2008-11-21T21:45:30+02:00 2008-11-21T21:45:30+02:00 https://brainmodular.org/forums/viewtopic.php?t=1158&p=6318#p6318 <![CDATA[scripting question: how to calculate bpm measures (1/8, 1/16,.. bar)?]]> to be more explicit its not the recording behavior its about to understand the N_BLOC_DELAY constant:

question:
how can I calculate eg. a length of 2bars in a script? like:

CODE:

IF&#40;2BarsHavePassedNow&#41; THEN countNoOfBars&#58;=countNoOfBars+2;
I know how to calculate bars <-> milliseconds (+ a given BPM tempo), eg. when manually syncing an analog delay.

how to use N_BLOC_DELAY and PPQ data type (if I have to use them)?

Statistics: Posted by amiga909 — 21 Nov 2008, 20:45


]]>
2008-11-19T09:56:36+02:00 2008-11-19T09:56:36+02:00 https://brainmodular.org/forums/viewtopic.php?t=1158&p=6293#p6293 <![CDATA[scripting question: how to calculate bpm measures (1/8, 1/16,.. bar)?]]> The tape delay works like an old 'audio tape delay' but with midi. In programing stuff we call it Circular Buffer.
But in an analog tape delay, the tape is moving and reading/writing heads a fixed. In computing it is the inverse, the 'tape' is fixed and the heads are moving.

when you write
readpos := (readpos+1) mod N_BLOC_DELAY;
it means that you move the reading head by one step (+1) and if you reach the end of the 'tape' you restart from the beginning.

now when write
writepos := (readpos+Trunc(GetValue(delay)/Blocduration)) mod N_BLOC_DELAY;
It mean that you write midi data's on the 'tape' N steps forward (N=GetValue(delay)/Blocduration)) so they will be read later.

Statistics: Posted by senso — 19 Nov 2008, 08:56


]]>
2008-11-18T16:44:29+02:00 2008-11-18T16:44:29+02:00 https://brainmodular.org/forums/viewtopic.php?t=1158&p=6280#p6280 <![CDATA[scripting question: how to calculate bpm measures (1/8, 1/16,.. bar)?]]>
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:

///////////////////////////////////////////////////// DATA Delay // Like an audio delay but works with DATA flows//////////////////////////////////////////////////// parameters declarationvar input   &#58; Tparameter;var output  &#58; Tparameter;var delay   &#58; TParameter;const N_BLOC_DELAY  = 1000;var TabDelay  &#58; array of Single;// initialisation &#58; create parametersprocedure init;begin   Input &#58;= CreateParam&#40;'in',ptDataField&#41;; Output &#58;= CreateParam&#40;'out',ptDataField&#41;; delay &#58;= CreateParam&#40;'delay',ptDataFader&#41;;   SetIsInput&#40;Output,false&#41;; SetIsOutPut&#40;Input,false&#41;; SetIsOutPut&#40;delay,false&#41;; SetFormat&#40;delay,'%.0f'&#41;; SetMin&#40;delay,0&#41;; SetMax&#40;delay,BlocDuration*&#40;N_BLOC_DELAY-2&#41;&#41;; SetSymbol&#40;delay,'ms'&#41;; SetValue&#40;delay,100&#41;; SetScale&#40;delay,lsLog&#41;; SetArraylength&#40;TabDelay,N_BLOC_DELAY&#41;; SetLength&#40;outPut,1&#41;; end;// Global variablesvar tmp      &#58; Single;var writepos &#58; integer;var readpos  &#58; integer;//////////////////////////////// main proc//////////////////////////////begin readpos &#58;= &#40;readpos+1&#41; mod N_BLOC_DELAY; writepos &#58;= &#40;readpos+Trunc&#40;GetValue&#40;delay&#41;/Blocduration&#41;&#41; mod N_BLOC_DELAY; TabDelay &#91;writePos&#93; &#58;= GetValue&#40;input&#41;; tmp &#58;= TabDelay&#91;readPos&#93;; SetValue&#40;output,tmp&#41;;  // set output value     end.
some concrete questions:

CODE:

 SetMax&#40;delay,BlocDuration*&#40;N_BLOC_DELAY-2&#41;&#41;;

CODE:

 readpos &#58;= &#40;readpos+1&#41; mod N_BLOC_DELAY; writepos &#58;= &#40;readpos+Trunc&#40;GetValue&#40;delay&#41;/Blocduration&#41;&#41; mod N_BLOC_DELAY;
whats the math behind this?
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.

Statistics: Posted by amiga909 — 18 Nov 2008, 15:44


]]>
BrainModular BrainModular Users Forum 2008-11-21T21:45:30+02:00 https://brainmodular.org/forums/app.php/feed/topic/1158 2008-11-21T21:45:30+02:00 2008-11-21T21:45:30+02:00 https://brainmodular.org/forums/viewtopic.php?t=1158&p=6318#p6318 <![CDATA[scripting question: how to calculate bpm measures (1/8, 1/16,.. bar)?]]> to be more explicit its not the recording behavior its about to understand the N_BLOC_DELAY constant:

question:
how can I calculate eg. a length of 2bars in a script? like:

CODE:

IF&#40;2BarsHavePassedNow&#41; THEN countNoOfBars&#58;=countNoOfBars+2;
I know how to calculate bars <-> milliseconds (+ a given BPM tempo), eg. when manually syncing an analog delay.

how to use N_BLOC_DELAY and PPQ data type (if I have to use them)?

Statistics: Posted by amiga909 — 21 Nov 2008, 20:45


]]>
2008-11-19T09:56:36+02:00 2008-11-19T09:56:36+02:00 https://brainmodular.org/forums/viewtopic.php?t=1158&p=6293#p6293 <![CDATA[scripting question: how to calculate bpm measures (1/8, 1/16,.. bar)?]]> The tape delay works like an old 'audio tape delay' but with midi. In programing stuff we call it Circular Buffer.
But in an analog tape delay, the tape is moving and reading/writing heads a fixed. In computing it is the inverse, the 'tape' is fixed and the heads are moving.

when you write
readpos := (readpos+1) mod N_BLOC_DELAY;
it means that you move the reading head by one step (+1) and if you reach the end of the 'tape' you restart from the beginning.

now when write
writepos := (readpos+Trunc(GetValue(delay)/Blocduration)) mod N_BLOC_DELAY;
It mean that you write midi data's on the 'tape' N steps forward (N=GetValue(delay)/Blocduration)) so they will be read later.

Statistics: Posted by senso — 19 Nov 2008, 08:56


]]>
2008-11-18T16:44:29+02:00 2008-11-18T16:44:29+02:00 https://brainmodular.org/forums/viewtopic.php?t=1158&p=6280#p6280 <![CDATA[scripting question: how to calculate bpm measures (1/8, 1/16,.. bar)?]]>
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:

///////////////////////////////////////////////////// DATA Delay // Like an audio delay but works with DATA flows//////////////////////////////////////////////////// parameters declarationvar input   &#58; Tparameter;var output  &#58; Tparameter;var delay   &#58; TParameter;const N_BLOC_DELAY  = 1000;var TabDelay  &#58; array of Single;// initialisation &#58; create parametersprocedure init;begin   Input &#58;= CreateParam&#40;'in',ptDataField&#41;; Output &#58;= CreateParam&#40;'out',ptDataField&#41;; delay &#58;= CreateParam&#40;'delay',ptDataFader&#41;;   SetIsInput&#40;Output,false&#41;; SetIsOutPut&#40;Input,false&#41;; SetIsOutPut&#40;delay,false&#41;; SetFormat&#40;delay,'%.0f'&#41;; SetMin&#40;delay,0&#41;; SetMax&#40;delay,BlocDuration*&#40;N_BLOC_DELAY-2&#41;&#41;; SetSymbol&#40;delay,'ms'&#41;; SetValue&#40;delay,100&#41;; SetScale&#40;delay,lsLog&#41;; SetArraylength&#40;TabDelay,N_BLOC_DELAY&#41;; SetLength&#40;outPut,1&#41;; end;// Global variablesvar tmp      &#58; Single;var writepos &#58; integer;var readpos  &#58; integer;//////////////////////////////// main proc//////////////////////////////begin readpos &#58;= &#40;readpos+1&#41; mod N_BLOC_DELAY; writepos &#58;= &#40;readpos+Trunc&#40;GetValue&#40;delay&#41;/Blocduration&#41;&#41; mod N_BLOC_DELAY; TabDelay &#91;writePos&#93; &#58;= GetValue&#40;input&#41;; tmp &#58;= TabDelay&#91;readPos&#93;; SetValue&#40;output,tmp&#41;;  // set output value     end.
some concrete questions:

CODE:

 SetMax&#40;delay,BlocDuration*&#40;N_BLOC_DELAY-2&#41;&#41;;

CODE:

 readpos &#58;= &#40;readpos+1&#41; mod N_BLOC_DELAY; writepos &#58;= &#40;readpos+Trunc&#40;GetValue&#40;delay&#41;/Blocduration&#41;&#41; mod N_BLOC_DELAY;
whats the math behind this?
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.

Statistics: Posted by amiga909 — 18 Nov 2008, 15:44


]]>