Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

a hack to feed audio from MIDI or VST back into SuperDirt #262

Open
wants to merge 32 commits into
base: develop
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
35b4ab1
a hack to feed audio from MIDI or VST back into SuperDirt
kasparsj Mar 2, 2022
0a6d955
add comment about MIDIFunc
kasparsj Mar 2, 2022
5e0a4a8
add note about VSTPlugin
kasparsj Mar 2, 2022
f19ee34
add comment about fadeInTime
kasparsj Mar 2, 2022
40dfd59
add comment about moveNodeToHead
kasparsj Mar 2, 2022
1ac9b7d
improve setup and instructions
kasparsj Mar 2, 2022
f49b7a5
add comment about the bridge synth
kasparsj Mar 2, 2022
fd73f45
fix typo
kasparsj Mar 2, 2022
2465c33
rename the midi arg back to device
kasparsj Mar 2, 2022
7d3bb0d
improve comment
kasparsj Mar 2, 2022
a1c461f
allow pure midi without bridge (bus=-1)
kasparsj Mar 2, 2022
9bc02b3
fix bus arg to support arrays
kasparsj Mar 2, 2022
4aef333
fix for bus arg array
kasparsj Mar 2, 2022
4330237
store bridge synth in metaData
kasparsj Mar 2, 2022
7b5af0b
fix meta cleanup
kasparsj Mar 2, 2022
d183a1c
rename var
kasparsj Mar 2, 2022
b7ab425
move bridge synthdef to core-synths
kasparsj Mar 2, 2022
75630f4
move the hack out of classes/core-synths
kasparsj Mar 2, 2022
0e4172c
bug fixes
kasparsj Mar 2, 2022
5a29554
revert changes from classes
kasparsj Mar 2, 2022
b778ab1
rewrite midi synth hack
kasparsj Mar 3, 2022
3db3ec0
small fixes
kasparsj Mar 3, 2022
2c4f004
fix typo
kasparsj Mar 3, 2022
c650341
improve midi synth hack
kasparsj Mar 3, 2022
9ffcb0e
fix hw midi synth hack
kasparsj Mar 3, 2022
4695a9d
fix midi-synth hack cleanup
kasparsj Mar 3, 2022
497cd8b
fix midi synth hack panning
kasparsj Mar 3, 2022
19bffe9
fix midi synth hack
kasparsj Mar 3, 2022
d49a13c
fix fadeTime for midi_synth hack
kasparsj Mar 3, 2022
ee4675f
fix gain for midi_synth hack
kasparsj Mar 3, 2022
7e55302
fix midi synth hack group
kasparsj Mar 4, 2022
1d641e8
make midi_synth gate synth more like dirt_gate
kasparsj Mar 4, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix fadeTime for midi_synth hack
  • Loading branch information
kasparsj committed Mar 3, 2022
commit d49a13c7416ae0f561bd9dca42c1a05c857667c0
22 changes: 14 additions & 8 deletions hacks/midi-synth.scd
Original file line number Diff line number Diff line change
@@ -5,23 +5,28 @@ and feed audio back into the orbit, and be able to apply effects/panning/etc in
(
var numChannels = ~dirt.numChannels;

SynthDef("midi_synth_bridge" ++ numChannels, { |out, from, amp = 1, pan = 0|
SynthDef("midi_synth_bridge" ++ numChannels, { |out, from, amp = 1, pan = 0, gate=1, fadeTime = 0.01|
var signal = In.ar(from, numChannels);
signal = DirtPan.ar(signal, numChannels, pan);
Out.ar(out, signal * amp);
var env = EnvGen.kr(Env.asr(fadeTime, 1.0, fadeTime, \sin), gate, doneAction: Done.freeSelf);
Out.ar(out, DirtPan.ar(signal, numChannels, pan) * amp);
}, [\ir, \ir, \kr]).add;

~addMIDISynth = { |dirt, name, device, bus, event, appendToExisting = false, metaData|
var midiEvent = DirtEventTypes.midiEvent.copy;
var lastEventSecs = 0, lastDelta = 0;
var freeSynths = {
var freeSynths = { |fadeTime = 0.01|
var metaDataEvents = dirt.soundLibrary.metaDataEvents[name];
if (metaDataEvents.notNil) {
metaDataEvents.flat.do { |md|
if (md[\bridge].notNil) {
md[\bridge].group.freeAll;
var group = md[\bridge].group;
md[\bridge].set(\gate, 0);
SystemClock.sched(fadeTime, {
group.freeAll;
nil;
});
};
md.copy.keysValuesDo { |key, val|
md.copy.keysDo { |key|
md.removeAt(key);
};
};
@@ -33,10 +38,11 @@ SynthDef("midi_synth_bridge" ++ numChannels, { |out, from, amp = 1, pan = 0|

dirt.soundLibrary.addSynth(name, (play: { |dirtEvent|
var delta = ~delta;
var fadeTime = ~fadeTime;
lastDelta = delta;
lastEventSecs = SystemClock.seconds;
if (bus.notNil) {
var bridgeArgs = [out: dirtEvent.orbit.dryBus.index, from: bus, pan: ~pan];
var bridgeArgs = [out: dirtEvent.orbit.dryBus.index, from: bus, pan: ~pan, fadeTime: fadeTime];
~synthGroup = dirtEvent.orbit.group;
~out = bus;
if (metaData[\bridge].isNil) {
@@ -74,7 +80,7 @@ SynthDef("midi_synth_bridge" ++ numChannels, { |out, from, amp = 1, pan = 0|
// if we don't receive next event, free the synths
SystemClock.sched((delta + ~latency), {
if ((SystemClock.seconds - lastEventSecs) > delta and: { delta == lastDelta }) {
freeSynths.value;
freeSynths.value(fadeTime);
};
nil;
});