[chuck-users] ChucK and Processing

Kassen signal.automatique at gmail.com
Sun Sep 2 11:47:16 EDT 2007


On 9/2/07, Arthur Clemens <arthur at visiblearea.com> wrote:
>
> Hi,


Hi Arthur, welcome! I'll try to help you with some of this, we'll see how
far we get. Some of it looks a bit odd to me.


>
> I have written a demo application to let Chuck be controlled through
> Processing. See my blog post: http://visiblearea.com/blog/bin/view/
> VisibleArea/ProcessingandChucK


Cool stuff.


The demo now plays audio files, but it would be easy to change this
> to let it create and play custom audio.
>
> - It should be possible to start and stop the ChucK VM in Processing,
> but no stop handlers are called at closing the app, leaving the VM in
> the air. I understand this is an issue with Java applets.


Yes, this is a bit mysterious to me. The way to go about this would be
staring ChucK using either "chuck --loop" or by feeding it a file like this;
"ChucK myfile.ck" using a file that will keep running. The ChucK VM should
exit after you give the system a command to "chuck --kill" or after the last
shred has been removed from it (if it's not set to --loop). If it doesn't
properly exit after either then that would probably be a bug. I don't see
how applets would affect this as this would be something between the OS and
ChucK, ChucK shouldn't be affected by what sort of thing send those system
calls. Strange.



- I would have liked to use 1 FilePlayer class that is loaded only
> once into the VM, but I have not found a way to do this. Either:
>     1) call 'chuck fileplayer.ck' before demo files are called causes
> errors on running the demo files that FilePlayer is unknown
>     2) for every demo file call 'chuck fileplayer.ck
> chuckdemo.ck:all:sorts:of:params' causes an error that FilePlayer is
> already in the global VM space and this will stop the demo file from
> running


I looked at your code for a bit and noticed you wrote a public class in one
file, then redefined the class in another... Maybe it would be best if I'd
review how public classes should work in ChucK.

A public class is usable by everything in the whole VM. So; in order to use
it you define it once and run this code. If the class enters the VM without
errors then it should be fine, if it isn't acessible afterwards the first
thing I'd verify in your situation is wether you aren't accidentally
starting a second instance of the ChucK VM (which wouldn't yet have this
class defined). Because of the way public classes work right now they can
only be defined once and trying to define them again will result in errors.
I'm not sure how the VM will deal with a non-public class of the same name
getting defined in other files, generally I simply wouldn't do that as it's
asking for confusion and trouble.

Beyond that it's hard for me to say what exactly is going wrong because I
don't have Processing on this computer right now and it's hard to tell
exactly what's happening in what order by just quickly reading your code.
Most likely it's just something small and silly, because of what you wrote
above I have a hunch it might have something to do with starting and
stopping the VM.


>
> - How can I use the analysis tools to create an equalizer-like display?


I'd like to know stuff like that too. The analysis stuff is very, very new,
I have yet to poke around in it. I'm planning to try to write some functions
that would deal with the arrays those produce in order to try to find the
highest peaks in the spectrum and so on but FFT on such a practical and low
level is very new to me.


Hope this was of some use to you, I'm sure we'll get to the bottom of this,
likely it's just a very minor misunderstanding.

Yours,
Kas.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20070902/e318af09/attachment.htm 


More information about the chuck-users mailing list