molo

package module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 3, 2026 License: MIT Imports: 9 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

molo

A batteries-included audio engine for Go, with decoder, parser, streamer, ring buffer, audio device, DSP, and metadata reader. Built with extendability and portability in mind.

It plays audio from local files or from a pluggable provider, and it hands a UI everything it needs to draw playback, so a consumer does not have to assemble the decoder-to-device stack itself.

Its DSP scripting engine is one of its core features: effects can be written in Lua and loaded at runtime, alongside the built-in effects, with no recompile.

Status

molo is at v1.0.0. The public surface is frozen and the core pieces are in place: decoders, streamer, ring buffer, device output, DSP, metadata, the Lua scripting engine, and the facade. The current known limitations are:

  • The AAC paths decode AAC-LC only; an HE-AAC (SBR or PS) stream is not supported.
  • A forward-only source, such as a network body or a pipe, has no native seek, so the streamer reopens and discards to position it. Every local file format seeks natively.
  • The duration is exact only after the asynchronous probe completes. Until then it is reported as unknown, so a UI that gates its seek bar on the duration shows no position for the first moment of a track.

Architecture and approach

molo is a set of components wired together, not one monolith. Decoders and audio devices implement interfaces owned by their own component, and molo is the glue plus the components those libraries need to work: a streamer, a ring buffer, and so on.

The pipeline is one path: a parser frames the source, a decoder turns it into PCM, the streamer feeds it through a ring buffer, and the device pulls it out. Volume and effects run after the ring, just before the device, so they never touch the decode side.

A track reference does not have to be a path. The session hands each ref to the first configured provider whose Match claims it.

provider.LocalAudio is the catch-all that keeps the historic local-file behaviour, so it stays last in the list. With no providers configured, the engine is local-file only.

A provider (provider.AudioProvider returning a provider.Source) only ever returns bytes and metadata, so the engine never imports a network library of its own.

The code is layered so a UI never reaches past the facade. core holds only types and contracts. internal/session owns the queue, the state machine, and the device, and it is unimportable from outside the module on purpose, so it can change without breaking consumers. Nothing below the facade imports a UI framework.

Extending it

Fork the library and add a codec by implementing the decoder interface and registering it. The same registry pattern covers playback backends, DSP effects, and metadata resolvers, so a new piece is one file plus one init() that calls Register. A decoder implements only what it needs: seeking, probing, and reader input are separate optional interfaces, not a wide base type.

A DSP effect does not need a fork at all. Write it in Lua, load it with script.Load or script.LoadDir, and register the factory with dsp.Register (or script.Register, which refuses a duplicate name). The engine then treats it exactly like a built-in: the same pipeline, the same parameter schema, the same editor. Scripts run in a sandbox and describe a graph the Go side compiles, so no Lua runs on the audio thread.

Portability, in two senses
  1. Platform portable. The main decoders and the audio device are pure Go, so the engine builds and cross-compiles across platforms without cgo, and it does not depend on a large library such as ffmpeg. When a reference codec implementation is genuinely needed, the project reaches it through ebitengine/purego, as it already does for the fast Opus path (libopusfile). That path is optional and sits behind a build tag, and a stub keeps the registry shape identical where it is unavailable.
  2. UI portable. The same engine drives a CLI, a TUI, or a GUI. The facade exposes cheap queries (Snapshot) and commands that return immediately, so a consumer never has to manage the low-level machinery, which the library already owns.

