First mockup of audio looper (==)

I am trying to add an audio looper to play breakbeats. It works .. meh for now but I'm sure that it'll slowly get better!
This commit is contained in:
2024-05-02 23:28:00 +02:00
parent 775e7efed7
commit b497ca13dc
5 changed files with 175 additions and 27 deletions

View File

@ -51,22 +51,22 @@ Boot {
// Post actions: installing behavior after server boot
Server.default.waitForBoot({
d = ();
// Exceptional Dual Sardine Boot
d.dirt = SuperDirt(2, s);
d.dirt.fileExtensions = ["wav","aif","aiff","aifc","mp3"];
d.dirt.loadSoundFiles("/Users/bubo/Library/Application\ Support/Sardine/SON/*");
d.dirt.loadSoundFiles("/Users/bubo/.config/livecoding/samples/*");
d.dirt.doNotReadYet = true;
d.dirt.start(57120, [ 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22]);
(
d.d1 = d.dirt.orbits[0]; d.d2 = d.dirt.orbits[1]; d.d3 = d.dirt.orbits[2];
d.d4 = d.dirt.orbits[3]; d.d5 = d.dirt.orbits[4]; d.d6 = d.dirt.orbits[5];
d.d7 = d.dirt.orbits[6]; d.d8 = d.dirt.orbits[7]; d.d9 = d.dirt.orbits[8];
d.d10 = d.dirt.orbits[9]; d.d11 = d.dirt.orbits[10]; d.d12 = d.dirt.orbits[11];
);
d.dirt.soundLibrary.addMIDI(\midi, MIDIOut.newByName("MIDI", "Bus 1"));
d.dirt.soundLibrary.addMIDI(\midi2, MIDIOut.newByName("MIDI", "Bus 2"));
// d = ();
// // Exceptional Dual Sardine Boot
// d.dirt = SuperDirt(2, s);
// d.dirt.fileExtensions = ["wav","aif","aiff","aifc","mp3"];
// d.dirt.loadSoundFiles("/Users/bubo/Library/Application\ Support/Sardine/SON/*");
// d.dirt.loadSoundFiles("/Users/bubo/.config/livecoding/samples/*");
// d.dirt.doNotReadYet = true;
// d.dirt.start(57120, [ 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22]);
// (
// d.d1 = d.dirt.orbits[0]; d.d2 = d.dirt.orbits[1]; d.d3 = d.dirt.orbits[2];
// d.d4 = d.dirt.orbits[3]; d.d5 = d.dirt.orbits[4]; d.d6 = d.dirt.orbits[5];
// d.d7 = d.dirt.orbits[6]; d.d8 = d.dirt.orbits[7]; d.d9 = d.dirt.orbits[8];
// d.d10 = d.dirt.orbits[9]; d.d11 = d.dirt.orbits[10]; d.d12 = d.dirt.orbits[11];
// );
// d.dirt.soundLibrary.addMIDI(\midi, MIDIOut.newByName("MIDI", "Bus 1"));
// d.dirt.soundLibrary.addMIDI(\midi2, MIDIOut.newByName("MIDI", "Bus 2"));
s.latency = 0.3;
// Resume normal boot sequence
@ -92,8 +92,26 @@ Boot {
Server.default.avgCPU.round(2),
Server.default.peakCPU.round(2)), 40)
}, Server.default);
// This custom event is used for audio looping
Event.addEventType(\buboLoopEvent, {
arg server;
if (~sp.notNil && ~nb.notNil, {
~sp = ~sp ?? 'default';
~nb = ~nb ?? 0;
~buf = Bank(~sp)[~nb % Bank(~sp).paths.size];
if (Bank(~sp).metadata[~nb % Bank(~sp).size][\numChannels] == 1) {
~instrument = \looperMono;
} {
~instrument = \looperStereo;
};
});
~type = \note;
currentEnvironment.play;
});
// This custom event makes it easier to play samples
Event.addEventType(\buboEvent, {
// This is a custom event that makes it easier to play samples
arg server;
if (~sp.notNil && ~nb.notNil, {
~sp = ~sp ?? 'default';