## SDK question (% modulo)

Scope and XITE Development

Original topic on PlanetZ: https://forums.scopeusers.com/viewtopic.php?t=15914

####

Posted: Mon May 09, 2005 7:23 am
by Casper
Hey guys,
is there a module in the SDK that acts like a %(modulo) does in c++?
I can create it by using if statements and conditional sends , but there must be module that does this. (I think i'm overlooking the dsp-modlist)
Any help would be great!
cheers,
_________________
Casper B.

####

Posted: Thu Jun 02, 2005 4:53 am
by Casper
Divider, Multiplier,Subtracter then?
Think that's the only way.

####

Posted: Sat Aug 06, 2005 6:28 pm
by blazesboylan
Casper, I would be very interested in your findings.
I just started with the SDK today, and that's exactly what I've been bashing my head against all day.
I suspect we're after the same end -- getting 7 "true or false" values out of a MIDI signal (0-127) -- but if I'm mistaken, my fears will be completely irrelevant to you.
What I'm afraid of: I can't route from MIDI outputs to to int divider, multiplier, subtracter modules.
But like I said, I'm brand new to this. Any tips?
(Or, if you've solved the problem, a screenshot would make me love you to bits! )
Thanks very much!
Johann

####

Posted: Sun Aug 07, 2005 1:31 am
by Casper
In SDK midi is a different type of signal.
add , subt , multipliers are either sync or async. It is possible to connect sync to async. But not to connect midi to one of them. To know exactly what midivaluus are coming in. Use the Midibyte Extract module.
Out of this module comes async signals.
Statusbyte , Data1byte, Data2byte.
Then the only way to get the signals back to midi is thrue the midicontrol2value module.
But that needs some changing the bits before it outputs the right message.
I'm looking for a way to do make a 16channel midi in transform(harmonize) thingy.
cheers,
Casper

####

Posted: Sun Aug 07, 2005 11:01 am
by blazesboylan
Thanks very much Casper!
I got my MIDI cc bit extractor working this morning with the MIDI Val Extractor (under Pacakages/Circuit Design/MIDI). But I haven't come across any of the modules you mentioned... Sorry for being dumb, but where should I look for these?
Thanks & best wishes with your MIDI harmonizer!
Cheers,
Johann

####

Posted: Mon Aug 08, 2005 7:30 am
by Casper
In scope there is a window called module list. Look in this list for the modules I mentioned. The modules you found in those directories are with GUI. Thw ones in modulelist are without GUI.
cheers,
Casper

####

Posted: Mon Aug 08, 2005 7:17 pm
by blazesboylan
Thanks Casper! Much appreciated.
The output of "MIDI Control 2 Number" seems to need division by 16,777,021. What a strange number...! (2^24 = 16,777,216.) Maybe I'm using it wrong?
Anyway thanks very much for your help Casper. Cheers,
Johann

####

Posted: Tue Aug 09, 2005 3:21 am
by Casper
mm Divide ? I subtrackt it like this:
noteof status byte 128 --> -12288 + notenumber
noteon status byte 144 --> -8192 + notenumber
Additional channel add.
for noteoff 128 -127 is channel 1
for noteon 144 -143 is channel 1
add it to the above outcome.
BUT! I've not managed to get it working correctly though.
When changing the velocity value it outputs a note , and when changing the notevalue it outputs a note. So guess what happens when updating velocity and notenumber?
Right , it outputs two notes , instead of one! Now I wisch it were possible to add the velocity to the already converted statusbyte+notenumber+channel so you'd only have to use the right inlet of the module.
Anywayz I hope you'd get futher with this and you'd tell what solution you've come up with. I badly want it to get working after (1 moth of working with it)
cheers
Casper

####

Posted: Tue Aug 09, 2005 3:22 am
by Casper
it's "wish" I know

####

Posted: Thu Aug 11, 2005 11:29 am
by blazesboylan
Yeah state is really tricky with the SDK. I wish there were some kind of "synchronize" module that waits for all inputs to change before "flushing" the output. I think maybe the conditional value send (Circuit Design / Logic / Conditional) could somehow be used to do something like that... But I haven't wrapped my head around how to do it yet.
I'm afraid I have no idea what to suggest. However I have done some MIDI state machine type stuff. Not with notes or velocities, mind you, but... Even though I can't see how it would help you offhand, maybe if you take a look at it yourself you'll get ideas?!?
(Moreover if you take a look at my modules and see something that should be fixed / improved, it would be a huge help to me! )
So I've put all the modules I've made so far online. None of them have GUIs! And most of them are just helper modules.
Beware, some of them might make your CWA cards melt or something. I reloaded a project in SCOPE last night that uses the "Brass Tusk Mammoth Buses" module, and I started getting continuous C++ exceptions and error messages like "no such board ID 0" etc. I have no idea what went wrong, but no matter how many times I reloaded the project, I couldn't get it to come up, until I finally deleted my module, and then the error messages went away. I've seen a lot of SCOPE error messages, but these ones were by far the scariest I've ever seen!
Anyway with that warning in mind, feel free to check these out -- and if you feel the inclination, feedback would be very very welcome! I need to figure out what my bad habits are... Better to learn from a mentor than by cruel experience.
http://www.brasstusk.com/planetz/sdk/
(EDIT: forgot to mention, the "MIDI State Machine" modules are the ones I would check out, to see if you can use any of the same approaches for your note / velocity selecting scenario.)
Cheers & thanks for your help Casper!
Johann

####

Posted: Thu Aug 11, 2005 11:58 am
by JLS
Hi
this link not working me http://www.brasstusk.com/planetz/sdk/
.mdl download link not working
Please fix thanks

####

Posted: Thu Aug 11, 2005 12:37 pm
by blazesboylan
Bloody MIME types!
OK the ZIP files should work now.
Good luck megerov...

####

Posted: Thu Aug 11, 2005 12:45 pm
by JLS
THANKS

####

Posted: Thu Aug 11, 2005 1:11 pm
by blazesboylan
Whoops, my script buggered up the descriptions. They're back online now.

####

Posted: Thu Aug 11, 2005 3:07 pm
by Casper
Let's have a look....
I will feedback you tomorrow ok?
Any feedback from anyone would be much,
"apreacheated" , oh god I just can't come up how to spell that right now
good night all..

####

Posted: Thu Aug 11, 2005 4:07 pm
by hubird
not to bad, that '-eated' part

####

Posted: Fri Aug 12, 2005 5:22 am
by Casper
Hey Johann ,
I've looked at the "Midi State Machine" Controller and Program.
Unfortunately there isn't much to learn from these that could help us in our quest.
What I want to achieve first is a correct working circuit. This circuit gets midiinput , then has to split all databytes and assemble a new midimessage for output.
This is what I came up with:
http://www2.hku.nl/~casper0/CreamwareDe ... 20Midi.mdl
It basicly uses the midicontrol2value module.
This module can do more than just control messages. Just by adding a certain number to the notenumber will let us create that midinoteon message and noteoff messages.
This module is partly working ok , and defenately the way to do this.
If we could make this circuit failproof , then we have everything we need for a harmonizer or channelcycler , or w.e.
I found a module that can get a set value and than 'bang' that value out its outlet.
"TrCol2e" & "TrCol4e" & "TrigSW"
Not tried anything jet though.
Well ,I hope someone could perfect my circuit and ->share-< his/her findings here on Z.
p.s. somewere on Z I posted something like this too, but now this module is doing a little better.
Also I mentioned some vars that weren't correct. But just look at the controller pads if you want to what values to add for on/off message.
Beware of different midiimplementations!
My roland D10:
noteon -> Status byte 144-160
noteoff -> also Status byte 144-160 only velo 0
+ an additional message 176 123 0 wich is a sort of special control message.
Cubase:
noteon -> Status byte 144-160
noteoff -> Status byte 128-144
You can see why things would go wrong if you'd create something for roland d10 only and than try using it with cubase.
So beware...
that's it for now. Good luck and keep us informed of your findings.
Cheers,
Casper

####

Posted: Fri Aug 12, 2005 11:02 pm
by blazesboylan
Sorry I can't help Casper. Also sorry for continuing to bombard your thread with dumb questions but... What are the MIDI Voice control modules supposed to do? I can't get them to do anything.
Oh well... Good luck with your harmonizer! Cheers Casper,
Johann

####

Posted: Sat Aug 13, 2005 2:47 am
by Casper
The MVC is the module that supports voltage controlled signals in conjunction with midi.
You'd have to connect an oscilator to the freq.
An ADSR to the gate and esync.
Also need a lin/exp VCA to control amplitude. Hook up the ADSR to the VCA controller input , and the oscil to it's other input. If you'd want polyphonic voices , then connect the polyvoicemodule after the VCA. Now hook up the midi to the MVC and play your midikeybord.
If you'd want to have two ADSR that use esync you'd have to add the esync's from the two ADSR and connect that to the MVC-esync.
If you've done all, you basicly created a 1 osc synth device.
Have you ever done a modular patch ?
Same thing.
cheers,
Casper

####

Posted: Sat Aug 13, 2005 7:19 am
by Casper
"I wish there were some kind of "synchronize" module that waits for all inputs to change before "flushing" the output"
Found this module!
it's the "as S-H lev-enb" in the modulelist.
It let's you input a streamof numbers and then pick just one number out of the stream to triggering.
I was searching for this a long time.
cheers
Casper

####

Posted: Sat Aug 13, 2005 10:17 am
by blazesboylan
Very cool, thanks for the tip Casper! I'm gonna go try it out now...

####

Posted: Sun Aug 14, 2005 12:53 am
by Casper
"I wish there were some kind of "synchronize" module that waits for all inputs to change before "flushing" the output"
Found this module!
it's the "as S-H lev-enb" in the modulelist.
It let's you input a streamof numbers and then pick just one number out of the stream to triggering.
I think you found out yourselve , but it was this module "as S-H trig-enb" I wanted to mention. Almost the same...
Casper