Features

  • Canonical format. Everything is normalized to 48 kHz stereo float32 before the ring, so the audio device opens once and is reused across tracks.
  • Decoders for Opus, FLAC, WAV, MP3, M4A, AAC, and Opus in WebM/Matroska. Opus has three implementations with different seek trade-offs.
  • Codec selection by name, or automatic by weight. molo -codecs lists what the build supports.
  • Streaming through a power-of-two SPSC ring (about 300 ms) with a decoder goroutine, high and low watermarks, and 100 ms chunks.
  • Seeking native where the format supports it, with latest-wins collapsing so a burst of seeks resolves to the last target.
  • Live swap. SwapDecoder or SwapBackend changes the decoder or the device on the track that is playing, reopening at the position playback has reached, without stopping the stream.
  • A DSP pipeline with a post-ring gain stage, a bs2b crossfeed, a fade, an effect registry, and a parameter schema a UI can render controls from. An effect can also publish live meters, described readings, and plots, and the engine exposes a separate effect-chain editor surface (molo.Effects) to add, remove, move, parameterize, and bypass stages without rebuilding the chain. Lua effects from the script package sit alongside the built-ins; see Extending it.
  • Metadata from embedded container tags first, filename fallback last, so a UI never shows an empty row. Embedded cover art rides along as raw bytes and a MIME type; a UI decodes and scales it.
  • Visualization through a non-blocking Tap that reads post-gain, pre-device samples, plus offline waveform analysis with a disk cache.
  • Events for discrete transitions and a polled snapshot for the continuous position. Neither blocks the engine.
Decoder implementations
Name Label Weight Extensions Notes
opus-pion Portable 90 .opus, .ogg Pure Go, 80 ms seek warm-up
opus-pion-exact Bit-perfect 85 .opus, .ogg 800 ms warm-up, byte-identical after seek
opus-libopusfile Fastest 80 .opus, .ogg Via purego, needs libopusfile.so.0
flac Lossless 90 .flac Bit-exact, normalized to 48 kHz
wav Wav 90 .wav Uncompressed
mp3 Mp3 90 .mp3 Exact sample seek
m4a M4a 90 .m4a, .mp4 AAC-LC only, native seek from the sample table
aac Aac 90 .aac ADTS, native seek and exact duration from a header index
webm-opus WebM 90 .webm, .weba Opus in WebM/Matroska

Weight only breaks ties between decoders that claim the same extension, and it is ignored when a name is requested explicitly.

Using the library

The facade is github.com/dlcuy22/molo. A minimal program:

p, err := molo.New()
if err != nil {
    log.Fatal(err)
}
defer p.Close()

if err := p.PlayQueue([]string{"a.opus", "b.flac"}); err != nil {
    log.Fatal(err)
}

go func() {
    for ev := range p.Events() {
        switch ev := ev.(type) {
        case molo.TrackChanged:
            fmt.Println("track:", ev.Path)
        case molo.Failed:
            fmt.Println("error:", ev.Err)
        }
    }
}()

for range time.Tick(250 * time.Millisecond) {
    snap := p.Snapshot()
    fmt.Printf("%s %v / %v\n", snap.State, snap.Position, snap.Duration)
}

Options such as the backend, decoder, ring size, probe mode, and providers are set at New (WithBackend, WithDecoder, WithRingFrames, WithProbeMode, WithProviders). Volume, decoder, backend, probe mode, and the effect pipeline can change at runtime through Settings, or with SwapDecoder and SwapBackend when the change must land on the track that is playing.

Example UIs

The repository ships three front ends behind one facade, and they share no UI code.

cmd/molo is the headless CLI, plain Go. It lives in the engine module rather than in a module of its own. It plays the paths given on the command line as a queue and keeps single-key controls when stdin is a terminal. this is just a reference implementation of the engine's facade, not actively maintained.

ui/tui is a terminal UI built on Bubble Tea and Lip Gloss. It draws a now-playing panel, a progress bar, a level meter, an optional waveform, and the queue. this frontend is not actively maintained.

ui/webui is a desktop app: a Wails v3 Go backend with a Svelte 5 frontend. It has transport controls, a clickable queue, decoder and backend selection, album artwork in the now-playing row, a bar visualizer driven by the engine's Tap, the effect editor, and YouTube Music search and queueing through the provider seam. It is the one front end that renders cover art today.

The TUI and the desktop app keep their own go.mod, joined to the engine by a go.work at the root, so the engine stays free of UI dependencies.

License

molo is licensed under the MIT License. See LICENSE.

Documentation

Overview

Package molo is the facade every UI imports. It exposes the controller as a small interface of cheap queries and non-blocking commands, and re-exports the state and event types so a UI never has to reach into internal/session.

