Giter VIP home page Giter VIP logo

pysndfile's People

Contributors

gesellkammer avatar hexagonrecursion avatar roebel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

pysndfile's Issues

cannot install from pip or source

Hi!
I'm trying to install the package on a Linux machine but I cannot do it neither from pip nor from source.
I keep receiving the error

[...]
 cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
  In file included from _pysndfile.cpp:674:
  pysndfile.hh:56:10: fatal error: sndfile.h: No such file or directory
     56 | #include <sndfile.h>
        |          ^~~~~~~~~~~
  compilation terminated.
  error: command 'gcc' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for pysndfile
Failed to build pysndfile
ERROR: Could not build wheels for pysndfile which use PEP 517 and cannot be installed directly

do you have any clue how to solve this? Needless to say that I've updated setuptools, wheel and pip.

pysndfile is unable to access filenames with non-latin-1 chars on windows

I'm having problems opening sound files with non-latin-1 characters in them on Windows:

import os, sys, pysndfile
print(pysndfile.PySndfile('Bublé.wav'))

This fails with:

Traceback (most recent call last):
  File ".\filename_test.py", line 6, in <module>
    print(pysndfile.PySndfile('Bublé.wav'))
  File "_pysndfile.pyx", line 676, in _pysndfile.PySndfile.__cinit__
OSError: PySndfile::error while opening b'Bubl\xc3\xa9'
        ->b'System error : The system cannot find the file specified.\r\n'

I've linked pysndfile with the official windows library release of libsndfile.

I think the cause is due to this code: https://github.com/roebel/pysndfile/blob/master/_pysndfile.pyx#L670-L673
which calls https://github.com/erikd/libsndfile/blob/master/src/sndfile.hh#L82 . From what I have figured out, Windows doesn't natively do utf-8, so the existing assumption of using utf-8 is wrong. I think it needs to call the LPCWSTR wpath variant on Windows. Correspondingly the define ENABLE_SNDFILE_WINDOWS_PROTOTYPES must be enabled and figuring out how to generate LPCWSTR strings from a python str object.

I am currently working on investigating these issues and hopefully find a solution. I'm not very well-versed in cython or in windows, but I'm hoping that I am able, since I depend on having this fixed. I am aware that @roebel has disclamed not being a Windows user.

UserWarning: PySoundFile failed. Trying audioread instead.

I use an AWS sagemaker ml.t2.medium machine.
This is the distributaion:

Linux ip-172-16-23-13 4.14.171-105.231.amzn1.x86_64 #1 SMP Thu Feb 27 23:49:15 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

I downloaded libsndfile with:

sudo wget http://www.mega-nerd.com/libsndfile/files/libsndfile-1.0.28.tar.gz
tar -xzf libsndfile-1.0.28.tar.gz

And installed with:

cd libsndfile-1.0.28
./configure --prefix=/usr --disable-static --docdir=/usr/share/doc/libsndfile-1.0.28 && make
sudo make install

Then, I downloaded pysndfile with:

pip install pysoundfile

Now, everything is working great when trying to read a .wav file with librosa.
But when I am trying to read a .flac file, it is writing:

/home/ec2-user/anaconda3/envs/python3/lib/python3.6/site-packages/librosa/core/audio.py:161: UserWarning: PySoundFile failed. Trying audioread instead.
  warnings.warn('PySoundFile failed. Trying audioread instead.')

It is working with audioread, but I think the pysndfile should work either.
libsndfile does support .flac format.
What can be the cause of this?
Maybe my installation is not enough and I need to install the codec for .flac in libsndfile somehow?

Thank you,

Remove cython from requirements.txt

When installing pysndfile from a binary wheel, it will install cython as a dependency. I believe that the pysndfile doesn't require cython when not building the application.

I believe cython should be removed from requirements.txt as cython isn't required for running the application. The build dependencies are covered in the new pyproject.toml. I've tested this and it works fine.

Missing SFC_SET_SCALE_INT_FLOAT_WRITE

The libsndfile setting SFC_SET_SCALE_INT_FLOAT_WRITE is missing from the exposed pysndfile API. I've added a pull request for the change. I hope this can be taken into consideration. I am willing to waive copyright on this change if this is required.

#1

compile error when installing via pip3

Hi,
I can't install via pip3 and I'll just use another tool because I don't have time to look into it but I thought I'd let you know... This is what I get:

