Code Monkey home page Code Monkey logo

python-soxr's People

Contributors

dofuuz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

python-soxr's Issues

Compiler crash in AnalyseDeclarationsTransform

Hello,

I am trying to build it from source and I am getting an error :

$ python3 setup.py bdist_wheel --verbose
Compiling src/soxr/cysoxr.pyx because it changed.
[1/1] Cythonizing src/soxr/cysoxr.pyx

Error compiling Cython file:
------------------------------------------------------------
...
    def __dealloc__(self):
        csoxr.soxr_delete(self._soxr)

    @cython.boundscheck(False)
    @cython.wraparound(False)
    cpdef np.ndarray process(self, const datatype_t[:, ::1] x, bint last=False):
                                                   ^
------------------------------------------------------------

src/soxr/cysoxr.pyx:81:52: Compiler crash in AnalyseDeclarationsTransform

File 'ModuleNode.py', line 124, in analyse_declarations: ModuleNode(cysoxr.pyx:1:0,
    full_module_name = 'soxr.cysoxr')
File 'Nodes.py', line 431, in analyse_declarations: StatListNode(cysoxr.pyx:6:0)
File 'Nodes.py', line 431, in analyse_declarations: StatListNode(cysoxr.pyx:48:5)
File 'Nodes.py', line 4814, in analyse_declarations: CClassDefNode(cysoxr.pyx:48:5,
    as_name = 'CySoxr',
    class_name = 'CySoxr',
    module_name = '',
    visibility = 'private')
File 'Nodes.py', line 431, in analyse_declarations: StatListNode(cysoxr.pyx:49:4)
File 'Nodes.py', line 375, in analyse_declarations: CompilerDirectivesNode(cysoxr.pyx:81:10)
File 'Nodes.py', line 431, in analyse_declarations: StatListNode(cysoxr.pyx:81:10)
File 'Nodes.py', line 2359, in analyse_declarations: CFuncDefNode(cysoxr.pyx:81:10,
    decorators = [...]/0,
    is_c_class_method = 1,
    modifiers = [...]/0,
    overridable = 1,
    visibility = 'private')
File 'Nodes.py', line 681, in analyse: CFuncDeclaratorNode(cysoxr.pyx:81:28,
    calling_convention = '',
    overridable = 1)
File 'Nodes.py', line 891, in analyse: CArgDeclNode(cysoxr.pyx:81:35,
    is_generic = 1,
    outer_attrs = [...]/2)
File 'Nodes.py', line 1093, in analyse: MemoryViewSliceTypeNode(cysoxr.pyx:81:52,
    is_arg = True,
    name = 'memoryview')

