[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [sc-users] Literal table ??



I've been trying to combine Alberto's patch with my
prexisting patch, except the one part of his that I
can't get to work is reading all the sound file
headers as a group.

this is Alberto's example:
 soundfiles = soundfilenames.collect({ arg filename;
 	var path, file;
 	path = foldername ++ filename;
 	file = SoundFile.new;
	if (file.readHeader(path) and: {  file.preload; },
 		{ file },
 			// complain if file is missing:
 		{	"WARNING! File:" + path + "not found!").postcln;
 			nil

it makes sense, but I just can't get it to work.
I get an error "readHeader primitive failed - path not
string"

For each sound file I'm playing in my patch, I need to
call the file's length.  I can't read the sound file
headers individually, because I'm using more that 256
literals.

Any ideas what I'm doing wrong?


--- Alberto de Campo <adc@xxxxxx> wrote:
> >Alberto,
> >I've run into the same problem (I want 832 files),
> and
> >like the looks of your solution, but can't seem to
> get
> >it to work.  Could you or someone else expand on
> this
> >a bit more?  Not sure what exactly you mean by
> legal
> >SC code.
> 
> sure.
> when you copy all the filenames in a folder in the
> finder,
> you get a list like this:
> 
> floating_1
> bohemianRap
> lastTrainToGeorgia
> 
> with bbedit, (find and replace all), you can
> semi-automatically
> convert that to:
> 
> #[		// # makes it count as just one literal.
> "floating_1",
> "bohemian rap",
> // etc etc etc...
> "lastTrainToGeorgia"
> ];
> 
> save that as a file called e.g. soundfiles.text,
> then you can call and execute that file as code:
> 
> (
> 
> var soundfilenames, foldername = ":Sounds:",
> soundfiles;
> 
> 		// legal sc code list of file names.
> soundfilenames =
> this.executeFile(":Sounds:soundfiles.text");
> 
> soundfiles = soundfilenames.collect({ arg filename;
> 	var path, file;
> 	path = foldername ++ filename;
> 	file = SoundFile.new;
> 	if (file.readHeader(path) and: {  file.preload; },
> 		{ file },
> 			// complain if file is missing:
> 		{	"WARNING! File:" + path + "not found!").postcln;
> 			nil
> 		}
> 	);
> });
> 
> // and do whatever you do with your soundfiles.
> 
> Synth.play({
> 	OverlapTexture.ar({
> 		DiskIn.ar(soundfiles.choose)
> 	}, 2);
> })
> )
> 
> hope that is clear enough,
> best,
> adc
> -- 
> --
> Alberto de Campo
> ACADEMY OF MEDIA ARTS
> Peter-Welter-Platz 2
> D - 50676 Cologne / Germany
> phone  : ++49-(0)221-20189-141
> e-mail : adc@xxxxxx
> --
> _______________________________________________
> sc-users mailing list
> sc-users@xxxxxxxxxxxxxxx
> http://www.create.ucsb.edu/mailman/listinfo/sc-users


__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com