The package is deliberately UI-agnostic: no terminal code, no bubbletea, no os.Exit. A TUI, a desktop window and a headless CLI all program against the same Player.

Index

Constants

View Source
const (
	// Idle is the state before any track has been started.
	Idle = session.StateIdle
	// Playing means a track is loaded and the device is consuming it.
	Playing = session.StatePlaying
	// Paused means a track is loaded but the device is paused.
	Paused = session.StatePaused
	// Stopped means playback ended, was stopped, or failed.
	Stopped = session.StateStopped
)

Variables

View Source
var (
	// ErrUnknownEffect means an editor command named a stage that is not in the
	// chain in force, either because it was removed or because a rebuild is
	// still installing.
	ErrUnknownEffect = session.ErrUnknownEffect

	// ErrEffectIndexOutOfRange means MoveEffect named a position outside the
	// chain.
	ErrEffectIndexOutOfRange = session.ErrEffectIndexOutOfRange
)

The editor errors are re-exported so a UI outside the module can tell a stale stage ID apart from an out-of-range move without importing internal/session. Match them with errors.Is.

View Source
var ErrBadProbeMode = session.ErrBadProbeMode

ErrBadProbeMode reports a duration mode outside the known set. ApplySettings wraps it. Match it with errors.Is.

View Source
var ErrBadVolume = session.ErrBadVolume

ErrBadVolume reports a gain outside dsp's accepted range. ApplySettings wraps it. Match it with errors.Is.

View Source
var ErrEmptyQueue = session.ErrEmptyQueue

ErrEmptyQueue reports PlayQueue or InsertQueue handed nothing to play. Match it with errors.Is.

View Source
var ErrIndexOutOfRange = session.ErrIndexOutOfRange

ErrIndexOutOfRange reports a PlayIndex jump to a queue position that does not exist. Like the other command errors it is returned synchronously, before the request reaches the engine.

View Source
var ErrInvalidSetting = session.ErrInvalidSetting

ErrInvalidSetting reports a rejected Settings update. It wraps a field-specific error, so a UI can tell "bad value" apart from other failures.

View Source
var ErrNoLiveTrack = session.ErrNoLiveTrack

ErrNoLiveTrack reports InsertQueueAndPlay while a track is already loaded, which would cut that track off. The caller appends instead, which is behaviourally what the user meant. It is returned synchronously.

View Source
var ErrNoProvider = session.ErrNoProvider

ErrNoProvider reports a configured provider list where none claimed the reference, which WithProviders documents as a failed track rather than a silent fallback to a file path. Match it with errors.Is.

View Source
var ErrUnknownBackend = session.ErrUnknownBackend

ErrUnknownBackend reports a backend preference that named no registered backend. ApplySettings wraps it. Match it with errors.Is.

View Source
var ErrUnknownDecoder = session.ErrUnknownDecoder

ErrUnknownDecoder reports a decoder preference that named no registered codec. ApplySettings wraps it, so a UI can tell a bad decoder from any other rejected update. Match it with errors.Is.

Functions

func Backends

func Backends() []string

Backends lists the registered playback backend names, for a UI that offers a choice. Empty is always valid and means the default.

func SupportedExtensions

func SupportedExtensions() []string

SupportedExtensions lists the file extensions this build can decode, each lowercased and including the leading dot (" .flac"). A caller that wants to turn a directory into a queue uses it to tell a playable file from a stray one without opening anything.

func UserBackends

func UserBackends() []string

UserBackends lists the playback backends a UI should offer. It is Backends without the dev-only entries, so a fake or null sink never reaches a listener's output dropdown. Validation still accepts the full list, so a test or a CLI flag can select a dev backend by name.

func ValidateBackend

func ValidateBackend(name string) error

ValidateBackend reports whether name is a usable playback backend, with empty meaning the default. Same rule as ApplySettings enforces.

func ValidateDecoder

func ValidateDecoder(name string) error

