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.

Bad .wav duration

See original GitHub issue

Hello!

First of all thank you guys for developing this amazing tool! I use it a lot and I come across one case where librosa somehow fails to determine correct file duration therefore fails to load it. I have a .wav file that is stereo track in 44100 kHZ, 32-bit float. In Audacity this file has 3 mins and 6.87 seconds length. When I do “librosa.get_duration(…” I get: 189.567

So that is off from original length by ~ 3 seconds. Now when I do “librosa.load(…” on that particular file I get an error:

File "/home/simanas/.virtualenvs/PhonicMind/local/lib/python2.7/site-packages/librosa/core/audio.py", line 150, in load
    y = y.reshape((-1, n_channels)).T
ValueError: cannot reshape array of size 16394065 into shape (2)

But if I add duration=187 to librosa.load function then it all works good.

Here is the file that is giving this error: https://files.fm/u/j44v5jgc

Appreciate your help!

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
stefan-balkecommented, Jul 16, 2018
0reactions
Simanascommented, Jul 18, 2018

Ok thank you guys for your help. Really appreciate it!

I am not doing anything fancy, just simple get_duration function on file path, which gives me wrong duration. Yes I believe that this must be something related to that specific file, because I only got this issue with it, so it perfectly falls in that %5 category where things don’t appear to be working as expected.

Thank you for your help, this gave me a lot of info on how to address this. I feel like there is no need to keep this issue open, so I am closing it. 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to get the duration of a .WAV file that is not supported by ...
I am writing a program to annotate .wav files, so I need to play them and to know their duration. I can use...
Read more >
How to fix a WAVE file that will no longer play, has a length of ...
It depends what you want out of it. There's some good points about a wireless drive, and just as many (if not more)...
Read more >
Fixing corrupted .wav files easily using the free VLC media ...
We had some problems after recording raw 4K footage, where the . wav sidecar file wouldn't import into video editing apps like Premiere...
Read more >
Change the DURATION of Your MUSIC to any length Adobe ...
Get 10% off Unlimited Soundstripe Music for video with code: GAL10 ➡️ https://bit.ly/10offSoundStripe (My affiliate link) In this video ...
Read more >
Fixing broken WAV files with SoX
Corrupted WAV files ... Many ways to fix these files involve opening it as RAW audio file in Audacity and ... sox --ignore-length...
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