Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultRate = Rate44100Hz
DefaultRate is the rate that all the audio will pe played on. If you need to change it, do it before loading any audio from Primen, as the audio context cannot be changed once it is created.
Functions ¶
Types ¶
type MonoPanStream ¶ added in v0.7.1
type MonoPanStream struct { audio.ReadSeekCloser // contains filtered or unexported fields }
MonoPanStream is an audio buffer that changes the stereo channel's signal based on the Panning.
func NewMonoPanStream ¶ added in v0.7.1
func NewMonoPanStream(src []byte) *MonoPanStream
NewMonoPanStream returns a new MonoPanStream with a shared buffer src. The src's format must be linear PCM (16bits little endian, 2 channel stereo) without a header (e.g. RIFF header). The sample rate must be same as that of the audio context.
The src can be shared by multiple buffers.
func NewMonoPanStreamFromReader ¶ added in v0.7.1
func NewMonoPanStreamFromReader(src audio.ReadSeekCloser) *MonoPanStream
NewMonoPanStreamFromReader returns a new MonoPanStream with buffer src.
The src's format must be linear PCM (16bits little endian, 2 channel stereo) without a header (e.g. RIFF header). The sample rate must be same as that of the audio context.
func (*MonoPanStream) Pan ¶ added in v0.7.1
func (s *MonoPanStream) Pan() float64
func (*MonoPanStream) Read ¶ added in v0.7.1
func (s *MonoPanStream) Read(p []byte) (n int, err error)
func (*MonoPanStream) SetPan ¶ added in v0.7.1
func (s *MonoPanStream) SetPan(pan float64)
type PanStream ¶ added in v0.7.1
type PanStream interface { audio.ReadSeekCloser SetPan(pan float64) Pan() float64 }
type PitchShiftStream ¶ added in v0.7.1
type PitchShiftStream struct { audio.ReadSeekCloser // contains filtered or unexported fields }
PitchShiftStream is an audio buffer that can dynamically alter the pitch oif the original audio as it is being played
func NewPitchShiftStreamFromReader ¶ added in v0.7.1
func NewPitchShiftStreamFromReader(src audio.ReadSeekCloser) *PitchShiftStream
NewPitchShiftStreamFromReader returns a new PitchShiftStream with buffer src.
The src's format must be linear PCM (16bits little endian, 2 channel stereo) without a header (e.g. RIFF header). The sample rate must be same as that of the audio context.
func (*PitchShiftStream) Pitch ¶ added in v0.7.1
func (s *PitchShiftStream) Pitch() float64
Pitch returns the current pitch
func (*PitchShiftStream) Read ¶ added in v0.7.1
func (s *PitchShiftStream) Read(p []byte) (n int, err error)
func (*PitchShiftStream) SetPitch ¶ added in v0.7.1
func (s *PitchShiftStream) SetPitch(pitch float64)
SetPitch sets a pitch between 0.5 and 2
Set the pitch to 1.0 to use the original playback
type SampleRate ¶
type SampleRate int
SampleRate is the rate (in Hz) at which all the audio will be played. Ebiten recommends a sample rate of 44100Hz or 48000Hz. 22050Hz is reported to have playback issues on Safari.
const ( Rate44100Hz SampleRate = 44100 Rate48000Hz SampleRate = 48000 Rate22050Hz SampleRate = 22050 )
type StereoPanStream ¶
type StereoPanStream struct { audio.ReadSeekCloser // contains filtered or unexported fields }
StereoPanStream is an audio buffer that changes the stereo channel's signal based on the Panning.
func NewStereoPanStream ¶
func NewStereoPanStream(src []byte) *StereoPanStream
NewStereoPanStream returns a new StereoPanStream with a shared buffer src. The src's format must be linear PCM (16bits little endian, 2 channel stereo) without a header (e.g. RIFF header). The sample rate must be same as that of the audio context.
The src can be shared by multiple buffers.
func NewStereoPanStreamFromReader ¶
func NewStereoPanStreamFromReader(src audio.ReadSeekCloser) *StereoPanStream
NewStereoPanStreamFromReader returns a new StereoPanStream with buffer src.
The src's format must be linear PCM (16bits little endian, 2 channel stereo) without a header (e.g. RIFF header). The sample rate must be same as that of the audio context.
func (*StereoPanStream) Pan ¶
func (s *StereoPanStream) Pan() float64
func (*StereoPanStream) SetPan ¶
func (s *StereoPanStream) SetPan(pan float64)