dsf

package
v0.0.0-...-2825a58 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2019 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Overview

Package dsf implements a DSF (DSD Stream File) audio decoder and encoder.

See "DSF File Format Specification", v1.01, Sony Corporation:

http://dsd-guide.com/sites/default/files/white-papers/DSFFileFormatSpec_E.pdf

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decode

func Decode(r io.Reader, logTo io.Writer) (*audio.Audio, error)

Decode reads a DSD stream file from r and returns it as an Audio. logTo is the optional destination to log to.

func Encode

func Encode(a *audio.Audio, w io.Writer, logTo io.Writer) error

Encode writes the Audio a to w as a DSD stream file. logTo is the optional destination to log to.

Types

type DataChunk

type DataChunk struct {
	// data chunk header.
	// 'd' , 'a' , 't', 'a '.
	Header [4]byte

	// Size of this chunk.
	Size [8]byte
}

DataChunk is the file structure of the data chunk within a DSD stream file, excluding the variable length sample data. See "DSF File Format Specification", v1.01, Sony Corporation. All data is little-endian. This is exported to allow reading with binary.Read.

type DsdChunk

type DsdChunk struct {
	// DSD chunk header.
	// 'D' , 'S' , 'D', ' ' (includes 1 space).
	Header [4]byte

	// Size of this chunk.
	// 28 bytes.
	Size [8]byte

	// Total file size.
	TotalFileSize [8]byte

	// Pointer to Metadata chunk.
	// If Metadata doesn’t exist, set 0. If the file has ID3v2 tag, then set the
	// pointer to it. ID3v2 tag should be located in the end of the file.
	MetadataPointer [8]byte
}

DsdChunk is the file structure of the DSD chunk within a DSD stream file. See "DSF File Format Specification", v1.01, Sony Corporation. All data is little-endian. This is exported to allow reading with binary.Read.

type FmtChunk

type FmtChunk struct {
	// fmt chunk header.
	// 'f' , 'm' , 't' , ' ' (includes 1 space).
	Header [4]byte

	// Size of this chunk.
	// Usually 52 bytes.
	Size [8]byte

	// Format version.
	// 1.
	Version [4]byte

	// Format id.
	// 0: DSD raw.
	Identifier [4]byte

	// Channel type.
	// 1: mono
	// 2: stereo
	// 3: 3 channels
	// 4: quad
	// 5: 4 channels
	// 6: 5 channels
	// 7: 5.1 channels
	ChannelType [4]byte

	// Channel num.
	// 1: mono
	// 2: stereo
	// ...
	// 6: 6 channels
	ChannelNum [4]byte

	// Sampling frequency in Hertz.
	// 2822400, 5644800, 11289600 or 22579200.
	SamplingFrequency [4]byte

	// Bits per sample.
	// 1 or 8.
	BitsPerSample [4]byte

	// Sample count.
	// This is for 1 channel e.g. for n seconds of data:
	// SampleCount = SamplingFrequency * n.
	SampleCount [8]byte

	// Block size per channel.
	// 4096, unused samples should be filled with zero.
	BlockSize [4]byte

	// Reserved.
	// Filled with zero.
	Reserved [4]byte
}

FmtChunk is the file structure of the fmt chunk within a DSD stream file. See "DSF File Format Specification", v1.01, Sony Corporation. All data is little-endian. This is exported to allow reading with binary.Read.

Jump to

Keyboard shortcuts

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