Token导航 LogoToken导航

Agent Skill · 前端设计

tonejs(tonejs 前端)

用于辅助前端页面、组件、样式和交互逻辑的开发与维护。它适合让 Agent 生成或审查 React、Next.js、Vue、Tailwind、CSS 等相关代码,整理组件结构,或定位布局和性能问题。使用时需要结合项目现有设计系统、路由和构建方式,避免只生成孤立片段;涉及页面改动时,应配合本地预览和构建检查确认视觉效果。

tonejs 是前端设计类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为操作浏览器;许可证为 MIT,第三方扫描已通过,按安装量在前端设计类的 10,216 个 Skill 里排第 1,630。

总安装 4,553周安装 186GitHub Stars 1下载 1,473核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
MIT

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:tonejs(tonejs 前端)
来源仓库:https://github.com/plyght/tonejs-skill
仓库路径:skills/tonejs
安装命令:
npx skills add https://github.com/plyght/tonejs-skill --skill tonejs
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/plyght/tonejs-skill --skill tonejs

这个 Skill 是做什么的

前端设计类 Skill 关注页面结构、视觉规范和组件写法,输出通常是可运行的界面代码。

tonejs 用于辅助前端页面、组件、样式和交互逻辑的开发与维护。适合生成或审查 React、Next.js、Vue、Tailwind、CSS 等相关代码。使用时需结合项目现有设计系统和路由方式,避免生成孤立片段。涉及页面改动时应配合本地预览和构建检查确认视觉效果。建议先在小范围内测试改动,再应用到生产环境。

来源仓库内路径:skills/tonejs

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/plyght/tonejs-skill --skill tonejs;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要操作浏览器,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

tonejs 怎么安装?

在终端执行 npx skills add https://github.com/plyght/tonejs-skill --skill tonejs。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

tonejs 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

tonejs 需要什么权限?

权限级别是操作浏览器。该 Skill 可能涉及浏览器控制能力,使用时可能读取或操作网页内容,需要在受控环境中确认权限边界。

tonejs 是免费的吗?

来源标注的许可证是 MIT。本站不代收任何费用,也不托管安装包;能否商用、要不要署名,以许可证原文为准。

tonejs 用的人多吗?

公开数据是累计安装 4,553 次,近一周安装 186 次,下载 1,473 次,GitHub 1 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

tonejs 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 3 个目录同时收录,说明这个 Skill 流传比较广。
  • 许可证明确为 MIT,商用和分发边界好判断。
  • 第三方扫描已通过,常见的高风险行为没有命中。

先想清楚的地方

  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理前端设计类任务、又不想每次都手写提示词的人。
  • 需要许可证清楚、并且有第三方扫描结果的团队项目。

不太适合

  • 需要厂商级技术支持和 SLA 的生产系统。

前端设计类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
frontend-design

前端设计 · Codex、Claude

8,823,360126,072只读MIT通过
vercel-composition-patterns

Vercel 组合模式 · Codex、Claude

3,858,81625,893需要联网MIT通过
vercel-react-native-skills

Vercel React native skills 前端 · Codex、Claude

2,468,66425,878只读MIT通过
adapt

adapt 搜索 · Codex、Claude

2,027,04023,125操作浏览器未明确通过
bolder

bolder 分析 · Codex、Claude

2,004,28823,130只读未明确通过
tonejs

tonejs 前端 · 本页

4,5531操作浏览器MIT通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

Tone.js Skill

Build interactive music applications in the browser using the Web Audio API through Tone.js's high-level abstractions.

When to Use This Skill

Use Tone.js when:

  • Creating synthesizers, samplers, or musical instruments
  • Building step sequencers, drum machines, or DAWs
  • Adding sound effects or music to games
  • Implementing audio visualizations synchronized to sound
  • Processing audio in real-time with effects
  • Scheduling musical events with precise timing
  • Working with musical concepts (notes, tempo, measures)

Core Concepts

1. Context and Initialization

The AudioContext must be started from a user interaction (browser requirement):

import * as Tone from "tone";

// ALWAYS call Tone.start() from user interaction
document.querySelector("button").addEventListener("click", async () => {
	await Tone.start();
	console.log("Audio context ready");
	// Now safe to play audio
});

2. Audio Graph and Routing

All audio nodes connect in a graph leading to Tone.Destination (the speakers):

// Basic connection
const synth = new Tone.Synth().toDestination();

// Chain through effects
const synth = new Tone.Synth();
const filter = new Tone.Filter(400, "lowpass");
const delay = new Tone.FeedbackDelay(0.125, 0.5);
synth.chain(filter, delay, Tone.Destination);

// Parallel routing (split signal)
const reverb = new Tone.Reverb().toDestination();
const delay = new Tone.Delay(0.2).toDestination();
synth.connect(reverb);
synth.connect(delay);

3. Time and Scheduling

Tone.js abstracts time in musical notation:

  • "4n" = quarter note
  • "8n" = eighth note
  • "2m" = two measures
  • "8t" = eighth note triplet
  • Numbers = seconds

CRITICAL: Always use the time parameter passed to callbacks:

// CORRECT - sample-accurate timing
const loop = new Tone.Loop((time) => {
	synth.triggerAttackRelease("C4", "8n", time);
}, "4n");

// WRONG - JavaScript timing is imprecise
const loop = new Tone.Loop(() => {
	synth.triggerAttackRelease("C4", "8n"); // Will drift
}, "4n");

4. Transport System

The global timekeeper for synchronized events:

// Schedule events on the Transport
const loop = new Tone.Loop((time) => {
	synth.triggerAttackRelease("C4", "8n", time);
}, "4n").start(0);

// Control the Transport
Tone.Transport.start();
Tone.Transport.stop();
Tone.Transport.pause();
Tone.Transport.bpm.value = 120; // Set tempo

Step-by-Step Instructions

Task 1: Create a Basic Synthesizer

  1. Import Tone.js
  2. Create a synth and connect to output
  3. Wait for user interaction to start audio
  4. Play notes using triggerAttackRelease
import * as Tone from "tone";

const synth = new Tone.Synth().toDestination();

button.addEventListener("click", async () => {
	await Tone.start();
	// Play C4 for an eighth note
	synth.triggerAttackRelease("C4", "8n");
});

Task 2: Create a Polyphonic Instrument

  1. Use PolySynth to wrap a monophonic synth
  2. Pass multiple notes to play chords
  3. Release specific notes when needed
const polySynth = new Tone.PolySynth(Tone.Synth).toDestination();

// Play a chord
polySynth.triggerAttack(["C4", "E4", "G4"]);

// Release specific notes
polySynth.triggerRelease(["E4"], "+1");

Task 3: Load and Play Audio Files

  1. Create a Player or Sampler
  2. Wait for Tone.loaded() promise
  3. Start playback
const player = new Tone.Player("https://example.com/audio.mp3").toDestination();

await Tone.loaded();
player.start();

// For multi-sample instruments
const sampler = new Tone.Sampler({
	urls: {
		C4: "C4.mp3",
		"D#4": "Ds4.mp3",
		"F#4": "Fs4.mp3",
	},
	baseUrl: "https://example.com/samples/",
}).toDestination();

await Tone.loaded();
sampler.triggerAttackRelease(["C4", "E4"], 1);

Task 4: Create a Looping Pattern

  1. Use Tone.Loop or Tone.Sequence for patterns
  2. Pass the time parameter to instrument triggers
  3. Start the loop and the Transport
const synth = new Tone.Synth().toDestination();

const loop = new Tone.Loop((time) => {
	synth.triggerAttackRelease("C4", "8n", time);
}, "4n").start(0);

await Tone.start();
Tone.Transport.start();

Task 5: Add Effects Processing

  1. Create effect instances
  2. Connect in desired order (serial or parallel)
  3. Adjust wet/dry mix if needed
const synth = new Tone.Synth();
const distortion = new Tone.Distortion(0.4);
const reverb = new Tone.Reverb({
	decay: 2.5,
	wet: 0.5, // 50% effect, 50% dry
});

synth.chain(distortion, reverb, Tone.Destination);

Task 6: Automate Parameters

  1. Access parameter via property (e.g., frequency, volume)
  2. Use methods like rampTo, linearRampTo, exponentialRampTo
  3. Schedule changes with time parameter
const osc = new Tone.Oscillator(440, "sine").toDestination();

osc.start();

// Ramp frequency to 880 Hz over 2 seconds
osc.frequency.rampTo(880, 2);

// Set value at specific time
osc.frequency.setValueAtTime(440, "+4");

// Exponential ramp (better for frequency)
osc.frequency.exponentialRampTo(220, 1, "+4");

Task 7: Synchronize Visuals with Audio

  1. Use Tone.Draw.schedule() for visual updates
  2. Schedule in the same callback as audio events
  3. Visual updates happen just before audio plays