$ sudo pip3 install --upgrade pysndfile
Collecting pysndfile
Using cached https://files.pythonhosted.org/packages/00/32/271564283bcde85c8b376290b65ed4eba3e10798a485cfd0ba80de94d993/pysndfile-1.3.3.tar.gz
Building wheels for collected packages: pysndfile
Building wheel for pysndfile (setup.py) ... error
ERROR: Complete output from command /usr/bin/python3 -u -c 'import setuptools, tokenize;file='"'"'/tmp/pip-install-x6c8t_ic/pysndfile/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-47e1zuc5 --python-tag cp37:
ERROR: cythonize not available use pre_cythonized source
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.7
creating build/lib.linux-x86_64-3.7/pysndfile
copying pysndfile/Faiff.py -> build/lib.linux-x86_64-3.7/pysndfile
copying pysndfile/init.py -> build/lib.linux-x86_64-3.7/pysndfile
copying pysndfile/sndio.py -> build/lib.linux-x86_64-3.7/pysndfile
running build_ext
check for clang compiler ... no
building '_pysndfile' extension
creating build/temp.linux-x86_64-3.7
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/lib/python3.7/dist-packages/numpy/core/include -I/usr/include/python3.7m -c _pysndfile.cpp -o build/temp.linux-x86_64-3.7/_pysndfile.o
In file included from /usr/local/lib/python3.7/dist-packages/numpy/core/include/numpy/ndarraytypes.h:1822,
from /usr/local/lib/python3.7/dist-packages/numpy/core/include/numpy/ndarrayobject.h:12,
from /usr/local/lib/python3.7/dist-packages/numpy/core/include/numpy/arrayobject.h:4,
from _pysndfile.cpp:449:
/usr/local/lib/python3.7/dist-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning "Using deprecated NumPy API, disable it with " "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
#warning "Using deprecated NumPy API, disable it with "
^~~~~~~
_pysndfile.cpp: In function ‘void __Pyx__ExceptionSave(PyThreadState*, PyObject**, PyObject**, PyObject**)’:
_pysndfile.cpp:18554:21: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_type’; did you mean ‘curexc_type’?
type = tstate->exc_type;
^~~~~~~~
curexc_type
_pysndfile.cpp:18555:22: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_value’; did you mean ‘curexc_value’?
value = tstate->exc_value;
^~~~~~~~~
curexc_value
_pysndfile.cpp:18556:19: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
tb = tstate->exc_traceback;
^~~~~~~~~~~~~
curexc_traceback
_pysndfile.cpp: In function ‘void __Pyx__ExceptionReset(PyThreadState
, PyObject
, PyObject
, PyObject*)’:
_pysndfile.cpp:18563:24: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_type’; did you mean ‘curexc_type’?
tmp_type = tstate->exc_type;
^~~~~~~~
curexc_type
_pysndfile.cpp:18564:25: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_value’; did you mean ‘curexc_value’?
tmp_value = tstate->exc_value;
^~~~~~~~~
curexc_value
_pysndfile.cpp:18565:22: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
tmp_tb = tstate->exc_traceback;
^~~~~~~~~~~~~
curexc_traceback
_pysndfile.cpp:18566:13: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_type’; did you mean ‘curexc_type’?
tstate->exc_type = type;
^~~~~~~~
curexc_type
_pysndfile.cpp:18567:13: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_value’; did you mean ‘curexc_value’?
tstate->exc_value = value;
^~~~~~~~~
curexc_value
_pysndfile.cpp:18568:13: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
tstate->exc_traceback = tb;
^~~~~~~~~~~~~
curexc_traceback
_pysndfile.cpp: In function ‘int __Pyx__GetException(PyThreadState*, PyObject**, PyObject**, PyObject**)’:
_pysndfile.cpp:18623:24: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_type’; did you mean ‘curexc_type’?
tmp_type = tstate->exc_type;
^~~~~~~~
curexc_type
_pysndfile.cpp:18624:25: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_value’; did you mean ‘curexc_value’?
tmp_value = tstate->exc_value;
^~~~~~~~~
curexc_value
_pysndfile.cpp:18625:22: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
tmp_tb = tstate->exc_traceback;
^~~~~~~~~~~~~
curexc_traceback
_pysndfile.cpp:18626:13: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_type’; did you mean ‘curexc_type’?
tstate->exc_type = local_type;
^~~~~~~~
curexc_type
_pysndfile.cpp:18627:13: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_value’; did you mean ‘curexc_value’?
tstate->exc_value = local_value;
^~~~~~~~~
curexc_value
_pysndfile.cpp:18628:13: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
tstate->exc_traceback = local_tb;
^~~~~~~~~~~~~
curexc_traceback
_pysndfile.cpp: In function ‘PyObject* __Pyx_PyCFunction_FastCall(PyObject*, PyObject**, Py_ssize_t)’:
_pysndfile.cpp:18707:69: error: too many arguments to function
return (*((__Pyx_PyCFunctionFast)meth)) (self, args, nargs, NULL);
^
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1


