system-audio
Captures and processes system audio output across multiple macOS versions.
Install
mkdir -p .claude/skills/system-audio && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/12379" && unzip -o skill.zip -d .claude/skills/system-audio && rm skill.zipInstalls to .claude/skills/system-audio
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Capture system audio (what the computer is playing) using crystal-audio. Covers ProcessTap (macOS 14.2+), ScreenCaptureKit fallback (macOS 13.0+), and the low-level SystemAudioCapture API for real-time audio processing.Key capabilities
- →Capture system audio (what the computer is playing) using crystal-audio.
- →Record system audio to a stereo WAV file.
- →Detect macOS version at runtime.
- →Access low-level API for real-time audio processing.
- →Record both system audio and microphone streams simultaneously.
- →Check for Screen Recording permission programmatically.
How it works
The skill captures system audio using macOS APIs (ProcessTap or ScreenCaptureKit) based on the OS version, allowing recording to a file or real-time processing through a low-level API.
Inputs & outputs
When to use system-audio
- →Recording system audio
- →Real-time audio visualization
- →Analyzing system sound output
About this skill
System Audio Capture with crystal-audio
Overview
crystal-audio captures system audio — everything playing through the computer's speakers — using two macOS APIs selected automatically based on OS version:
| macOS Version | API | Permission Required |
|---|---|---|
| 14.2+ (Sonoma) | ProcessTap | None |
| 13.0-14.1 (Ventura) | ScreenCaptureKit | Screen Recording |
Quick Start
require "crystal_audio"
rec = CrystalAudio::Recorder.new(
source: CrystalAudio::RecordingSource::System,
output_path: "/tmp/system_audio.wav"
)
rec.start
sleep 30.seconds
rec.stop
Output: stereo WAV, 48 kHz, 16-bit PCM.
Version Detection
The library detects macOS version at runtime:
CrystalAudio::MacOS.version
# => {major: 15, minor: 3, patch: 0}
CrystalAudio::MacOS.process_tap?
# => true on macOS 14.2+
CrystalAudio::MacOS.screen_capture_kit?
# => true on macOS 13.0+
Low-Level API: SystemAudioCapture
For real-time audio processing (visualization, streaming, analysis), use the
SystemAudioCapture class directly:
require "crystal_audio"
tap = CrystalAudio::SystemAudioCapture.new
tap.start do |frames, frame_count, channels|
# frames: Slice(Float32) — interleaved PCM (L, R, L, R, ...)
# frame_count: UInt32 — number of sample frames
# channels: UInt32 — channel count (typically 2)
# Calculate RMS volume
sum = 0.0_f64
frames.each { |s| sum += s.to_f64 * s.to_f64 }
rms = Math.sqrt(sum / frames.size)
puts "Volume: #{(rms * 100).round(1)}%"
end
sleep 10.seconds
tap.stop
Real-Time Safety
The callback runs on a real-time audio thread. Inside the callback:
- DO NOT allocate Crystal objects (no
String.new, noArray.new, etc.) - DO NOT acquire mutexes or call
Fiber.yield - DO write to pre-allocated buffers
- DO use atomic operations for signaling
- DO keep the callback as short as possible
For processing that requires allocations, copy data to a ring buffer and process on another thread.
Audio Format Details
| Property | Microphone | System Audio |
|---|---|---|
| Sample Rate | 44,100 Hz | 48,000 Hz |
| Channels | 1 (mono) | 2 (stereo) |
| Bit Depth | 16-bit int | 32-bit float (callback) / 16-bit int (WAV) |
| Buffer | ~185ms | ~10ms |
Recording Both Streams
rec = CrystalAudio::Recorder.new(
source: CrystalAudio::RecordingSource::Both,
output_path: "/tmp/meeting_system.wav",
mic_output_path: "/tmp/meeting_mic.wav"
)
rec.start
# Both streams record simultaneously
# System: 48kHz stereo
# Mic: 44.1kHz mono
rec.stop
Permissions
macOS 14.2+ (ProcessTap)
No special permissions needed. ProcessTap captures audio directly from the audio server without screen recording access.
macOS 13.0-14.1 (ScreenCaptureKit)
Requires Screen Recording permission. The user will be prompted on first use.
Add to your Info.plist:
<key>NSAudioCaptureUsageDescription</key>
<string>Capture system audio output</string>
Checking Permission Programmatically
The library handles permission prompts automatically. If the user denies permission,
rec.start will raise an exception.
Native Extension: system_audio_tap
The system audio capture is implemented in ObjC (ext/system_audio_tap.m) because it
requires ObjC APIs (ScreenCaptureKit, AudioProcessTap). The C API:
// Create a system audio tap
void *system_audio_tap_create(
void (*callback)(void *ctx, void *buf, uint32_t frames, uint32_t channels),
void *ctx
);
// Start audio delivery
int system_audio_tap_start(void *tap);
// Stop audio delivery
int system_audio_tap_stop(void *tap);
// Cleanup
void system_audio_tap_destroy(void *tap);
Limitations
- iOS: System audio capture is not available on iOS (Apple's sandbox prevents it)
- Simulator: System audio capture only works on macOS; the iOS Simulator runs macOS but the sandboxed app can't access ProcessTap/SCK
- Headless: Works in headless environments (no display needed) on macOS 14.2+ with ProcessTap
- Multiple taps: Only one system audio tap can be active at a time per process
When not to use it
- →On iOS devices, as system audio capture is not available.
- →On the iOS Simulator, as sandboxed apps cannot access ProcessTap/SCK.
- →When multiple system audio taps are needed simultaneously per process.
Limitations
- →System audio capture is not available on iOS.
- →System audio capture only works on macOS.
- →Only one system audio tap can be active at a time per process.
How it compares
This skill provides direct access to macOS system audio capture APIs, including real-time processing capabilities and version-dependent API selection, unlike general audio recording tools.
Compared to similar skills
system-audio side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| system-audio (this skill) | 0 | 5mo | No flags | Advanced |
| feishu-drive | 3 | 6mo | No flags | Intermediate |
| calculator | 7 | 7mo | Review | Beginner |
| speech-to-text | 7 | 2mo | Review | Beginner |
Try saying
Example prompts that trigger this skill in your AI assistant.
You might also like
feishu-drive
openclaw
Feishu cloud storage file management. Activate when user mentions cloud space, folders, drive.
calculator
Code-and-Sorts
Performs arbitrary-precision arithmetic calculations including addition, subtraction, multiplication, division, and exponents. Use when the user asks to calculate, compute, or evaluate math expressions, or when precise decimal arithmetic is needed to avoid floating-point errors.
speech-to-text
benchflow-ai
Transcribe video to timestamped text using Whisper tiny model (pre-installed).
transactionsyncing
AojdevStudio
Import Fidelity transaction history CSV into Google Sheets with smart categorization. USE WHEN user mentions "sync transactions", "import transactions", "transaction history", OR wants to import Fidelity History CSV. Routes debit card purchases to Expense Tracker with auto-categorization.
office-docs
Xxiii8322766509
Extract text and tables from .docx and .xlsx using local scripts (no external deps).
raffle-winner-picker
ComposioHQ
Picks random winners from lists, spreadsheets, or Google Sheets for giveaways, raffles, and contests. Ensures fair, unbiased selection with transparency.