Author |
Message |
majutsu

Joined: Jun 18, 2006 Posts: 151 Location: New York
Audio files: 1
|
Posted: Sun Aug 13, 2006 3:51 pm Post subject:
midi data in chucK |
 |
|
I found the page 22 about midi in the manual to be very confusing and disorganized.
This code identifies the opened device opened, then prints out the midi data received. I found it much more enlightening to use this sample code rather than that given in the manual. It may be of help to others struggling to start out in ChucK, because the "now" concept is a little hard to grasp. But after going through this code, "now" and event scheduling (critical points in ChucK) are, in my opinion, easier to understand. Comes from the swiki
Code: | // number of the device to open (see: chuck --probe)
0 => int device;
// the midi event
MidiIn min;
// the message for retrieving data
MidiMsg msg;
// open the device
if( !min.open( device ) ) me.exit();
// print out device that was opened
<<<MIDI> ", min.name() >>>;
// infinite time-loop
while( true )
{
// wait on the event 'min'
min => now;
// get the message(s)
while( min.recv(msg) )
{
// print out midi message
<<<msg>>>;
}
}
|
I might come back and edit this post to explain it for noobs like me. But it's also enlightening on its own to start with a basic midi controller. Feel free to add any other tricks, tips, code, or ideas about midi in this thread so these references can be gathered together. _________________ All phenomena are atoms in association and dissociation. |
|
Back to top
|
|
 |
Kassen
Janitor


Joined: Jul 06, 2004 Posts: 7678 Location: The Hague, NL
G2 patch files: 3
|
Posted: Sun Aug 13, 2006 4:40 pm Post subject:
|
 |
|
Yes, that example file is a realy good one to explain what's going on as well as figure out exactly what MIDI some controler is sending for diagnostic purposes.
There are similar examples (that just print to the schreen) for the keyboard and for joypads. Especially the keyboard one is handy because it can be quite unpredictable what key sends what numbers.
For a long time there was no manual at all and the only real way to get to grips with ChucK was to try to understand the examples, I still think it's one of the best ways to learn the basics.
A lot of fun can be had taking a example file that demonstrates some audio stuff, pasting in a example file for one of the interfaces and lining up theoutput of the interface stuf with the modulation inputs of the audio stuff. This is easy and imidiately gratifying fun while you'll also learn a lot without much efford.
If somehing suddenly behaves unpredictably you can always look up the theory in the manual (at least that's what I did). _________________ Kassen |
|
Back to top
|
|
 |
audiocommander

Joined: Aug 13, 2006 Posts: 2 Location: Nürnberg, Germany
|
Posted: Sun Aug 13, 2006 5:52 pm Post subject:
sending 2byte messages? |
 |
|
Hi!
great that there is a (searchable) forum now!
I wonder, if it's possible to send 2-byte messages only – as it's needed for a PRG-CH for example
I just found examples with 3-byte messages, that always send one invalid 3rd byte, which confuses some machines...
couldn't find anything about in the docs/wiki either?
cheers,
Michael |
|
Back to top
|
|
 |
Kassen
Janitor


Joined: Jul 06, 2004 Posts: 7678 Location: The Hague, NL
G2 patch files: 3
|
Posted: Sun Aug 13, 2006 6:43 pm Post subject:
|
 |
|
Welcome!
There was some discusion on this on the list, I myself would like MIDI clock signals.
These things should be on the "to do" list right now. _________________ Kassen |
|
Back to top
|
|
 |
audiocommander

Joined: Aug 13, 2006 Posts: 2 Location: Nürnberg, Germany
|
Posted: Sun Aug 13, 2006 6:52 pm Post subject:
|
 |
|
thanks for your answer
this would be really great if the MIDI capabilities would be increased somewhen; as I found it hard to find simple applications that can easily send some messages to devices (incl. sysex)...
best regards,
Michael |
|
Back to top
|
|
 |
|