[chuck-users] Matlab data help

mike clemow michaelclemow at gmail.com
Wed Jun 27 11:03:00 EDT 2012


Hayden,

Your file is very simple:

[number],[number]

If I were you, I'd output (or process) this data file such that the two
values are separated by white space instead of a comma and read this data
with Chuck by using the FileIO objects (especially the tokenizer object --
see Chuck examples under the folder "io").  That will disintermediate the
entire process and remove the need for using Open Sound Control to send the
data into Chuck.

UNLESS, you mean to generate this data in realtime with Matlab and sonify
it using Chuck, in which case, you should definitely use Open Sound Control
to send the values to your Chuck script as they are generated.  (The
relevant Chuck examples will be found the folder called "osc".  Those
should tell you how to send and receive OSC messages.)

Also, if you're sending OSC from one local program to another on the same
machine, you'll probably not have to change anything with regard to your
firewall.  On the other hand, if you're sending from one machine to
another, then you might want to disable the firewall altogether in order to
test the connection.  Once you get it operating, then you should probably
put the firewall back on and change the settings to allow connectivity
through only the ports you're using.

Hope that helps!  Good luck!

Mike



http://michaelclemow.com
http://semiotech.org




On Tue, Jun 26, 2012 at 9:27 PM, Hayden Dahmm <hwdahmm at live.com> wrote:

>  Hi guys,
>
>
>
> Thank you so much for your advice!  I hadn’t realized the meaning of OSC,
> so I really appreciate you bringing this to my attention.  I’m still a
> novice at programming, so I might need some time to digest the codes and
> examples.
>
>
>
> I’m still a bit confused about how to plug OSC outputs from Matlab into
> Chuck.  I understand that I could eventually save the OSC values in a
> variable, but would I need to use UDP and take down my firewall?
>
>
>
> As was suggested, I’ve attached one of the data sets I’m working with.  It’s
> a csv with some 3,000 data points representing the stress-strain diagram
> for aluminum.  I’m hoping to put the values in the left column (strain)
> in a time array and the values in the right column (stress) in a frequency
> array.  These values were converted from matlab.
>
>
>
> Thanks again for your help!
>
>
>
> Cheers,
>
> Hayden
>
> hwdahmm at live.com
>
>
>  From: chuck-users-request at lists.cs.princeton.edu
> Subject: chuck-users Digest, Vol 83, Issue 7
> To: chuck-users at lists.cs.princeton.edu
> Date: Sun, 24 Jun 2012 12:00:02 -0400
>
> Send chuck-users mailing list submissions to
> 	chuck-users at lists.cs.princeton.edu
>
> To subscribe or unsubscribe via the World Wide Web, visit
> 	https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
> or, via email, send a message with subject or body 'help' to
> 	chuck-users-request at lists.cs.princeton.edu
>
> You can reach the person managing the list at
> 	chuck-users-owner at lists.cs.princeton.edu
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of chuck-users digest..."
>
>
>
> --Forwarded Message Attachment--
> From: witt0191 at gmail.com
> To: chuck-users at lists.cs.princeton.edu
> Date: Sun, 24 Jun 2012 01:13:29 +0100
> Subject: Re: [chuck-users] Importing Data/Using Quadraphonic Headphones
> with ChucK
>
> If the data is static another option is use to regex across the files
> and import it in as variables not pretty put does work.
>
>
> ----------
> visit me
>
> http://www.scotthewitt.co.uk
> @scotthewitt
>
> http://www.theaudiopodcast.co.uk
> http://www.ablelemon.co.uk
> http://www.inclusiveimprov.co.uk/
>
>
> On 23 June 2012 23:54, Jordan Orelli <jordanorelli at gmail.com> wrote:
> > oh, wait, .m files.  Is the data being generated by Matlab?  I haven't tried
> > it, but there's an OSC implementation for Matlab
> > here: http://opensoundcontrol.org/implementation/matlab-osc
> >
> > Depending on how the data is generated, the simplest thing to do may be to
> > just send OSC directly from Matlab to ChucK.
> >
> > -jordan
> >
> > On Saturday, June 23, 2012 at 6:45 PM, Jordan Orelli wrote:
> >
> > the documentation isn't the greatest when it comes to parsing data from
> > files, but it is possible in ChucK.
> >
> > There are some examples on performing file i/o that you can read
> > here: http://chuck.cs.princeton.edu/doc/examples/io/
> >
> > There are some examples on performing string manipulations that you can read
> > here:  http://chuck.cs.princeton.edu/doc/examples/string/
> >
> > The string examples aren't listed on the main examples page, but they can be
> > found in the examples directory that comes with the language.  It's
> > definitely worth your time to look through those examples and listen to
> > them.
> >
> > Do you have some sample files that you could post somewhere to share with
> > us?  It would be helpful to have a dozen or so data points just so we know
> > what the format is.
> >
> > How big are your data sets?  I'm curious to know if they are small enough to
> > fit in memory or if a streaming approach is required.
> >
> > If I was in your position, I would probably use some other programming
> > language to handle the data itself, format it into OSC messages, and send it
> > to ChucK through OSC, especially if the data sets are large and you can't
> > fit them in memory.  Of course, most other programming languages don't give
> > you the time guarantees that ChucK gives you, so I would probably have ChucK
> > send an OSC message to request a data point, with some other process sending
> > an OSC message back in response.  In that way, you could iterate over a
> > large dataset without ever holding it in memory.
> >
> > As an aside, do you have any recommendations on quadraphonic headphones?
> >
> > Oh and, if you're just starting out with ChucK, make sure you have test
> > headphones to test new code, and don't wear them when learning new features.
> >  I blew out the cones in a pair of headphones by accidentally setting the
> > pole position of a OnePole ugen to 0, so… be careful ;)
> >
> > -jordan
> >
> > On Saturday, June 23, 2012 at 3:26 PM, Hayden Dahmm wrote:
> >
> > Hi everyone,
> >
> >
> >
> > My name is Hayden, and I’m a blind student at Swarthmore College, where I
> > intend to major in Environmental Engineering.  Over the summer, I’m working
> > on learning ChucK so I can create auditory data displays.  I’ve made decent
> > progress so far, but I do have a couple questions.
> >
> >
> >
> > I’m struggling to import data from cmv or .m files, forcing me to enter
> > values in by hand.  Does anyone have suggestions as to how I could
> > circumvent this problem?
> >
> >
> >
> > Also, I plan to use a pair of quadraphonic headphones to interrogate spatial
> > data with a joystick or track pad.  Has anybody tried using ChucK for this
> > purpose before?  If so, I would be very interested to hear your thoughts.
> >
> >
> >
> > Thanks so much,
> >
> > Hayden
> >
> > hwdahmm at live.com
> >
> > _______________________________________________
> > chuck-users mailing list
> > chuck-users at lists.cs.princeton.edu
> > https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
> >
> >
> >
> >
> > _______________________________________________
> > chuck-users mailing list
> > chuck-users at lists.cs.princeton.edu
> > https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
> >
>
>
>
> --Forwarded Message Attachment--
> From: michaelclemow at gmail.com
> To: chuck-users at lists.cs.princeton.edu
> Date: Sat, 23 Jun 2012 21:54:30 -0400
> Subject: Re: [chuck-users] Importing Data/Using Quadraphonic Headphones
> with ChucK
>
> Format the data using something else so that it can read into chuck
> scripts using the tokenizer and the put that into variables.
>
> Jordan's got the right idea, I think.  Also, OSC is great for this
> kind of thing.  Check out pyliblo OSC library for python. python's
> great at data manipulation.
>
> Peace,
> Mike
>
> Sent from my Computing Familiar.
>
> On Jun 23, 2012, at 8:14 PM, Scott Hewitt <witt0191 at gmail.com> wrote:
>
> > If the data is static another option is use to regex across the files
> > and import it in as variables not pretty put does work.
> >
> >
> > ----------
> > visit me
> >
> > http://www.scotthewitt.co.uk
> > @scotthewitt
> >
> > http://www.theaudiopodcast.co.uk
> > http://www.ablelemon.co.uk
> > http://www.inclusiveimprov.co.uk/
> >
> >
> > On 23 June 2012 23:54, Jordan Orelli <jordanorelli at gmail.com> wrote:
> >> oh, wait, .m files.  Is the data being generated by Matlab?  I haven't tried
> >> it, but there's an OSC implementation for Matlab
> >> here: http://opensoundcontrol.org/implementation/matlab-osc
> >>
> >> Depending on how the data is generated, the simplest thing to do may be to
> >> just send OSC directly from Matlab to ChucK.
> >>
> >> -jordan
> >>
> >> On Saturday, June 23, 2012 at 6:45 PM, Jordan Orelli wrote:
> >>
> >> the documentation isn't the greatest when it comes to parsing data from
> >> files, but it is possible in ChucK.
> >>
> >> There are some examples on performing file i/o that you can read
> >> here: http://chuck.cs.princeton.edu/doc/examples/io/
> >>
> >> There are some examples on performing string manipulations that you can read
> >> here:  http://chuck.cs.princeton.edu/doc/examples/string/
> >>
> >> The string examples aren't listed on the main examples page, but they can be
> >> found in the examples directory that comes with the language.  It's
> >> definitely worth your time to look through those examples and listen to
> >> them.
> >>
> >> Do you have some sample files that you could post somewhere to share with
> >> us?  It would be helpful to have a dozen or so data points just so we know
> >> what the format is.
> >>
> >> How big are your data sets?  I'm curious to know if they are small enough to
> >> fit in memory or if a streaming approach is required.
> >>
> >> If I was in your position, I would probably use some other programming
> >> language to handle the data itself, format it into OSC messages, and send it
> >> to ChucK through OSC, especially if the data sets are large and you can't
> >> fit them in memory.  Of course, most other programming languages don't give
> >> you the time guarantees that ChucK gives you, so I would probably have ChucK
> >> send an OSC message to request a data point, with some other process sending
> >> an OSC message back in response.  In that way, you could iterate over a
> >> large dataset without ever holding it in memory.
> >>
> >> As an aside, do you have any recommendations on quadraphonic headphones?
> >>
> >> Oh and, if you're just starting out with ChucK, make sure you have test
> >> headphones to test new code, and don't wear them when learning new features.
> >>  I blew out the cones in a pair of headphones by accidentally setting the
> >> pole position of a OnePole ugen to 0, so… be careful ;)
> >>
> >> -jordan
> >>
> >> On Saturday, June 23, 2012 at 3:26 PM, Hayden Dahmm wrote:
> >>
> >> Hi everyone,
> >>
> >>
> >>
> >> My name is Hayden, and I’m a blind student at Swarthmore College, where I
> >> intend to major in Environmental Engineering.  Over the summer, I’m working
> >> on learning ChucK so I can create auditory data displays.  I’ve made decent
> >> progress so far, but I do have a couple questions.
> >>
> >>
> >>
> >> I’m struggling to import data from cmv or .m files, forcing me to enter
> >> values in by hand.  Does anyone have suggestions as to how I could
> >> circumvent this problem?
> >>
> >>
> >>
> >> Also, I plan to use a pair of quadraphonic headphones to interrogate spatial
> >> data with a joystick or track pad.  Has anybody tried using ChucK for this
> >> purpose before?  If so, I would be very interested to hear your thoughts.
> >>
> >>
> >>
> >> Thanks so much,
> >>
> >> Hayden
> >>
> >> hwdahmm at live.com
> >>
> >> _______________________________________________
> >> chuck-users mailing list
> >> chuck-users at lists.cs.princeton.edu
> >> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
> >>
> >>
> >>
> >>
> >> _______________________________________________
> >> chuck-users mailing list
> >> chuck-users at lists.cs.princeton.edu
> >> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
> >>
> > _______________________________________________
> > chuck-users mailing list
> > chuck-users at lists.cs.princeton.edu
> > https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
>
>
> _______________________________________________
> chuck-users mailing list
> chuck-users at lists.cs.princeton.edu
> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20120627/9c9574f8/attachment-0001.html>


More information about the chuck-users mailing list