const loop = new Tone.Loop((time) => {
	synth.triggerAttackRelease("C4", "8n", time);

	// Schedule visual update
	Tone.Draw.schedule(() => {
		element.classList.add("active");
	}, time);
}, "4n");

Common Patterns

Pattern: Step Sequencer

const synth = new Tone.Synth().toDestination();
const notes = ["C4", "D4", "E4", "G4"];

const seq = new Tone.Sequence(
	(time, note) => {
		synth.triggerAttackRelease(note, "8n", time);
	},
	notes,
	"8n"
).start(0);

Tone.Transport.start();

Pattern: Probabilistic Playback

const loop = new Tone.Loop((time) => {
	if (Math.random() > 0.5) {
		synth.triggerAttackRelease("C4", "8n", time);
	}
}, "8n");

Pattern: Dynamic Effect Parameters

const filter = new Tone.Filter(1000, "lowpass").toDestination();
const lfo = new Tone.LFO(4, 200, 2000); // 4Hz, 200-2000Hz range

lfo.connect(filter.frequency);
lfo.start();

Sound Design Principles

Core Insights

Auditory processing is 10x faster than visual (~25ms vs ~250ms). Sound provides immediate feedback that makes interactions feel responsive. A button that clicks *feels* faster than one that doesn't, even with identical visual feedback.

Sound communicates emotion instantly. A single tone conveys success, error, or tension better than visual choreography. When audio and visuals tell the same story together, the experience is stronger than either alone.

Less is more. Most interactions should be silent. Reserve sound for moments that matter: confirmations for major actions, errors that can't be overlooked, state transitions, and notifications. Always pair sound with visuals for accessibility - sound enhances, never replaces. Study games for reference - they've perfected informative, emotional, non-intrusive audio feedback.

Design Philosophy

Good sound design transforms user experience across all platforms - web apps, mobile apps, desktop applications, and games. These principles apply universally whether creating notification sounds, UI feedback, or musical interactions.

Sound uses a universal language understood by everyone. When designing audio:

Ask foundational questions:

  • What is the essence of what this app/feature is about?
  • What emotion do you want to evoke?
  • How does it match the app's visual aesthetics?
  • How would users understand this interaction without looking at the screen?

Consider context:

  • Where will users hear this? (Pocket, desk, busy street, quiet room)
  • What will they be doing? (Working, commuting, gaming)
  • How often will they hear it? (Once per day vs hundreds of times)

Notification Sound Design

Effective notification sounds have these characteristics:

1. Distinguishable

  • Create a unique sonic signature that identifies the app
  • Use characteristic timbres or melodic patterns
  • Layer simple elements to build recognition
  • Don't mimic system defaults or other common sounds

2. Conveys meaning

  • The sound should connect to the message (not literal, but suggestive)
  • Liquid qualities for water/weather, metallic for alerts, warm tones for success
  • Use timbre and envelope to suggest the content
  • Abstract representation, not sound effects

3. Friendly and appropriate

  • Match urgency to message importance
  • Gentle sounds: Soft attacks (50ms+), smooth timbres (sine, triangle)
  • Urgent sounds: Fast attacks (<5ms), brighter timbres (square, FM synthesis)
  • Volume and brightness indicate priority

4. Simple and clean

  • Avoid complex layering or dense harmonic content
  • One or two-note patterns work better than melodies
  • Pleasant timbres remain tolerable when heard repeatedly
  • Clarity over cleverness

5. Unobtrusive and repeatable

  • Duration: 0.3-0.8 seconds maximum for notifications
  • Use softer timbres (sine, triangle) for frequent sounds
  • Avoid harsh, complex, or extremely bright timbres
  • Should remain pleasant when heard 50+ times per day

6. Cuts through noise, not abrasive

  • Mid-range frequencies (300-3000Hz) are most effective
  • Avoid extreme highs (>8kHz) and lows (<80Hz)
  • Design for noisy environments without being harsh
  • Triangle and sine waves are gentler than square waves

UI Sound Design

For buttons, interactions, and transitions:

1. Use sparingly

  • Add sound only to significant state changes or confirmations
  • Silence is often the best choice
  • Don't sonify every hover, mouseover, or minor interaction
  • Reserve audio feedback for meaningful moments

2. Volume relative to purpose

  • UI sounds: Much quieter than notifications (-20 to -30dB)
  • Users have device in hand, subtlety works
  • Notifications: Louder to cut through ambient noise (-10 to -15dB)

3. Synchronization matters

  • Audio and visual updates must occur simultaneously (< 10ms tolerance)
  • Misalignment feels laggy and unprofessional
  • Use precise scheduling, not approximate timing

