pyreaper
A python wrapper for REAPER (Robust Epoch And Pitch EstimatoR)
Installation
pip install pyreaper
Demonstration notebnook
http://nbviewer.jupyter.org/gist/r9y9/e7d6604757403ec74557ccd93e1f0c8c
A python wrapper for REAPER (Robust Epoch And Pitch EstimatoR)
pip install pyreaper
http://nbviewer.jupyter.org/gist/r9y9/e7d6604757403ec74557ccd93e1f0c8c
Hi, I've being trying to install pyreaper, first with pip install pyreaper and then by cloning the repository and doing: git submodule update --init --recursive python setup.py build (I also tried python setup.py develop)
however in each case I got this error:
pyreaper/creaper.cpp:4153:155: error: cannot initialize a parameter of type 'int32_t *' (aka 'int *') with an rvalue of type '__pyx_t_5numpy_int32_t *' (aka 'long *')
it was preceded by this warning (although I think it's independent from the error message). warning: "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-W#warnings]
Have you encountered this error before ?
bug help wantedhello,
There is a wav example (Maybe I will sent it by email). I just to extract the pitch features, but unfortunately when I use the frame_period and it is set to 0.016 rather than the default value 0.005. The code didn't work, the error is:
However, when I change the frame_period to default value 0.005, the code is ok. So how to deal with it? and could you fix the bug? Thx
Hi,
Is there any method I can use to suppress printing statements like
Residual symmetry: P:2468.209473 N:1539.423462 MEAN:0.045802
Inverting signal
when I run pyreaper.reaper()
?
I tried using a context like this:
class DummyFile(object):
def write(self, x): pass
@contextlib.contextmanager
def suppress_print():
save_stdout = sys.stdout
save_stderr = sys.stderr
sys.stdout = DummyFile()
sys.stderr = DummyFile()
yield
sys.stdout = save_stdout
sys.stderr = save_stderr
but it doesn't work. I guess since cython is used, the output is going through somewhere else besides stdout.
I have fixed the compiler error preventing the installation on Windows. MSVC refused to cast the pointers, but both pointers should point to typedef'ed int32_t on all platforms so reinterpret_cast should not be a problem here. This also fixes #6.
In the pypi released package there's a built reaper.cpp which is incompatible with python3.7. I got these errors:
pyreaper/creaper.cpp:8197:69: error: too many arguments to function
return (*((__Pyx_PyCFunctionFast)meth)) (self, args, nargs, NULL);
^
pyreaper/creaper.cpp: In function ‘void __Pyx__ExceptionSave(PyThreadState*, PyObject**, PyObject**, PyObject**)’:
pyreaper/creaper.cpp:9364:21: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_type’; did you mean ‘curexc_type’?
*type = tstate->exc_type;
^~~~~~~~
curexc_type
pyreaper/creaper.cpp:9365:22: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_value’; did you mean ‘curexc_value’?
*value = tstate->exc_value;
^~~~~~~~~
curexc_value
pyreaper/creaper.cpp:9366:19: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
*tb = tstate->exc_traceback;
^~~~~~~~~~~~~
curexc_traceback
pyreaper/creaper.cpp: In function ‘void __Pyx__ExceptionReset(PyThreadState*, PyObject*, PyObject*, PyObject*)’:
pyreaper/creaper.cpp:9373:24: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_type’; did you mean ‘curexc_type’?
tmp_type = tstate->exc_type;
^~~~~~~~
curexc_type
pyreaper/creaper.cpp:9374:25: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_value’; did you mean ‘curexc_value’?
tmp_value = tstate->exc_value;
^~~~~~~~~
curexc_value
pyreaper/creaper.cpp:9375:22: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
tmp_tb = tstate->exc_traceback;
^~~~~~~~~~~~~
curexc_traceback
pyreaper/creaper.cpp:9376:13: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_type’; did you mean ‘curexc_type’?
tstate->exc_type = type;
^~~~~~~~
curexc_type
pyreaper/creaper.cpp:9377:13: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_value’; did you mean ‘curexc_value’?
tstate->exc_value = value;
^~~~~~~~~
curexc_value
pyreaper/creaper.cpp:9378:13: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
tstate->exc_traceback = tb;
^~~~~~~~~~~~~
curexc_traceback
pyreaper/creaper.cpp: In function ‘int __Pyx__GetException(PyThreadState*, PyObject**, PyObject**, PyObject**)’:
pyreaper/creaper.cpp:9433:24: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_type’; did you mean ‘curexc_type’?
tmp_type = tstate->exc_type;
^~~~~~~~
curexc_type
pyreaper/creaper.cpp:9434:25: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_value’; did you mean ‘curexc_value’?
tmp_value = tstate->exc_value;
^~~~~~~~~
curexc_value
pyreaper/creaper.cpp:9435:22: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
tmp_tb = tstate->exc_traceback;
^~~~~~~~~~~~~
curexc_traceback
pyreaper/creaper.cpp:9436:13: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_type’; did you mean ‘curexc_type’?
tstate->exc_type = local_type;
^~~~~~~~
curexc_type
pyreaper/creaper.cpp:9437:13: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_value’; did you mean ‘curexc_value’?
tstate->exc_value = local_value;
^~~~~~~~~
curexc_value
pyreaper/creaper.cpp:9438:13: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
tstate->exc_traceback = local_tb;
^~~~~~~~~~~~~
curexc_traceback
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
I think it would be better to delete it and rebuild extension using Cython from scratch during installation. In that case installation is fine.
bugHi, I ran pyreaper and the original Google REAPER on some wav files. The F0 results are very similar, but there are a few small differences even though I think I am using the same parameters. Do you know why there are differences?
For pyreaper, I'm running the following commands in my Python script:
from scipy.io import wavfile
from pyreaper import reaper
fs, y = wavfile.read('my-wavfile.wav')
pm_times, pm, F0_times, F0, corr = reaper(y, fs, minf0=40.0, maxf0=500.0, do_high_pass=True, do_hilbert_transform=False, inter_pulse=0.01, frame_period=0.001)
For Google's original REAPER, I'm running this on the command line:
$ ./reaper -i my-wavfile.wav -f f0.txt -p pitchmarks.txt -c corr.txt -s -e 0.001 -x 500.0 -m 40.0 -u 0.01 -a
When I apply a pyreaper.reaper function on a folder of files, it's crashing with this error:
python(94746,0x119755dc0) malloc: Incorrect checksum for freed object 0x7f9d2c43d780: probably modified after being freed. Corrupt value: 0x800000003f052325 python(94746,0x119755dc0) malloc: *** set a breakpoint in malloc_error_break to debug Abort trap: 6
I tried python 3.6.9 with pyreaper 0.0.8 and 0.0.6 and python 3.7.8 with pyreaper 0.0.8. Here is an output from the report on mac os in case that might help:
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread 0 libsystem_kernel.dylib 0x00007fff6e86033a __pthread_kill + 10 1 libsystem_pthread.dylib 0x00007fff6e91ce60 pthread_kill + 430 2 libsystem_c.dylib 0x00007fff6e7e7808 abort + 120 3 libsystem_malloc.dylib 0x00007fff6e8dd50b malloc_vreport + 548 4 libsystem_malloc.dylib 0x00007fff6e8eed27 malloc_zone_error + 183 5 libsystem_malloc.dylib 0x00007fff6e8d5081 tiny_free_list_remove_ptr + 690 6 libsystem_malloc.dylib 0x00007fff6e8d4279 tiny_free_no_lock + 1018 7 libsystem_malloc.dylib 0x00007fff6e8d3d8b free_tiny + 459 8 creaper.cpython-36m-darwin.so 0x000000013ad2b952 __pyx_f_8pyreaper_7creaper_12EpochTracker_GetF0AndCorrTrack(__pyx_obj_8pyreaper_7creaper_EpochTracker*, float, Track*, Track*) + 578 9 creaper.cpython-36m-darwin.so 0x000000013ad3201a __pyx_pf_8pyreaper_7creaper_reaper_internal(_object*, tagPyArrayObject_fields*, _object*, float, float, bool, bool, float, float, float) + 5306 10 python 0x000000010eab28fb _PyCFunction_FastCallDict + 475 11 python 0x000000010eb42d4b call_function + 539 12 python 0x000000010eb3f98e _PyEval_EvalFrameDefault + 26014 13 python 0x000000010eb438aa _PyEval_EvalCodeWithName + 2698 14 python 0x000000010eb440b2 fast_function + 386 15 python 0x000000010eb42d15 call_function + 485 16 python 0x000000010eb3fa34 _PyEval_EvalFrameDefault + 26180 17 python 0x000000010eb438aa _PyEval_EvalCodeWithName + 2698 18 python 0x000000010eb440b2 fast_function + 386 19 python 0x000000010eb42d15 call_function + 485 20 python 0x000000010eb3f98e _PyEval_EvalFrameDefault + 26014 21 python 0x000000010eb438aa _PyEval_EvalCodeWithName + 2698 22 python 0x000000010eb440b2 fast_function + 386 23 python 0x000000010eb42d15 call_function + 485 24 python 0x000000010eb3f98e _PyEval_EvalFrameDefault + 26014 25 python 0x000000010eb438aa _PyEval_EvalCodeWithName + 2698 26 python 0x000000010eb440b2 fast_function + 386 27 python 0x000000010eb42d15 call_function + 485 28 python 0x000000010eb3fa34 _PyEval_EvalFrameDefault + 26180 29 python 0x000000010eb44159 fast_function + 553 30 python 0x000000010eb42d15 call_function + 485 31 python 0x000000010eb3f98e _PyEval_EvalFrameDefault + 26014 32 python 0x000000010eb44159 fast_function + 553 33 python 0x000000010eb42d15 call_function + 485 34 python 0x000000010eb3f98e _PyEval_EvalFrameDefault + 26014 35 python 0x000000010eb438aa _PyEval_EvalCodeWithName + 2698 36 python 0x000000010eb39360 PyEval_EvalCode + 48 37 python 0x000000010eb7293e PyRun_FileExFlags + 174 38 python 0x000000010eb71ede PyRun_SimpleFileExFlags + 270 39 python 0x000000010eb8e72a Py_Main + 3306 40 python 0x000000010ea59ac8 main + 248 41 libdyld.dylib 0x00007fff6e718cc9 start + 1
I got the error when I was install pyreaper
How can I solve this problem?
pyreaper\creaper.cpp(4680): error C2664: 'PyObject *(__pyx_obj_8pyreaper_7creaper_EpochTracker *,Track *,int32_t *)': cannot convert argument 3 from '__pyx_t_5numpy_int32_t *' to 'int32_t *'
wontfixpip install pyreaper
fails to installpip install pyreaper Collecting pyreaper Using cached pyreaper-0.0.8.tar.gz (124 kB) Preparing metadata (setup.py) ... error error: subprocess-exited-with-error× python setup.py egg_info did not run successfully. │ exit code: 1 ╰─> [6 lines of output] Traceback (most recent call last): File "
", line 2, in File " ", line 34, in File "/tmp/pip-install-s03_fbrw/pyreaper_473cbdcdb56d4bc3b46dfa8bce38e114/setup.py", line 8, in import numpy as np ModuleNotFoundError: No module named 'numpy' [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. error: metadata-generation-failed
× Encountered error while generating package metadata. ╰─> See above for output.
note: This is an issue with the package mentioned above, not pip. hint: See above for details.
I'tried to install from source but it seems like build dependencies (numpy, Cython) are not configured correctly
pip install git+https://github.com/r9y9/pyreaper
Collecting git+https://github.com/r9y9/pyreaper Cloning https://github.com/r9y9/pyreaper to /tmp/pip-req-build-gtap3quc Running command git clone --filter=blob:none --quiet https://github.com/r9y9/pyreaper /tmp/pip-req-build-gtap3quc Resolved https://github.com/r9y9/pyreaper to commit f0f09a0735edac92a54095c6752ddbd7b8a450c2 Running command git submodule update --init --recursive -q Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [6 lines of output]
Traceback (most recent call last):
File "", line 2, in File " ", line 34, in
File "/tmp/pip-req-build-gtap3quc/setup.py", line 8, inimport numpy as np
ModuleNotFoundError: No module named 'numpy'
[end of output]note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed× Encountered error while generating package metadata.
╰─> See above for output.note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
This PR fixes that, I tested installation in isolated virtualenv and it installs correctly:
pip install git+https://github.com/tandav/pyreaper
pip install git+https://github.com/tandav/pyreaper Collecting git+https://github.com/tandav/pyreaper Cloning https://github.com/tandav/pyreaper to /tmp/pip-req-build-5va0xf3f Running command git clone --filter=blob:none --quiet https://github.com/tandav/pyreaper /tmp/pip-req-build-5va0xf3f Resolved https://github.com/tandav/pyreaper to commit 1d9cd22b324d4e05bde917c86f5e29c5cf6572d5 Running command git submodule update --init --recursive -q Installing build dependencies ... done Getting requirements to build wheel ... done Preparing metadata (pyproject.toml) ... done Collecting numpy>=1.8.0 Using cached numpy-1.23.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (17.1 MB) Building wheels for collected packages: pyreaper Building wheel for pyreaper (pyproject.toml) ... done Created wheel for pyreaper: filename=pyreaper-0.0.9.dev0-cp310-cp310-linux_x86_64.whl size=614301 sha256=0aeb4a5b9f6e46bc8d46a86497386aa56ff0d5be8fc39fc3f1aef22e7cfa66be Stored in directory: /tmp/pip-ephem-wheel-cache-8ugsflvx/wheels/b0/2d/9b/45bf5cc06c19cc079084b01ee402d3677aa809f826ef03f90b Successfully built pyreaper Installing collected packages: numpy, pyreaper Successfully installed numpy-1.23.4 pyreaper-0.0.9.dev0 python -c 'import pyreaper' # works
when set the frame period to 0.0125, the pyreaper may cause memory free() error. This is random in different wavs. But it is right with the default frame period.
something may be wrong because of the mismatch between the wave length and frame period
pyreaper crashes when I narrow the F0 range (e.g. when I set minf0=100
and maxf0=170
).
The particular minf0 and maxf0 values that cause the crash depend on the analyzed waveform but you can try such extreme values as minf0=160
and maxf0=170
and pyreaper should crash for sure.
The original REAPER works fine and does not crash even with the extreme F0 values.
The error message is:
File "/Users/jmatouse/.pyenv/versions/3.6.6/lib/python3.6/site-packages/pyreaper/__init__.py", line 95, in reaper
unvoiced_cost)
File "pyreaper/creaper.pyx", line 183, in pyreaper.creaper.reaper_internal
IndexError: Out of bounds on buffer access (axis 0)
bug
Fixed compilation on windows https://github.com/r9y9/pyreaper/pull/12 (thanks to @OrcusCZ)
Source code(tar.gz)Fix py37 issue #11
Source code(tar.gz)Rewinder A tool for retrieving audio in the past. Ever felt like, I need to remember that discussion which happened 10 min back. Now you can! Rewind a
Official repository for the paper MelGAN: Generative Adversarial Networks for Conditional Waveform Synthesis The original work URL: https://github.com
Telegram Streamer Bot This is rewrite version of solidmusic, but it can't be deployed now, help me to make this bot running fast and good. If anyone w
Voicely Table of Contents About The Project Built With Getting Started Prerequisites Installation Usage Roadmap Contributing License Contact Acknowled
ADAT USB Audio Interface FPGA based USB 2.0 High Speed audio interface featuring multiple optical ADAT inputs and outputs Status / current limitations
LAKH MuseNet MIDI Dataset Full LAKH MIDI dataset converted to MuseNet MIDI output format (9 instruments + drums) Bonus: Choir on Channel 10 Please CC
ffmosher Datamoshing with FFmpeg Drag and drop video onto mosh.bat to create a datamoshed video. To datamosh an image, please ensure the file is in a
Mutagen is a Python module to handle audio metadata. It supports ASF, FLAC, MP4, Monkey's Audio, MP3, Musepack, Ogg Opus, Ogg FLAC, Ogg Speex, Ogg The
On-device voice activity detection (VAD) powered by deep learning.
OMNIZART Omnizart is a Python library that aims for democratizing automatic music transcription. Given polyphonic music, it is able to transcribe pitc
Voicefixer aims at the restoration of human speech regardless how serious its degraded.
ezchord Simple python script that can convert complex chord names to midi notes Prerequisites pip install midiutil Usage ./ezchord.py Dmin7 G7 C timi
CATCHY Corpus Analysis Tools for Computational Hook discovery Python tools for the corpus analysis of popular music recordings. The tools can be used
Gradient is a Python program designed to create a reactive and ambient music listening experience.
yt-dl (GUI Edition) An app made in Python using the PyTube and Tkinter libraries to download videos and MP3 audio. How do I download this? Windows: Fi
Auto-Spotify using Voice Recognition A Simple Script that will help you to Play / Change Songs with just your Voice Explore the docs » Table of Conten
Automatically move or copy files based on metadata associated with the files. For example, file your photos based on EXIF metadata or use MP3 tags to file your music files.
Algorithmic and AI MIDI Drums Generator Implementation
Library for working with sound files of the format: .ogg, .mp3, .wav. By work is meant - playing sound files in a straight line and in the background, obtaining information about the sound file (auth
puddletag puddletag is an audio tag editor (primarily created) for GNU/Linux similar to the Windows program, Mp3tag. Unlike most taggers for GNU/Linux