Skip to content

24 bit AIFFs imported at 16 bit WAVs does not raise exception #344

Closed
@danmackinlay

Description

@danmackinlay

If I import a 24 bit AIFF in librosa, no exception is raised, but it is parsed as (I think?) a 16 bit WAV, resulting in an array of modulated white-ish noise.
This should be either an exception, or correctly load the file.

FWIW, I use subprocess calls to sox and ffmpeg to handle all non-WAVs, since audiorate etc seem to also have problems with non-16-bit non-WAV files, and much of my data is in 24 or 32 bit formats.

Activity

bmcfee

bmcfee commented on Apr 30, 2016

@bmcfee
Member

Since librosa doesn't handle audio decoding directly, I think this is probably an issue in audioread.

Have you tried loading with PySoundFile instead? It will also load into a numpy array, so all of the other librosa functionality ought to work.

danmackinlay

danmackinlay commented on May 1, 2016

@danmackinlay
Author

Wow, PySoundfile is a find. It does correctly load 24 bit audio. audioread does not.
to quote them:

Each buffer is a buffer or str object containing raw 16-bit little-endian signed integer PCM data. (Currently, these PCM format parameters are not configurable, but this could be added to most of the backends.)

It's a pity they don't throw an exception for non-16 bit audio, but that's not an issue for here.

Of course, libsoundfile doesn't support MP3, and presumably AAC etc for the same reason, so this would still leave a role for audioread. And if you then have a 24-bit MPEG4 audio file, neither library can do it; but once again, implementing universal audio support is not librosa's job.

bmcfee

bmcfee commented on May 1, 2016

@bmcfee
Member

Yup, lack of mp3 support of the main reason we haven't switched over.

If there anything left to do in this thread, or can we close it out?

added
questionIssues asking for help doing something
on May 1, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionIssues asking for help doing something

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @danmackinlay@bmcfee

        Issue actions

          24 bit AIFFs imported at 16 bit WAVs does not raise exception · Issue #344 · librosa/librosa