ebiten

package module
v0.0.0-...-07f8463 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2026 License: MIT Imports: 5 Imported by: 1 module, 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.

Documentation

Overview

Package ebiten plays a synth.Stream of the voice library on an Ebiten audio context. It is a nested module, so programs that do not use Ebiten never depend on it.

Index

Constants

View Source
const DefaultBufferSize = 50 * time.Millisecond

DefaultBufferSize is a player buffer that keeps the typewriter and the sound in step (notes start within about this much of their Sink call) without underruns on desktop or in browsers.

Variables

This section is empty.

Functions

This section is empty.

Types

type Player

type Player struct {
	// contains filtered or unexported fields
}

Player plays a synth.Stream on an Ebiten audio context. The stream must be in FormatFloat32 at the context's sample rate.

The Ebiten player owns the stream's Read from its own goroutine; keep calling only the stream's Sink methods (through a voice.Speaker) from the game. Browsers start audio only after a user gesture; Ebiten resumes the context on the first input, so sound starts then. Keep the Player referenced while it plays: the audio library closes a player that is garbage collected.

func NewPlayer

func NewPlayer(ctx *audio.Context, s *synth.Stream, bufferSize time.Duration) (*Player, error)

NewPlayer starts playing s on ctx with the given buffer size (0 means DefaultBufferSize). It returns an error, and starts nothing, when the stream's format or sample rate does not fit the context.

func (*Player) Close

func (p *Player) Close() error

Close stops playback and releases the Ebiten player. The stream is left as it is.

func (*Player) SetVolume

func (p *Player) SetVolume(v float64)

SetVolume sets the playback volume, 0 to 1.

func (*Player) Volume

func (p *Player) Volume() float64

Volume returns the playback volume.

Directories

Path Synopsis
cmd
say command
Command say speaks a line of text through the default audio device, with no WAV file in between, and types the text out in the terminal as it is spoken.
Command say speaks a line of text through the default audio device, with no WAV file in between, and types the text out in the terminal as it is spoken.
Package dialoguebox is an Ebiten game that shows a dialogue: a dark screen with a box at the bottom, the speaker's name, the text typing out in the speaker's voice, and a hint.
Package dialoguebox is an Ebiten game that shows a dialogue: a dark screen with a box at the bottom, the speaker's name, the text typing out in the speaker's voice, and a hint.
Command example plays a dialogue in an Ebiten window: each line is spoken in its character's voice while the text types out.
Command example plays a dialogue in an Ebiten window: each line is spoken in its character's voice while the text types out.

Jump to

Keyboard shortcuts

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