Buzz or Speed Detection?

Ozarkeys

2007-11-26 10:39:13

Is it possible to use the new input timer to change notes (or global variables) based on the speed of a note. I've written before, but that was before the latest update. (e.g. If a snare drum hit was to get to a certain speed that it switch to a different note with buzz roll samples.) Or like the Vienna Symphonic Library collections with speed detection that switches to different layers based on how fast the notes are being played. Thanks for a wonderful and adaptable product.

Ozarkeys

florian

2007-11-27 18:34:40

Hi,

I guess what you really need is a clock. The timers in MT allow delayed and/or repeated execution of Translation actions, so they're not perfect what you are trying to do.

However, there is a way to do that right in MT Pro: use a high frequency timer (e.g. every 5 milliseconds) and as only action it increases a variable, e.g. "gt" by 5. Now gt is your clock, and you can query it in the drum Translators. The following is an example preset:

Code: Select all

Translator 1: Set Timer
Options: stop=false
Incoming: Project Opened
Outgoing: Periodic timer "Clock": 5 ms (initial delay: 5 ms)

Translator 2: Clock Timer
Options: stop=false
Incoming: On timer "Clock"
Rules: Increase gt
  gt=gt+5
Outgoing: (none)

Translator 3: Change Drum Note if Fast
Options: stop=false
Incoming: MIDI 90 40 pp 
Rules: 
  Label "Ignore if velocity=0"
  if pp==0 then exit rules, skip Outgoing Action
  Label "calculate time from last drum note"
  tt=gt-ga
  Label "Remember current time in ga"
  ga=gt
  Label "Calculate note to play"
  qq=64
  if tt<=200 then qq=65
Outgoing: MIDI 90 qq pp 
Translator 3 will react on note 0x40 (hexadecimal), which is 64 decimal. It will calculate the time from the last time this note was played in the variable tt by subtracting ga (last time of note) from gt(current time). Then it will store the current time in ga. Last, it will inspect tt (the time it took from the last note to the current note). If it is smaller or equal than 200 milliseconds = 0.2 seconds, then the note is changed from 64 to 65. The Outgoing action will then play the note 64 or 65 stored in variable qq.

The timer is started when the project is loaded. You will probably want to add other ways to start the timer, too, because timers are sometimes reset (e.g. when pressing the panic button).

Also, note that the approach above is somewhat CPU intense, because the timer is called so often. You should check, e.g. with the task manager, how much CPU is taken by MT with the timer. My computer, however, shows "0%" CPU usage with the preset above... Anyway, if too bad, you may want to increase the repeat time of the timer to use less CPU, and change the gt add number from 5, too (at the expense of less resolution of the clock).

Regards,
Florian

Ozarkeys

2007-12-03 01:34:32

Awesome, that works great! Thank You So much for the help and ongoing support.

If I was to use this on an instrument that sustains, how would I send the correct note off info for the other layer?

Thanks again!

Ozarkeys

florian

2007-12-04 10:18:12

For that you should probably remember in a global variable which note you've actually played.

E.g. so replace qq with gn. Then add a translator:

Code: Select all

Translator 4: Handle Note Off
Options: stop=false
Incoming: MIDI 90 40 00
Outgoing: MIDI 90 gn 00
That should work.

Regards,
Florian

Ozarkeys

2008-01-22 01:11:56

Works like a charm. Thanks again!!!

Ozarkeys--