ValidateDecoder reports whether name is a usable decoder preference: empty means automatic selection. It is the same rule ApplySettings enforces, exposed so a caller can check a value before offering it (a CLI flag, a settings screen) without importing the registry or reimplementing the check.

Types

type Codec

type Codec = decode.Codec

Codec is one selectable decoder, re-exported so a UI can build a chooser without importing the decode registry itself.

func Codecs

func Codecs() []Codec

Codecs lists the registered decoders, sorted, for a UI that offers a choice. The Name is the configuration key Settings.Decoder and SwapDecoder accept; a UI shows FriendlyName.

type Config

type Config struct {
	// Backend is the playback backend name, default "oto".
	Backend string

	// EventBuffer is the event channel depth, default 64.
	EventBuffer int

	// RingFrames is the streamer ring size in output frames. Zero selects the
	// streamer's own default of about 300 ms.
	RingFrames int

	// Volume is the initial gain in [0, 1]. Zero selects unity, because a
	// muted-by-default player is never what a caller means.
	Volume float64

	// Resolver describes each track. Nil selects meta.Default().
	Resolver meta.Resolver

	// Providers resolves track references, highest priority first. See
	// WithProviders for the ordering rule.
	Providers []provider.AudioProvider

	// ProbeMode selects how much work the asynchronous duration probe may do.
	// Nil selects the cheap tail probe. A pointer, not a value, because
	// core.DurationUnknown is the zero value and must stay distinguishable
	// from "the caller did not choose".
	ProbeMode *core.DurationMode

	// Decoder is the initial decoder preference: a name from
	// decode.Default.Codecs(), or empty for automatic selection.
	Decoder string

	// Pipeline is the post-ring effect chain. Zero is an empty chain, which
	// means only the master gain runs. The Pre half is the streamer's business
	// and is ignored here.
	Pipeline dsp.Pipeline

	// Experimental toggles not-yet-stable features. Zero is today's behaviour.
	Experimental Experimental
}

Config holds the public construction knobs an Option writes. Zero fields take the documented default, and New maps a Config into the controller's own config, so the empty Config is the intended setup.

type EffectChain

type EffectChain struct {
	Stages []EffectStage
}

EffectChain is the chain in force in processing order. It is a value, not a live handle: mutating it cannot reach the engine, and the editor commands are the only way to change anything.

type EffectKind

type EffectKind = session.EffectKindInfo

EffectKind is one registered effect implementation: the (kind, impl) pair a chooser offers and AddEffect accepts, plus the label and script flag a UI groups by.

type EffectMeters

type EffectMeters = session.EffectMeters

EffectMeters is one stage's live meters with no schema or values attached, for a UI that wants to drive a meter faster than the full snapshot.

type EffectStage

type EffectStage = session.EffectStage

EffectStage is one stage of the chain in force, with its schema, current values, live meters and described readings and visual.

type Effects

type Effects interface {
	// EffectKindList lists every registered implementation, so a chooser can
	// offer each (kind, impl) pair.
	EffectKindList() []EffectKind

	// EffectChain returns the chain in force, in processing order.
	EffectChain() EffectChain

	// EffectMeters returns only the live meters of every stage that meters, for
	// a UI that drives a needle faster than the full snapshot. It reads no
	// schema and no values, so it is cheap enough for a high tick rate.
	EffectMeters() []EffectMeters

	// AddEffect appends a stage and returns its generated ID. The stage is
	// built on the caller's goroutine; the control loop installs the rebuild.
	AddEffect(kind, impl string) (string, error)

	// RemoveEffect drops the stage with id.
	RemoveEffect(id string) error

	// MoveEffect moves the stage with id to index to in processing order.
	MoveEffect(id string, to int) error

	// SetEffectParam applies one parameter to the live effect, without
	// rebuilding the chain, so effect state such as a filter's memory is not
	// discarded.
	SetEffectParam(id, key string, value any) error

	// SetEffectBypass toggles the standard bypass parameter of the live effect,
	// on the same no-rebuild path as any other parameter.
	SetEffectBypass(id string, bypassed bool) error
}

