class Mp3::Frame::Header

Defined in:

id3/mp3/header.cr

Constant Summary

BITMAP = {sync: 21..31, version_bits: 19..20, layer_bits: 17..18, crc: 16, bitrate_idx: 12..15, sampling_idx: 10..11, padding_bit: 9, reserved: 8, channel_mode_bits: 6..7, mode_extension_bits: 4..5, copyright: 3, original: 2, emphasis: 0..1}
BITRATE_MAP = {MPEGVersion::V1 => {Layer::L1 => [0, 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448].map(&.kbit), Layer::L2 => [0, 32, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384].map(&.kbit), Layer::L3 => [0, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320].map(&.kbit)}, MPEGVersion::V2 => COMMON_BITRATES, MPEGVersion::V2_5 => COMMON_BITRATES}

Bitrates are in kilo-bits / second

COMMON_BITRATES = {Layer::L1 => [0, 32, 48, 56, 64, 80, 96, 112, 128, 144, 160, 176, 192, 224, 256].map(&.kbit), Layer::L2 => [0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160].map(&.kbit), Layer::L3 => [0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160].map(&.kbit)}

V2/2.5

SAMPLE_RATE = {MPEGVersion::V1 => [44100, 48000, 32000], MPEGVersion::V2 => [22050, 24000, 16000], MPEGVersion::V2_5 => [11025, 12000, 8000]}
SAMPLES_PER_FRAME = {MPEGVersion::V1 => {Layer::L1 => 384, Layer::L2 => 1152, Layer::L3 => 1152}, MPEGVersion::V2 => {Layer::L1 => 384, Layer::L2 => 1152, Layer::L3 => 576}, MPEGVersion::V2_5 => {Layer::L1 => 384, Layer::L2 => 1152, Layer::L3 => 576}}

Constructors

Instance Method Summary

Constructor Detail

def self.new(raw : UInt32) #

[View source]

Instance Method Detail

def bitrate : BinarySize #

[View source]
def bitrate_idx #

[View source]
def channel_mode #

[View source]
def channel_mode_bits #

[View source]
def copyright #

[View source]
def crc #

[View source]
def emphasis #

[View source]
def frame_duration #

[View source]
def frame_size : BinarySize #

[View source]
def layer #

[View source]
def layer_bits #

[View source]
def mode_extension_bits #

[View source]
def mono? #

[View source]
def original #

[View source]
def padding : BinarySize #

[View source]
def padding_bit #

[View source]
def raw : UInt32 #

[View source]
def reserved #

[View source]
def sample_duration #

[View source]
def samples_per_frame #

[View source]
def sampling_idx #

[View source]
def sampling_rate #

[View source]
def slot_size(*args, **options) #

[View source]
def slot_size(*args, **options, &) #

[View source]
def sync #

[View source]
def to_s(io) #

[View source]
def valid? #

[View source]
def version #

[View source]
def version_bits #

[View source]
def xing_header_offset : BinarySize #

[View source]