Documentation
¶
Index ¶
- func CreateWaveHeader(sampleRate int, channelCount int, dataSize uint32) ([]byte, error)
- func PCMToWave(sampleRate int, channelCount int, pcm []byte) ([]byte, error)
- type DataReader
- type DataReaderChunk
- type DataWriterChunk
- type FmtChunk
- type Reader
- type RiffChunk
- type WavFmtChunkData
- type Writer
- func (w *Writer) Close() error
- func (w *Writer) HeaderBytes() ([]byte, error)
- func (w *Writer) Write(p []byte) (int, error)
- func (w *Writer) WriteSample8(samples []uint8) (int, error)
- func (w *Writer) WriteSample16(samples []int16) (int, error)
- func (w *Writer) WriteSample24(samples []byte) (int, error)
- type WriterParam
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateWaveHeader ¶
CreateWaveHeader -
Types ¶
type DataReaderChunk ¶
type DataReaderChunk struct {
ID []byte // 'data'
Size uint32 // data size * channel
Data DataReader // actual data
}
DataReaderChunk -
type DataWriterChunk ¶
DataWriterChunk -
type FmtChunk ¶
type FmtChunk struct {
ID []byte // 'fmt '
Size uint32 // 16
Data *WavFmtChunkData
}
FmtChunk - 8 + 16 = 24byte
type Reader ¶
type Reader struct {
RiffChunk *RiffChunk
FmtChunk *FmtChunk
DataChunk *DataReaderChunk
NumSamples uint32
ReadSampleNum uint32
SampleTime float64
// contains filtered or unexported fields
}
Reader -
func NewReaderByData ¶
NewReaderByData -
type RiffChunk ¶
type RiffChunk struct {
ID []byte // 'RIFF'
Size uint32 // 36bytes + data_chunk_size or whole_file_size - 'RIFF'+ChunkSize (8byte)
FormatType []byte // 'WAVE'
}
RiffChunk - 12byte
type WavFmtChunkData ¶
type WavFmtChunkData struct {
WaveFormatType uint16 // PCM 1
Channel uint16 // channel
SamplesPerSec uint32
BytesPerSec uint32 // The number of bytes required per second
BlockSize uint16 // Quantization accuracy * number of channels
BitsPerSamples uint16 // Quantization accuracy
}
WavFmtChunkData - 6byte
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
Writer -
func (*Writer) WriteSample8 ¶
WriteSample8 -
func (*Writer) WriteSample16 ¶
WriteSample16 -
Click to show internal directories.
Click to hide internal directories.