|
Post by MrB on Sept 7, 2018 16:33:20 GMT
Hi there I am a bit lost at the moment. Trying to figure all this stuff out. I am a developer for loooots of years but this is bugging me...so sorry. I achieved to send a volume parameter (CC) via this: #SND B(channel1) (CC)07[Volume in hex] SND B1 07 10 Is it possible to read the actual volume if a note is played? Like reading that same B1 register? Thanks in advance!
|
|
nic
Soapbox Supremo
Troublemaker
Press any key to continue
Posts: 2,011
|
Post by nic on Sept 7, 2018 16:42:46 GMT
Hi MrB, The volume of a note is part of the 'note on' MIDI message (the velocity). Say you want to show the note velocity of each note played as it passes through in the StreamByter left label: IF MT == 90 IF M2 > 0 SET LB0 M2 +L END ENDA really good MIDI spec is hereRegards, Nic.
|
|
|
Post by MrB on Sept 7, 2018 17:00:21 GMT
Hoped for you to reply Thanks for this. I am getting an error where the label should be set - i have to remove the „+L“ Using StreamByter inside AUM here at the moment. That reads the velocity, getting 7F as max - which is perfect. Looking inside that spec there to find anything regarding the volume...
|
|
nic
Soapbox Supremo
Troublemaker
Press any key to continue
Posts: 2,011
|
Post by nic on Sept 7, 2018 17:07:42 GMT
Uuugh, that was meant to be a +D (show velocity in decimal)
|
|
|
Post by MrB on Sept 7, 2018 17:08:00 GMT
That is the reference i was looking at. I can not, well my brain can not, map M2 to velocity. I am starring at the table „Summary of Status bytes“ and this example: 0x90 0x3C 0x7F Note On for C4, max velocity
M0: 90= note on M1: 3c=C4 M2: 7f=value for velocity
Where can i find a table for the construction of that string on that side... maybe i am just stupid atm...
|
|
nic
Soapbox Supremo
Troublemaker
Press any key to continue
Posts: 2,011
|
Post by nic on Sept 7, 2018 17:10:23 GMT
Tell me what you want to do and I will try and explain (assuming it's possible). I have a little familiarity with the MIDI spec ;-)
Regards, Nic.
|
|
|
Post by MrB on Sept 7, 2018 17:22:14 GMT
I just started today with StreamByter - i have an idea what i want to do but i am just trying to get „warmed up“ with the syntax. And i guess it is not helpful never had something to do with MIDI - codewise. I just try to understand what data is send inside/into StreamByter and what i can get where to do stuff with it. I am trying to understand the byte-orders at the moment. Like this: IF MT == B0 # it's a CC Where is written that B0 (176) defines a CC? Where are the type-definitions - because MT = Message Type, right? Is this the note structure 9n : Note On 3 bytes 1001nnnn , 0kkkkkkk , 0vvvvvvv M0? 1001nnnn Note On status byte; nnnn (0-15) = MIDI channel 1-16 M1? kkkkkkk Note number (0-127) M2? vvvvvvv Key On (attack) velocity (1-127, soft-loud); 0 = Note Off; Defaults to 64 in the absence of velocity sensors That would fit M2 to velocity. Leaves the question where is that CC definition for B0 Kind regards, Frank
|
|
nic
Soapbox Supremo
Troublemaker
Press any key to continue
Posts: 2,011
|
Post by nic on Sept 7, 2018 17:59:57 GMT
Hi Frank, OK, briefly: When a MIDI message is received by the Stream Byter it passes through the rules you have coded and the message itself is in a variable array M which will usually be 2 or 3 bytes. You can refer to the M array in (most) rules. The data in the M array consists of the actual bytes in the MIDI spec that I linked to already. The first byte of the current MIDI message is referred as M0, the second byte, M1 and the third byte M2. So, a standard note on message looks like 90 3C 40 in hex (if you were capturing with a monitor): 9 - means note on 0 - means MIDI channel 1 3C - means the middle C note (see this table for note to hex mapping) 40 - means the velocity of the note (in this case 64 in decimal) Unless you specifically block the current message, it will also exit the Stream Byter, but you could change it on the way. Let's say we want to 'fix' all note velocities to decimal 100 (hex 64) on MIDI channel 2 only: IF M0 == 91 # message is a note event on channel 2 IF M2 > 0 # message velocity is not zero ASS M2 = 64 # rewrite velocity of message END ENDIf you want to generate your own events, you can use the SND rule, so let's say we now wish to clone all those incoming notes to channel 3 with that fixed velocity, then you could do something like: IF M0 == 91 # message is a note event on channel 2 IF M2 > 0 # message velocity is not zero SND 92 M1 64 # send new msg on chan 3 with fixed velocity END ENDRegards, Nic.
|
|
|
Post by MrB on Sept 7, 2018 18:04:59 GMT
You are very helpful Nic. Thanks for that! I try to mess around for longer - i want to achieve my idea I let you know if i get it or throw it away. Another last (at least for today) thing - I am trying to assign a random note. Can i not assign a variable as a note like this: ASS L0 = R77 N0 XX = XX L0 I get an error in that last line. R77 should create valid notes from hex 0 to hex 77.
|
|
|
Post by MrB on Sept 7, 2018 18:08:21 GMT
Ah, i guess it falls under this restriction: Variables cannot be used in Stream Byter 1 rules.
Do i have to create a send?
|
|
|
Post by MrB on Sept 7, 2018 18:13:27 GMT
Ha. Have to build something like: IF MT == 90 #N0 XX = XX L0 SND M0 L0 64 END IF MT == 80 N0 XX = XX XX +B END At the moment they keep playing - have to stop them somehow
|
|
|
Post by MrB on Sept 7, 2018 18:33:07 GMT
Sorry. The played notes are random but they do not stop - they keep on playing. I have no clue why they don’t just play the time the key is pressed.
|
|
nic
Soapbox Supremo
Troublemaker
Press any key to continue
Posts: 2,011
|
Post by nic on Sept 7, 2018 18:42:19 GMT
Hi Frank,
Yeah, you can't mix array variables in the old Stream Byter 1 pattern matching rules.
To send a random note, you need to send the note off as well, otherwise you will get a stuck note:
ASS I0 = R77 # get a random note number SND 90 I0 40 # start sounding the note SND 80 I0 00 +D1000 # stop sounding the note after 1 second
Regards, Nic.
|
|
|
Post by MrB on Sept 7, 2018 18:53:36 GMT
Nic, thanks for your help - it brought me a lot further today!! Sending the Note off on MT=80 helped to solve this. I am slowly getting forward...but i think i can do what i have planned...
Thanks again! Lovely to see a dev being so active and responseful.
Sorry for being annoying and thanks for the hints!
Kind regards, Frank
|
|
mrb
Converser
Posts: 9
|
Post by mrb on Sept 7, 2018 20:23:24 GMT
After such great help i shall have registered. Done
|
|