electro-music.org   Dedicated to experimental electro-acoustic
and electronic music
 
 Front Page  |  Radio  |  Forum  |  Media  |  Playlists  |  Wiki
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
Realtime ChucK control
Post new topic   Reply to topic Moderators: Kassen
Page 1 of 1 [4 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
Author Message
circuitbent



Joined: Oct 10, 2010
Posts: 4
Location: Canada

PostPosted: Sun Oct 10, 2010 9:53 pm    Post subject: Realtime ChucK control
Subject description: Confused about how to get this working
Reply with quote  Mark this post and the followings unread

Hey forum! This is my first post, and I'm excited. This seems like a pretty sweet community. You'll probably see me over in the circuit bending forums (as well as here) in the future.

So here's my issue:

I'm new to ChucK, and I'm trying to use it to take care of my sound requirements for C# applications. Currently, my confusion over how to interact with a ChucK application in real time. This is probably best explained by the application I am currently writing. I am using C#, ARTags and ChucK to create a simple program that allows the modification of a sine wave depending on the movement of a tag. What I want to be able to do is be able to adjust the pitch of the sine wave in a ChucK program as it is running. How do I do this? I looked at the examples on user input that come with ChucK, but they confused me and I couldn't find any documentation to straighten me out. If anyone has specific instruction on how to go about this easily with C#, that'd be helpful too *shrug*. At this point, I am able to initialize/replace shreds in C#, but I'm still confused on how to do any sort of control of the insides of a ChucK program as it is running.

If anyone can point me to a resource about this or give me advice, that'd be sweet.

Thanks so much for your time!

(TLDR: How do I modify a ChucK program while it is running?)
Back to top
View user's profile Send private message
Antimon



Joined: Jan 18, 2005
Posts: 4145
Location: Sweden
Audio files: 373
G2 patch files: 100

PostPosted: Mon Oct 11, 2010 12:53 pm    Post subject: Reply with quote  Mark this post and the followings unread

welcome circuitbent

I'm interested in knowing how you add and remove shreds from your C# program - do you do some kind of command line call?

You communicate with a running ChucK application using some communications protocol, or a HID controller (joysticks, mouse etc). The communications protocols are MIDI and OSC. OSC in is a (usually UDP-based) network communications protocol that is tailored for performance, and sometimes seen as the heir to MIDI, though MIDI refuses to die. I found some reference to C# here: http://opensoundcontrol.org/ - maybe you can find it in other places as well. If you're savvy in networks programming it isn't that hard to brew your own after reading the OSC spec. If you can find a MIDI library for C# you might be able to make use of that as well.

You can't modify a running ChucK program as such, but you can add and remove programs/shreds from the ChucK runtime/VM on the fly, by using chuck + and chuck -. Since you're using C# I guess your in Microsoft land, if you used a Mac you could have used the MiniAudicle for this I think.

I'd recommend having a look at the examples included in the ChucK package if you want to learn how OSC works in ChucK. It's easy enough to set up the OSC input for controlling the pitch of a sine wave, but getting over the OSC-in-C# threshold might be tricky. If you want some more specific pointers, just say the word. Smile

/Stefan

_________________
Antimon's Window
@soundcloud @Flattr home - you can't explain music
Back to top
View user's profile Send private message Visit poster's website
circuitbent



Joined: Oct 10, 2010
Posts: 4
Location: Canada

PostPosted: Sat Oct 23, 2010 7:08 pm    Post subject: Reply with quote  Mark this post and the followings unread

Hey Antimon! Thanks a lot for the advice! Sorry for the slow reply, grad school eats people alive.

I'm using command line calls for the adding and removing of shreds as well as everything else when it comes to talking to ChucK. An example one (that doesn't pop up a command line window) goes something like this:
Code:
ProcessStartInfo loop1 = new ProcessStartInfo();
loop1.FileName = "chuck"; //not actually the "filename" but the process name
loop1.Arguments = @"ChucKs\loop1again.ck";
loop1.WindowStyle = ProcessWindowStyle.Hidden;
Process process1 = new Process();
process1.StartInfo = loop1;
process1.Start();


I was able to get OSC working with a bit of help from a guy in my lab. He pointed me to the Bespoke OSC library, which made this pretty easy. The main reason I'm using C# is because I am interfacing ChucK with a Vicon motion tracking system, and the in-house libraries for that are all written in C#. Its pretty exciting stuff.

I'll post here again with more questions or with a video of the completed interface!
Back to top
View user's profile Send private message
Antimon



Joined: Jan 18, 2005
Posts: 4145
Location: Sweden
Audio files: 373
G2 patch files: 100

PostPosted: Sun Oct 24, 2010 7:06 am    Post subject: Reply with quote  Mark this post and the followings unread

Cool you got it working. Smile Sounds like an interesting project.
_________________
Antimon's Window
@soundcloud @Flattr home - you can't explain music
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 [4 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
Log in
Username:     Password:      Log me on automatically each visit    


Forum with support of Syndicator RSS
Powered by phpBB © 2001, 2005 phpBB Group
Copyright © 2003 through 2026 by electro-music.org