lame-0.1.1: Fairly complete high-level binding to LAME encoder

Copyright© 2017 Mark Karpov
LicenseBSD 3 clause
MaintainerMark Karpov <markkarpov92@gmail.com>
Stabilityexperimental
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

Codec.Audio.LAME

Description

The module provides an interface to LAME MP3 encoder. All you need to do to encode a WAVE (or RF64) file is to call encodeMp3, which see.

Synopsis

Documentation

encodeMp3 #

Arguments

:: MonadIO m 
=> EncoderSettings

Encoder settings

-> FilePath

WAVE file to encode

-> FilePath

Where to save the resulting MP3 file

-> m () 

Encode a WAVE file or RF64 file to MP3.

If the input file is not a valid WAVE file, WaveException will be thrown. LameException is thrown when underlying LAME encoder reports a problem.

Not all sample formats and bit depth are currently supported. Supported sample formats include:

  • PCM with samples represented as signed integers > 8 bit and <= 16 bit per mono-sample.
  • IEEE floating point (32 bit) samples.
  • IEEE floating point (64 bit) samples.

If you feed the encoder with something else, expect LameUnsupportedSampleFormat to be thrown.

data EncoderSettings #

LAME encoder settings.

Currently some noise-shaping and psycho-acoustic parameters are omitted, but can be added on request.

Constructors

EncoderSettings 

Fields

data Compression #

The data type represents supported options for compression. You can specify either fixed bitrate, compression ratio, or use the VBR mode.

Constructors

CompressionBitrate Word

Specify compression by setting a fixed bitrate, e.g. CompressionBitrate 320.

CompressionRatio Float

Specify compression ratio.

CompressionVBR VbrMode Word

VBR. Here you can specify which mode to use and the second argument is VBR quality from 0 (highest), to 9 (lowest). Good default is 4.

data VbrMode #

Variable bitrate (VBR) modes with their associated parameters.

Constructors

VbrRh

VBR RH.

VbrAbr (Maybe Word) (Maybe Word) (Maybe Word) Bool

VBR ABR. Parameters of the data constructor in order:

  • Minimal bitrate
  • Mean bitrate
  • Maximal bitrate
  • “Hard minimal bitrate”, if True, then the specified minimal bitrate will be enforced in all cases (normally it's violated for silence).
VbrMtrh

VBR MTRH

Instances
Eq VbrMode # 
Instance details

Defined in Codec.Audio.LAME

Methods

(==) :: VbrMode -> VbrMode -> Bool #

(/=) :: VbrMode -> VbrMode -> Bool #

Ord VbrMode # 
Instance details

Defined in Codec.Audio.LAME

Read VbrMode # 
Instance details

Defined in Codec.Audio.LAME

Show VbrMode # 
Instance details

Defined in Codec.Audio.LAME

data FilterSetup #

Settings for a filter.

Constructors

FilterAuto

Filter settings are chosen automatically

FilterDisabled

Filter is disabled

FilterManual Word (Maybe Word)

The first parameter is the filter's frequency (cut-off frequency) in Hz and the second parameter is width of transition band in Hz (if Nothing, it's chosen automatically).

data LameException #

Enumeration of problems you can have with LAME.

Constructors

LameGenericError

A “generic error” happened

LameNoMemory

Memory allocation issue

LameBadBitrate

Unsupported bitrate

LameBadSampleFreq

Unsupported sample rate

LameInternalError

An “Internal error” happened

LameInvalidTrackNumber Word8 (Maybe Word8)

Invalid track number (first argument) or total number of tracks (second argument) was supplied

LameUnsupportedSampleFormat SampleFormat

This sample format is not supported at this time