跳到正文
cccskills
免费在 GitHub 公开

supercollider-projects

Work with SuperCollider projects as files - the shape of a .scd piece, how to read and write one with sc_project, how to send the file that is on disk into the live session with sc_load, what state belongs in the session and what belongs in the file, and how to package a piece the SuperCollider way (a folder with its .scd, its SynthDefs, and a Quark-style layout) instead of inventing a format.

中文简介正在准备中。当前显示原文说明。

查看安装方法

包含的文件(1)

  • SKILL.md7.4 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

SuperCollider projects

SuperCollider has no project file and no build system. What it has is a convention, and it has held for twenty years:

A piece is a folder with a .scd file in it, and everything the piece needs is either in that file or in Extensions/ next to it.

That is the whole format. Respecting it means the user can open the folder in the SuperCollider IDE, in Emacs, or in the editor vncode ships, and everything works.

.scd files

A .scd is a plain text file of sclang. Three shapes are idiomatic:

A score — the whole piece runs top to bottom.

(
s.waitForBoot {
	var root = 55;
	SynthDef(\drone, { |freq = 55, amp = 0.1| LFTri.ar(freq) * amp * EnvGen.kr(Env.asr(0.5, 1, 1), gate: 1, doneAction: 2) }).add;
	s.sync;
	~voice = Synth(\drone, [freq: root]);
	30.wait;
	~voice.set(\gate, 0);
};
)

A live-coding session — definitions at the top, edits made from the keyboard.

(
s.waitForBoot {
	Ndef(\drone, { |freq = 55, amp = 0.1| LFTri.ar(freq) * amp }).play;
	Ndef(\air, { HPF.ar(PinkNoise.ar(0.02), 1200) }).play;
};
)

A library — reusable definitions, no sound on load.

(
SynthDef(\blip, { |freq = 440, amp = 0.2, decay = 0.25|
	var env = EnvGen.kr(Env.perc(0.004, decay), doneAction: 2);
	Out.ar(0, Pan2.ar(SinOsc.ar(freq) * env * amp, 0));
}).add;

SynthDef(\pad, { |freq = 110, amp = 0.08, gate = 1, cutoff = 900|
	var env = EnvGen.kr(Env.asr(0.4, 1, 0.8), gate, doneAction: 2);
	Out.ar(0, RLPF.ar(LFSaw.ar([freq, freq * 1.004]), cutoff, 0.4) * env * amp);
}).add;
)

Rules of thumb that keep a .scd usable:

  • Wrap the whole file in one outer block ( ... ). It makes the file one submission, which is what sc_load and the IDE both want.
  • s.waitForBoot { ... } when the file needs the server to exist. Without it, .add on a SynthDef races the server's boot.
  • s.sync after .add before the first Synth(...): .add is asynchronous, and a node created before the def arrives fails with "SynthDef not found".
  • Give the piece a variable it can be stopped from: ~voice, ~piece, an Ndef name. A file whose only handle is a node id is a file you cannot stop.
  • Amplitudes modest (0.05–0.2 per voice).

Working with files through the tools

WantCall
What is in this foldersc_project action=list, dir .
Read onesc_project action=read, file piece.scd
Create or replace onesc_project action=write, file piece.scd, code (...)
Run the file that is on disksc_load file piece.scd
Run it with a different deadlinesc_load file piece.scd, timeoutMs 120000

sc_project action=write refuses to replace an existing file unless you pass overwrite: true. That is deliberate: a piece the user wrote by hand should not disappear because an agent decided to "save" it. When you want to change a file, read it first, understand what is there, then write with overwrite: true — or better, write a new file and say what it is.

A relative path resolves against the conversation workspace, and the resolved absolute path is reported back, so there is never any doubt about which file was touched. sc_load reads from disk at the moment of the call, so it is always the file the user is looking at — including edits they made since you last read it. That is the point of the tool: edit in your editor, load, hear it.

What belongs in the session, and what belongs in the file

The session is a live interpreter; the file is the durable artifact. They are not the same, and confusing them loses work.

Belongs in the fileBelongs in the session
SynthDef definitionsThe running nodes those defs made
The Ndef / Pdef definitionsThe current Ndef(\x).set(...) values
The structure of the pieceThe improvisation inside it
Anything the user would want tomorrowAnything you would want in ten seconds

So: a parameter you are exploring goes in sc_exec or sc_nodes; a parameter that is the piece goes in the file. When an exploration settles, write it back.

Save definitions, not state. A file that contains ~voice.set(\freq, 41.2) is a file that only makes sense after the file before it ran. Put that value in the def's default, or in a ~variable the file sets at the top.

Packaging a piece

