MoltenMaster playback manager for generative albums
Inherits from: Object
MoltenMaster is a playback manager for generative sound albums, which one might want to distribute as software instead of realized and finished (in some sense "Gold Mastered" at some stage of production) recordings. It manages the initialization and deallocation of resources relevant to your pieces in a simple manner.
See also: MoltenPiece MoltenPlayer
Creation / Class Methods
*new (argNumPieces)
argNumPieces - Number of piece slots to allocate. Should be an Integer.
Accessing Instance and Class Variables
pieces
This is a List of pieces that are of type MoltenPiece. The size of this array is the number of pieces supplied as an argument at instance creation.
isPlaying
Boolean. Indicates the current playback status.
lockAction_(arg1)
lockAction
When you build a GUI around this class (see MoltenPlayer for the simple one), you will want to lock the GUI widgets at initialization (before playback) and probably "deallocation of resources" stages. The class runs this function when it is suitable to lock GUI input, so if you supply one, it will be executed at appropriate stages.
unlockAction_(arg1)
unlockAction
See lockAction above. This function, if supplied, is executed when it is meaningful to interact with your instance again.
currentlyPlaying
The index of the piece that is currently playing. If isPlaying is false, this is -1.
Doing Some Task
playPiece (argIndex)
Initializes and plays the piece with the given index. If there is a piece already on playback, it is stopped and its resources are deallocated before playing back the new piece.
stopPlayback
Stops the playback and deallocates the resources of the playing piece.
signal
To see what this does, see the help for MoltenPiece.
Examples
// to make sense of all that is going on here
// be sure to check MoltenPiece help too.
s.boot;
(
SynthDef(\piece1,
{
arg buf, hold = 1;
var env = EnvGen.ar(Env([0, 1, 0], [0.01, 3], 2, 1), hold, doneAction: 2);
var trig = Impulse.ar(8);
var needle = (Sweep.ar(trig, 44100) % TRand.ar(100,22050,trig));
var snd = BufRd.ar(1, buf, ([44100, 44600] * LFNoise0.ar(8,9,9)) + needle) * env;
Out.ar(0, snd);
}).memStore;
SynthDef(\piece2,
{
arg hold = 1;
var env = EnvGen.ar(Env([0, 1, 0], [1, 3], 2, 1), hold, doneAction: 2);
var snd =
SinOsc.ar
(
Impulse.ar(2).lagud(0,0.4)*360,
Integrator.ar
(
Integrator.ar(Impulse.ar(64).lag(LFNoise1.ar(2!2,2,2))*99,0.9),
0.99
).fold2(pi)
) * env;
Out.ar(0, snd);
}).memStore;
)
(
a = MoltenMaster(2);
a.pieces[0].nameString = "HoustonWarp";
a.pieces[0].durationString = "infinite";
a.pieces[1].nameString = "Ugly Dance";
a.pieces[1].durationString = "infinite";
a.pieces[0].initAction =
{
fork //a thread is necessary!
({
b = Buffer.read(s, "sounds/a11wlk01.wav");
s.sync; //make sure it is fully loaded at init;
a.signal; //signal a to proceed to playback.
});
};
a.pieces[0].playAction =
{
fork
({
~piece1 = Synth(\piece1, [\buf, b]);
a.signal;
});
};
a.pieces[0].finishAction =
{
fork
({
~piece1.set(\hold, 0);
3.wait; //wait for fadeout of env.
//~piece1.free; //not necessary here, env has doneAction: 2
a.signal;
});
};
a.pieces[1].initAction =
{
fork
({
//nothing to init, hust signal. We could omit setting this action.
a.signal; //signal a to proceed to playback.
});
};
a.pieces[1].playAction =
{
fork
({
~piece2 = Synth(\piece2);
a.signal;
});
};
a.pieces[1].finishAction =
{
fork
({
~piece2.set(\hold, 0);
3.wait; //wait for fadeout of env.
//~piece2.free; //not necessary here, env has doneAction: 2
a.signal;
});
};
)
a.playPiece(0);
a.stopPlayback; //blocks further input for 3 seconds, given our finishAction
a.playPiece(1);
a.stopPlayback;
//changing tracks:
a.playPiece(0); //while playing execute the code below
a.playPiece(1);
a.stopPlayback;
//a simple GUI that plays MoltenMasters...
p = MoltenPlayer(a);