You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
79 lines
2.5 KiB
Plaintext
79 lines
2.5 KiB
Plaintext
TITLE:: FluidLoadFolder
|
|
summary:: Load a folder of audio into a single buffer
|
|
categories:: Libraries>FluidCorpusManipulation
|
|
related:: Classes/FluidSliceCorpus, Classes/FluidProcessSlices
|
|
|
|
DESCRIPTION::
|
|
Given a path name, load every audio file in the path (using link::Classes/SoundFile#*collect::), allocate a link::Classes/Buffer::, and load the files top to tail into the buffer. Information about start stop points, channel counts and sample rates is then stored in link::Classes/FluidLoadFolder#index:: as a link::Classes/IdentityDictionary::.
|
|
|
|
|
|
CLASSMETHODS::
|
|
|
|
METHOD:: new
|
|
Construct a new instance
|
|
|
|
ARGUMENT:: path
|
|
A string pointing to a folder on disk
|
|
|
|
ARGUMENT:: idFunc
|
|
A function that determines how the identifiers for the chunks are created; default is file name without path.
|
|
|
|
ARGUMENT:: channelFunc
|
|
A funciton that controls what to do with differently wide files. Default behaviour is for loaded buffer to have as many channels as the widest file in the path, and for narrower files to repeat their channels across this buffer. The funciton is passed the channels for the current file, the maximum channel count, and the current index.
|
|
|
|
INSTANCEMETHODS::
|
|
|
|
METHOD:: index
|
|
A link::Classes/IdentityDictionary:: containing the metadata on the loaded files
|
|
|
|
The keys of this dictionary are the identifiers produced by the code::idFunc:: passed to link::Classes/FluidLoadFolder#*new:: (or the default of the filename if nil). The value for each key is a further dictionary consisting of:
|
|
|
|
definitionlist::
|
|
## bounds
|
|
|| A two element array giving the start and end point of this files eventual position in the overall buffer (in samples).
|
|
## sr
|
|
|| The sampling rate of the original file
|
|
## numchans
|
|
|| Number of channels in the original file
|
|
::
|
|
|
|
METHOD:: files
|
|
The list of files loaded
|
|
|
|
METHOD:: buffer
|
|
The buffer in which the files are placed, end to end.
|
|
|
|
METHOD:: play
|
|
Load the files.
|
|
|
|
ARGUMENT:: server
|
|
The server on which to run
|
|
|
|
ARGUMENT:: action
|
|
Function to execute on completion
|
|
|
|
|
|
EXAMPLES::
|
|
|
|
code::
|
|
s.reboot;
|
|
|
|
(
|
|
// We'll load all the Fluid Corpus Manipulation audio example files
|
|
~path = File.realpath(FluidLoadFolder.class.filenameSymbol).dirname +/+ "../AudioFiles";
|
|
|
|
~loader = FluidLoadFolder(~path);
|
|
|
|
~loader.play(s,action:{ |dataDictionary|
|
|
("Done loading into" + ~loader.buffer).postln;
|
|
//we get passed an IdentityDictionary of slice data, let's look at it
|
|
dataDictionary.pairsDo{|identifier,data|
|
|
//data is also a dictionary
|
|
(identifier ++ '(').post;
|
|
data.pairsDo{|k,v| (k ++ ':' + v + ' ').post };
|
|
')'.postln;
|
|
}
|
|
});
|
|
)
|
|
::
|