electro-music.com   Dedicated to experimental electro-acoustic
and electronic music
 
    Front Page  |  Articles  |  Radio
 |  Media  |  Forum  |  Wiki  |  Links  |  Store
Forum with support of Syndicator RSS
 FAQFAQ   CalendarCalendar   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   LinksLinks
 RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in  Chat RoomChat Room 
 Forum index » DIY Hardware and Software » ChucK programming language
midi data in chucK
Post new topic   Reply to topic Moderators: Kassen
Page 1 of 1 [5 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
Author Message
majutsu



Joined: Jun 18, 2006
Posts: 151
Location: New York
Audio files: 1

PostPosted: Sun Aug 13, 2006 3:51 pm    Post subject: midi data in chucK Reply with quote  Mark this post and the followings unread

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
View user's profile Send private message
Kassen
Janitor
Janitor


Joined: Jul 06, 2004
Posts: 7678
Location: The Hague, NL
G2 patch files: 3

PostPosted: Sun Aug 13, 2006 4:40 pm    Post subject: Reply with quote  Mark this post and the followings unread

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
View user's profile Send private message Send e-mail Visit poster's website
audiocommander



Joined: Aug 13, 2006
Posts: 2
Location: Nürnberg, Germany

PostPosted: Sun Aug 13, 2006 5:52 pm    Post subject: sending 2byte messages? Reply with quote  Mark this post and the followings unread

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
View user's profile Send private message Visit poster's website
Kassen
Janitor
Janitor


Joined: Jul 06, 2004
Posts: 7678
Location: The Hague, NL
G2 patch files: 3

PostPosted: Sun Aug 13, 2006 6:43 pm    Post subject: Reply with quote  Mark this post and the followings unread

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
View user's profile Send private message Send e-mail Visit poster's website
audiocommander



Joined: Aug 13, 2006
Posts: 2
Location: Nürnberg, Germany

PostPosted: Sun Aug 13, 2006 6:52 pm    Post subject: Reply with quote  Mark this post and the followings unread

thanks for your answer Smile

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
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic Moderators: Kassen
Page 1 of 1 [5 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
 Forum index » DIY Hardware and Software » ChucK programming language
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Forum with support of Syndicator RSS
Powered by phpBB © 2001, 2005 phpBB Group
Copyright © 2003 through 2009 by electro-music.com - Conditions Of Use