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.

Changing the pitch of a sample leads to a TypeError

See original GitHub issue

Description

When i try to change the pitch of my sample, i get the error

TypeError: Failed in nopython mode pipeline (step: nopython mode backend)
__new__() got an unexpected keyword argument 'code'

Steps/Code to Reproduce

#!/usr/bin/env python3
import librosa

data, sample_rate = librosa.core.load(sr=16000, path='my_file_path',offset=10.2, duration=10)
pitched = librosa.effects.pitch_shift(data, sr=sample_rate, n_steps=-4.0)

Expected Results

A numpy array with the pitched sample

Actual Results

File "HIDDEN", line 332, in export
    data = librosa.effects.pitch_shift(data, sr=sample_rate, n_steps=change_pitch_in_semitones)
  File "/path/to/my/venv/lib/python3.7/site-packages/librosa/effects.py", line 312, in pitch_shift
    y_shift = core.resample(time_stretch(y, rate, **kwargs), float(sr)/rate, sr,
  File "/path/to/my/venv/lib/python3.7/site-packages/librosa/effects.py", line 243, in time_stretch
    stft_stretch, dtype=y.dtype, length=len_stretch, **kwargs)
  File "/path/to/my/venv/lib/python3.7/site-packages/librosa/core/spectrum.py", line 321, in istft
    __overlap_add(y[frame * hop_length:], ytmp, hop_length)
  File "/path/to/my/venv/lib/python3.7/site-packages/numba/dispatcher.py", line 395, in _compile_for_args
    raise e
  File "/path/to/my/venv/lib/python3.7/site-packages/numba/dispatcher.py", line 352, in _compile_for_args
    return self.compile(tuple(argtypes))
  File "/path/to/my/venv/lib/python3.7/site-packages/numba/compiler_lock.py", line 32, in _acquire_compile_lock
    return func(*args, **kwargs)
  File "/path/to/my/venv/lib/python3.7/site-packages/numba/dispatcher.py", line 693, in compile
    cres = self._compiler.compile(args, return_type)
  File "/path/to/my/venv/lib/python3.7/site-packages/numba/dispatcher.py", line 76, in compile
    status, retval = self._compile_cached(args, return_type)
  File "/path/to/my/venv/lib/python3.7/site-packages/numba/dispatcher.py", line 90, in _compile_cached
    retval = self._compile_core(args, return_type)
  File "/path/to/my/venv/lib/python3.7/site-packages/numba/dispatcher.py", line 108, in _compile_core
    pipeline_class=self.pipeline_class)
  File "/path/to/my/venv/lib/python3.7/site-packages/numba/compiler.py", line 972, in compile_extra
    return pipeline.compile_extra(func)
  File "/path/to/my/venv/lib/python3.7/site-packages/numba/compiler.py", line 390, in compile_extra
    return self._compile_bytecode()
  File "/path/to/my/venv/lib/python3.7/site-packages/numba/compiler.py", line 903, in _compile_bytecode
    return self._compile_core()
  File "/path/to/my/venv/lib/python3.7/site-packages/numba/compiler.py", line 890, in _compile_core
    res = pm.run(self.status)
  File "/path/to/my/venv/lib/python3.7/site-packages/numba/compiler_lock.py", line 32, in _acquire_compile_lock
    return func(*args, **kwargs)
  File "/path/to/my/venv/lib/python3.7/site-packages/numba/compiler.py", line 266, in run
    raise patched_exception
  File "/path/to/my/venv/lib/python3.7/site-packages/numba/compiler.py", line 257, in run
    stage()
  File "/path/to/my/venv/lib/python3.7/site-packages/numba/compiler.py", line 764, in stage_nopython_backend
    self._backend(lowerfn, objectmode=False)
  File "/path/to/my/venv/lib/python3.7/site-packages/numba/compiler.py", line 703, in _backend
    lowered = lowerfn()
  File "/path/to/my/venv/lib/python3.7/site-packages/numba/compiler.py", line 690, in backend_nopython_mode
    self.metadata)
  File "/path/to/my/venv/lib/python3.7/site-packages/numba/compiler.py", line 1145, in native_lowering_stage
    lower.create_cpython_wrapper(flags.release_gil)
  File "/path/to/my/venv/lib/python3.7/site-packages/numba/lowering.py", line 271, in create_cpython_wrapper
    release_gil=release_gil)
  File "/path/to/my/venv/lib/python3.7/site-packages/numba/targets/cpu.py", line 157, in create_cpython_wrapper
    builder.build()
  File "/path/to/my/venv/lib/python3.7/site-packages/numba/callwrapper.py", line 122, in build
    self.build_wrapper(api, builder, closure, args, kws)
  File "/path/to/my/venv/lib/python3.7/site-packages/numba/callwrapper.py", line 163, in build_wrapper
    innerargs)
  File "/path/to/my/venv/lib/python3.7/site-packages/numba/targets/callconv.py", line 481, in call_function
    builder.load(excinfoptr))
  File "/path/to/my/venv/lib/python3.7/site-packages/numba/targets/callconv.py", line 410, in _get_return_status
    excinfoptr=excinfoptr)
TypeError: Failed in nopython mode pipeline (step: nopython mode backend)
__new__() got an unexpected keyword argument 'code'

Versions

Linux-5.2.14-arch2-1-ARCH-x86_64-with-arch
Python 3.7.4 (default, Jul 16 2019, 07:12:58) 
[GCC 9.1.0]
NumPy 1.16.4
SciPy 1.3.0
librosa 0.7.0

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
g3n35i5commented, Sep 23, 2019

Wow, that actually fixed the bug, thanks a lot! I’m closing the issue.

0reactions
lostanlencommented, Sep 24, 2019

I’m glad it’s solved!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Changing the pitch of a sample leads to a TypeError issue ...
Description. When i try to change the pitch of my sample, i get the error TypeError: Failed in nopython mode pipeline (step: nopython...
Read more >
librosa.effects.pitch_shift only accepts mono audio · Issue #1085
Invoking librosa.effects.pitch_shift with a stereo wave file yields a ParameterError: Invalid shape for monophonic audio: ndim=2, ...
Read more >
Python, Pitch shifting, and the Pianoputer - __del__( self )
Record a sound, change its pitch 50 times and assign each new sound to a key of your computer keyboard. You get a...
Read more >
Python unsubscriptable - typeerror - Stack Overflow
The problem in your sample code is that the array "a" contains two different types: it has 4 2-element lists and one integer....
Read more >
https://cs111.wellesley.edu/content/libraries/wave...
DT = 1 / SAMPLE_RATE """ From the sample rate we can compute the time ... if not isinstance(pitch, (int, float)): raise TypeError("Pitch...
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