ref: 451b05d2a7a965fc0638e76db930ab83d8cfe373
parent: c71e40548aa64b7dc3203fa7fa4d00c7047cc24e
parent: 0ed517b8059dbd45ff5aa3b1aea9d68025fb78c4
author: Paul Brossier <piem@piem.org>
date: Tue Jul 10 17:25:25 EDT 2012
Merge branch 'numpy-1.8' into develop
--- a/interfaces/python/aubio-types.h
+++ b/interfaces/python/aubio-types.h
@@ -1,6 +1,7 @@
#include <Python.h>
#include <structmember.h>
#define NO_IMPORT_ARRAY
+#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
#include <numpy/arrayobject.h>
#define AUBIO_UNSTABLE 1
#include <aubio.h>
--- a/interfaces/python/aubiomodule.c
+++ b/interfaces/python/aubiomodule.c
@@ -1,5 +1,6 @@
#include <Python.h>
#define PY_ARRAY_UNIQUE_SYMBOL PyArray_API
+#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
#include <numpy/arrayobject.h>
#include "aubio-types.h"
@@ -131,17 +132,17 @@
return;
}
+ m = Py_InitModule3 ("_aubio", aubio_methods, aubio_module_doc);
+
+ if (m == NULL) {
+ return;
+ }
+
err = _import_array ();
if (err != 0) {
fprintf (stderr,
"Unable to import Numpy C API from aubio module (error %d)\n", err);
- }
-
- m = Py_InitModule3 ("_aubio", aubio_methods, aubio_module_doc);
-
- if (m == NULL) {
- return;
}
Py_INCREF (&Py_cvecType);
--- a/interfaces/python/aubioproxy.c
+++ b/interfaces/python/aubioproxy.c
@@ -12,19 +12,19 @@
if (PyArray_Check(input)) {
// we got an array, convert it to an fvec
- if (PyArray_NDIM (input) == 0) {
+ if (PyArray_NDIM ((PyArrayObject *)input) == 0) {
PyErr_SetString (PyExc_ValueError, "input array is a scalar");
goto fail;
- } else if (PyArray_NDIM (input) > 1) {
+ } else if (PyArray_NDIM ((PyArrayObject *)input) > 1) {
PyErr_SetString (PyExc_ValueError,
"input array has more than one dimensions");
goto fail;
}
- if (!PyArray_ISFLOAT (input)) {
+ if (!PyArray_ISFLOAT ((PyArrayObject *)input)) {
PyErr_SetString (PyExc_ValueError, "input array should be float");
goto fail;
- } else if (PyArray_TYPE (input) != AUBIO_NPY_SMPL) {
+ } else if (PyArray_TYPE ((PyArrayObject *)input) != AUBIO_NPY_SMPL) {
PyErr_SetString (PyExc_ValueError, "input array should be float32");
goto fail;
} else {
@@ -35,8 +35,8 @@
// vec = new_fvec (vec->length);
// no need to really allocate fvec, just its struct member
vec = (fvec_t *)malloc(sizeof(fvec_t));
- vec->length = PyArray_SIZE (array);
- vec->data = (smpl_t *) PyArray_GETPTR1 (array, 0);
+ vec->length = PyArray_SIZE ((PyArrayObject *)array);
+ vec->data = (smpl_t *) PyArray_GETPTR1 ((PyArrayObject *)array, 0);
} else if (PyObject_TypeCheck (input, &PyList_Type)) {
PyErr_SetString (PyExc_ValueError, "does not convert from list yet");
--- /dev/null
+++ b/interfaces/python/build_linux
@@ -1,0 +1,6 @@
+#! /bin/sh
+
+python setup.py clean build
+export PYTHONPATH=./build/lib.linux-x86_64-2.6/
+export LD_LIBRARY_PATH=../../build/src/
+./run_all_tests --verbose
--- /dev/null
+++ b/interfaces/python/build_osx
@@ -1,0 +1,8 @@
+#! /bin/sh
+
+export CFLAGS=-I/Users/piem/Library/Python/2.7/site-packages/numpy-1.8.0.dev_436a28f_20120710-py2.7-macosx-10.7-x86_64.egg/numpy/core/include/
+export LDFLAGS=-L../../build/src/
+python setup.py clean build
+export PYTHONPATH=./build/lib.macosx-10.6-intel-2.7:$PYTHONPATH
+export DYLD_LIBRARY_PATH=../../build/src
+./run_all_tests --verbose
--- a/interfaces/python/demo_filterbank.py
+++ b/interfaces/python/demo_filterbank.py
@@ -3,7 +3,7 @@
f = filterbank(9, 1024)
freq_list = [60, 80, 200, 400, 800, 1600, 3200, 6400, 12800, 15000, 24000]
freqs = fvec(freq_list)
-f.set_triangle_bands(freq_list, 48000)
+f.set_triangle_bands(freqs, 48000)
f.get_coeffs().T
from pylab import loglog, show
--- a/interfaces/python/py-cvec.c
+++ b/interfaces/python/py-cvec.c
@@ -125,7 +125,7 @@
static int
Py_cvec_set_norm (Py_cvec * vec, PyObject *input, void * closure)
{
- PyObject * array;
+ PyArrayObject * array;
if (input == NULL) {
PyErr_SetString (PyExc_ValueError, "input array is not a python object");
goto fail;
@@ -133,23 +133,23 @@
if (PyArray_Check(input)) {
// we got an array, convert it to a cvec.norm
- if (PyArray_NDIM (input) == 0) {
+ if (PyArray_NDIM ((PyArrayObject *)input) == 0) {
PyErr_SetString (PyExc_ValueError, "input array is a scalar");
goto fail;
- } else if (PyArray_NDIM (input) > 2) {
+ } else if (PyArray_NDIM ((PyArrayObject *)input) > 2) {
PyErr_SetString (PyExc_ValueError,
"input array has more than two dimensions");
goto fail;
}
- if (!PyArray_ISFLOAT (input)) {
+ if (!PyArray_ISFLOAT ((PyArrayObject *)input)) {
PyErr_SetString (PyExc_ValueError, "input array should be float");
goto fail;
- } else if (PyArray_TYPE (input) != AUBIO_NPY_SMPL) {
+ } else if (PyArray_TYPE ((PyArrayObject *)input) != AUBIO_NPY_SMPL) {
PyErr_SetString (PyExc_ValueError, "input array should be float32");
goto fail;
}
- array = input;
+ array = (PyArrayObject *)input;
// check input array dimensions
if (PyArray_NDIM (array) != 1) {
@@ -161,7 +161,7 @@
if (vec->o->length != PyArray_SIZE (array)) {
PyErr_Format (PyExc_ValueError,
"input array has length %d, but cvec has length %d",
- PyArray_SIZE (array), vec->o->length);
+ (int)PyArray_SIZE (array), vec->o->length);
goto fail;
}
}
@@ -183,7 +183,7 @@
static int
Py_cvec_set_phas (Py_cvec * vec, PyObject *input, void * closure)
{
- PyObject * array;
+ PyArrayObject * array;
if (input == NULL) {
PyErr_SetString (PyExc_ValueError, "input array is not a python object");
goto fail;
@@ -191,23 +191,23 @@
if (PyArray_Check(input)) {
// we got an array, convert it to a cvec.phas
- if (PyArray_NDIM (input) == 0) {
+ if (PyArray_NDIM ((PyArrayObject *)input) == 0) {
PyErr_SetString (PyExc_ValueError, "input array is a scalar");
goto fail;
- } else if (PyArray_NDIM (input) > 2) {
+ } else if (PyArray_NDIM ((PyArrayObject *)input) > 2) {
PyErr_SetString (PyExc_ValueError,
"input array has more than two dimensions");
goto fail;
}
- if (!PyArray_ISFLOAT (input)) {
+ if (!PyArray_ISFLOAT ((PyArrayObject *)input)) {
PyErr_SetString (PyExc_ValueError, "input array should be float");
goto fail;
- } else if (PyArray_TYPE (input) != AUBIO_NPY_SMPL) {
+ } else if (PyArray_TYPE ((PyArrayObject *)input) != AUBIO_NPY_SMPL) {
PyErr_SetString (PyExc_ValueError, "input array should be float32");
goto fail;
}
- array = input;
+ array = (PyArrayObject *)input;
// check input array dimensions
if (PyArray_NDIM (array) != 1) {
@@ -219,7 +219,7 @@
if (vec->o->length != PyArray_SIZE (array)) {
PyErr_Format (PyExc_ValueError,
"input array has length %d, but cvec has length %d",
- PyArray_SIZE (array), vec->o->length);
+ (int)PyArray_SIZE (array), vec->o->length);
goto fail;
}
}
--- a/interfaces/python/setup.py
+++ b/interfaces/python/setup.py
@@ -4,8 +4,17 @@
from generator import generate_object_files
-setup(name="_aubio", version="1.0",
+setup(name='aubio',
+ version = '0.4.0alpha',
packages = ['aubio'],
+ description = 'interface to the aubio library',
+ long_description = 'interface to the aubio library',
+ license = 'GNU/GPL version 3',
+ author = 'Paul Brossier',
+ author_email = 'piem@aubio.org',
+ maintainer = 'Paul Brossier',
+ maintainer_email = 'piem@aubio.org',
+ url = 'http://aubio.org/',
ext_modules = [
Extension("_aubio",
["aubiomodule.c",