Effects is the effect-chain editor surface. Player embeds it, so every Player offers these methods directly, and Effects returns the same view for callers that want to name the surface.

The kind accessor is named EffectKindList rather than EffectKinds because the Player interface also owns EffectKinds for the plain []string list. One type cannot carry two methods of the same name, and the plain list must keep working for the existing chooser, so the detailed list gets its own name. A UI that wants both reads Player.EffectKinds for the names and Effects.EffectKindList for the per-implementation detail.

type Event

type Event = session.Event

Event is the sealed set of things the player reports. A UI type-switches on the concrete aliases below.

type Experimental

type Experimental = session.Experimental

Experimental toggles features that are not yet stable, re-exported so a UI can opt in without importing internal/session. The zero value is the current behaviour.

type Failed

type Failed = session.Failed

Failed reports a decode or device error. The player remains usable.

type Option

type Option func(*Config)

Option customises a Player. It is a function over Config, so a new knob is one option and no new type, and a consumer outside the module can author one as a plain closure.

func WithBackend

func WithBackend(name string) Option

WithBackend selects the playback backend by registry name. The default is "oto".

func WithDecoder

func WithDecoder(name string) Option

WithDecoder picks the decoder by registry name, for example "opus-pion" or "opus-libopusfile". Empty means automatic selection, where the codec with the highest weight wins. It is the starting value; ApplySettings can change it while the player runs.

func WithEventBuffer

func WithEventBuffer(n int) Option

WithEventBuffer sets the event channel depth. A deeper buffer tolerates a slower consumer before events are dropped.

func WithExperimental

func WithExperimental(e Experimental) Option

WithExperimental enables or disables experimental features for this Player. It is read once, at construction, like WithProviders: these knobs change how a source is opened and swapped, so they cannot be a runtime setting. The zero value leaves every path exactly as it behaves today.

func WithPipeline

func WithPipeline(p dsp.Pipeline) Option

WithPipeline sets the initial post-ring effect chain. Only the Post half is used; the Pre half belongs to the streamer. Each stage is validated when the player is built, so a bad stage fails New rather than becoming a Failed event on the first Play. ApplyPipeline can change the chain while the player runs.

func WithProbeMode

func WithProbeMode(mode core.DurationMode) Option

WithProbeMode selects how much work the asynchronous duration probe may do when a track starts. It does not affect playback, only how quickly and how accurately the reported duration becomes known.

func WithProviders

func WithProviders(ps ...provider.AudioProvider) Option

WithProviders sets the audio source providers, highest priority first. Each track reference is given to the first provider whose Match returns true, so a catch-all provider such as provider.LocalAudio must stay last. Nil keeps the default: local files only, through the decode registry.

A non-empty list that claims nothing fails the track with ErrNoProvider rather than silently treating the reference as a file path.

func WithResolver

func WithResolver(r meta.Resolver) Option

WithResolver supplies the metadata resolver. Nil selects meta.Default().

func WithRingFrames

func WithRingFrames(n int) Option

WithRingFrames sets the streamer ring size in output frames. Zero selects the streamer default of about 300 ms.

func WithVolume

func WithVolume(v float64) Option

WithVolume sets the initial gain in [0, 1]. Zero means unity.

type PipelineChanged

type PipelineChanged = session.PipelineChanged

PipelineChanged confirms that a new post-ring effect chain is in force. Stages is how many effects the chain runs after the change.

type Player