Compiler crash traceback from this point on:
  File "/usr/lib/python3/dist-packages/Cython/Compiler/Nodes.py", line 1093, in analyse
    self.type = PyrexTypes.MemoryViewSliceType(base_type, axes_specs)
  File "/usr/lib/python3/dist-packages/Cython/Compiler/PyrexTypes.py", line 625, in __init__
    self.dtype_name = Buffer.mangle_dtype_name(self.dtype)
  File "/usr/lib/python3/dist-packages/Cython/Compiler/Buffer.py", line 631, in mangle_dtype_name
    return prefix + dtype.specialization_name()
  File "/usr/lib/python3/dist-packages/Cython/Compiler/PyrexTypes.py", line 57, in specialization_name
    common_subs = (self.empty_declaration_code()
  File "/usr/lib/python3/dist-packages/Cython/Compiler/PyrexTypes.py", line 51, in empty_declaration_code
    self._empty_declaration = self.declaration_code('')
  File "/usr/lib/python3/dist-packages/Cython/Compiler/PyrexTypes.py", line 1582, in declaration_code
    return self.const_base_type.declaration_code("const %s" % entity_code, for_display, dll_linkage, pyrex)
  File "/usr/lib/python3/dist-packages/Cython/Compiler/PyrexTypes.py", line 1649, in declaration_code
    raise Exception("This may never happen, please report a bug")
Exception: This may never happen, please report a bug
Traceback (most recent call last):
  File "/home/pierre/Sources/python-soxr/setup.py", line 155, in <module>
    ext_modules=cythonize(extensions, language_level='3'),
  File "/usr/lib/python3/dist-packages/Cython/Build/Dependencies.py", line 1127, in cythonize
    cythonize_one(*args)
  File "/usr/lib/python3/dist-packages/Cython/Build/Dependencies.py", line 1250, in cythonize_one
    raise CompileError(None, pyx_file)
Cython.Compiler.Errors.CompileError: src/soxr/cysoxr.pyx

Do you have any pointers to resolve it ?

Issue related to INTERLEAVE2

Hi Team,

I was working on librosa for arm64 but while testing with pytest, the testcase ‘tests/test_core.py’ is failing due to below error:
E ImportError: /root/miniconda3/envs/testenv/lib/python3.9/site-packages/soxr/cysoxr.cpython-39-aarch64-linux-gnu.so: undefined symbol: INTERLEAVE2 /root/miniconda3/envs/testenv/lib/python3.9/site-packages/soxr/__init__.py:9: ImportError

Here are the detailed log: GHA_arm64

This seems related to python-soxr. I made sure to install soxr from pypi, and validated that it is installing required library cysoxr.cpython-38-x86_64-linux-gnu.so too.
But seems this .so file is having some reference related to INTERLEAVE2, which requires your opinion and suggestion to make it working for arm64.

ValueError: buffer source array is read-only

Stack trace below:


return soxr.resample(np.frombuffer(out, np.float32),44100,16000)
File "/home/tensorfoo/research/venv/lib/python3.8/site-packages/soxr/__init__.py", line 152, in resample
  return cysoxr_divide_proc_1d(in_rate, out_rate, x, q)
File "soxr/cysoxr.pyx", line 129, in soxr.cysoxr.__pyx_fuse_0cysoxr_divide_proc_1d
File "stringsource", line 658, in View.MemoryView.memoryview_cwrapper
File "stringsource", line 349, in View.MemoryView.memoryview.__cinit__
ValueError: buffer source array is read-only

any ideas?

conda-forge packaging

👋 @dofuuz are you at all interested in providing a conda-forge package for this library?

libsoxr itself is already available https://anaconda.org/conda-forge/soxr so there shouldn't be any significant barrier here.

The main benefit of conda-forge packaging this library would be ease of installation and management for downstream projects (eg librosa).

"always_inline" error when building on 32bit

I packaged python-soxr for Slackware 15.0. I am stuck to v0.2.4 due to the system not having a newer cython.

64bit builds work without issue, however, I was notified the build fails on 32bit systems while trying to build the internal libsoxr. After spinning up a 32bit VM, I confirmed it is unable to compile libsoxr/src/cr32s.c with the following error:

gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -Ilibsoxr/src -Isoxr -I/usr/lib/python3.9/site-packages/numpy/core/include -I/usr/lib/python3.9/site-packages/numpy/core/include -I/usr/include/python3.9 -c libsoxr/src/cr32s.c -o build/temp.linux-i686-3.9/libsoxr/src/cr32s.o -DSOXR_LIB
In file included from libsoxr/src/cr-core.c:200,
                 from libsoxr/src/cr32s.c:8:
libsoxr/src/poly-fir.h: In function ‘vpoly3’:
libsoxr/src/poly-fir.h:27:26: warning: SSE vector return without SSE enabled changes the ABI [-Wpsabi]
   27 |   #define BEGINNING v4_t X = vLds(x), sum = vZero(); \
      |                          ^
libsoxr/src/poly-fir.h:81:5: note: in expansion of macro ‘BEGINNING’
   81 |     BEGINNING; CONVOLVE(n); END; \
      |     ^~~~~~~~~
libsoxr/src/poly-fir.h:114:45: note: in expansion of macro ‘highPrecCore’
  114 |   #define core(n) if (p->use_hi_prec_clock) highPrecCore(n) else SPCORE(n)
      |                                             ^~~~~~~~~~~~
libsoxr/src/poly-fir.h:30:25: note: in expansion of macro ‘core’
   30 |   #define cc(n) case n: core(n); break
      |                         ^~~~
libsoxr/src/poly-fir.h:31:31: note: in expansion of macro ‘cc’
   31 |   #define CORE(n) switch (n) {cc(2); cc(3); cc(4); cc(5); cc(6); default: core(n);}
      |                               ^~
libsoxr/src/poly-fir.h:128:3: note: in expansion of macro ‘CORE’
  128 |   CORE(N);
      |   ^~~~
In file included from libsoxr/src/dev32s.h:17,
                 from libsoxr/src/cr-core.c:38,
                 from libsoxr/src/cr32s.c:8:
libsoxr/src/dev32s.h: In function ‘vStorSum’:
/usr/lib/gcc/i586-slackware-linux/11.2.0/include/xmmintrin.h:961:1: error: inlining failed in call to ‘always_inline’ ‘_mm_store_ss’: target specific option mismatch
  961 | _mm_store_ss (float *__P, __m128 __A)
      | ^~~~~~~~~~~~
In file included from libsoxr/src/cr-core.c:38,
                 from libsoxr/src/cr32s.c:8:
libsoxr/src/dev32s.h:32:3: note: called from here
   32 |   _mm_store_ss(a, vAdd(t, _mm_shuffle_ps(t,t,1)));}
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from libsoxr/src/dev32s.h:17,
                 from libsoxr/src/cr-core.c:38,
                 from libsoxr/src/cr32s.c:8:
/usr/lib/gcc/i586-slackware-linux/11.2.0/include/xmmintrin.h:184:1: error: inlining failed in call to ‘always_inline’ ‘_mm_add_ps’: target specific option mismatch
  184 | _mm_add_ps (__m128 __A, __m128 __B)
      | ^~~~~~~~~~
In file included from libsoxr/src/cr-core.c:38,
                 from libsoxr/src/cr32s.c:8:
libsoxr/src/dev32s.h:32:3: note: called from here
   32 |   _mm_store_ss(a, vAdd(t, _mm_shuffle_ps(t,t,1)));}
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from libsoxr/src/dev32s.h:17,
                 from libsoxr/src/cr-core.c:38,
                 from libsoxr/src/cr32s.c:8:
/usr/lib/gcc/i586-slackware-linux/11.2.0/include/xmmintrin.h:744:1: error: inlining failed in call to ‘always_inline’ ‘_mm_shuffle_ps’: target specific option mismatch
  744 | _mm_shuffle_ps (__m128 __A, __m128 __B, int const __mask)
      | ^~~~~~~~~~~~~~
