audiotools

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2019 License: Apache-2.0 Imports: 7 Imported by: 0

README

audiotools

GoDoc Build Status

Generic tools to deal with audio content. The goal of this repo is to provide a list of abstraction for common cases while developers can always reach directly to the specific audio packages.

An example of such tools would be to guess the format of an audio file, as shown here

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidPath indicates that the path is... wait for it... invalid!
	ErrInvalidPath = errors.New("invalid path")
)

Functions

This section is empty.

Types

type Format

type Format string

Format is the audio format canonical name

var (
	// Unknown means that this library couldn't detect the format type
	Unknown Format = "unknown"
	// Wav is the Waveform Audio File Format (WAVE, or more commonly known
	// as WAV due to its filename extension)
	Wav Format = "wav"
	// Aiff is the Audio Interchange File Format
	Aiff Format = "aiff"
	// VideoMP4 is the video mp4 format
	VideoMP4 Format = "video/mp4"
	// Mp3 is the audio mpeg/3 format
	Mp3 Format = "mp3"
	// MIDI is the MIDI format
	MIDI Format = "midi"
)

func FileFormat

func FileFormat(path string) (Format, error)

FileFormat returns the known format of the passed path.

func HeaderFormat

func HeaderFormat(header []byte) (Format, error)

HeaderFormat is looking at the header of a file and trying to guess the format. In most cases you can pass less than 512 bytes. Note that this function won't tell the difference between a video and an audio mp4 container. See https://golang.org/pkg/net/http/#DetectContentType for details.

Jump to

Keyboard shortcuts

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