bounce audio and section navigation essentially done
This commit is contained in:
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
Binary file not shown.
Binary file not shown.
|
|
@ -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,
|
||||
currentSection = 1, currentSubsection = 1;
|
||||
|
||||
buildGenerator = {arg view;
|
||||
var ranSeed;
|
||||
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_([["random seed"]]).action_({ ranSeed.string = 50000000.rand.asString}.inEnvir),
|
||||
Button(view).states_([["generate"]]).action_({
|
||||
{~genAll.value(ranSeed.string.asInteger); ~appStatus.string = "status: ready"}.fork(AppClock);
|
||||
~appStatus.string = "status: generating"}.inEnvir),
|
||||
[~appStatus = StaticText(view).string_("status: ready"), stretch: 1],
|
||||
Button(view).states_([["transcribe"]]).action_({
|
||||
{~transcribe.value(~scoreData, ~sectionData); ~appStatus.string = "status: ready"}.fork(AppClock);
|
||||
~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
|
||||
|
|
@ -59,16 +63,30 @@ buildMetronome = {arg win;
|
|||
[clock, metronome, layout]
|
||||
};
|
||||
|
||||
updateSection = {arg mod, clock, metronome, sectionDisplay, refresh = true;
|
||||
if(~sectionNavDict[[currentSection + mod, 1]] != nil, {
|
||||
updateSection = {arg mod, clock, metronome, sectionDisplay, refresh = true, indirect = false;
|
||||
var changeSection;
|
||||
case
|
||||
{(currentSubsection > 1) && (mod < 0)} {
|
||||
currentSubsection = 1;
|
||||
}
|
||||
{(currentSubsection <= 1) && (mod < 0) && (currentSection > 1)} {
|
||||
currentSection = currentSection + mod;
|
||||
if(indirect, {
|
||||
currentSubsection = ~sectionNavDict[[currentSection, 1]][1]
|
||||
}, {
|
||||
currentSubsection = 1;
|
||||
})
|
||||
}
|
||||
{(mod > 0) && (~sectionNavDict[[currentSection + mod, 1]] != nil)} {
|
||||
currentSection = currentSection + mod;
|
||||
currentSubsection = 1;
|
||||
if(refresh, {
|
||||
updateTransport.value(clock, metronome, sectionDisplay,
|
||||
~sectionNavDict[[currentSection, currentSubsection]], 1,
|
||||
currentSection, currentSubsection
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
if(refresh, {
|
||||
updateTransport.value(clock, metronome, sectionDisplay,
|
||||
~sectionNavDict[[currentSection, currentSubsection]][0], 1,
|
||||
currentSection, currentSubsection
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -78,12 +96,12 @@ updateSubsection = {arg mod, clock, metronome, sectionDisplay, refresh = true;
|
|||
currentSubsection = currentSubsection + mod;
|
||||
if(refresh, {
|
||||
updateTransport.value(clock, metronome, sectionDisplay,
|
||||
~sectionNavDict[[currentSection, currentSubsection]], 1,
|
||||
~sectionNavDict[[currentSection, currentSubsection]][0], 1,
|
||||
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;
|
||||
if(pState.value == 1, {
|
||||
player = {
|
||||
var startMeasure = ~sectionNavDict[[currentSection, currentSubsection]] - 1;
|
||||
var startMeasure = ~sectionNavDict[[currentSection, currentSubsection]][0] - 1;
|
||||
~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);
|
||||
[1, 2, 1, 2].do({arg beat;
|
||||
|
|
@ -131,7 +149,7 @@ buildTransport = {arg win, view, clock, metronome, preampBusses, accompBusses, p
|
|||
~patternProxy.pause;
|
||||
//player.stop;
|
||||
updateTransport.value(clock, metronome, sectionDisplay,
|
||||
~sectionNavDict[[currentSection, currentSubsection]], 1,
|
||||
~sectionNavDict[[currentSection, currentSubsection]][0], 1,
|
||||
currentSection.postln, currentSubsection.postln);
|
||||
});
|
||||
}.inEnvir),
|
||||
|
|
@ -142,7 +160,7 @@ buildTransport = {arg win, view, clock, metronome, preampBusses, accompBusses, p
|
|||
};
|
||||
|
||||
|
||||
buildAuxControls = {arg view;
|
||||
buildTempoControl = {arg view;
|
||||
var tempo, address, updateSection;
|
||||
HLayout(
|
||||
tempo = TextField(view).string_("60"),
|
||||
|
|
@ -199,7 +217,7 @@ masterView = {arg win, preampBusses, accompBusses, postampBusses;
|
|||
generatorLayout = buildGenerator.value(view);
|
||||
# clock, metronome, metronomeLayout = buildMetronome.value(win);
|
||||
# sectionDisplay, transportLayout = buildTransport.value(win, view, clock, metronome, preampBusses, accompBusses, postampBusses);
|
||||
auxControlsLayout = buildAuxControls.value(view);
|
||||
auxControlsLayout = buildTempoControl.value(view);
|
||||
|
||||
view.layout_(
|
||||
HLayout(
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@
|
|||
var appEnvironment;
|
||||
|
||||
//push new environment
|
||||
appEnvironment = Environment.make;
|
||||
appEnvironment.push;
|
||||
//appEnvironment = Environment.make;
|
||||
//appEnvironment.push;
|
||||
|
||||
s.waitForBoot({
|
||||
var preampBusses, accompBusses, postampBusses;
|
||||
|
|
@ -44,5 +44,5 @@ s.waitForBoot({
|
|||
~generateGUI.value(preampBusses, accompBusses, postampBusses);
|
||||
"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;
|
||||
[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;
|
||||
var musicData, partState, noteCountInd;
|
||||
|
|
@ -505,6 +505,10 @@ genAmpCurve = {arg temporalData1, temporalData2, offset1, offset2, type;
|
|||
|
||||
sectionData.add(((curLen - temporalData[0].size) / 4).asInteger->
|
||||
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];
|
||||
# lastCadenceTemporalData, lastCadenceState, lastSectionPoint = [temporalData, modeState, curLen];
|
||||
cadence = true;
|
||||
|
|
|
|||
|
|
@ -188,7 +188,9 @@ formatPatternData = {arg musData, measureLen;
|
|||
|
||||
|
||||
~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;
|
||||
basePath = ~dir +/+ ".." +/+ "audio";
|
||||
|
|
@ -209,11 +211,13 @@ formatPatternData = {arg musData, measureLen;
|
|||
|
||||
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;
|
||||
|
||||
score.score[2].postln;
|
||||
score.score.last.postln;
|
||||
nextNode.postln;
|
||||
|
||||
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, [\s_new, \disk_out_ ++ ~hash, nextNode, 1, 1, \bufnum, track, \inbus, track]]);
|
||||
|
||||
score.add([120.0, [\n_free, nextNode]]);
|
||||
score.add([120.0, [\b_close, track]]);
|
||||
score.add([120.0, [\b_free, track]]);
|
||||
score.add([recDur, [\n_free, nextNode]]);
|
||||
score.add([recDur, [\b_close, track]]);
|
||||
score.add([recDur, [\b_free, track]]);
|
||||
nextNode = nextNode + 1;
|
||||
});
|
||||
|
||||
|
|
@ -244,7 +248,7 @@ formatPatternData = {arg musData, measureLen;
|
|||
headerFormat: "WAV",
|
||||
sampleFormat: "int16",
|
||||
options: server.options,
|
||||
duration: 120
|
||||
duration: recDur
|
||||
);
|
||||
|
||||
server.remove;
|
||||
|
|
|
|||
Loading…
Reference in a new issue