magenta / magenta/mt3

Upload get error `AudioIOReadError: <ufunc 'positive'>`

Open
#41 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
1.8k
Forks
224
Avg merge
54m
Merged PRs (30d)
1

Description

```
/usr/local/lib/python3.7/dist-packages/librosa/core/audio.py:165: UserWarning: PySoundFile failed. Trying audioread instead.
warnings.warn("PySoundFile failed. Trying audioread instead.")
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
[/usr/local/lib/python3.7/dist-packages/note_seq/audio_io.py](https://localhost:8080/#) in load_audio(audio_filename, sample_rate)
279 try:
--> 280 y, unused_sr = librosa.load(audio_filename, sr=sample_rate, mono=True)
281 except Exception as e: # pylint: disable=broad-except

18 frames
[/usr/local/lib/python3.7/dist-packages/librosa/core/audio.py](https://localhost:8080/#) in load(path, sr, mono, offset, duration, dtype, res_type)
174 if sr is not None:
--> 175 y = resample(y, sr_native, sr, res_type=res_type)
176

[/usr/local/lib/python3.7/dist-packages/librosa/core/audio.py](https://localhost:8080/#) in resample(y, orig_sr, target_sr, res_type, fix, scale, **kwargs)
603 else:
--> 604 y_hat = resampy.resample(y, orig_sr, target_sr, filter=res_type, axis=-1)
605

[/usr/local/lib/python3.7/dist-packages/resampy/core.py](https://localhost:8080/#) in resample(x, sr_orig, sr_new, axis, filter, **kwargs)
119 y_2d = y.swapaxes(0, axis).reshape((y.shape[axis], -1))
--> 120 resample_f(x_2d, y_2d, sample_ratio, interp_win, interp_delta, precision)
121

[/usr/local/lib/python3.7/dist-packages/numba/core/dispatcher.py](https://localhost:8080/#) in _compile_for_args(self, *args, **kws)
433 llvm : dict[signature, str] or str
--> 434 Either the LLVM IR string for the specified signature, or, if no
435 signature was given, a dictionary mapping signatures to LLVM IR

[/usr/local/lib/python3.7/dist-packages/numba/core/dispatcher.py](https://localhost:8080/#) in _compile_for_args(self, *args, **kws)
366 "Please see nested and suppressed exceptions.")
--> 367 info = ', '.join('Arg #{} is {}'.format(i, args[i])
368 for i in sorted(already_lit_pos))

[/usr/local/lib/python3.7/dist-packages/numba/core/compiler_lock.py](https://localhost:8080/#) in _acquire_compile_lock(*args, **kwargs)
31 with self:
---> 32 return func(*args, **kwargs)
33 return _acquire_compile_lock

[/usr/local/lib/python3.7/dist-packages/numba/core/dispatcher.py](https://localhost:8080/#) in compile(self, sig)
818 # Ensure the old overloads are disposed of, including compiled functions.
--> 819 self._make_finalizer()()
820 self._reset_overloads()

[/usr/local/lib/python3.7/dist-packages/numba/core/dispatcher.py](https://localhost:8080/#) in compile(self, args, return_type)
77 status, retval = self._compile_cached(args, return_type)
---> 78 if status:
79 return retval

[/usr/local/lib/python3.7/dist-packages/numba/core/dispatcher.py](https://localhost:8080/#) in _compile_cached(self, args, return_type)
91 retval = self._compile_core(args, return_type)
---> 92 except errors.TypingError as e:
93 self._failed_cache[key] = e

[/usr/local/lib/python3.7/dist-packages/numba/core/dispatcher.py](https://localhost:8080/#) in _compile_core(self, args, return_type)
109 pipeline_class=self.pipeline_class)
--> 110 # Check typing error if object mode is used
111 if cres.typing_error is not None and not flags.enable_pyobject:

[/usr/local/lib/python3.7/dist-packages/numba/core/compiler.py](https://localhost:8080/#) in compile_extra(typingctx, targetctx, func, args, return_type, flags, locals, library, pipeline_class)
625 cres = norw_cres
--> 626 return cres
627

[/usr/local/lib/python3.7/dist-packages/numba/core/compiler.py](https://localhost:8080/#) in __init__(self, typingctx, targetctx, library, args, return_type, flags, locals)
312 self.state.reload_init = []
--> 313 # hold this for e.g. with_lifting, null out on exit
314 self.state.pipeline = self

[/usr/local/lib/python3.7/dist-packages/numba/core/base.py](https://localhost:8080/#) in refresh(self)
282 self.install_registry(builtin_registry)
--> 283 self.load_additional_registries()
284 # Also refresh typing context, since @overload declarations can

[/usr/local/lib/python3.7/dist-packages/numba/core/cpu.py](https://localhost:8080/#) in load_additional_registries(self)
65 # Add target specific implementations
---> 66 from numba.np import npyimpl
67 from numba.cpython import cmathimpl, mathimpl, printimpl, randomimpl

[/usr/local/lib/python3.7/dist-packages/numba/np/npyimpl.py](https://localhost:8080/#) in ()
545 ufunc = getattr(np, ufunc_name)
--> 546 kernel = _kernels[ufunc]
547 if ufunc.nin == 1:

KeyError:

During handling of the above exception, another exception occurred:

AudioIOReadError Traceback (most recent call last)
[](https://localhost:8080/#) in ()
4
5 log_event('uploadAudioStart', {})
----> 6 audio = upload_audio(sample_rate=SAMPLE_RATE)
7 log_event('uploadAudioComplete', {'value': round(len(audio) / SAMPLE_RATE)})
8

[](https://localhost:8080/#) in upload_audio(sample_rate)
37 print('Multiple files uploaded; using only one.')
38 return note_seq.audio_io.wav_data_to_samples_librosa(
---> 39 data[0], sample_rate=sample_rate)
40
41

[/usr/local/lib/python3.7/dist-packages/note_seq/audio_io.py](https://localhost:8080/#) in wav_data_to_samples_librosa(audio_file, sample_rate)
169 # And back the file position to top (not need for Copy but for certainty)
170 wav_input_file.seek(0)
--> 171 return load_audio(wav_input_file.name, sample_rate)
172
173

[/usr/local/lib/python3.7/dist-packages/note_seq/audio_io.py](https://localhost:8080/#) in load_audio(audio_filename, sample_rate)
280 y, unused_sr = librosa.load(audio_filename, sr=sample_rate, mono=True)
281 except Exception as e: # pylint: disable=broad-except
--> 282 raise AudioIOReadError(e)
283 return y
284

AudioIOReadError:
```

Contributor guide

Open the contributing guide

Research direction

Start at the notebook's upload_audio call and follow it into note_seq/audio_io.py, especially load_audio and wav_data_to_samples_librosa. Reproduce the traceback with the reported Python 3.7 environment, then inspect the librosa, resampy, numba, and NumPy interaction. Done means uploaded audio no longer fails with AudioIOReadError for this path, with a regression check if an appropriate test location is found.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
audio-video-rtc
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.