Event + access to symbols and items

hello!

I am blind and operating my Apple system with VoiceOver. This way, SC help system and this forum are unfortunately not very accessible to me.

I have a project with many audio files organised in a folder containing 1 level with subfolders of .wav files.

this code is based on code of one of Eli Fieldsteels tutorials.


(

var path, subfolders;

b = ();

path = PathName(thisProcess.nowExecutingPath).parentPath;

subfolders = PathName(path ++ "projectSamples").entries;

subfolders.do({

arg dir;

var bufArray;

bufArray = dir.entries.collect({

arg file;

Buffer.read(s, file.fullPath)

});

b[dir.folderName.asSymbol] = bufArray;

});

)

there are also related SynthDefs and Pbinds. they all work well, when accessing buffers via symbol .

I need to use a step further beyond:

I can access the number of buffers contained in a symbol, but not the bufnums itself, that are related to this symbol (\a has i.e. 23 buffers, but which numbers on the Server?).

if a specific buffer is used from within the Pbind, I have no access to its numFrames or duration (I know a method to get access via \index and a Pfunc, but this does not work with an „event“ structure as in this case -

(

…

\index, Pxrand((0.. (~numBuffers - 1)), inf),

\bufnum, Pfunc{arg ev; ~samples[ev.index]},

\startPos, Pwhite(0, Pfunc{arg ev; ~samples[ev.index].numFrames}, inf),

…

)

as I need to know exact frame numbers and durations for start- and endpositions for sample playback).

and lastly for reasons of convenience: using an event works well and fast, but using the buffers via symbols mean, that I have to type in all symbol names correctly into the Pbind, in order to access them. this is a pain for me, as the orientation within large Pbinds or SynthDefs using VoiceOver is neither fast nor convenient. also using a structure with different subfolders containing different samples mean, that all code has to be rewritten, in case of names and number of subfolders change. is there a language based method, that allows names of symbols or indices of that symbols to be attached to a Pbind without typing them in by hand?

or is there a structure, that manages these needs better, than an event does, but also allows to import a folder containing subfolders with audio files without preparing them priorly in a specific way?

I would be very pleased receiving any ideas!

thank you in advance for your assistance!

best regards from Austria

Rainer

some things that might help -

if you have an array of buffers b you can make an array of the framesizes:

~frameSizes = b.collect( _.frameSize )

you can also make an Event with Arrays stored under each key you are interested in like this perhaps:

(
c = ();
[\bufnum, \numFrames].do{|key|
	c.put(key,List.new);
	b.do{ |buffer|
		c.at(key).add( Message(buffer, key).value )
	}
}
)

then for a given index you could access the properties you want like c.bufnum[index] or c.frameSize[index]