[chuck-users] Embedded ChucK

Jack Atherton lja at ccrma.stanford.edu
Fri Aug 16 13:22:45 EDT 2019


There isn't great documentation like those projects have, but if you want
to embed ChucK then you just need to include all of the C++ files in the
src/core folder. To use ChucK, make a new ChucK object and then all the
functions you need to call are in chuck.h:
https://github.com/ccrma/chuck/blob/master/src/core/chuck.h

A typical sequence might look something like this:

// create
the_chuck = new ChucK();

// set params (see full list at top of chuck.h)
the_chuck->setParam( CHUCK_PARAM_SAMPLE_RATE, (t_CKINT) MY_SRATE );
the_chuck->setParam( CHUCK_PARAM_INPUT_CHANNELS, (t_CKINT) MY_CHANNELS );
the_chuck->setParam( CHUCK_PARAM_OUTPUT_CHANNELS, (t_CKINT) MY_CHANNELS );

// init
the_chuck->init();

// start
the_chuck->start();

...
// add code
the_chuck->compileCode( "SinOsc foo => dac; while(true) { 2::second => now;
}", "" );
// or
the_chuck->compileFile( "myChuckProgram.ck", "my:list:of:args:2:3.5" );

...
// in audio callback
the_chuck->run( inBuffer, outBuffer, numFrames );


...
// elsewhere in your application, might want to use global variables
the_chuck->setGlobalInt( "roughness", 2 );
the_chuck->broadcastGlobalEvent( "playTheSound" );


On Fri, Aug 16, 2019 at 4:07 AM Mario Buoninfante <
mario.buoninfante at gmail.com> wrote:

> Hi,
>
> Do we have anything like ctcsound (
> https://csound.com/docs/ctcsound/ctcsound-API.html) or libpd (
> http://libpd.cc/) for ChucK.
> I know changes have been made in the latest release, I was just wondering
> if there's anything to look at out there.
>
> Cheers,
> Mario
> _______________________________________________
> 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/20190816/e9e1fed9/attachment.html>


More information about the chuck-users mailing list