tstosc
raw JSON → 0.0.2 verified Fri May 01 auth: no javascript
A transpiler converting TypeScript to SuperCollider's SCLang. Version 0.0.2, experimental/unstable, released 2025-01-15 (first version). Differentiators: enables using TypeScript syntax/type-checking for SuperCollider music/audio programming, writes classes to SuperCollider User Extension folder. Built with Node.js, ESM-only, no peer dependencies.
Common errors
error Error: Cannot find module 'tstosc' ↓
cause Package not installed or not in PATH when using CLI.
fix
Ensure global installation: npm install -g tstosc
error SyntaxError: Unexpected token 'export' ↓
cause Running transpiled output with Node.js instead of SuperCollider.
fix
Use the .sc file in SuperCollider, not Node.
Warnings
gotcha Package is highly experimental (v0.0.2). May produce unreliable or incorrect SCLang code. ↓
fix Always review generated .sc files before use in SuperCollider.
gotcha Class definitions are written to SuperCollider's User Extension folder, potentially overwriting existing files. ↓
fix Back up your SuperCollider extensions or run in a test environment.
Install
npm install tstosc yarn add tstosc pnpm add tstosc Imports
- tstosc wrong
const tstosc = require('tstosc')correctimport tstosc from 'tstosc'
Quickstart
// Install globally
npm install -g tstosc
// Transpile a TypeScript file (e.g., test.ts)
tstosc ./test.ts
// Converts ./test.ts to ./test.sc
// Example test.ts content:
// const freq = 440;
// const duration = 0.5;
// Synth('sine', { freq, gate: 1, out: 0 });
// After running tstosc, check test.sc:
// cat test.sc