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 {
(
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),
(
~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.
Pmonophonic : Pattern {
*initClass {
Class.initClassTree(Event);
Event.composeEventType(
\monoUpdate,
composeType: \set,
parentEvent: (updateGroup:false),
func: {
|server, set|
var bundle;

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();
@scztt
scztt / String-unicode.sc
Last active December 12, 2024 15:15
unicode Strings
+String {
unicodeSize {
var size = this.size;
size = size - (this.select({ |c| c.ascii < 0 }).size / 3 * 2).asInteger;
^size;
}
unicodeIndex {
|index|
var i = 0;
(
Ndef(\synth, {
var lpf, res, distort, rate, decay,
freq, amp, sig, env, trig, detune;
// CONTROLS
lpf = \lpf.ar(540);
res = \res.ar(0.9);
distort = \distort.ar(0.7);