In file included from libsoxr/src/cr-core.c:38,
                 from libsoxr/src/cr32s.c:8:
libsoxr/src/dev32s.h:32:3: note: called from here
   32 |   _mm_store_ss(a, vAdd(t, _mm_shuffle_ps(t,t,1)));}
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from libsoxr/src/dev32s.h:17,
                 from libsoxr/src/cr-core.c:38,
                 from libsoxr/src/cr32s.c:8:
/usr/lib/gcc/i586-slackware-linux/11.2.0/include/xmmintrin.h:184:1: error: inlining failed in call to ‘always_inline’ ‘_mm_add_ps’: target specific option mismatch
  184 | _mm_add_ps (__m128 __A, __m128 __B)
      | ^~~~~~~~~~
In file included from libsoxr/src/cr-core.c:38,
                 from libsoxr/src/cr32s.c:8:
libsoxr/src/dev32s.h:22:22: note: called from here
   22 | #define vAdd(a,b)    _mm_add_ps(a,b)
      |                      ^~~~~~~~~~~~~~~
libsoxr/src/dev32s.h:31:12: note: in expansion of macro ‘vAdd’
   31 |   v4_t t = vAdd(_mm_movehl_ps(b, b), b);
      |            ^~~~
In file included from libsoxr/src/dev32s.h:17,
                 from libsoxr/src/cr-core.c:38,
                 from libsoxr/src/cr32s.c:8:
/usr/lib/gcc/i586-slackware-linux/11.2.0/include/xmmintrin.h:785:1: error: inlining failed in call to ‘always_inline’ ‘_mm_movehl_ps’: target specific option mismatch
  785 | _mm_movehl_ps (__m128 __A, __m128 __B)
      | ^~~~~~~~~~~~~
In file included from libsoxr/src/cr-core.c:38,
                 from libsoxr/src/cr32s.c:8:
libsoxr/src/dev32s.h:22:22: note: called from here
   22 | #define vAdd(a,b)    _mm_add_ps(a,b)
      |                      ^~~~~~~~~~~~~~~
libsoxr/src/dev32s.h:31:12: note: in expansion of macro ‘vAdd’
   31 |   v4_t t = vAdd(_mm_movehl_ps(b, b), b);
      |            ^~~~
error: command '/usr/bin/gcc' failed with exit code 1

Oddly enough, if I compile libsoxr by itself using cmake, I run into no such problems. However, since I'm stuck running 0.2.4, I am unable to tell python-soxr to use the system libraries for libsoxr.

I know this is not standard usage for python and I'm requesting this on an older version, but building packages this way is the only way the software repo supports, and all dependencies have to be available to submit other packages (this is a dependency for another package I maintain).

Any hints or suggestions I could do to enable compiling on 32bit while we wait for a version bump of cython from the main distro? I appreciate any help you might be able to provide.

soxr-python can't be found in conda-forge

I'm trying to install librosa 0.10 through conda (actually micromamba, but that shouldn't matter) but I receive the following error:

error    libmamba Could not solve for environment specs
    The following package could not be installed
    └─ librosa 0.10**  is uninstallable because it requires
       └─ soxr-python >=0.3.2 , which does not exist (perhaps a missing channel).

I am using conda-forge as a channel for packages. I tried adding the default one but nothing changed. This is unexpected because https://anaconda.org/conda-forge/soxr-python says that soxr-python 0.3.3 should be available on conda-forge.

I'm on a Mac M1, MacOS 13.3.1.

Installation Issue with Python-Soxr: AttributeError on 'version'

Problem Description

Encountered an installation issue while attempting to install Python-Soxr using the provided setup script. The installation process fails with the following error:

AttributeError: module 'soxr' has no attribute '__version__'

Reproduction Steps

  1. Clone the Python-Soxr repository: git clone https://github.com/pytorch/audio.git
  2. Navigate to the Python-Soxr directory: cd python-soxr
  3. Run the installation script: sudo python3 setup.py install

Expected Behavior

Expect a successful installation of Python-Soxr without encountering the AttributeError related to the 'version' attribute.

Environment Information

  • Operating System: Linux debian risc-v
  • Python Version: 3.11
  • Python-Soxr Version: (latest commit or release version)

Compile fails on Pi4 Buster

