Sha256: c8f44df88098d16d95611e3e906e5cd3566c405560b62de6efb5351674b46561

Contents?: true

Size: 1.08 KB

Versions: 2

Compression:

Stored size: 1.08 KB

Contents

require 'spec_helper'

describe FormatParser::AIFFParser do
  it 'parses an AIFF sample file' do
    parse_result = subject.call(File.open(__dir__ + '/fixtures/AIFF/fixture.aiff', 'rb'))

    expect(parse_result.nature).to eq(:audio)
    expect(parse_result.format).to eq(:aiff)
    expect(parse_result.media_duration_frames).to eq(46433)
    expect(parse_result.num_audio_channels).to eq(2)
    expect(parse_result.audio_sample_rate_hz).to be_within(0.01).of(44100)
    expect(parse_result.media_duration_seconds).to be_within(0.01).of(1.05)
  end

  it 'parses a Logic Pro created AIFF sample file having a COMT chunk before a COMM chunk' do
    parse_result = subject.call(File.open(__dir__ + '/fixtures/AIFF/fixture-logic-aiff.aif', 'rb'))

    expect(parse_result.nature).to eq(:audio)
    expect(parse_result.format).to eq(:aiff)
    expect(parse_result.media_duration_frames).to eq(302400)
    expect(parse_result.num_audio_channels).to eq(2)
    expect(parse_result.audio_sample_rate_hz).to be_within(0.01).of(44100)
    expect(parse_result.media_duration_seconds).to be_within(0.01).of(6.85)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
format_parser-0.3.0 spec/aiff_parser_spec.rb
format_parser-0.2.0 spec/aiff_parser_spec.rb