Documentation ¶
Index ¶
- Variables
- type AudioSegment
- func NewAudioSegment(data []byte, opts ...AudioSegmentOption) (*AudioSegment, error)
- func NewAudioSegmentFromWaveAudio(waveAudio *wav.WaveAudio) (*AudioSegment, error)
- func NewEmptyAudioSegment() (*AudioSegment, error)
- func NewSilentAudioSegment(duration int, frameRate uint32) (*AudioSegment, error)
- func (seg *AudioSegment) Add(other *AudioSegment) (*AudioSegment, error)
- func (seg *AudioSegment) Append(segments ...*AudioSegment) (*AudioSegment, error)
- func (seg *AudioSegment) ApplyGain(volumeChange Volume) (*AudioSegment, error)
- func (seg *AudioSegment) AsWaveAudio() *wav.WaveAudio
- func (seg *AudioSegment) Channels() uint16
- func (seg *AudioSegment) DBFS() Volume
- func (seg *AudioSegment) Duration() time.Duration
- func (seg *AudioSegment) Equal(other *AudioSegment) bool
- func (seg *AudioSegment) ForkWithChannels(channels uint16) (*AudioSegment, error)
- func (seg *AudioSegment) ForkWithFrameRate(frameRate int) (*AudioSegment, error)
- func (seg *AudioSegment) ForkWithSampleWidth(sampleWidth int) (*AudioSegment, error)
- func (seg *AudioSegment) FrameCount() float64
- func (seg *AudioSegment) FrameCountIn(d time.Duration) float64
- func (seg *AudioSegment) FrameRate() uint32
- func (seg *AudioSegment) FrameWidth() uint32
- func (seg *AudioSegment) Max() float64
- func (seg *AudioSegment) MaxDBFS() Volume
- func (seg *AudioSegment) MaxPossibleAmplitude() float64
- func (seg *AudioSegment) Overlay(other *AudioSegment, config *OverlayConfig) (*AudioSegment, error)
- func (seg *AudioSegment) RMS() float64
- func (seg *AudioSegment) RawData() []byte
- func (seg *AudioSegment) Repeat(count int) (*AudioSegment, error)
- func (seg *AudioSegment) Reverse() (*AudioSegment, error)
- func (seg *AudioSegment) SampleWidth() uint16
- func (seg *AudioSegment) Slice(start, end time.Duration) (*AudioSegment, error)
- func (seg *AudioSegment) String() string
- type AudioSegmentError
- type AudioSegmentOption
- type Exporter
- func (e *Exporter) Export(segment *AudioSegment) error
- func (e *Exporter) WithBitRate(rate int) *Exporter
- func (e *Exporter) WithCodec(c string) *Exporter
- func (e *Exporter) WithCover(c string) *Exporter
- func (e *Exporter) WithDstFormat(f string) *Exporter
- func (e *Exporter) WithID3TagVersion(v int) *Exporter
- func (e *Exporter) WithParams(p ...string) *Exporter
- func (e *Exporter) WithSampleRate(rate int) *Exporter
- func (e *Exporter) WithTags(tags map[string]string) *Exporter
- type Loader
- type OverlayConfig
- type Volume
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ValidChannels = utils.NewSet(1, 2)
)
Functions ¶
This section is empty.
Types ¶
type AudioSegment ¶
type AudioSegment struct {
// contains filtered or unexported fields
}
AudioSegment represents an segment of audio that can be manipulated using Go code. AudioSegment is **immutable**.
func NewAudioSegment ¶
func NewAudioSegment(data []byte, opts ...AudioSegmentOption) (*AudioSegment, error)
Factory functions
func NewAudioSegmentFromWaveAudio ¶
func NewAudioSegmentFromWaveAudio(waveAudio *wav.WaveAudio) (*AudioSegment, error)
func NewEmptyAudioSegment ¶
func NewEmptyAudioSegment() (*AudioSegment, error)
func NewSilentAudioSegment ¶
func NewSilentAudioSegment(duration int, frameRate uint32) (*AudioSegment, error)
func (*AudioSegment) Add ¶
func (seg *AudioSegment) Add(other *AudioSegment) (*AudioSegment, error)
func (*AudioSegment) Append ¶
func (seg *AudioSegment) Append(segments ...*AudioSegment) (*AudioSegment, error)
func (*AudioSegment) ApplyGain ¶
func (seg *AudioSegment) ApplyGain(volumeChange Volume) (*AudioSegment, error)
func (*AudioSegment) AsWaveAudio ¶
func (seg *AudioSegment) AsWaveAudio() *wav.WaveAudio
func (*AudioSegment) Channels ¶
func (seg *AudioSegment) Channels() uint16
func (*AudioSegment) DBFS ¶
func (seg *AudioSegment) DBFS() Volume
DBFS returns the value of dB Full Scale
func (*AudioSegment) Duration ¶
func (seg *AudioSegment) Duration() time.Duration
func (*AudioSegment) Equal ¶
func (seg *AudioSegment) Equal(other *AudioSegment) bool
func (*AudioSegment) ForkWithChannels ¶
func (seg *AudioSegment) ForkWithChannels(channels uint16) (*AudioSegment, error)
func (*AudioSegment) ForkWithFrameRate ¶
func (seg *AudioSegment) ForkWithFrameRate(frameRate int) (*AudioSegment, error)
func (*AudioSegment) ForkWithSampleWidth ¶
func (seg *AudioSegment) ForkWithSampleWidth(sampleWidth int) (*AudioSegment, error)
func (*AudioSegment) FrameCount ¶
func (seg *AudioSegment) FrameCount() float64
func (*AudioSegment) FrameCountIn ¶
func (seg *AudioSegment) FrameCountIn(d time.Duration) float64
func (*AudioSegment) FrameRate ¶
func (seg *AudioSegment) FrameRate() uint32
func (*AudioSegment) FrameWidth ¶
func (seg *AudioSegment) FrameWidth() uint32
func (*AudioSegment) Max ¶
func (seg *AudioSegment) Max() float64
func (*AudioSegment) MaxDBFS ¶
func (seg *AudioSegment) MaxDBFS() Volume
func (*AudioSegment) MaxPossibleAmplitude ¶
func (seg *AudioSegment) MaxPossibleAmplitude() float64
func (*AudioSegment) Overlay ¶
func (seg *AudioSegment) Overlay(other *AudioSegment, config *OverlayConfig) (*AudioSegment, error)
Overlay overlays the given audio segment on the current segment.
func (*AudioSegment) RMS ¶
func (seg *AudioSegment) RMS() float64
RMS returns the value of root mean square
func (*AudioSegment) RawData ¶
func (seg *AudioSegment) RawData() []byte
func (*AudioSegment) Repeat ¶
func (seg *AudioSegment) Repeat(count int) (*AudioSegment, error)
func (*AudioSegment) Reverse ¶
func (seg *AudioSegment) Reverse() (*AudioSegment, error)
func (*AudioSegment) SampleWidth ¶
func (seg *AudioSegment) SampleWidth() uint16
func (*AudioSegment) Slice ¶
func (seg *AudioSegment) Slice(start, end time.Duration) (*AudioSegment, error)
Operations
func (*AudioSegment) String ¶
func (seg *AudioSegment) String() string
type AudioSegmentError ¶
type AudioSegmentError struct {
// contains filtered or unexported fields
}
func NewAudioSegmentError ¶
func NewAudioSegmentError(format string, args ...interface{}) AudioSegmentError
func (AudioSegmentError) Error ¶
func (e AudioSegmentError) Error() string
type AudioSegmentOption ¶
type AudioSegmentOption func(*AudioSegment)
func Channels ¶
func Channels(v uint16) AudioSegmentOption
func FrameRate ¶
func FrameRate(v uint32) AudioSegmentOption
func FrameWidth ¶
func FrameWidth(v uint32) AudioSegmentOption
func SampleWidth ¶
func SampleWidth(v uint16) AudioSegmentOption
type Exporter ¶
type Exporter struct {
// contains filtered or unexported fields
}
func NewExporter ¶
func NewExporter(dst interface{}) *Exporter
func (*Exporter) Export ¶
func (e *Exporter) Export(segment *AudioSegment) error
func (*Exporter) WithBitRate ¶
func (*Exporter) WithDstFormat ¶
func (*Exporter) WithID3TagVersion ¶
func (*Exporter) WithParams ¶
func (*Exporter) WithSampleRate ¶
type Loader ¶
type Loader struct {
// contains filtered or unexported fields
}
func (*Loader) Load ¶
func (l *Loader) Load(src interface{}) (*AudioSegment, error)
func (*Loader) WithParams ¶
type OverlayConfig ¶
type OverlayConfig struct { // Position to start overlaying Position time.Duration // LoopToEnd indicates whether it's necessary to match the original segment's length LoopToEnd bool // LoopCount indicates that we should loop the segment for `LoopCount` times // until it matches the original segment length, default to 1. LoopCount int GainDuringOverlay Volume }
type Volume ¶
type Volume float64
Volume is the quantity of three-dimensional space enclosed by a closed surface. Volume unit is dBFS.
func NewVolumeFromRatio ¶
Directories ¶
Path | Synopsis |
---|---|
_examples
|
|
Package audioop provides some useful operations on sound fragments by manipulating raw audio data.
|
Package audioop provides some useful operations on sound fragments by manipulating raw audio data. |
Package wav defines WAV audio struct and Chunk struct.
|
Package wav defines WAV audio struct and Chunk struct. |
Click to show internal directories.
Click to hide internal directories.