pip install soxr
Defaulting to user installation because normal site-packages is not writeable
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting soxr
  Using cached soxr-0.3.5.tar.gz (287 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: numpy in /home/mpelkoski/.local/lib/python3.7/site-packages (from soxr) (1.21.6)
Building wheels for collected packages: soxr
  Building wheel for soxr (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for soxr (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [78 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.linux-armv7l-cpython-37
      creating build/lib.linux-armv7l-cpython-37/soxr
      copying src/soxr/version.py -> build/lib.linux-armv7l-cpython-37/soxr
      copying src/soxr/__init__.py -> build/lib.linux-armv7l-cpython-37/soxr
      running egg_info
      writing src/soxr.egg-info/PKG-INFO
      writing dependency_links to src/soxr.egg-info/dependency_links.txt
      writing requirements to src/soxr.egg-info/requires.txt
      writing top-level names to src/soxr.egg-info/top_level.txt
      listing git files failed - pretending there aren't any
      reading manifest file 'src/soxr.egg-info/SOURCES.txt'
      reading manifest template 'MANIFEST.in'
      warning: no files found matching 'src/soxr/*.pyd'
      warning: no previously-included files matching '__pycache__' found anywhere in distribution
      warning: no previously-included files matching '*.py[cod]' found anywhere in distribution
      warning: no previously-included files matching '.*' found anywhere in distribution
      adding license file 'LICENSE.txt'
      adding license file 'COPYING.LGPL'
      writing manifest file 'src/soxr.egg-info/SOURCES.txt'
      copying src/soxr/__init__.pxd -> build/lib.linux-armv7l-cpython-37/soxr
      copying src/soxr/csoxr.pxd -> build/lib.linux-armv7l-cpython-37/soxr
      copying src/soxr/cysoxr.c -> build/lib.linux-armv7l-cpython-37/soxr
      copying src/soxr/cysoxr.pyx -> build/lib.linux-armv7l-cpython-37/soxr
      copying src/soxr/soxr-config.h -> build/lib.linux-armv7l-cpython-37/soxr
      running build_ext
      building 'soxr.cysoxr' extension
      creating build/temp.linux-armv7l-cpython-37
      creating build/temp.linux-armv7l-cpython-37/libsoxr
      creating build/temp.linux-armv7l-cpython-37/libsoxr/src
      creating build/temp.linux-armv7l-cpython-37/src
      creating build/temp.linux-armv7l-cpython-37/src/soxr
      arm-linux-gnueabihf-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -flto -fuse-linker-plugin -ffat-lto-objects -fPIC -Ilibsoxr/src -Isrc/soxr -I/tmp/pip-build-env-e7rah1r9/overlay/lib/python3.7/site-packages/numpy/core/include -I/tmp/pip-build-env-e7rah1r9/overlay/lib/python3.7/site-packages/numpy/core/include -I/tmp/pip-build-env-e7rah1r9/overlay/lib/python3.7/site-packages/numpy/core/include -I/usr/include/python3.7m -c libsoxr/src/cr.c -o build/temp.linux-armv7l-cpython-37/libsoxr/src/cr.o -DSOXR_LIB -mfpu=neon -std=gnu99 -Werror=implicit
      arm-linux-gnueabihf-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -flto -fuse-linker-plugin -ffat-lto-objects -fPIC -Ilibsoxr/src -Isrc/soxr -I/tmp/pip-build-env-e7rah1r9/overlay/lib/python3.7/site-packages/numpy/core/include -I/tmp/pip-build-env-e7rah1r9/overlay/lib/python3.7/site-packages/numpy/core/include -I/tmp/pip-build-env-e7rah1r9/overlay/lib/python3.7/site-packages/numpy/core/include -I/usr/include/python3.7m -c libsoxr/src/cr32.c -o build/temp.linux-armv7l-cpython-37/libsoxr/src/cr32.o -DSOXR_LIB -mfpu=neon -std=gnu99 -Werror=implicit
      arm-linux-gnueabihf-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -flto -fuse-linker-plugin -ffat-lto-objects -fPIC -Ilibsoxr/src -Isrc/soxr -I/tmp/pip-build-env-e7rah1r9/overlay/lib/python3.7/site-packages/numpy/core/include -I/tmp/pip-build-env-e7rah1r9/overlay/lib/python3.7/site-packages/numpy/core/include -I/tmp/pip-build-env-e7rah1r9/overlay/lib/python3.7/site-packages/numpy/core/include -I/usr/include/python3.7m -c libsoxr/src/cr32s.c -o build/temp.linux-armv7l-cpython-37/libsoxr/src/cr32s.o -DSOXR_LIB -mfpu=neon -std=gnu99 -Werror=implicit
      arm-linux-gnueabihf-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -flto -fuse-linker-plugin -ffat-lto-objects -fPIC -Ilibsoxr/src -Isrc/soxr -I/tmp/pip-build-env-e7rah1r9/overlay/lib/python3.7/site-packages/numpy/core/include -I/tmp/pip-build-env-e7rah1r9/overlay/lib/python3.7/site-packages/numpy/core/include -I/tmp/pip-build-env-e7rah1r9/overlay/lib/python3.7/site-packages/numpy/core/include -I/usr/include/python3.7m -c libsoxr/src/cr64.c -o build/temp.linux-armv7l-cpython-37/libsoxr/src/cr64.o -DSOXR_LIB -mfpu=neon -std=gnu99 -Werror=implicit
      arm-linux-gnueabihf-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -flto -fuse-linker-plugin -ffat-lto-objects -fPIC -Ilibsoxr/src -Isrc/soxr -I/tmp/pip-build-env-e7rah1r9/overlay/lib/python3.7/site-packages/numpy/core/include -I/tmp/pip-build-env-e7rah1r9/overlay/lib/python3.7/site-packages/numpy/core/include -I/tmp/pip-build-env-e7rah1r9/overlay/lib/python3.7/site-packages/numpy/core/include -I/usr/include/python3.7m -c libsoxr/src/data-io.c -o build/temp.linux-armv7l-cpython-37/libsoxr/src/data-io.o -DSOXR_LIB -mfpu=neon -std=gnu99 -Werror=implicit
      libsoxr/src/data-io.c:67: warning: ignoring #pragma STDC FENV_ACCESS [-Wunknown-pragmas]
           #pragma STDC FENV_ACCESS ON

      libsoxr/src/data-io.c:155: warning: ignoring #pragma STDC FENV_ACCESS [-Wunknown-pragmas]
           #pragma STDC FENV_ACCESS OFF

      arm-linux-gnueabihf-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -flto -fuse-linker-plugin -ffat-lto-objects -fPIC -Ilibsoxr/src -Isrc/soxr -I/tmp/pip-build-env-e7rah1r9/overlay/lib/python3.7/site-packages/numpy/core/include -I/tmp/pip-build-env-e7rah1r9/overlay/lib/python3.7/site-packages/numpy/core/include -I/tmp/pip-build-env-e7rah1r9/overlay/lib/python3.7/site-packages/numpy/core/include -I/usr/include/python3.7m -c libsoxr/src/dbesi0.c -o build/temp.linux-armv7l-cpython-37/libsoxr/src/dbesi0.o -DSOXR_LIB -mfpu=neon -std=gnu99 -Werror=implicit
      arm-linux-gnueabihf-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -flto -fuse-linker-plugin -ffat-lto-objects -fPIC -Ilibsoxr/src -Isrc/soxr -I/tmp/pip-build-env-e7rah1r9/overlay/lib/python3.7/site-packages/numpy/core/include -I/tmp/pip-build-env-e7rah1r9/overlay/lib/python3.7/site-packages/numpy/core/include -I/tmp/pip-build-env-e7rah1r9/overlay/lib/python3.7/site-packages/numpy/core/include -I/usr/include/python3.7m -c libsoxr/src/fft4g32.c -o build/temp.linux-armv7l-cpython-37/libsoxr/src/fft4g32.o -DSOXR_LIB -mfpu=neon -std=gnu99 -Werror=implicit
      arm-linux-gnueabihf-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -flto -fuse-linker-plugin -ffat-lto-objects -fPIC -Ilibsoxr/src -Isrc/soxr -I/tmp/pip-build-env-e7rah1r9/overlay/lib/python3.7/site-packages/numpy/core/include -I/tmp/pip-build-env-e7rah1r9/overlay/lib/python3.7/site-packages/numpy/core/include -I/tmp/pip-build-env-e7rah1r9/overlay/lib/python3.7/site-packages/numpy/core/include -I/usr/include/python3.7m -c libsoxr/src/fft4g64.c -o build/temp.linux-armv7l-cpython-37/libsoxr/src/fft4g64.o -DSOXR_LIB -mfpu=neon -std=gnu99 -Werror=implicit
      arm-linux-gnueabihf-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -flto -fuse-linker-plugin -ffat-lto-objects -fPIC -Ilibsoxr/src -Isrc/soxr -I/tmp/pip-build-env-e7rah1r9/overlay/lib/python3.7/site-packages/numpy/core/include -I/tmp/pip-build-env-e7rah1r9/overlay/lib/python3.7/site-packages/numpy/core/include -I/tmp/pip-build-env-e7rah1r9/overlay/lib/python3.7/site-packages/numpy/core/include -I/usr/include/python3.7m -c libsoxr/src/filter.c -o build/temp.linux-armv7l-cpython-37/libsoxr/src/filter.o -DSOXR_LIB -mfpu=neon -std=gnu99 -Werror=implicit
      arm-linux-gnueabihf-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -flto -fuse-linker-plugin -ffat-lto-objects -fPIC -Ilibsoxr/src -Isrc/soxr -I/tmp/pip-build-env-e7rah1r9/overlay/lib/python3.7/site-packages/numpy/core/include -I/tmp/pip-build-env-e7rah1r9/overlay/lib/python3.7/site-packages/numpy/core/include -I/tmp/pip-build-env-e7rah1r9/overlay/lib/python3.7/site-packages/numpy/core/include -I/usr/include/python3.7m -c libsoxr/src/pffft32s.c -o build/temp.linux-armv7l-cpython-37/libsoxr/src/pffft32s.o -DSOXR_LIB -mfpu=neon -std=gnu99 -Werror=implicit
      arm-linux-gnueabihf-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -flto -fuse-linker-plugin -ffat-lto-objects -fPIC -Ilibsoxr/src -Isrc/soxr -I/tmp/pip-build-env-e7rah1r9/overlay/lib/python3.7/site-packages/numpy/core/include -I/tmp/pip-build-env-e7rah1r9/overlay/lib/python3.7/site-packages/numpy/core/include -I/tmp/pip-build-env-e7rah1r9/overlay/lib/python3.7/site-packages/numpy/core/include -I/usr/include/python3.7m -c libsoxr/src/soxr.c -o build/temp.linux-armv7l-cpython-37/libsoxr/src/soxr.o -DSOXR_LIB -mfpu=neon -std=gnu99 -Werror=implicit
      arm-linux-gnueabihf-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -flto -fuse-linker-plugin -ffat-lto-objects -fPIC -Ilibsoxr/src -Isrc/soxr -I/tmp/pip-build-env-e7rah1r9/overlay/lib/python3.7/site-packages/numpy/core/include -I/tmp/pip-build-env-e7rah1r9/overlay/lib/python3.7/site-packages/numpy/core/include -I/tmp/pip-build-env-e7rah1r9/overlay/lib/python3.7/site-packages/numpy/core/include -I/usr/include/python3.7m -c libsoxr/src/util32s.c -o build/temp.linux-armv7l-cpython-37/libsoxr/src/util32s.o -DSOXR_LIB -mfpu=neon -std=gnu99 -Werror=implicit
      arm-linux-gnueabihf-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -flto -fuse-linker-plugin -ffat-lto-objects -fPIC -Ilibsoxr/src -Isrc/soxr -I/tmp/pip-build-env-e7rah1r9/overlay/lib/python3.7/site-packages/numpy/core/include -I/tmp/pip-build-env-e7rah1r9/overlay/lib/python3.7/site-packages/numpy/core/include -I/tmp/pip-build-env-e7rah1r9/overlay/lib/python3.7/site-packages/numpy/core/include -I/usr/include/python3.7m -c src/soxr/cysoxr.c -o build/temp.linux-armv7l-cpython-37/src/soxr/cysoxr.o -DSOXR_LIB -mfpu=neon -std=gnu99 -Werror=implicit
      In file included from /tmp/pip-build-env-e7rah1r9/overlay/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1816,
                       from /tmp/pip-build-env-e7rah1r9/overlay/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:18,
                       from /tmp/pip-build-env-e7rah1r9/overlay/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,
                       from src/soxr/cysoxr.c:1108:
      /tmp/pip-build-env-e7rah1r9/overlay/lib/python3.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: #warning "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
       #warning "Using deprecated NumPy API, disable it by " \
        ^~~~~~~
      arm-linux-gnueabihf-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-z,relro build/temp.linux-armv7l-cpython-37/libsoxr/src/cr.o build/temp.linux-armv7l-cpython-37/libsoxr/src/cr32.o build/temp.linux-armv7l-cpython-37/libsoxr/src/cr32s.o build/temp.linux-armv7l-cpython-37/libsoxr/src/cr64.o build/temp.linux-armv7l-cpython-37/libsoxr/src/data-io.o build/temp.linux-armv7l-cpython-37/libsoxr/src/dbesi0.o build/temp.linux-armv7l-cpython-37/libsoxr/src/fft4g32.o build/temp.linux-armv7l-cpython-37/libsoxr/src/fft4g64.o build/temp.linux-armv7l-cpython-37/libsoxr/src/filter.o build/temp.linux-armv7l-cpython-37/libsoxr/src/pffft32s.o build/temp.linux-armv7l-cpython-37/libsoxr/src/soxr.o build/temp.linux-armv7l-cpython-37/libsoxr/src/util32s.o build/temp.linux-armv7l-cpython-37/src/soxr/cysoxr.o -L/usr/lib -o build/lib.linux-armv7l-cpython-37/soxr/cysoxr.cpython-37m-arm-linux-gnueabihf.so
      during RTL pass: expand
      libsoxr/src/pffft.c: In function ‘reversed_copy.constprop’:
      libsoxr/src/pffft.c:1313:13: internal compiler error: in convert_move, at expr.c:218
       static void reversed_copy(int N, const v4sf *in, int in_stride, v4sf *out) {
                   ^
      0xb6a66717 __libc_start_main
          /build/glibc-Ir6W4B/glibc-2.28/csu/libc-start.c:308
      Please submit a full bug report,
      with preprocessed source if appropriate.
      Please include the complete backtrace with any bug report.
      See <file:///usr/share/doc/gcc-8/README.Bugs> for instructions.
      lto-wrapper: fatal error: /usr/bin/arm-linux-gnueabihf-gcc returned 1 exit status
      compilation terminated.
      /usr/bin/ld: error: lto-wrapper failed
      collect2: error: ld returned 1 exit status
      error: command '/usr/bin/arm-linux-gnueabihf-gcc' failed with exit code 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for soxr
Failed to build soxr
ERROR: Could not build wheels for soxr, which is required to install pyproject.toml-based projects

error: command '/usr/bin/arm-linux-gnueabihf-gcc' failed with exit code 1 ON Raspberry PI 3

Hello i get this error while install using pip3 install soxr on my raspberry pi 3

    arm-linux-gnueabihf-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-z,relro build/temp.linux-armv7l-cpython-37/libsoxr/src/cr.o build/temp.linux-armv7l-cpython-37/libsoxr/src/cr32.o build/temp.linux-armv7l-cpython-37/libsoxr/src/cr32s.o build/temp.linux-armv7l-cpython-37/libsoxr/src/cr64.o build/temp.linux-armv7l-cpython-37/libsoxr/src/data-io.o build/temp.linux-armv7l-cpython-37/libsoxr/src/dbesi0.o build/temp.linux-armv7l-cpython-37/libsoxr/src/fft4g32.o build/temp.linux-armv7l-cpython-37/libsoxr/src/fft4g64.o build/temp.linux-armv7l-cpython-37/libsoxr/src/filter.o build/temp.linux-armv7l-cpython-37/libsoxr/src/pffft32s.o build/temp.linux-armv7l-cpython-37/libsoxr/src/soxr.o build/temp.linux-armv7l-cpython-37/libsoxr/src/util32s.o build/temp.linux-armv7l-cpython-37/src/soxr/cysoxr.o -L/usr/lib -o build/lib.linux-armv7l-cpython-37/soxr/cysoxr.cpython-37m-arm-linux-gnueabihf.so
    during RTL pass: expand
    libsoxr/src/pffft.c: In function ‘reversed_copy.constprop’:
    libsoxr/src/pffft.c:1313:13: internal compiler error: in convert_move, at expr.c:218
     static void reversed_copy(int N, const v4sf *in, int in_stride, v4sf *out) {
                 ^
    0x76b16767 __libc_start_main
        /build/glibc-lsttuD/glibc-2.28/csu/libc-start.c:308
    Please submit a full bug report,
    with preprocessed source if appropriate.
    Please include the complete backtrace with any bug report.
    See <file:///usr/share/doc/gcc-8/README.Bugs> for instructions.
    lto-wrapper: fatal error: /usr/bin/arm-linux-gnueabihf-gcc returned 1 exit status
    compilation terminated.
    /usr/bin/ld: error: lto-wrapper failed
    collect2: error: ld returned 1 exit status
    error: command '/usr/bin/arm-linux-gnueabihf-gcc' failed with exit code 1

Any Solution?

Bug in dithering

In system that 'unsigned long' is 32-bit(i.e. Windows, 32-bit Linux), dithering is not working as expected.

In those systems, dithering has pattern of every 16 samples. Later 8 samples are always ±0.

 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
 0  1  0  0 -1  0  0 -1  0  0  0  0  0  0  0  0
 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
-1  1  0  0  0  0  0  0  0  0  0  0  0  0  0  0
 0  1  0  0  0  0  0 -1  0  0  0  0  0  0  0  0
 0  0  0  1  0  0  1  1  0  0  0  0  0  0  0  0
 0 -1  0  0  0  0  0  0  0  0  0  0  0  0  0  0
 0  0  0  0  0  0  0  1  0  0  0  0  0  0  0  0
 0 -1  0  0  1  0  0  0  0  0  0  0  0  0  0  0
 0  0  0 -1  0  0  0  1  0  0  0  0  0  0  0  0
 0  0  1  0  0 -1  0  0  0  0  0  0  0  0  0  0
-1  0  0 -1  0  0  0  0  0  0  0  0  0  0  0  0
 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
 0  0  1  1  0  0  0  1  0  0  0  0  0  0  0  0
 0  0  0  0  0  0 -1  0  0  0  0  0  0  0  0  0
 0  0  0  0  0  1 -1  1  0  0  0  0  0  0  0  0
...

Random variable used in dithering is unsigned long.
And it should have 56+ bits. 32-bit is not sufficient and it cause fixed 0 output.

I reported this issue to upstream:
https://sourceforge.net/p/soxr/discussion/general/thread/5d68180432/
but, it's not likely to be fixed. Maintainer is not active for 3+ years.

I'll wait for response about a month. After than, I'm going to fix this issue in my fork of libsoxr.

'import soxr' fails: ImportError: cannot import name '__version__' from 'soxr._version'

$ python3.9
Python 3.9.17 (main, Aug  6 2023, 01:11:50) 
[Clang 14.0.5 (https://github.com/llvm/llvm-project.git llvmorg-14.0.5-0-gc1238 on freebsd13
Type "help", "copyright", "credits" or "license" for more information.
>>> import soxr
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.9/site-packages/soxr/__init__.py", line 12, in <module>
    from ._version import __version__
ImportError: cannot import name '__version__' from 'soxr._version' (/usr/local/lib/python3.9/site-packages/soxr/_version.py)
>>> 

version is defined but __version__ isn't.
Not sure why other scripts expect __version__.

$ cat /usr/local/lib/python3.9/site-packages/soxr/_version.py
# coding: utf-8
# file generated by setuptools_scm
# don't change, don't track in version control
version = '0.3.6'
version_tuple = (0, 3, 6)

Version: 0.3.6
python-3.9
FreeBSD 13.2

error: implicit declaration of function... during installation or building

Python-SoXR now supports x86 and ARM processors.
(ppc64le is also supported but it's not being intensively tested.)

In other platforms, an error like below can occur during pip installation or building.

In file included from libsoxr/src/util-simd.c:43,
                 from libsoxr/src/util32s.c:8:
libsoxr/src/pffft.c:186:6: warning: #warning "building with simd disabled !\n"; [-Wcpp]
  186 | #    warning "building with simd disabled !\n";
      |      ^~~~~~~
In file included from libsoxr/src/util32s.c:8:
libsoxr/src/util-simd.c: In function ‘_soxr_ordered_convolve_simd32’:
libsoxr/src/util-simd.c:58:5: error: implicit declaration of function ‘UNINTERLEAVE2’ [-Werror=implicit-function-declaration]
   58 |     UNINTERLEAVE2(a1r, a1i, a1r, a1i);
      |     ^~~~~~~~~~~~~
libsoxr/src/util-simd.c:61:5: error: implicit declaration of function ‘INTERLEAVE2’ [-Werror=implicit-function-declaration]
   61 |     INTERLEAVE2(a1r, a1i, a1r, a1i);
      |     ^~~~~~~~~~~
cc1: some warnings being treated as errors
error: command '/usr/bin/gcc' failed with exit code 1

In this case, see BUILDING.md and build Python-SoXR using system libsoxr.

Release GIL while resampling

Hi, it's nice to see there's a convenient library to use soxr in python.
But it seems that it will not release GIL while resampling.
Can it release GIL while resampling?

Build breaks on arm64: cc: error: unsupported option '-mfpu=' for target 'aarch64-unknown-freebsd15.0'

cc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -O2 -pipe -fstack-protector-strong -fno-strict-aliasing -O2 -pipe -fstack-protector-strong -fno-strict-aliasing -fPIC -Ilibsoxr/src -Isrc/soxr -I/usr/local/lib/python3.9/site-packages/numpy/core/include -I/usr/local/lib/python3.9/site-packages/numpy/core/include -I/usr/local/include/python3.9 -c libsoxr/src/cr.c -o build/temp.freebsd-15.0-CURRENT-arm64-cpython-39/libsoxr/src/cr.o -DSOXR_LIB -mfpu=neon -std=gnu99 -Werror=implicit
cc: error: unsupported option '-mfpu=' for target 'aarch64-unknown-freebsd15.0'
error: command '/usr/bin/cc' failed with exit code 1

Missing APIs / Platforms not supported

Not complete libsoxr API

Some of libsoxr API is missing, like error handling, filter and phase setting.

No *-manylinux_i686 wheel

https://github.com/dofuuz/python-soxr/runs/2588306191

Adding -msse to compiler option will fix this issue.
But I'm looking for more elegant way to solve it. (Detecting compiler option automatically)

No pp*-macosx_x86_64 wheel

https://github.com/dofuuz/python-soxr/runs/2588631143

Numpy bug numpy/numpy#15947

No PyPy pp*-win32 wheel

https://github.com/dofuuz/python-soxr/runs/2596317718

setuptools_scm does not generate correct version name. I do not know why.


I'll fix these issue if there are reasonable request and spare time.

Feel free to open issue or PR.

AttributeError: soxr has no attribute __version__

Error log:

~/downloads/soxr-0.3.5 $ ls                                                          
BUILDING.md   LICENSE.txt  PKG-INFO   docs     pyproject.toml  setup.py  tests
COPYING.LGPL  MANIFEST.in  README.md  libsoxr  setup.cfg       src
~/downloads/soxr-0.3.5 $ python setup.py build
/data/data/com.termux/files/usr/lib/python3.11/site-packages/pythran/tables.py:4555: FutureWarning: In the future `np.bytes` will be defined as the corresponding NumPy scalar.
  obj = getattr(themodule, elem)
Traceback (most recent call last):
  File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/setuptools/config/expand.py", line 81, in __getattr__
    return next(
           ^^^^^
StopIteration

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/setuptools/config/expand.py", line 191, in read_attr
    return getattr(StaticModule(module_name, spec), attr_name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/setuptools/config/expand.py", line 87, in __getattr__
    raise AttributeError(f"{self.name} has no attribute {attr}") from e
AttributeError: soxr has no attribute __version__

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/storage/emulated/0/Download/soxr-0.3.5/setup.py", line 98, in <module>
    setup(
  File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/setuptools/__init__.py", line 107, in setup
    return distutils.core.setup(**attrs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 159, in setup
    dist.parse_config_files()                                                          
  File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/setuptools/dist.py", line 904, in parse_config_files                                                   
  setupcfg.parse_configuration(
  File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/setuptools/config/setupcfg.py", line 189, in parse_configuration
    meta.parse()                                                                          
  File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/setuptools/config/setupcfg.py", line 500, in parse
    section_parser_method(section_options)
  File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/setuptools/config/setupcfg.py", line 475, in parse_section                                                     self[name] = value
    ~~~~^^^^^^
  File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/setuptools/config/setupcfg.py", line 293, in __setitem__                                                       parsed = self.parsers.get(option_name, lambda x: x)(value)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/setuptools/config/setupcfg.py", line 606, in _parse_version
    return expand.version(self._parse_attr(value, self.package_dir, self.root_dir))
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/setuptools/config/setupcfg.py", line 417, in _parse_attr                                                       return expand.read_attr(attr_desc, package_dir, root_dir)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/setuptools/config/expand.py", line 195, in read_attr                                                           return getattr(module, attr_name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'soxr' has no attribute '__version__'
~/downloads/soxr-0.3.5 $ ls                                                             
BUILDING.md   LICENSE.txt  PKG-INFO   docs     pyproject.toml  setup.py  tests
COPYING.LGPL  MANIFEST.in  README.md  libsoxr  setup.cfg       src

No SIMD64 support (relatively slow VHQ mode)

No SIMD64 support (relatively slow VHQ mode)

It's not easy to solve because not every system supports AVX.
This needs different compiler flags for each source files and systems.

So again, I'm looking for more elegant way to solve it. (Detecting compiler option automatically)


Using external libsoxr may solve this problem. Build with --use-system-libsoxr flag if you really need faster VHQ mode.

Non-deterministic output issue

When using int16 output, soxr uses dithering and it's random.
Each run of soxr will produce different results.

Related issue:
chirlu/soxr#8

I'm considering to fix random seed of soxr to make result deterministic.

If anyone has opinion about this, feel free to leave comment!

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.