bounce audio and section navigation essentially done

main
mwinter 4 years ago
parent 64e4a5591f
commit 1e91bc864f

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -1,21 +1,25 @@
( (
var genWindow, masterView, faderView, buildGenerator, buildMetronome, buildTransport, buildAuxControls, buildMasterFader, buildTrackFader, var genWindow, masterView, faderView, buildGenerator, buildMetronome, buildTransport, buildTempoControl, buildMasterFader, buildTrackFader,
updateSection, updateSubsection, clockStringFunc, metronomeStringFunc, metronomeColorFunc, updateTransport, updateSection, updateSubsection, clockStringFunc, metronomeStringFunc, metronomeColorFunc, updateTransport,
currentSection = 1, currentSubsection = 1; currentSection = 1, currentSubsection = 1;
buildGenerator = {arg view; buildGenerator = {arg view;
var ranSeed; var ranSeed;
HLayout( HLayout(
ranSeed = TextField(view, Rect(10, 10, 10, 20)).string_("19800725"), ranSeed = TextField(view).string_("19800725"),
Button(view).states_([["reset seed"]]).action_({ ranSeed.string = "19800725"}.inEnvir), Button(view).states_([["reset seed"]]).action_({ ranSeed.string = "19800725"}.inEnvir),
Button(view).states_([["random seed"]]).action_({ ranSeed.string = 50000000.rand.asString}.inEnvir), Button(view).states_([["random seed"]]).action_({ ranSeed.string = 50000000.rand.asString}.inEnvir),
Button(view).states_([["generate"]]).action_({ Button(view).states_([["generate"]]).action_({
{~genAll.value(ranSeed.string.asInteger); ~appStatus.string = "status: ready"}.fork(AppClock); {~genAll.value(ranSeed.string.asInteger); ~appStatus.string = "status: ready"}.fork(AppClock);
~appStatus.string = "status: generating"}.inEnvir), ~appStatus.string = "status: generating"}.inEnvir),
[~appStatus = StaticText(view).string_("status: ready"), stretch: 1],
Button(view).states_([["transcribe"]]).action_({ Button(view).states_([["transcribe"]]).action_({
{~transcribe.value(~scoreData, ~sectionData); ~appStatus.string = "status: ready"}.fork(AppClock); {~transcribe.value(~scoreData, ~sectionData); ~appStatus.string = "status: ready"}.fork(AppClock);
~appStatus.string = "status: transcribing"}.inEnvir), ~appStatus.string = "status: transcribing"}.inEnvir),
[~appStatus = StaticText(view).string_("status: ready"), stretch: 1], nil) Button(view).states_([["bounce audio"]]).action_({
{~bounceAudio.value; ~appStatus.string = "status: ready"}.fork(AppClock);
~appStatus.string = "status: bouncing audio"}.inEnvir),
nil)
}; };
// these funcs update the elements of the transport panel // these funcs update the elements of the transport panel
@ -59,17 +63,31 @@ buildMetronome = {arg win;
[clock, metronome, layout] [clock, metronome, layout]
}; };
updateSection = {arg mod, clock, metronome, sectionDisplay, refresh = true; updateSection = {arg mod, clock, metronome, sectionDisplay, refresh = true, indirect = false;
if(~sectionNavDict[[currentSection + mod, 1]] != nil, { var changeSection;
case
{(currentSubsection > 1) && (mod < 0)} {
currentSubsection = 1;
}
{(currentSubsection <= 1) && (mod < 0) && (currentSection > 1)} {
currentSection = currentSection + mod; currentSection = currentSection + mod;
if(indirect, {
currentSubsection = ~sectionNavDict[[currentSection, 1]][1]
}, {
currentSubsection = 1; currentSubsection = 1;
})
}
{(mod > 0) && (~sectionNavDict[[currentSection + mod, 1]] != nil)} {
currentSection = currentSection + mod;
currentSubsection = 1;
};
if(refresh, { if(refresh, {
updateTransport.value(clock, metronome, sectionDisplay, updateTransport.value(clock, metronome, sectionDisplay,
~sectionNavDict[[currentSection, currentSubsection]], 1, ~sectionNavDict[[currentSection, currentSubsection]][0], 1,
currentSection, currentSubsection currentSection, currentSubsection
); );
}); });
});
}; };
@ -78,12 +96,12 @@ updateSubsection = {arg mod, clock, metronome, sectionDisplay, refresh = true;
currentSubsection = currentSubsection + mod; currentSubsection = currentSubsection + mod;
if(refresh, { if(refresh, {
updateTransport.value(clock, metronome, sectionDisplay, updateTransport.value(clock, metronome, sectionDisplay,
~sectionNavDict[[currentSection, currentSubsection]], 1, ~sectionNavDict[[currentSection, currentSubsection]][0], 1,
currentSection, currentSubsection currentSection, currentSubsection
); );
}); });
}, { }, {
updateSection.value(mod, clock, metronome, sectionDisplay, refresh) updateSection.value(mod, clock, metronome, sectionDisplay, refresh, true)
}) })
}; };
@ -112,7 +130,7 @@ buildTransport = {arg win, view, clock, metronome, preampBusses, accompBusses, p
Button(view).states_([["play", Color.black], ["stop", Color.black, Color.grey]]).action_({arg pState; Button(view).states_([["play", Color.black], ["stop", Color.black, Color.grey]]).action_({arg pState;
if(pState.value == 1, { if(pState.value == 1, {
player = { player = {
var startMeasure = ~sectionNavDict[[currentSection, currentSubsection]] - 1; var startMeasure = ~sectionNavDict[[currentSection, currentSubsection]][0] - 1;
~patternProxy.source = ~genPlayablePatterns.value(startMeasure, ~patterns, preampBusses, accompBusses, postampBusses); ~patternProxy.source = ~genPlayablePatterns.value(startMeasure, ~patterns, preampBusses, accompBusses, postampBusses);
Pbind(\instrument, \click_ ++ ~hash, \beat, Pseq([1, 2, 1, 2]), \dur, 1).play(~tempoClock, quant: 0); Pbind(\instrument, \click_ ++ ~hash, \beat, Pseq([1, 2, 1, 2]), \dur, 1).play(~tempoClock, quant: 0);
[1, 2, 1, 2].do({arg beat; [1, 2, 1, 2].do({arg beat;
@ -131,7 +149,7 @@ buildTransport = {arg win, view, clock, metronome, preampBusses, accompBusses, p
~patternProxy.pause; ~patternProxy.pause;
//player.stop; //player.stop;
updateTransport.value(clock, metronome, sectionDisplay, updateTransport.value(clock, metronome, sectionDisplay,
~sectionNavDict[[currentSection, currentSubsection]], 1, ~sectionNavDict[[currentSection, currentSubsection]][0], 1,
currentSection.postln, currentSubsection.postln); currentSection.postln, currentSubsection.postln);
}); });
}.inEnvir), }.inEnvir),
@ -142,7 +160,7 @@ buildTransport = {arg win, view, clock, metronome, preampBusses, accompBusses, p
}; };
buildAuxControls = {arg view; buildTempoControl = {arg view;
var tempo, address, updateSection; var tempo, address, updateSection;
HLayout( HLayout(
tempo = TextField(view).string_("60"), tempo = TextField(view).string_("60"),
@ -199,7 +217,7 @@ masterView = {arg win, preampBusses, accompBusses, postampBusses;
generatorLayout = buildGenerator.value(view); generatorLayout = buildGenerator.value(view);
# clock, metronome, metronomeLayout = buildMetronome.value(win); # clock, metronome, metronomeLayout = buildMetronome.value(win);
# sectionDisplay, transportLayout = buildTransport.value(win, view, clock, metronome, preampBusses, accompBusses, postampBusses); # sectionDisplay, transportLayout = buildTransport.value(win, view, clock, metronome, preampBusses, accompBusses, postampBusses);
auxControlsLayout = buildAuxControls.value(view); auxControlsLayout = buildTempoControl.value(view);
view.layout_( view.layout_(
HLayout( HLayout(

@ -4,8 +4,8 @@
var appEnvironment; var appEnvironment;
//push new environment //push new environment
appEnvironment = Environment.make; //appEnvironment = Environment.make;
appEnvironment.push; //appEnvironment.push;
s.waitForBoot({ s.waitForBoot({
var preampBusses, accompBusses, postampBusses; var preampBusses, accompBusses, postampBusses;
@ -44,5 +44,5 @@ s.waitForBoot({
~generateGUI.value(preampBusses, accompBusses, postampBusses); ~generateGUI.value(preampBusses, accompBusses, postampBusses);
"ready".postln; "ready".postln;
}); });
appEnvironment.pop; //appEnvironment.pop;
) )

@ -460,7 +460,7 @@ genAmpCurve = {arg temporalData1, temporalData2, offset1, offset2, type;
sectionData.add((curLen / 4).asInteger->[roots, lastRoots.collect({arg fr, part; sectionData.add((curLen / 4).asInteger->[roots, lastRoots.collect({arg fr, part;
[fr, 36.midicps * pow(2, [1, 0, 1, 2][part]) * frToFloat.value(fr)]}), sectionCount, subsectionCount, cadence, ultimate]); [fr, 36.midicps * pow(2, [1, 0, 1, 2][part]) * frToFloat.value(fr)]}), sectionCount, subsectionCount, cadence, ultimate]);
sectionNavDict.add([sectionCount, subsectionCount]->(curLen / 16 + 1).asInteger); sectionNavDict.add([sectionCount, subsectionCount]->[(curLen / 16 + 1).asInteger]);
4.do({arg part; 4.do({arg part;
var musicData, partState, noteCountInd; var musicData, partState, noteCountInd;
@ -505,6 +505,10 @@ genAmpCurve = {arg temporalData1, temporalData2, offset1, offset2, type;
sectionData.add(((curLen - temporalData[0].size) / 4).asInteger-> sectionData.add(((curLen - temporalData[0].size) / 4).asInteger->
sectionData[((curLen - temporalData[0].size) / 4).asInteger].put(5, true)); sectionData[((curLen - temporalData[0].size) / 4).asInteger].put(5, true));
(subsectionCount - 1).do({arg subsectionIndex;
sectionNavDict.add([sectionCount, subsectionIndex + 1]->[sectionNavDict[[sectionCount, subsectionIndex + 1]].postln[0], subsectionCount - 1]);
});
//sectionNavDict.add([sectionCount, subsectionCount]->[(curLen / 16 + 1).asInteger, subsectionCount]);
# sectionCount, subsectionCount = [sectionCount + 1, 1]; # sectionCount, subsectionCount = [sectionCount + 1, 1];
# lastCadenceTemporalData, lastCadenceState, lastSectionPoint = [temporalData, modeState, curLen]; # lastCadenceTemporalData, lastCadenceState, lastSectionPoint = [temporalData, modeState, curLen];
cadence = true; cadence = true;

@ -188,7 +188,9 @@ formatPatternData = {arg musData, measureLen;
~bounceAudio = { ~bounceAudio = {
var basePath, server, buffers, preampBusses, nextNode, accompBusses, postampBusses, synths, prePatterns, playablePatterns, score; var basePath, server, buffers, recDur,
preampBusses, nextNode, accompBusses, postampBusses,
synths, prePatterns, playablePatterns, score;
//dir = thisProcess.nowExecutingPath.dirname; //dir = thisProcess.nowExecutingPath.dirname;
basePath = ~dir +/+ ".." +/+ "audio"; basePath = ~dir +/+ ".." +/+ "audio";
@ -209,11 +211,13 @@ formatPatternData = {arg musData, measureLen;
playablePatterns = ~genPlayablePatterns.value(0, prePatterns, preampBusses, accompBusses, postampBusses); playablePatterns = ~genPlayablePatterns.value(0, prePatterns, preampBusses, accompBusses, postampBusses);
score = playablePatterns.asScore(duration: 120, timeOffset: 0.001); recDur = (prePatterns[2][0].size / 8) + 10;
score = playablePatterns.asScore(duration: recDur, timeOffset: 0.001);
nextNode = score.score.slice(nil, 1).select({arg msg; msg[0] == 9}).slice(nil, 2).maxItem + 1; nextNode = score.score.slice(nil, 1).select({arg msg; msg[0] == 9}).slice(nil, 2).maxItem + 1;
score.score[2].postln; score.score.last.postln;
nextNode.postln; nextNode.postln;
synths.do({arg synth; score.add([0.0, [\d_recv, synth.asBytes]])}); synths.do({arg synth; score.add([0.0, [\d_recv, synth.asBytes]])});
@ -230,9 +234,9 @@ formatPatternData = {arg musData, measureLen;
score.add([0.0, [\b_write, track, basePath +/+ "test_" ++ track ++ ".wav".standardizePath, "WAV", "int16", 0, 0, 1]]); score.add([0.0, [\b_write, track, basePath +/+ "test_" ++ track ++ ".wav".standardizePath, "WAV", "int16", 0, 0, 1]]);
score.add([0.0, [\s_new, \disk_out_ ++ ~hash, nextNode, 1, 1, \bufnum, track, \inbus, track]]); score.add([0.0, [\s_new, \disk_out_ ++ ~hash, nextNode, 1, 1, \bufnum, track, \inbus, track]]);
score.add([120.0, [\n_free, nextNode]]); score.add([recDur, [\n_free, nextNode]]);
score.add([120.0, [\b_close, track]]); score.add([recDur, [\b_close, track]]);
score.add([120.0, [\b_free, track]]); score.add([recDur, [\b_free, track]]);
nextNode = nextNode + 1; nextNode = nextNode + 1;
}); });
@ -244,7 +248,7 @@ formatPatternData = {arg musData, measureLen;
headerFormat: "WAV", headerFormat: "WAV",
sampleFormat: "int16", sampleFormat: "int16",
options: server.options, options: server.options,
duration: 120 duration: recDur
); );
server.remove; server.remove;

Loading…
Cancel
Save