hundredrabbits / Orca-c

Live Programming Environment(C Port)
http://wiki.xxiivv.com/orca
MIT License
482 stars 48 forks source link

Wrong midi octaves #70

Closed a-atamian closed 3 years ago

a-atamian commented 3 years ago

Hi, It seems that the midi messages are offsets by -2 octaves. When I send a :13C it triggers the C1 note.

Tested with a raspberry Pi

cancel commented 3 years ago

Many MIDI piano conventions treat MIDI note number 60 as middle C. On Roland pianos this will probably be C4. And they also have octaves numbered 0, and maybe -1 and -2. Let's say you want change the design of Orca so that the text :13C sends a note value that your digital piano treats as C3. There's no way to enter negative numbers in Orca. And an octave of 0 is reserved for "no note" with the : operator. This would make the notes within octaves 0 and below, as named by your MIDI device, inaccessible to Orca. I think you can see why this is a bad idea.

Orca isn't an instrument itself and doesn't have a concept of middle C. Yamaha pianos and MIDI devices will treat note number 60 as C3 instead of C4. Uh oh.

If you need the note values to be higher in Orca, you can just change the numeric value you use for the octave in your code.

a-atamian commented 3 years ago

Thanks for your explanations, this makes sense. However I would at least expect the same behaviour with every versions of Orca, as the Electron version does not seems to use the same scale. It is pretty anoying when switching between the two...

cancel commented 3 years ago

You can edit the source code pretty easily.

Add an extra line around here: https://github.com/hundredrabbits/Orca-c/blob/master/sim.c#L285

Change it to be like this:

  if (octave_num == 0)
    return;
  octave_num += 2;
  if (octave_num > 9)
    octave_num = 9;