This forum is read-only. Please post new topics in our Q&A forum.

How can I transpose notes?

General discussion about MIDI Translator

Moderators: florian, DvlsAdvct

Post Reply
User avatar
florian
Bome Software: Founder
Posts: 2435
Joined: Thu Apr 28, 2005 10:09 pm
Location: Munich, Germany
Contact:

How can I transpose notes?

Post by florian » Sun Aug 19, 2007 5:52 pm

a user asked this question:
Can I transpose my played notes, e.g. by an octave, with Midi Translator? Is the Classic version sufficient, or do I need the Pro version?

User avatar
florian
Bome Software: Founder
Posts: 2435
Joined: Thu Apr 28, 2005 10:09 pm
Location: Munich, Germany
Contact:

Post by florian » Sun Aug 19, 2007 5:57 pm

yes, you can do that.

In theory, you can do transposition with the Classic edition of Midi Translator. However, it only allows static translations, so you'll end up defining one translation for every note:

Code: Select all

   INPUT             OUTPUT
NOTE ON key 20 -> NOTE ON key 32
NOTE ON key 21 -> NOTE ON key 33
...
NOTE ON key 80 -> NOTE ON key 92
...
The note numbers are in semitones, so adding twelve semitones will increase the note by one octave.

Midi Translator Pro offers an elegant way for doing so, by way of "Rules" with variables (variables have 2-letter names, e.g. pp, qq, etc. or "global" variables ga, gb, gc,...).
Here, the octave transposition is one simple translator:

Code: Select all

INPUT:  NOTE ON key "pp"
RULE:   pp=pp+12
OUTPUT: NOTE ON key "pp"
It'll be easy to change this definition to an arbitrary transposition, simply change the rule.

darmohray
New User
Posts: 2
Joined: Thu Aug 30, 2007 10:19 pm

How about partial transpositions?

Post by darmohray » Thu Aug 30, 2007 10:30 pm

Florian, thank you for the example using rules in Midi Translator Pro. How would one go about shifting a subset of octaves?

Say I have a 4 octave midi keyboard ranging from C2 to C6. I'd like to shift the lower two octaves down by one octave. So I'd like a keyboard ranging from C1 to B2 and C4 to C6. How would I go about setting up translations for all of the Note On and Note off keys?

I'd also like to setup transpositions where all the notes on the 4 octave keyboard are shifted either up or down, however not all the same shift direction. So likely to need 50 translations just for the notes, plus I'd like to have numerous other translations for special effects.

If I have to setup individual translations for each key, are there performance considerations in setting up so many translations?

I'd like to setup such a large number of translations using a text editor. Is there any way to import and export CSV files, rather the text oriented import/export format? Would be much nicer to use Excel to create all of these different translations, or ast least see each rule on a single line.

darmohray
New User
Posts: 2
Joined: Thu Aug 30, 2007 10:19 pm

Think I figured out the rule for partial transpositions

Post by darmohray » Thu Aug 30, 2007 10:49 pm

Florian, after posting my message, I quickly realized it's easy to create such a rule for partial transpositions. I believe the following should work:

Name0=Shift Down 1 Octave
Incoming0=MID190oopp
Outgoing0=MID190oopp
Options0=Actv01Stop01OutO00StMa00000004if(oo<=59)skipexecuteif(oo>=36)oo=oo-12execute

Can you confirm for me the above will work? Also, can you answer my other questions about performance in considering large number of translations and/or translations with rules and the question about any other formatted import/export files?

Thanks,
Gregory

User avatar
florian
Bome Software: Founder
Posts: 2435
Joined: Thu Apr 28, 2005 10:09 pm
Location: Munich, Germany
Contact:

Post by florian » Sat Sep 01, 2007 10:51 pm

Hi Gregory,

your rules seem to be doing this:

Code: Select all

Translator 1: Shift Down 1 Octave
Options: stop=true
Incoming: MIDI 90 oo pp 
Rules: 
  if oo<=59 then skip next rule
  exit rules, execute Outgoing Action
  if oo>=36 then oo=oo-12
  exit rules, execute Outgoing Action
Outgoing: MIDI 90 oo pp 
I must admit, it's easy to get lost in the logic. I think what you want to do is done by just removing the "exit" rules:

Code: Select all

Translator 1: Shift Down 1 Octave
Options: stop=true
Incoming: MIDI 90 oo pp 
Rules: 
  if oo<=59 then skip next rule
  if oo>=36 then oo=oo-12
Outgoing: MIDI 90 oo pp 
This code means: whenever the note number is in between 36 and 59, the notes are transposed down by one octave.

MT's engine is very fast and although I haven't done any formal tests, it can easily handle thousands of translator entries. Also the rules are implemented in a highly optimized fashion (they won't be parsed at runtime) so there is no need in trying to avoid them.

The next beta will feature text output (also for copy) which yields a result as above in the code blocks. However, you cannot import them back. CSV/Excel export/import is already on the internal feature request list and I'll add it to the public one. It's a very useful feature, but I'm not sure when we'll be able to implement it.

Regards,
Florian

Post Reply