electro-music.com   Dedicated to experimental electro-acoustic
and electronic music
 
    Front Page  |  Radio
 |  Media  |  Forum  |  Wiki  |  Links
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
How to load multiple sndbuf
Post new topic   Reply to topic Moderators: Kassen
Page 1 of 1 [2 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
Author Message
rylanschneider



Joined: Jul 31, 2022
Posts: 1
Location: usa

PostPosted: Sun Jul 31, 2022 8:07 am    Post subject: How to load multiple sndbuf Reply with quote  Mark this post and the followings unread

First post!

I've been trying out chuck and in the examples for sndbuf, a fully qualified pathname is required to read in a sound file. Is that supposed to be the case?

I've also got this idea for storing a bunch of files in various folders, based on some kind of group similarity and having chuck randomly pick one to play. But i can't seem to find any native file handling/string handling capability with chuck. Is there any way around it?

The only other way i can think of, is to use perl or bash and randomly feed this to chuck. But this kind of sucks because if you want to attach a midi controller to alter parameters, this won't work because there's no way to marshal all sounds to go through one chuck program.

Any thoughts????
Back to top
View user's profile Send private message
Borogove



Joined: Dec 11, 2022
Posts: 1
Location: California

PostPosted: Sun Dec 11, 2022 8:47 pm    Post subject: Reply with quote  Mark this post and the followings unread

I couldn't find a way of processing the contents of a directory/folder, but by naming a number of samples similarly with a sequential numerical ID, I was able to assemble random drum sets, e.g.:

fun string getSamplePath( string basePath, int numSamples )
{
Math.random2(1,numSamples) => int index;
Std.itoa(index) => string indexStr;
return basePath + indexStr + ".wav";
}

getSamplePath( me.dir() + "samples/Drench/KICK/KIK ", 65 ) => string
kickPath;
getSamplePath( me.dir() + "samples/Drench/SNARE/SNR ", 51 ) => string snarePath;
getSamplePath( me.dir() + "samples/Drench/HAT/HAT ", 37 ) => string hat1Path;

This expects that in the named path, you'll have a series of files named "KIK1.wav", "KIK2.wav" ... "KIK65.wav", and so forth. Ugly, but it worked for my purposes. The ability to read a directory into an array of strings would be very useful.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic Moderators: Kassen
Page 1 of 1 [2 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


Forum with support of Syndicator RSS
Powered by phpBB © 2001, 2005 phpBB Group
Copyright © 2003 through 2009 by electro-music.com - Conditions Of Use