MCPcopy Index your code
hub / github.com/faiface/beep

github.com/faiface/beep @v1.1.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.1.0 ↗ · + Follow
228 symbols 648 edges 41 files 91 documented · 40% 2 cross-repo links
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Beep GoDoc Go Report Card Discord Chat

A little package that brings sound to any Go application. Suitable for playback and audio-processing.

go get -u github.com/faiface/beep

Features

Beep is built on top of its Streamer interface, which is like io.Reader, but for audio. It was one of the best design decisions I've ever made and it enabled all the rest of the features to naturally come together with not much code.

  • Decode and play WAV, MP3, OGG, and FLAC.
  • Encode and save WAV.
  • Very simple API. Limiting the support to stereo (two channel) audio made it possible to simplify the architecture and the API.
  • Rich library of compositors and effects. Loop, pause/resume, change volume, mix, sequence, change playback speed, and more.
  • Easily create new effects. With the Streamer interface, creating new effects is very easy.
  • Generate completely own artificial sounds. Again, the Streamer interface enables easy sound generation.
  • Very small codebase. The core is just ~1K LOC.

Tutorial

The Wiki contains a handful of tutorials for you to get started. They teach the fundamentals and advanced topics alike. Read them especially if you call speaker.Init every time you play something.

Examples

Speedy Player Doppler Stereo Room
Speedy Player Doppler Stereo Room

Dependencies

For playback, Beep uses Oto under the hood. Check its requirements to see what you need to install for building your application.

Running an already built application should work with no extra dependencies.

Licence

MIT

Projects using beep

Extension points exported contracts — how you extend this code

Streamer (Interface)
Streamer is able to stream a finite or infinite sequence of audio samples. [21 implementers]
interface.go
EqualizerSections (Interface)
EqualizerSections is the interfacd that is passed into NewEqualizer
effects/equalizer.go
StreamSeeker (Interface)
StreamSeeker is a finite duration Streamer which supports seeking to an arbitrary position. [6 implementers]
interface.go
StreamCloser (Interface)
StreamCloser is a Streamer streaming from a resource which needs to be released, such as a file or a network connection. [4 …
interface.go
StreamSeekCloser (Interface)
StreamSeekCloser is a union of StreamSeeker and StreamCloser. [4 implementers]
interface.go
StreamerFunc (FuncType)
StreamerFunc is a Streamer created by simply wrapping a streaming function (usually a closure, which encloses a time tra
interface.go

Core symbols most depended-on inside this repo

Stream
called by 25
interface.go
Close
called by 17
interface.go
N
called by 15
buffer.go
Width
called by 14
buffer.go
Init
called by 14
speaker/speaker.go
Lock
called by 14
speaker/speaker.go
Unlock
called by 14
speaker/speaker.go
Play
called by 14
speaker/speaker.go

Shape

Method 108
Function 75
Struct 35
Interface 5
TypeAlias 4
FuncType 1

Languages

Go100%

Modules by API surface

buffer.go31 symbols
interface.go17 symbols
effects/equalizer.go16 symbols
compositors.go14 symbols
compositors_test.go13 symbols
wav/decode.go12 symbols
examples/doppler-stereo-room/main.go11 symbols
resample.go9 symbols
flac/decode.go9 symbols
vorbis/decode.go8 symbols
mp3/decode.go8 symbols
examples/speedy-player/main.go8 symbols

Used by 2 indexed graphs manifest dependencies, hub-wide

For agents

$ claude mcp add beep \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact