Skip to content

Instantly share code, notes, and snippets.

View scztt's full-sized avatar

scott carver scztt

  • Berlin
View GitHub Profile
@scztt
scztt / sample
Created October 8, 2012 01:23
sample gist
This is a test gist.
@scztt
scztt / gist:da81d2531f77fefa5c0d
Last active August 29, 2015 14:19
Test Quarks.load and Quarks.save functions
(
var root = "/a/b/c";
var testSpec = {
|a, b|
a = Quarks.parseQuarkSpecifier(a, root);
"%: % == %".format(a == b, a, b).postln;
};
var testSaved = {
|a, b|
a = Quarks.savedQuarkSpecifier(a, root);
{
Quarks.directory.keysValuesDo {
|quarkName, path|
var quark, tags, deps, expectedMatches, depData;
Quarks.clear();
quark = Quark(quarkName);
quark.checkout();
tags = quark.tags ++ ["HEAD"];
tags.do {
@scztt
scztt / recorder.sc
Last active September 10, 2015 16:44
// Settings
~recordPath = "~/Desktop".standardizePath;
~recordName = "sc_capture"; // e.g. recordings will be named "sc_capture [...].aiff"
~preroll = 0.5; // seconds to capture before sound starts
~bufferLength = s.sampleRate * 60;
// Threshold settings
// These can be changed while recorder is running, to refine threshold values
Ndef(\threshold).source = -24; // Record threshold, in dB
Ndef(\durThreshold).source = 0.2; // Minimum amount of time above \threshold for it to trigger
Deferred {
var value, error, resolved=\unresolved, waitingThreads;
*new {
^super.new.init
}
init {
waitingThreads = Array(2);
}
(
~menu = Menu(
Action("A", { "a selected".postln }),
Action("B", { "b selected".postln }),
Action("C", { "c selected".postln }),
);
~menu.front; // can be re-invoked after menu is closed
)
+SynthDef {
specs {
metadata ?? { metadata = () };
metadata[\specs] ?? { metadata[\specs] = () };
^metadata[\specs]
}
}
+SynthDesc {
specs {
QuNeo {
var midiIn, midiOut,
<>pads, connections;
*new {
| midiOut, midiIn |
MIDIClient.initialized.not.if({ MIDIClient.init });
MIDIIn.connectAll();
q = QuNeo().connect();
(
SynthDef(\buzz, {
var sig, env, pressure, freqs, lpfFreq, gate;
gate = \gate.kr(1); // wait 2 secs before releasing
pressure = \pressure.kr(0.1, 1);
pressure = Gate.kr(pressure, gate);

// Twister devices are expected to be named in this form: // classvar <endpointDevice="Midi Fighter Twister %", <endpointName="Midi Fighter Twister"; // Where "Midi Fighter Twister 1" is TwisterDevice(\default) and "Midi Fighter Twister 2" is TwisterDevice(\secondary)

// A twister device. These are singletons - there is only ever one registered per device. It works ala Ndef, Pdef, etc, see Singleton help file. ~device = TwisterDevice(\default);

// If your MIDI Fighter is named something other than the above, you can register it via: this.registerDevice(\myDevice, "endpoint device", "endpoint name"); // And then access it via TwisterDevice(\myDevice)