question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

libsndfile (soundfile) for mp3 not float32 but float64

See original GitHub issue

Is your feature request related to a problem? Please describe. Audio out from libsndfile (soundfile) for mp3 not float32 but float64. Because of this, if we do not force the dtype=float64 , we get an empty array

Describe the solution you’d like Maybe it makes sense to add a check for mp3 and change the dtype for the soundfile to float64 in this case? In file https://github.com/librosa/librosa/blob/main/librosa/core/audio.py

Additional context

 if isinstance(path, tuple(audioread.available_backends())):
        # Force the audioread loader if we have a reader object already
        y, sr_native = __audioread_load(path, offset, duration, dtype)
    else:
        # Otherwise try soundfile first, and then fall back if necessary
        try:
            y, sr_native = __soundfile_load(path, offset, duration, dtype) <----------------- here also make check fro mp3 type

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
bmcfeecommented, Sep 29, 2022

Thanks for confirming. I’ll close this out, as it’s an upstream issue.

1reaction
bmcfeecommented, Sep 29, 2022

@magicse as stated above, I don’t think this is our bug to fix (if it is a bug). I would suggest to try reading from soundfile directly with the specified dtype. I expect you’ll find the same behavior.

Also, please use the issue template and fill out all fields. This information is helpful to maintainers for diagnosing issues, and it really does not require much effort from your side.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Issues · bastibe/python-soundfile - GitHub
SoundFile is an audio library based on libsndfile, CFFI, and NumPy - Issues ... libsndfile (soundfile) for mp3 not float32 but float64.
Read more >
SoundFile — PySoundFile 0.10.3post1-1-g0394588 ...
Usually two-dimensional (frames x channels), but one-dimensional data can be used for mono files. Only the data types 'float64' , 'float32' , 'int32'...
Read more >
Newest 'soundfile' Questions - Stack Overflow
I am making a simple software which reads a map of events from a json file and creates sound based off of it....
Read more >
pysndfile Documentation - Read the Docs
By default, when clipping is off, libsndfile uses slightly different scaling factors when reading pcm format into float samples, or when writing ...
Read more >
Week 7 Class 2 CS 312 Audio Programming Winter 2020
MP3 files can be as much as one tenth the size of the WAV file. ... for more accurate internal computation but later...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found