Sha256: 2bdcb231c6e124902d6a547ba81d32342463986f92e1b8da2ee11d43a9d22b41

Contents?: true

Size: 1.13 KB

Versions: 8

Compression:

Stored size: 1.13 KB

Contents

require 'spec_helper'

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

    expect(parse_result.file_nature).to eq(:audio)
    expect(parse_result.file_type).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.information_from_io(File.open(__dir__ + '/fixtures/AIFF/fixture-logic-aiff.aif', 'rb'))

    expect(parse_result.file_nature).to eq(:audio)
    expect(parse_result.file_type).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

8 entries across 8 versions & 1 rubygems

Version Path
format_parser-0.1.7 spec/aiff_parser_spec.rb
format_parser-0.1.6 spec/aiff_parser_spec.rb
format_parser-0.1.5 spec/aiff_parser_spec.rb
format_parser-0.1.4 spec/aiff_parser_spec.rb
format_parser-0.1.3 spec/aiff_parser_spec.rb
format_parser-0.1.2 spec/aiff_parser_spec.rb
format_parser-0.1.1 spec/aiff_parser_spec.rb
format_parser-0.1.0 spec/aiff_parser_spec.rb