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.zip

Installs 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.
219 charsno explicit “when” trigger
Advanced

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

You give it
A request to record system audio or process it in real-time.
You get back
A stereo WAV file of system audio, or real-time audio frames for processing.

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 VersionAPIPermission Required
14.2+ (Sonoma)ProcessTapNone
13.0-14.1 (Ventura)ScreenCaptureKitScreen 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, no Array.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

PropertyMicrophoneSystem Audio
Sample Rate44,100 Hz48,000 Hz
Channels1 (mono)2 (stereo)
Bit Depth16-bit int32-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.

SkillInstallsUpdatedSafetyDifficulty
system-audio (this skill)05moNo flagsAdvanced
feishu-drive36moNo flagsIntermediate
calculator77moReviewBeginner
speech-to-text72moReviewBeginner

Try saying

Example prompts that trigger this skill in your AI assistant.

Search skills

Search the agent skills registry