playsample

package module
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2024 License: MIT Imports: 13 Imported by: 8

README

playsample

Try to play a given audio sample or wav file, using SDL2 by default, or the ffplay command if -tags ff is given at build-time.

  • Version: 0.2.1
  • License: MIT

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadWav added in v0.0.2

func LoadWav(filename string, monoToStereo bool) ([]float64, int, error)

LoadWav loads a WAV file and returns the samples as []float64 and the sample rate. If monoToStereo is true and the audio is mono, the samples will be duplicated to create stereo output.

func SaveToWav added in v0.0.2

func SaveToWav(w io.WriteSeeker, samples []float64, sampleRate, bitDepth, channels int) error

SaveToWav saves the samples to a WAV file using the provided parameters.

Types

type Player added in v0.0.2

type Player struct {
	Initialized bool
}

Player represents a struct with methods for playing audio

func NewPlayer added in v0.0.2

func NewPlayer() *Player

NewPlayer tries to initialize SDL2 Audio and returns a Player struct

func (*Player) Close added in v0.0.2

func (player *Player) Close()

Close calls sdl.Quit and sets the Player struct as uninitialized

func (*Player) Done added in v0.2.0

func (player *Player) Done() bool

func (*Player) PlayWav added in v0.0.2

func (player *Player) PlayWav(filePath string) error

PlayWav plays a WAV file using SDL2 and SDL_mixer

func (*Player) PlayWaveform added in v0.0.2

func (player *Player) PlayWaveform(samples []float64, sampleRate, bitDepth, channels int) error

Directories

Path Synopsis
cmd
playwav command

Jump to

Keyboard shortcuts

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