GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - gogpu/audio: Pure Go audio engine — WASAPI, CoreAudio, PulseAudio. Zero CGO.

BranchesTags
Open more actions menu

Latest commit

 

History

10 Commits
10 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
examples
examples
 
 
internal/wasapi
internal/wasapi
 
 
tools
tools
 
 
.gitignore
.gitignore
 
 
.golangci.yml
.golangci.yml
 
 
AGENTS.md
AGENTS.md
 
 
CHANGELOG.md
CHANGELOG.md
 
 
CODE_OF_CONDUCT.md
CODE_OF_CONDUCT.md
 
 
CONTRIBUTING.md
CONTRIBUTING.md
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
ROADMAP.md
ROADMAP.md
 
 
SECURITY.md
SECURITY.md
 
 
context.go
context.go
 
 
context_test.go
context_test.go
 
 
doc.go
doc.go
 
 
driver.go
driver.go
 
 
driver_default_other.go
driver_default_other.go
 
 
driver_default_windows.go
driver_default_windows.go
 
 
driver_null.go
driver_null.go
 
 
go.mod
go.mod
 
 
go.sum
go.sum
 
 
llms.txt
llms.txt
 
 
mixer.go
mixer.go
 
 
mixer_test.go
mixer_test.go
 
 
player.go
player.go
 
 
player_test.go
player_test.go
 
 
wav.go
wav.go
 
 
wav_test.go
wav_test.go
 
 

Repository files navigation

GoGPU Logo

audio

Pure Go audio engine for Windows, macOS, and Linux
Zero CGO. PCM output. WAV decoding. Mixing. Platform-native drivers.

CI Go Reference Go Report Card License Zero CGO


Overview

audio is a Pure Go audio engine for the gogpu ecosystem. It provides low-latency PCM audio output, WAV decoding, and multi-channel mixing using platform-native APIs — without CGO.

Part of the gogpu GPU computing ecosystem (~800K+ LOC Pure Go).

Features

  • Pure Go — zero CGO on all platforms. Uses goffi/syscall for platform calls
  • Platform-native drivers — WASAPI (Windows), CoreAudio (macOS), PulseAudio (Linux)
  • WAV decoder — Pure Go WAV file parsing and playback
  • Mixer — multi-channel audio mixing with per-channel volume
  • io.Reader streams — composable audio pipeline (decoder → mixer → driver)
  • Non-blocking — audio runs in background goroutine, never blocks rendering

Status

Windows audio output working (WASAPI). macOS and Linux drivers planned.

Architecture

User Code
    │
    ▼
audio.Context (singleton, manages audio device)
    │
    ├── WAV Decoder (Pure Go)
    ├── Mixer (multi-channel, volume control)
    │       ↑ ReadFloat32er (pull model)
    ▼
Platform Driver (background goroutine → hardware)
    ├── WASAPI (Windows) ✅ — COM vtable via syscall.SyscallN
    ├── CoreAudio (macOS) — planned
    └── PulseAudio (Linux) — planned

API

package audio

// Create audio context (one per application)
ctx, err := audio.NewContext()
defer ctx.Close()

// Play a WAV file
player, err := ctx.PlayWAV(wavData)
player.SetVolume(0.8)

// Play from io.Reader stream
player, err := ctx.NewPlayer(pcmReader)
player.Play()

Examples

# Play 440Hz sine wave
go run ./examples/play_wav

# Play Mozart's "Eine Kleine Nachtmusik" (Casio watch style)
go run ./examples/mozart

Platform Support

Platform Driver Status
Windows WASAPI (COM vtable via syscall) ✅ Working
macOS CoreAudio (AudioQueue via goffi) Planned
Linux PulseAudio (libpulse-simple via dlopen) Planned

Ecosystem

Package Description
gogpu Application framework, windowing
gogpu/sound UI system sounds (clicks, alerts)
gogpu/audio Full audio engine (this package)
wgpu Pure Go WebGPU
gg 2D graphics
ui GUI toolkit

Related: gogpu/sound (UI System Sounds)

For simple UI feedback sounds (button clicks, notifications), use gogpu/sound — a thin platform delegation layer (~500 LOC) that plays OS system sounds via winmm.dll (Windows), NSSound (macOS), and PulseAudio (Linux).

gogpu/audio is for games, media apps, and audio visualization that need full PCM playback, mixing, and streaming.

Star History

Star History Chart

License

MIT License — see LICENSE.

About

Pure Go audio engine — WASAPI, CoreAudio, PulseAudio. Zero CGO.

Resources

Readme
MIT license

Code of conduct

Code of conduct

Contributing

Contributing

Security policy

Security policy
Activity
Custom properties

Stars

8 stars

Watchers

1 watching

Forks

2 forks
Report repository

Releases

Sponsor this project

Packages

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.