4. Match interaction character

  • Quick taps: Short duration (<50ms), higher frequencies
  • Heavy presses: Longer duration (100-200ms), lower frequencies
  • Drag operations: Continuous feedback or silence
  • Successful actions: Rising pitch or bright timbre
  • Failed actions: Falling pitch or dull timbre

5. Convey depth and movement

  • Forward movement: Rising pitch over time
  • Backward movement: Falling pitch over time
  • Opening: Expanding envelope (fade in)
  • Closing: Contracting envelope (fade out)
  • Envelope shape suggests physical metaphor

Creative Process

1. Start with a sound palette

  • Explore different synthesis types (sine, triangle, square, FM, AM, noise)
  • Record or synthesize sounds related to the concept
  • Physical objects, everyday sounds, and traditional instruments all work
  • Build a library of 5-10 candidate sounds

2. Match sound to purpose

  • Each UI element gets ONE sound that fits its specific purpose
  • Button click: Quick and responsive (high pitch, fast decay)
  • Toggle switch: Two distinct sounds for on/off states
  • Notification: Longer and more distinctive
  • No need to provide multiple options - choose the best fit

3. Use any sound source

  • Traditional instruments: Kalimba, bells, piano, marimba
  • Physical materials: Metal, glass, wood, plastic
  • Synthesized: Pure tones, FM synthesis, filtered noise
  • Unconventional: Toasters, doors, mechanical sounds
  • The source matters less than the final character

4. Layer for richness

  • Combine 2-3 simple elements rather than one complex sound
  • Base tone + harmonic layer + texture
  • Each layer serves a purpose (body, brightness, character)
  • Keep total duration brief even with layers

Technical Considerations

1. Clean audio

  • Fade in/out to prevent clicks (10-50ms)
  • Remove DC offset
  • Normalize levels consistently
  • Avoid truncation or abrupt endings

2. Frequency filtering

  • High-pass filter at 80Hz (removes sub-bass)
  • Small speakers can't reproduce low frequencies
  • Low-pass filter at 8kHz if needed (removes harsh highs)
  • Focus energy in 300-3000Hz for maximum effectiveness

3. Cross-platform design

  • Design for the worst speaker system (phone, laptop)
  • Headphones reveal more detail, but optimize for speakers
  • Avoid sub-bass (<80Hz) entirely
  • Mid-range frequencies work everywhere

4. Duration guidelines

  • Notifications: 0.3-0.8 seconds
  • Button clicks: 0.05-0.1 seconds
  • Toggles: 0.05-0.15 seconds
  • Transitions: 0.1-0.3 seconds
  • Keep all UI sounds brief to respect user attention

5. User control

  • Always provide settings to disable sounds
  • Volume control separate from system volume
  • Per-sound-type toggles (notifications vs UI feedback)
  • Respect system-wide mute switches

6. Synchronization precision

  • Schedule audio at exact same moment as visuals
  • 10-20ms latency is perceptible and feels wrong
  • Use precise timing APIs, not setTimeout/setInterval
  • Audio-visual sync is critical for perceived responsiveness

Design Checklist

Implementation considerations when designing sounds:

  • Distinguishable: Unique waveform/envelope that doesn't mimic system defaults
  • Repeatable: Simple, pleasant timbres (sine, triangle) rather than complex or harsh
  • Cross-platform: Frequencies between 300-3000Hz, high-pass filtered at 80Hz
  • Audible but not harsh: Mid-range frequencies, avoid extreme highs (>8kHz) and lows (<80Hz)
  • Short duration: 0.3-0.8 seconds for notifications, <0.1 seconds for UI feedback
  • Synchronized: Audio triggers scheduled at same time as visual updates (< 10ms tolerance)
  • User control: Settings option to disable sounds and adjust volume
  • Appropriate character: Envelope matches interaction (quick tap = short decay, heavy press = longer decay)
  • Clean audio: Fade in/out to prevent clicks, filtered to remove unused frequencies
  • Meaningful: Timbre/pitch suggests the message (liquid for rain, metallic for alerts, warm for success)

Important Edge Cases and Gotchas

1. Browser Autoplay Policy

MUST call Tone.start() from user interaction. Without this, no audio will play.

// WRONG - will fail silently
Tone.Transport.start();

// CORRECT
button.addEventListener("click", async () => {
	await Tone.start();
	Tone.Transport.start();
});

2. Memory Management

Always dispose of nodes when done:

const synth = new Tone.Synth().toDestination();

// When finished
synth.dispose();