type Player interface {
	// Effects is the chain editor surface, embedded so every Player is
	// directly usable as one. Effects returns the same view.
	Effects

	// Snapshot returns a cheap, read-only view of the player at one instant.
	Snapshot() Snapshot
	// Events returns the stream of player events. It never blocks the engine: a
	// consumer that falls behind costs the oldest event, counted in
	// Snapshot.DroppedEvents.
	Events() <-chan Event

	// Play replaces the queue with one track and starts it. ref is a track
	// reference, not necessarily a filesystem path: it may be any string a
	// configured provider claims (see WithProviders). With no providers it is a
	// path resolved by the decode registry.
	Play(ref string) error
	// PlayQueue replaces the queue with refs and starts at the first. Each entry
	// is a track reference, as for Play.
	PlayQueue(refs []string) error
	// PlayIndex starts the queue entry at index, keeping the queue. It is what
	// a click on a row in a track list means. An index outside the queue is
	// rejected synchronously and changes nothing.
	PlayIndex(index int) error
	// Next advances to the next queued track; past the last track it stops.
	Next() error
	// Prev goes back one track, restarting the current one when it is the
	// first.
	Prev() error
	// InsertQueue inserts refs into the queue at index without touching the
	// track that is playing, which is what "play next" means. An index at or
	// past the end appends. The live track keeps sounding; the inserted refs
	// are what the engine reaches when it advances.
	InsertQueue(index int, refs []string) error
	// InsertQueueAndPlay inserts refs and starts the first of them. With a
	// track already sounding it would cut that track off, so it is refused with
	// ErrNoLiveTrack and nothing changes; the caller then appends instead.
	InsertQueueAndPlay(index int, refs []string) error
	// Queue returns a copy of the current queue, which holds track references
	// (for example "ytm:abc123") rather than paths once a provider is in use.
	Queue() []string
	// Providers lists the names of the providers in effect, in priority order,
	// for a UI that shows where audio can come from. It is empty for the default
	// local-only setup.
	Providers() []string

	// Pause stops the device; it is ignored unless the player is playing.
	Pause() error
	// Resume restarts a paused device; it is ignored unless the player is
	// paused.
	Resume() error
	// Stop ends playback and keeps the queue, so a later Play resumes from the
	// same queue.
	Stop() error
	// Seek repositions the current track once the device has been paused, so
	// the device never reads a half-flushed ring.
	Seek(d time.Duration) error
	// SetVolume changes the post-ring gain in [0, 1]. It takes effect on the
	// next buffer and is safe to call while audio is running.
	SetVolume(v float64)

	// SwapDecoder forces the named decoder for the current track, reopening it
	// at the position playback has reached. Empty means automatic selection. A
	// bad name is rejected synchronously and changes nothing. With no live
	// track it just sets the preference the next track uses.
	SwapDecoder(name string) error
	// SwapBackend forces the named playback backend for the current device,
	// reopening the device against the same provider without touching the
	// stream. Empty means the default. An unknown name is rejected
	// synchronously. With no open device it just sets the preference the next
	// device uses.
	SwapBackend(name string) error

	// Settings reads the mutable configuration in effect.
	Settings() Settings
	// ApplySettings validates every field before applying any of them: a
	// rejected update changes nothing, so a UI can report the error without
	// worrying about partial state. It never blocks on disk or the device.
	ApplySettings(s Settings) error

	// Pipeline returns the effect chain in effect.
	Pipeline() dsp.Pipeline
	// ApplyPipeline validates every stage before applying any of them,
	// matching ApplySettings: a rejected update changes nothing. The accepted
	// chain is handed to the engine, which confirms it with PipelineChanged.
	ApplyPipeline(p dsp.Pipeline) error
	// EffectSchema returns the parameter schema for an effect kind, so a UI
	// can render controls without building the effect. It returns an error for
	// an unknown kind.
	EffectSchema(kind string) ([]dsp.Param, error)
	// EffectKinds lists the registered effect kinds, sorted.
	EffectKinds() []string
	// Effects returns the chain editor over this player, the same value the
	// embedded Effects methods act on.
	Effects() Effects

	// Tap returns the visualizer feed. The feed starts publishing on the first
	// Read, so holding a Tap without reading it costs the audio path nothing.
	Tap() Tap

	// Close stops every goroutine and releases the device. It is idempotent
	// and safe to call from any goroutine.
	Close() error
}

Player is what a UI holds. Every command is non-blocking; the only errors a command returns are immediate validation problems such as an empty queue.

Concurrency: every method is safe to call from any goroutine. A command appends to the engine's inbox under a short-lived mutex and wakes the control loop without blocking, and every slow step runs on its own goroutine, so a UI can drive the Player from whatever goroutine owns its event loop. Close is idempotent and safe to call from any goroutine; it blocks until the engine has stopped.

