|
Post by richtowns on Sept 25, 2017 3:24:25 GMT
Ive just dl your cool app. Ive been trying some strange stuff out and have a couple of observations and questions.
my first project was going to be make a relative to absolute cc knob mapper. The idea is that a controller will generate only 1, 2, 3 etc or 127, 126, 125 and that these two sets of values will increment and decrement a cc value. Im not sure how to do this yet but Im getting there. I think everything is necessary. Love the wildcards etc available in the stream byte module.
ok so my observation is that I went on to try and make a module that would generate notes and or cc input and thought I could do it using recursion feeding back snd commands to a module after modifying. I dont know if this is allowed but ....
when I couldnt get the +I command to do what I expected I connected the output to the input from the stream byte module and it crashed. I had to reinstall the app after that stupid move because every time I openned the app after that it crashed again. Obviously I should connect the output to the input! Just a fyi, maybe you can stop it being allowed if it crashed the app or not autoload the last project by default.
im a bit confused about now the +I option works. Can you give a couple of examples please.
also how would one go about making midi note feedback/echo for example.
i havent seen too many examples of how to code in in the stream byte. Any links to resources would be great
nice app, thank you. Richtown
|
|
nic
Soapbox Supremo
Troublemaker
Press any key to continue
Posts: 2,011
|
Post by nic on Sept 25, 2017 12:57:08 GMT
Hi richtowns , I'd be careful with recursion! If you create an infinitie MIDI Loop, MidiFire will detect this though. Let's look at how to increment one CC with another. Let's say the CC to be incremented is CC 80 (hex 50) and you use CC 81 (hex 51) to increment by the value set in CC 81. We will keep track of the current value in CC80 in local variable L0. IF LOAD ASS L0 = 0 # initialise L0 to 0 END
# only work with CC messages IF M0 >= B0 IF M0 <= BF
# retain current CC 80 value # if it happens to come in IF M1 == 50 ASS L0 = M2 END
# process increment request IF M1 == 51 MAT L0 = L0 + M2 # increment L0 by CC81 value SND M0 50 L0 # send CC80 with L0 as value END
END ENDNow, the +I flag is a bit tricky. When you SND with +I, the message specified is injected into MidiFire as if it arrived externally on a MIDI source (input). Which input will depend on the context of the SND. If the SND +I is inside an IF LOAD then the message will be injected as if it was received on the 'MidiFire' virtual input. If the SND +I is generated due to an incoming message, then the SND message is injected as if it was received on the same MIDI input as the incoming message. You could make 2 tap a MIDI echo in a really simple (Stream Byter I) fashion: 9X 01-7F = XX +C +D200 # clone note on, delay 200ms 9X 01-7F = 8X +C +D300 # clone note off, 100ms after on 9X 01-7F = XX +C +D400 # clone note on, delay 200ms 9X 01-7F = 8X +C +D500 # clone note off, 100ms after onOf course, you're going to ask about reducing the velocity with each 'tap' :-) For that, we need to do it in Stream Byter II: IF M0 >= 90 IF M0 <= 9F IF M1 > 0 # note on messages only # 1st tap, velocity less 16 MAT L0 = M2 - 10 SND M0 M1 L0 +D200 SND M0 00 00 +D300 # 2nd tap, velocity less 32 MAT L0 = M2 - 20 SND M0 M1 L0 +D400 SND M0 00 00 +D500 END ENDENDI will create some tutorials when I can (after bugs fixed) but for now, just ask specific questions here (or you could look at the code behind some of the modules in the 'Scenes Club')
Regards, Nic.
|
|
|
Post by richtowns on Sept 25, 2017 12:58:20 GMT
Ok, so I see now that there actually are some nice examples in the online help. This one is useful for me, recursion and that helpful +I option.
Unfortunately, it doesnt seem to work! Place the code in the stream byter then connect an event monitor and install the rules and nothing happens. But after removing the +I options in the code the first two note sends get sent to the event viewer. Looks like +I needs some explaining/fixin.
Great app, I have high hopes for doing some midi trickery.
# when loaded play C3 3 times (looping) IF LOAD ASS L0 = 3 SND 90 3C 60 +I SND 80 3C 00 +D500 +I END IF L0 > 0 SND 90 3C 60 +I +D1000 SND 80 3C 00 +I +D1500 END IF M0 == 90 MAT L0 = L0 - 1 END
Unfortunately it doesnt generate any output!
|
|
|
Post by richtowns on Sept 25, 2017 13:03:01 GMT
Ok, looks like we just replied at the same time. It will take me a little while to digest your message. Just spotted the scenes club. Very cool. This is perfect for me. Great app. Im off to give you a review on the app store. Thanks rich
|
|
nic
Soapbox Supremo
Troublemaker
Press any key to continue
Posts: 2,011
|
Post by nic on Sept 25, 2017 13:06:57 GMT
Hi richtowns , With your example above, the injects inside the 'IF LOAD' block will appear on the 'MidiFire' virtual source. In order to see those +I events, that port must be on the canvas. Make sure it is there and connect up an event monitor to it and you should see those events whenever you press the 'Install Rules' button or load in a scene with that setup. If you remove the +I from those SND commands, those events will come out of the module itself. Regards, Nic.
|
|
|
Post by richtowns on Sept 25, 2017 13:19:15 GMT
Thanks, Nic. Yes, with the midifire virtual port on the canvas and connected to the stream byte input, it is working.
One more question, is there a way to display variables values?
|
|
nic
Soapbox Supremo
Troublemaker
Press any key to continue
Posts: 2,011
|
Post by nic on Sept 25, 2017 13:56:41 GMT
Hi richtowns, Only way to display variable value is to set one of the block labels with its value. I use this all the time when debugging my shonky rules: SET LB0 L0 +D will display the current value of variable L0 (in decimal) on the left hand block label. (use LB1 for right hand label) you can also use +N to show MIDI note (assuming variable is a MIDI note number) or S<some text> to display 3 characters of text; also useful. Regards, Nic.
|
|
|
Post by richtowns on Sept 25, 2017 14:11:40 GMT
Ok, spoke to soon. But its a different issue. Using this simple piece of code the condition L0 > 0, seems to always be true even though the variable is decremented. The code never exits and this seems to hang the app, due to too many midi messages I imagine
This is my setup MidiFire midi source, connected to Stream Byter with the play C3 3 time example, connected to Event Monitor.
Click Install Rule and the program runs and outputs midi ons and offs but stops and then the midi fire input instead of flashing yellow, just stays yellow and the app becomes unresponsive.
Note. I did some troubleshooting and using a start value of L0 of 60 and a conditional value of 5e it worked as expected. Looks like a little bug to me
I also viewed the variable L0 by making it the velocity value with the original example and the value of L0 was being decrmented it's just that the condition L0 > 0 seems to be always true even when L0 is below zero! Ill leave this one for you to look at. Im off to play with feedback.
|
|
nic
Soapbox Supremo
Troublemaker
Press any key to continue
Posts: 2,011
|
Post by nic on Sept 26, 2017 11:28:17 GMT
Hi richtowns, OK, I've looked into this some more. It's not a bug in the Stream Byter - it's just a really bad example for three reasons: 1. It actually repeats 3 times so plays 4 notes (that's the simple one) 2. The IF L0 > 0 is true if L0 is any value but zero as in the compare it's comparing unsigned integers so -1 is actually 65535 3. And the worst is we issue the note on/off pair each time we see *any* incoming event so note offs also generate the pair to be sent and we get nasty recursion. So, here is the 'corrected' code: # when loaded play C3 3 times (looping) IF LOAD ASS L0 = 2 SND 90 3C 40 +I SND 80 3C 00 +D500 +I END IF M0 == 90 IF L0 > 0 SND 90 3C 40 +I +D1000 SND 80 3C 00 +I +D1500 END IF L0 != 0 MAT L0 = L0 - 1 END ENDThat worked for me. I'll update the example in the help file. :-) Regards, Nic.
|
|
|
Post by richtowns on Sept 26, 2017 14:21:09 GMT
Hi Nic,
Great explanation. Im really enjoying playing with midifire. Well done on a great app
|
|