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.

Unhelpful error message in recurrence_matrix [formerly: Load Small Duration Error]

See original GitHub issue

Description

I have a project that has to occasionally deal with very small audio file segments. These segments can be less than 2 seconds long. pydub handles small segments correctly, but librosa crashes.

Steps/Code to Reproduce

import librosa

librosa.load(file_path, sr=None, duration=1, offset=10)

Expected Results

I expected to be able to load the offset to duration length of the file

Actual Results

...
  File "/Users/patrick/anaconda3/lib/python3.6/site-packages/librosa/decompose.py", line 503, in nn_filter
    rec = segment.recurrence_matrix(S, axis=axis, **kwargs)
  File "/Users/patrick/anaconda3/lib/python3.6/site-packages/librosa/segment.py", line 216, in recurrence_matrix
    rec.setdiag(0, diag)
  File "/Users/patrick/anaconda3/lib/python3.6/site-packages/scipy/sparse/base.py", line 1143, in setdiag
    raise ValueError("k exceeds matrix dimensions")
ValueError: k exceeds matrix dimensions

Versions

Darwin-18.2.0-x86_64-i386-64bit
Python 3.6.5 |Anaconda, Inc.| (default, Apr 26 2018, 08:42:37)
[GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)]
NumPy 1.14.3
SciPy 1.1.0
librosa 0.6.2

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
bmcfeecommented, Feb 16, 2019

Note: I’m re-opening this issue and flagging it for 0.7 so that we improve the documentation in the recurrence matrix function.

1reaction
bmcfeecommented, Feb 13, 2019

Great, thanks for checking back on it! I expect that the culprit here is the width parameter, which is passed through to recurrence_matrix and documented here: https://librosa.github.io/librosa/generated/librosa.segment.recurrence_matrix.html#librosa.segment.recurrence_matrix . I don’t know what you currently have it set to, but dropping it down to something smaller should resolve the problem.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Source setup error – The simulation was working previously
Hello,. I'm doing a 3D magnetostatic simulation using the full geometry of a motor, therefore, I don't have any master-slave boundaries.
Read more >
IBM Informix Messages and Corrections
If the error recurs, note all circumstances and contact IBM Informix Techical Support. -9 Bad file number. An operating-system error code with the...
Read more >
NetSuite Applications Suite - Error Status Codes
The customer matched an entry on the processors negative file. Possible action: Review the order and contact the payment processor. CYBERSOURCE_ERROR. Invalid ...
Read more >
What is the maximum recursion depth in Python, and how to ...
sys.setrecursionlimit(50) or a small amount is useful if your program is entering recursion and you would like the error message to NOT be...
Read more >
FEKO Errors, Warnings and Notes - Documentation
The MoM matrix is singular, no solution possible. Error 574: Dielectric (surface equivalence principle) and magnetic body not permitted simultaneously. Errors ...
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