func New

func New(opts ...Option) (Player, error)

New builds a Player. It does not touch the file system or the audio server, so it succeeds headless; a backend failure surfaces as a Failed event on the first Play.

type Seeked

type Seeked = session.Seeked

Seeked confirms a seek after it has been applied.

type Settings

type Settings = session.Settings

Settings is the subset of configuration that can change while a Player is alive. Everything else is read once by New.

The fields take effect at different moments, which a UI should know:

  • Volume applies immediately.
  • Decoder and ProbeMode are read when the next track is built, so the track already playing keeps the decoder it started with.
  • Backend is read when a device is built. An open device cannot be re-bound, so a backend change lands on the next Play that has to build one.
  • Pipeline is applied to the running audio as soon as the engine accepts it, confirmed by a PipelineChanged event. Only its Post half is used; Pre belongs to the streamer.

Changing Decoder or Backend here is for the next build; to change what is playing now, call SwapDecoder or SwapBackend.

type Snapshot

type Snapshot = session.Snapshot

Snapshot is a read-only view of the player at one instant. It is cheap enough to poll every frame.

type State

type State = session.State

State is the playback lifecycle. It is an alias of the controller's type, so a value crossing the boundary needs no conversion.

type StateChanged

type StateChanged = session.StateChanged

StateChanged is emitted for every accepted state transition.

type Swapped

type Swapped = session.Swapped

Swapped confirms a live decoder or backend change on the current track. Kind is "decoder" or "backend".

type Tap

type Tap = session.Tap

Tap is the real-time audio feed a visualizer reads. Read copies up to len(dst) mono downmixed frames in time order, never blocks, and reports zero when nothing is buffered.

type TrackChanged

type TrackChanged = session.TrackChanged

TrackChanged is emitted when a new track becomes current.

type TrackEnded

type TrackEnded = session.TrackEnded

TrackEnded is emitted once per track when it reaches its natural end.

Directories

Path Synopsis
Package analysis computes information about a file that playback does not need, starting with the waveform a seek bar draws.
Package analysis computes information about a file that playback does not need, starting with the waveform a seek bar draws.
cmd
molo command
Command molo is the headless CLI for the molo engine.
Command molo is the headless CLI for the molo engine.
Package core defines the data currency shared by every layer of the player: interleaved float32 PCM at a known frame format, frame-domain positions, and the Module contract that pre- and post-ring processing both satisfy.
Package core defines the data currency shared by every layer of the player: interleaved float32 PCM at a known frame format, frame-domain positions, and the Module contract that pre- and post-ring processing both satisfy.
M4A/MP4 decoding through github.com/tphakala/go-m4a's container reader and github.com/tphakala/go-aac's frame decoder.
M4A/MP4 decoding through github.com/tphakala/go-m4a's container reader and github.com/tphakala/go-aac's frame decoder.
Package dsp holds the real-time stages that run after the ring: gain, effects, metering.
Package dsp holds the real-time stages that run after the ring: gain, effects, metering.
internal
session
Package session is the player's controller: the only component that owns mutable engine state.
Package session is the player's controller: the only component that owns mutable engine state.
Package meta turns a media path into the descriptive metadata a UI shows: tags, cover art and the stream shape.
Package meta turns a media path into the descriptive metadata a UI shows: tags, cover art and the stream shape.
Package playback turns a Provider of interleaved float32 frames into sound through a named backend.
Package playback turns a Provider of interleaved float32 frames into sound through a named backend.
Package provider maps a track reference to the audio bytes and metadata the engine needs.
Package provider maps a track reference to the audio bytes and metadata the engine needs.
Package script builds dsp.Effect implementations from Lua descriptions.
Package script builds dsp.Effect implementations from Lua descriptions.
Package stream bridges a decode.Decoder to a real-time consumer through a single-producer, single-consumer ring buffer.
Package stream bridges a decode.Decoder to a real-time consumer through a single-producer, single-consumer ring buffer.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL