[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[sc-dev] methods for rendering and playing functions and patterns ?
Wouldn't it be useful to have such methods ?
I think I've read in a thread that something had already existed in earlier SC versions, no ?
(
p = Pbind(
\midinote, Pwhite(60, 90),
\dur, 0.2
);
// and similar for Functions of course
// in a real implementation SynthDef would better be predefined
~renderPlay = { |pat, numChannels = 2, server, path, maxTime = 60, sampleRate = 44100,
headerFormat = "AIFF", sampleFormat = "int16", options, inputFilePath, action|
path = path ?? { "pRender_" ++ Date.localtime.stamp ++ "." ++ headerFormat.toLower };
options = options ?? { ServerOptions().numOutputBusChannels = numChannels };
server = server ?? { Server.default };
pat.render(path, maxTime, sampleRate, headerFormat = "AIFF", sampleFormat = "int16",
options, inputFilePath, {
server.makeBundle(nil, {
var bufnum = Buffer.read(server, path).bufnum;
{ PlayBuf.ar(numChannels, bufnum, BufRateScale.kr(bufnum)) }.play;
})
}
);
};
)
~renderPlay.(p, maxTime: 10)
Very practical: sample-exact if desired, neglectable latency with examples up to a minute or so !
Greetings
Daniel
-----------------------------
www.daniel-mayer.at
-----------------------------
_______________________________________________
sc-dev mailing list
info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: https://listarc.bham.ac.uk/marchives/sc-dev/
search: https://listarc.bham.ac.uk/lists/sc-dev/search/