Skip to content

Instantly share code, notes, and snippets.

View scztt's full-sized avatar

scott carver scztt

  • Berlin
View GitHub Profile
#!/usr/bin/env python3
# /// script
# requires-python = ">=3.10"
# dependencies = [
# "click>=8.0",
# "aiohttp>=3.9",
# ]
# ///
"""
Bandcamp meta-player: resolve a markdown playlist into a streamable HTML player.
+ControlPanelNotification {
*exposeControlValue {
|category, cv, id|
instances.do { |inst| inst.exposeControlValue(category, cv, id) };
}
displayString {
|value, cv|
var str = cv.value.asString;
if (cv.spec.units.notNil and: { cv.spec.units.notEmpty }) {
ThreadPostln {
classvar <>all, <>lastChar;
*initClass {
all = ();
lastChar = ();
}
}
+String {
@scztt
scztt / extFile.sc
Last active January 23, 2026 13:02
// XMP parsing requires:
// Quarks.install("XML"); [in supercollider]
// brew install exiftool [in terminal]
+SoundFile {
exiftoolPath {
^"/usr/local/bin/exiftool"
}
extractMarkers {
Pmonophonic : Pattern {
*initClass {
Class.initClassTree(Event);
Event.composeEventType(
\monoUpdate,
composeType: \set,
parentEvent: (updateGroup:false),
func: {
|server, set|
var bundle;
(
SynthDef(\default, {
var env, sig, freq, velocity;
velocity = \velocity.kr(80).linlin(0, 127, 0, 1);
env = Env.adsr(
\attackTime.kr(0.05),
\decayTime.kr(0.2),
\sustainLevel.kr(-2.dbamp),
Event.addEventType(\pattern, {
var pat, event, outerEvent, recursionLevel, instrument, embeddingLevel, freq, rest;
var args, defaults, timingOffset;
~pattern = ~pattern ?? { ~instrument };
if (~pattern.isKindOf(Function)) {
defaults = ~pattern.def.prototypeFrame;
args = ~pattern.def.argNames.collect {
(
~c = nil;
~c = ~c ?? { ControlValueEnvir(BusControlValue) }; // controls mapped to busses
~c.name = "My controls";
// ~c = ~c ?? { ControlValueEnvir(NumericControlValue) }; // controls mapped to sclang only values
// controls are automatically created when you refer to them, so you can just do ~controlName.spec = ....
// to set their spec. This determines what is displayed on the Electra screen.

Quark folder structure

NewQuark/
├── Assets
│   └── new_sound.wav
├── Classes
│   └── NewClass.sc
├── HelpSource
│   └── NewClass.scdoc
@scztt
scztt / Gdef.sc
Last active January 28, 2025 13:21
Gdef : Singleton {
classvar <groupOrder, rebuildBundle, <nodeMap;
var <group, <afterList, <beforeList, <server, <>permanent=true;
classvar blockUpdate=false, updateCount=0;
*initClass {
[Event, EventTypesWithCleanup].do(Class.initClassTree(_));
groupOrder = LinkedList();
nodeMap = IdentityDictionary();