Two levels, and picking the right one is most of the decision:

A piece — one folder, one file, its defs.

my-piece/
  piece.scd          the piece: defs at the top, the score below
  README.md          what it is and how to run it
  samples/           any buffers it loads

A Quark — a reusable library, the SuperCollider package format.

MyQuarks/
  quarks/
    my-quarks/       or the classes alone, at the top of the folder
      Classes/       one .sc per class, the file named after the class
      HelpSource/    one .schelp per class, the file named after the class
      README.md
      .quark         a one-line file: MyQuarks: "description"

A Quark has hard naming rules, because the class library builds it:

  • One class per file, and the file is named exactly after the class (Classes/BlipVoice.sc contains BlipVoice). Two classes in one file, or a file name that does not match, is the most common reason a Quark "does not exist".
  • HelpSource/ mirrors Classes/, one .schelp per class, named the same.
  • The folder name is the Quark name, and .quark (or quarks/<name>/) is where SuperCollider looks. Install it by adding the parent folder to Quarks.quarkDir-adjacent search paths, or by symlinking into ~/Library/Application Support/SuperCollider/Extensions on macOS, %LOCALAPPDATA%\SuperCollider\Extensions on Windows, or ~/.local/share/SuperCollider/Extensions on Linux.

Do not invent a project format on top of this. If the user has four pieces in one folder, that folder is the project; a .scd per piece is the organisation, and .sc classes plus a HelpSource beside them is the upgrade path when something is worth re-using.

Before you say a piece is finished

  1. It stops. Every sustained voice has a gate, and the file ends by releasing it (~voice.set(\gate, 0)) or frees it (Ndef(\x).stop). A piece that cannot be stopped is not finished.
  2. It does not raise its own volume. Check the per-voice amplitudes; ten voices at 0.2 is clipping.
  3. Its defs load in order. s.waitForBoot around the defs, s.sync after them, before the first Synth(...).
  4. It says how to stop it. Either in the file (a final Ndef.clear;) or in the README — the user should not have to reload the file to stop the sound.
  5. It is readable. A piece someone opens in six months should explain itself in comments at the top: what it is, what to run, how to stop.

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

Author an editorial HTML+SVG diagram with the Diagram Design kit - choose the visual type, read its reference, start from an example, and satisfy the safety and accessibility contract that diagram_write({kind:"html"}) enforces.

中文简介正在准备中。当前显示原文说明。

vecnode/vn-code102026年10月20日 更新

Control this machine's Docker or Podman engine through the docker_* tools - read the engine's state first, list containers and images, inspect one, tail its logs, pull an image and start it, then stop, restart or remove what you started. Covers the engine that is asleep behind Docker Desktop and the exact call for each verb, the confirm rule removals obey, and the flags the tools deliberately do not have.

中文简介正在准备中。当前显示原文说明。

vecnode/vn-code102026年10月20日 更新

Drive ffmpeg through the media_run tool as an argv array - remux instead of re-encode, map streams explicitly, trim at keyframes, scale and crop, extract audio and frames, and build GIFs, contact sheets and concatenations. Covers the flags this pack injects, reading a failure from its exit code and last log lines, and the version-dependent spellings to hedge.

中文简介正在准备中。当前显示原文说明。

vecnode/vn-code102026年10月20日 更新

Read a media file's real structure with ffprobe through media_run - the JSON invocation and how to read it, what every family of field means, how to count frames, sample without decoding everything, detect HDR and interlacing, and diagnose a missing duration, a stream with no frames or a container that lies. Covers when media_probe's own report is already enough.

中文简介正在准备中。当前显示原文说明。

vecnode/vn-code102026年10月20日 更新

Use when the user wants to design, redesign, shape, critique, audit, polish, simplify, harden, animate, or otherwise improve a frontend interface: websites, landing pages, dashboards, product UI, components, forms, settings, onboarding, empty states, and native iOS or Android screens. Handles UX review, hierarchy, layout, typography, color, motion, UX copy, accessibility, responsive behavior, edge cases, and capturing or documenting design systems (DESIGN.md, tokens). Also for making bland UI bolder, loud UI quieter, or ambitious visual effects. Not for backend-only or non-UI tasks.

中文简介正在准备中。当前显示原文说明。

vecnode/vn-code102026年10月20日 更新

Author Mermaid diagrams that parse the first time: choose the right diagram type for the question, write syntax the parser accepts, and keep the picture readable in a narrow panel. A bundled reference covers complex, large diagrams.

中文简介正在准备中。当前显示原文说明。

vecnode/vn-code102026年10月20日 更新

查看 vecnode 的全部技能

报告此技能的问题