[chuck-users] String concatenation

Norman Gray norman at astro.gla.ac.uk
Thu Oct 5 12:43:58 EDT 2006


Greetings.

Is there any support for building up strings within ChucK?

I'd like to do something like

     WvOut ofile;
     0 => int idx;
     "out" + idx + ".aif" => ofile.aifFilename;

I'm trying to produce a script which will split an input file into  
short sections.  I think I can see how to do most of it, but can't  
work out how to generate file names.

The "string" type is mentioned in passing in the 'type' section of  
the manual, but with no indication of what methods it might have (I  
tried "idx => ofile.append", but...).  Googling for 'string' at  
chuck.csc.princeton.edu doesn't indicate that I've missed anything  
major.  And I can't spot anything in the FAQ at <http:// 
wiki.cs.princeton.edu/index.php/ChucK>, other than a `medium  
priority' note `string operations' in <http://wiki.cs.princeton.edu/ 
index.php/ChucK/Dev/DoThisNow>.  Does this latter note mean that this  
isn't possible, but might be soon?

By the way, I'm doing the split by elaborating on

   SndBuf ibuf;
   "test.aif" => ibuf.read;
   0 => ibuf.pos;

   WvOut ofile;
   "out0.aif" => ofile.aifFilename;

   ibuf => ofile => blackhole;
   2::second => now;

   ofile.closeFile;

Does that look reasonable, or am I misunderstanding something (on a  
few hours' acquaintance with ChucK)?

Thanks for any pointers.

Norman


-- 
------------------------------------------------------------------------ 
----
Norman Gray  /  http://nxg.me.uk
eurovotech.org  /  University of Leicester, UK





More information about the chuck-users mailing list