Open detly opened 10 years ago
So the code in that branch now seems to be more-or-less done, but there are a couple of issues I need to resolve before I tidy things up and issue a pull request. These are listed below.
You can try out the current state of things by doing pip install git+https://github.com/detly/audiolab.git@p3
, or of course cloning the repo and installing it manually.
First issue: I can't get all of the tests to run on Python 2, so I can't really tell whether my Python 3 test run is failing because of my porting, or failing for some other reason. The errors I get are:
/home/jason/Code/audiolab-p2/audiolab/soundio/play.py:48: UserWarning: Could not import alsa backend; most probably, you did not have alsa headers when building audiolab
warnings.warn("Could not import alsa backend; most probably, "
Check aiffread ... ok
Check aiffwrite ... ok
Check auread ... ok
Check wavwrite ... ok
Check wavread on bad file ... ok
Check flacread ... ok
Check flacwrite ... ok
Check oggread ... ok
Check oggwrite ... ok
Check sdifread (ircam format) ... ok
Check wavwrite ... ok
Check wavread ... ok
Check wavwrite ... ok
Check open, close and basic read/write ... ok
Check open from fd works ... ok
Try to seek really far ... ok
Check float write/read works ... ok
Check float64 write/read works ... ok
Check nframes can be a float ... ok
test_int_io (audiolab.tests.test_pysndfile.test_pysndfile) ... ERROR
test_mismatch (audiolab.tests.test_pysndfile.test_pysndfile) ... ok
Check the failure when opening a non existing file. ... ok
test_raw (audiolab.tests.test_pysndfile.test_pysndfile) ... ok
test_short_io (audiolab.tests.test_pysndfile.test_pysndfile) ... ok
test_supported_features (audiolab.tests.test_pysndfile.test_pysndfile) ... SKIP: Skipping test: test_supported_features: Broken test and feature
Test read/write pointers for seek. ... ok
test_simple (audiolab.tests.test_pysndfile.test_seek) ... ok
Test read/write pointers for seek. ... ok
test_simple (audiolab.tests.test_sndfile.TestSeek) ... ok
Check open, close and basic read/write ... ok
Check open from fd works ... ok
Try to seek really far. ... ok
Check float32 write/read works ... ok
Check float64 write/read works ... ok
Check nframes can be a float ... ok
Check 16 bits pcm write/read works ... ok
Check 32 bits pcm write/read works ... ERROR
test_int32_io (audiolab.tests.test_sndfile.TestSndfile) ... ERROR
Check for bad arguments. ... ok
Check the failure when opening a non existing file. ... ok
test_raw (audiolab.tests.test_sndfile.TestSndfile) ... ok
test_short_io (audiolab.tests.test_sndfile.TestSndfile) ... ok
Failure: ImportError (cannot import name NumpyTest) ... ERROR
======================================================================
ERROR: test_int_io (audiolab.tests.test_pysndfile.test_pysndfile)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/jason/Code/audiolab-p2/audiolab/tests/test_pysndfile.py", line 213, in test_int_io
b.write_frames(a, nbuff)
File "/home/jason/Code/audiolab-p2/audiolab/pysndfile/compat.py", line 234, in write_frames
return self._sndfile.write_frames(input[:nframes,...])
File "_sndfile.pyx", line 743, in scikits.audiolab.pysndfile._sndfile.Sndfile.write_frames (audiolab/pysndfile/_sndfile.c:6813)
TypeError: not all arguments converted during string formatting
======================================================================
ERROR: Check 32 bits pcm write/read works
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/jason/Code/audiolab-p2/audiolab/tests/test_sndfile.py", line 77, in test_int32
self._test_read_write(np.int32)
File "/home/jason/Code/audiolab-p2/audiolab/tests/test_sndfile.py", line 100, in _test_read_write
tmpa = a.read_frames(nbuff, dtype=dtype)
File "_sndfile.pyx", line 632, in scikits.audiolab.pysndfile._sndfile.Sndfile.read_frames (audiolab/pysndfile/_sndfile.c:5433)
File "_sndfile.pyx", line 672, in scikits.audiolab.pysndfile._sndfile.Sndfile.read_frames_int (audiolab/pysndfile/_sndfile.c:6102)
ValueError: Buffer dtype mismatch (expected numpy.int32_t, got long)
======================================================================
ERROR: test_int32_io (audiolab.tests.test_sndfile.TestSndfile)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/jason/Code/audiolab-p2/audiolab/tests/test_sndfile.py", line 135, in test_int32_io
self._test_int_io(np.int32)
File "/home/jason/Code/audiolab-p2/audiolab/tests/test_sndfile.py", line 152, in _test_int_io
b.write_frames(a)
File "_sndfile.pyx", line 743, in scikits.audiolab.pysndfile._sndfile.Sndfile.write_frames (audiolab/pysndfile/_sndfile.c:6813)
TypeError: not all arguments converted during string formatting
======================================================================
ERROR: Failure: ImportError (cannot import name NumpyTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/jason/Code/p2/local/lib/python2.7/site-packages/nose/loader.py", line 413, in loadTestsFromName
addr.filename, addr.module)
File "/home/jason/Code/p2/local/lib/python2.7/site-packages/nose/importer.py", line 47, in importFromPath
return self.importFromDir(dir_path, fqname)
File "/home/jason/Code/p2/local/lib/python2.7/site-packages/nose/importer.py", line 94, in importFromDir
mod = load_module(part_fqname, fh, filename, desc)
File "/home/jason/Code/audiolab-p2/tester.py", line 6, in <module>
from numpy.testing import NumpyTest
ImportError: cannot import name NumpyTest
----------------------------------------------------------------------
Ran 43 tests in 0.625s
FAILED (SKIP=1, errors=4)
Apparently some of this is due to some incompatibility between Numpy and Scipy, but since Scipy's website (and therefore bug tracker) is currently down, I can't fix it yet.
But I can say that I get the same set of errors with my Python 3 port, so that gives me some degree of confidence.
Second issue: because I'm installing via pip install -e .
, neither my Python 2 audiolab
installation nor my Python 3 port seem to have the scikits
prefix on the package name, ie. the package must be imported as audiolab
, not scikits.audiolab
. I don't really understand how the current build system does this, so I can't tell if my port will respect the scikits
prefix for non-pip
installation under Python 3.
Just curious, did you ever get the Python 3 port fully working?
No, I removed it as a dependency from my project instead, since I only used it for a frontend script and not the library itself. (I also had a lot of trouble installing it on Windows 7, which was a motivating factor.) But you can see the state of things here.
merged both branches in milahu/scikits-audiolab
had to change the version in common.py
and Makefile
from 0.11.0.p3.1
to 0.11.1
to fix
setuptools.extern.packaging.version.InvalidVersion: Invalid version: '0.11.0.p3.1'
fixed some cython errors
moved module to namespace scikits.audiolab
added mpeg format 0x230000
tested with audio-cross-correlation/code/analysis.py
nix package in nur.repos.milahu.python3.pkgs.scikits-audiolab
Audiolab isn't compatible with Python 3. It would be nice if it were.
I'll start work on this now in a fork of my own, but I'm submitting the issue in case (a) you've already tried this and have any tips, and (b) I get stuck and need to ask questions.