Fix operator overriding mess
This commit is contained in:
@ -46,8 +46,8 @@
|
||||
/* Syntax for sending MIDI messages */
|
||||
>> {
|
||||
arg pattern;
|
||||
var quant = this.getQuantFromPattern(pattern);
|
||||
var fade = this.getFadeFromPattern(pattern);
|
||||
var quant = BuboUtils.getQuantFromPattern(pattern);
|
||||
var fade = BuboUtils.getFadeFromPattern(pattern);
|
||||
pattern = EventShortener.process(
|
||||
pattern, this.key, \midi, 0
|
||||
);
|
||||
@ -59,14 +59,12 @@
|
||||
/* MIDI CC Operator */
|
||||
>>+ {
|
||||
arg pattern;
|
||||
var quant = this.getQuantFromPattern(pattern);
|
||||
var fade = this.getFadeFromPattern(pattern);
|
||||
"Fonction Control Change".postln;
|
||||
var quant = BuboUtils.getQuantFromPattern(pattern);
|
||||
var fade = BuboUtils.getFadeFromPattern(pattern);
|
||||
pattern = EventShortener.process(
|
||||
pattern, this.key, 'midicc', 0
|
||||
);
|
||||
this[0] = Pbind(*pattern);
|
||||
this[0].patternpairs.postln;
|
||||
this.prepareToPlay(this, quant, fade);
|
||||
^this
|
||||
}
|
||||
@ -74,8 +72,8 @@
|
||||
/* Player syntax sugar */
|
||||
=> {
|
||||
arg pattern;
|
||||
var quant = this.getQuantFromPattern(pattern);
|
||||
var fade = this.getFadeFromPattern(pattern);
|
||||
var quant = BuboUtils.getQuantFromPattern(pattern);
|
||||
var fade = BuboUtils.getFadeFromPattern(pattern);
|
||||
pattern = EventShortener.process(pattern, this.key, 'buboEvent', 1);
|
||||
pattern = EffectChain.process(pattern, this.key);
|
||||
this[0] = Pbind(*pattern);
|
||||
@ -86,8 +84,8 @@
|
||||
/* Pmono player */
|
||||
-> {
|
||||
arg pattern;
|
||||
var quant = this.getQuantFromPattern(pattern);
|
||||
var fade = this.getFadeFromPattern(pattern);
|
||||
var quant = BuboUtils.getQuantFromPattern(pattern);
|
||||
var fade = BuboUtils.getFadeFromPattern(pattern);
|
||||
pattern = EventShortener.process(pattern, this.key, 'pmono', 1);
|
||||
this[0] = Pmono(*pattern);
|
||||
this.prepareToPlay(this, quant, fade);
|
||||
@ -95,11 +93,11 @@
|
||||
}
|
||||
|
||||
/* Audio Looper (sample playback) */
|
||||
== {
|
||||
==> {
|
||||
// TODO: fix this terrible mess
|
||||
arg pattern;
|
||||
var quant = this.getQuantFromPattern(pattern);
|
||||
var fade = this.getFadeFromPattern(pattern);
|
||||
var quant = BuboUtils.getQuantFromPattern(pattern);
|
||||
var fade = BuboUtils.getFadeFromPattern(pattern);
|
||||
var nbSlices = this.getValueFromPattern(pattern, 'slices', 1);
|
||||
var time = (Pkey(\dur) / Pfunc { currentEnvironment.clock.tempo }) / nbSlices;
|
||||
pattern = EventShortener.process(
|
||||
@ -109,25 +107,4 @@
|
||||
this.prepareToPlay(this, quant, fade);
|
||||
^this
|
||||
}
|
||||
|
||||
|
||||
getValueFromPattern {
|
||||
arg pattern, key, default;
|
||||
var keyIndex = pattern.indexOf(key);
|
||||
if (keyIndex.notNil) {
|
||||
^pattern[keyIndex + 1]
|
||||
} {
|
||||
^default
|
||||
}
|
||||
}
|
||||
|
||||
getQuantFromPattern {
|
||||
arg pattern;
|
||||
^this.getValueFromPattern(pattern, 'quant', 4)
|
||||
}
|
||||
|
||||
getFadeFromPattern {
|
||||
arg pattern;
|
||||
^this.getValueFromPattern(pattern, 'fade', 0.01)
|
||||
}
|
||||
}
|
||||
|
||||
@ -71,4 +71,35 @@ BuboUtils {
|
||||
each.postln;
|
||||
});
|
||||
}
|
||||
|
||||
*getValueFromPattern {
|
||||
arg pattern, key, default;
|
||||
var keyIndex;
|
||||
try {
|
||||
if (pattern == nil, {
|
||||
^default
|
||||
});
|
||||
keyIndex = pattern.indexOf(key);
|
||||
if (keyIndex.notNil) {
|
||||
^pattern[keyIndex + 1]
|
||||
} {
|
||||
^default
|
||||
}
|
||||
} {
|
||||
^default
|
||||
}
|
||||
}
|
||||
|
||||
*getQuantFromPattern {
|
||||
arg pattern;
|
||||
^this.getValueFromPattern(pattern, 'quant', 4)
|
||||
}
|
||||
|
||||
*getFadeFromPattern {
|
||||
arg pattern;
|
||||
^this.getValueFromPattern(pattern, 'fade', 0.01)
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -76,7 +76,7 @@ I personally dislike the `Pbind(\qdklsj)` or `Ndef(\qkljsdf)` syntax. The `\` sy
|
||||
- Operators for creating SuperCollider patterns on-the-fly:
|
||||
- `=>` (Pbind): basic musical pattern
|
||||
- `->` (Pmono): monophonic expression pattern
|
||||
- `==` (Looper): looper/sampler (**WIP**, currently broken)
|
||||
- `==>` (Looper): looper/sampler (**WIP**, currently broken)
|
||||
- `>>` (Note): MIDI Note Pattern
|
||||
- `>>+` (CC): MIDI CC Pattern
|
||||
|
||||
@ -348,4 +348,4 @@ Contributions are welcome! If you have a technique/method that you think is wort
|
||||
|
||||
## About the website
|
||||
|
||||
There is a [small companion website](https://bubobubobubobubo.github.io/BuboQuark/#/) that initially came with the repo but it is not really important. It will be used to host a few tutorials when everything will take shape in the future.
|
||||
There is a [small companion website](https://bubobubobubobubo.github.io/BuboQuark/#/) that initially came with the repo but it is not really important. It will be used to host a few tutorials when everything will take shape in the future.
|
||||
|
||||
40
test.scd
Normal file
40
test.scd
Normal file
@ -0,0 +1,40 @@
|
||||
(
|
||||
p = ProxySpace.push(s.boot, p);
|
||||
"abcde".do { |k| p[k.asSymbol].ar };
|
||||
m = ProxyMixer(p, 8);
|
||||
m.parent.alwaysOnTop_(true); // show mixer in front of IDE
|
||||
)
|
||||
|
||||
(
|
||||
p = ProxySpace.push(s.waitForBoot({
|
||||
~a = {
|
||||
SinOsc.ar([199, 201, 199/1.75] * [1, 8, 2, 4].choose) * SinOsc.ar(
|
||||
LFNoise2.kr(1 /4).range(1,8)
|
||||
).range(0.01, 0.125);
|
||||
};
|
||||
~a.play;
|
||||
}), p);
|
||||
)
|
||||
|
||||
Boot()
|
||||
|
||||
(
|
||||
~a = {
|
||||
SinOsc.ar([200, 400] ! 2) * 0.125
|
||||
};
|
||||
)
|
||||
|
||||
~a.play;
|
||||
|
||||
|
||||
(
|
||||
~b.fadeTime = 4;
|
||||
~b => [
|
||||
i: "Panalog", pat: "0 2 3 4", octave: 6,
|
||||
];
|
||||
~b.play;
|
||||
)
|
||||
|
||||
p.gui
|
||||
|
||||
|
||||
Reference in New Issue
Block a user