// For arrays of instruments
players.forEach((player) => player.dispose());

3. Timing Precision

JavaScript callbacks are NOT precise. Always use the time parameter:

// WRONG - will drift out of sync
setInterval(() => {
	synth.triggerAttackRelease("C4", "8n");
}, 250);

// CORRECT - sample-accurate
new Tone.Loop((time) => {
	synth.triggerAttackRelease("C4", "8n", time);
}, "4n").start(0);

4. Loading Samples

Wait for samples to load before playing:

const sampler = new Tone.Sampler({
	urls: { C4: "piano.mp3" },
	baseUrl: "/audio/",
}).toDestination();

// WRONG - may not be loaded yet
sampler.triggerAttack("C4");

// CORRECT
await Tone.loaded();
sampler.triggerAttack("C4");

5. Monophonic vs Polyphonic

Basic synths are monophonic (one note at a time):

// Only plays one note
const mono = new Tone.Synth().toDestination();
mono.triggerAttack(["C4", "E4", "G4"]); // Only C4 plays

// Plays all notes
const poly = new Tone.PolySynth(Tone.Synth).toDestination();
poly.triggerAttack(["C4", "E4", "G4"]); // All play

6. Note Format

Notes can be specified multiple ways:

synth.triggerAttackRelease("C4", "8n"); // Pitch-octave notation
synth.triggerAttackRelease(440, "8n"); // Frequency in Hz
synth.triggerAttackRelease("A4", "8n"); // A4 = 440Hz

7. Transport Time vs Audio Context Time

Two timing systems exist:

Tone.now(); // AudioContext time (always running)
Tone.Transport.seconds; // Transport time (starts at 0)

// Schedule on AudioContext
synth.triggerAttackRelease("C4", "8n", Tone.now() + 1);

// Schedule on Transport
Tone.Transport.schedule((time) => {
	synth.triggerAttackRelease("C4", "8n", time);
}, "1m");

Architecture Overview

ToneAudioNode (base class)
├── Source (audio generators)
│   ├── Oscillator, Player, Noise
│   └── Instrument
│       ├── Synth, FMSynth, AMSynth
│       ├── Sampler
│       └── PolySynth
├── Effect (audio processors)
│   ├── Filter, Delay, Reverb
│   ├── Distortion, Chorus, Phaser
│   └── PitchShift, FrequencyShifter
├── Component (building blocks)
│   ├── Envelope, Filter, LFO
│   └── Channel, Volume, Panner
└── Signal (parameter automation)
    ├── Signal, Add, Multiply
    └── Scale, WaveShaper

Quick Reference

Instrument Types

  • Tone.Synth - Basic single-oscillator synth
  • Tone.FMSynth - Frequency modulation synthesis
  • Tone.AMSynth - Amplitude modulation synthesis
  • Tone.MonoSynth - Monophonic with filter and envelope
  • Tone.DuoSynth - Two-voice synth
  • Tone.MembraneSynth - Percussive synth
  • Tone.MetalSynth - Metallic sounds
  • Tone.NoiseSynth - Noise-based synthesis
  • Tone.PluckSynth - Plucked string model
  • Tone.PolySynth - Polyphonic wrapper
  • Tone.Sampler - Multi-sample instrument

Common Effects

  • Tone.Filter - Lowpass, highpass, bandpass, etc.
  • Tone.Reverb - Convolution reverb
  • Tone.Delay / Tone.FeedbackDelay - Echo effects
  • Tone.Distortion - Waveshaping distortion
  • Tone.Chorus - Chorus effect
  • Tone.Phaser - Phaser effect
  • Tone.PitchShift - Real-time pitch shifting
  • Tone.Compressor - Dynamic range compression
  • Tone.Limiter - Brick wall limiter

Time Notation

  • "4n" - Quarter note
  • "8n" - Eighth note
  • "16n" - Sixteenth note
  • "2m" - Two measures
  • "8t" - Eighth note triplet
  • "1:0:0" - Bars:Beats:Sixteenths
  • 0.5 - Seconds (number)

Resources

平台分布

Claude Code

30.46%
按下载量换算449

OpenCode

24.79%
按下载量换算365

windsurf

16.5%
按下载量换算243

trae

13.85%
按下载量换算204

Codex

8.62%
按下载量换算127

Antigravity

3.67%
按下载量换算54

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

操作浏览器

该 Skill 可能涉及浏览器控制能力,使用时可能读取或操作网页内容,需要在受控环境中确认权限边界。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。

继续浏览同类 Skills