ERROR: Failed building wheel for pysndfile
Running setup.py clean for pysndfile
Failed to build pysndfile
Installing collected packages: pysndfile
Running setup.py install for pysndfile ... error
ERROR: Complete output from command /usr/bin/python3 -u -c 'import setuptools, tokenize;file='"'"'/tmp/pip-install-x6c8t_ic/pysndfile/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /tmp/pip-record-devvjd2s/install-record.txt --single-version-externally-managed --compile:
ERROR: cythonize not available use pre_cythonized source
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.7
creating build/lib.linux-x86_64-3.7/pysndfile
copying pysndfile/Faiff.py -> build/lib.linux-x86_64-3.7/pysndfile
copying pysndfile/init.py -> build/lib.linux-x86_64-3.7/pysndfile
copying pysndfile/sndio.py -> build/lib.linux-x86_64-3.7/pysndfile
running build_ext
check for clang compiler ... no
building '_pysndfile' extension
creating build/temp.linux-x86_64-3.7
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/lib/python3.7/dist-packages/numpy/core/include -I/usr/include/python3.7m -c _pysndfile.cpp -o build/temp.linux-x86_64-3.7/_pysndfile.o
In file included from /usr/local/lib/python3.7/dist-packages/numpy/core/include/numpy/ndarraytypes.h:1822,
from /usr/local/lib/python3.7/dist-packages/numpy/core/include/numpy/ndarrayobject.h:12,
from /usr/local/lib/python3.7/dist-packages/numpy/core/include/numpy/arrayobject.h:4,
from _pysndfile.cpp:449:
/usr/local/lib/python3.7/dist-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning "Using deprecated NumPy API, disable it with " "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
#warning "Using deprecated NumPy API, disable it with "
^~~~~~~
_pysndfile.cpp: In function ‘void __Pyx__ExceptionSave(PyThreadState*, PyObject**, PyObject**, PyObject**)’:
_pysndfile.cpp:18554:21: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_type’; did you mean ‘curexc_type’?
type = tstate->exc_type;
^~~~~~~~
curexc_type
_pysndfile.cpp:18555:22: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_value’; did you mean ‘curexc_value’?
value = tstate->exc_value;
^~~~~~~~~
curexc_value
_pysndfile.cpp:18556:19: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
tb = tstate->exc_traceback;
^~~~~~~~~~~~~
curexc_traceback
_pysndfile.cpp: In function ‘void __Pyx__ExceptionReset(PyThreadState
, PyObject
, PyObject
, PyObject*)’:
_pysndfile.cpp:18563:24: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_type’; did you mean ‘curexc_type’?
tmp_type = tstate->exc_type;
^~~~~~~~
curexc_type
_pysndfile.cpp:18564:25: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_value’; did you mean ‘curexc_value’?
tmp_value = tstate->exc_value;
^~~~~~~~~
curexc_value
_pysndfile.cpp:18565:22: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
tmp_tb = tstate->exc_traceback;
^~~~~~~~~~~~~
curexc_traceback
_pysndfile.cpp:18566:13: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_type’; did you mean ‘curexc_type’?
tstate->exc_type = type;
^~~~~~~~
curexc_type
_pysndfile.cpp:18567:13: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_value’; did you mean ‘curexc_value’?
tstate->exc_value = value;
^~~~~~~~~
curexc_value
_pysndfile.cpp:18568:13: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
tstate->exc_traceback = tb;
^~~~~~~~~~~~~
curexc_traceback
_pysndfile.cpp: In function ‘int __Pyx__GetException(PyThreadState*, PyObject**, PyObject**, PyObject**)’:
_pysndfile.cpp:18623:24: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_type’; did you mean ‘curexc_type’?
tmp_type = tstate->exc_type;
^~~~~~~~
curexc_type
_pysndfile.cpp:18624:25: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_value’; did you mean ‘curexc_value’?
tmp_value = tstate->exc_value;
^~~~~~~~~
curexc_value
_pysndfile.cpp:18625:22: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
tmp_tb = tstate->exc_traceback;
^~~~~~~~~~~~~
curexc_traceback
_pysndfile.cpp:18626:13: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_type’; did you mean ‘curexc_type’?
tstate->exc_type = local_type;
^~~~~~~~
curexc_type
_pysndfile.cpp:18627:13: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_value’; did you mean ‘curexc_value’?
tstate->exc_value = local_value;
^~~~~~~~~
curexc_value
_pysndfile.cpp:18628:13: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
tstate->exc_traceback = local_tb;
^~~~~~~~~~~~~
curexc_traceback
_pysndfile.cpp: In function ‘PyObject* __Pyx_PyCFunction_FastCall(PyObject*, PyObject**, Py_ssize_t)’:
_pysndfile.cpp:18707:69: error: too many arguments to function
return (*((__Pyx_PyCFunctionFast)meth)) (self, args, nargs, NULL);
^
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
ERROR: Command "/usr/bin/python3 -u -c 'import setuptools, tokenize;file='"'"'/tmp/pip-install-x6c8t_ic/pysndfile/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /tmp/pip-record-devvjd2s/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-x6c8t_ic/pysndfile/

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.