History

Merge branch 'master' of aubio.org:/git/aubio/aubio into develop

Paul Brossier committed 12 years ago

Commit 21234ee2 parents 1573b16 c3c630585 files · +603 −934Browse files

Unified · Split

85 files
  1. ChangeLog +1 −1
  2. doc/web.cfg +1 −3
  3. examples/aubionotes.c +2 −2
  4. examples/aubioonset.c +9 −8
  5. examples/aubiopitch.c +9 −4
  6. examples/aubiotrack.c +1 −5
  7. examples/jackio.c +2 −2
  8. examples/parse_args.h +3 −3
  9. examples/utils.c +3 −3
  10. examples/wscript_build +4 −0
  11. python/demos/demo_bpm_extract.py +0 −0
  12. python/demos/demo_mel-energy.py +2 −1
  13. python/demos/demo_pitch.py +8 −4
  14. python/demos/demo_specdesc.py +1 −1
  15. python/ext/aubio-types.h +2 −0
  16. python/ext/aubiomodule.c +3 −0
  17. python/ext/aubioproxy.c +21 −3
  18. python/ext/py-fft.c +0 −4
  19. python/ext/py-source.c +137 −0
  20. python/lib/gen_pyobject.py +2 −2
  21. python/lib/generator.py +1 −0
  22. python/setup.py +1 −0
  23. src/aubio.h +1 −2
  24. src/aubio_priv.h +3 −3
  25. src/cvec.c +23 −18
  26. src/cvec.h +52 −40
  27. src/fmat.c +9 −6
  28. src/fmat.h +16 −31
  29. src/fvec.c +5 −5
  30. src/fvec.h +10 −19
  31. src/io/audio_unit.c +2 −2
  32. src/io/sndfileio.c +0 −254
  33. src/io/sndfileio.h +0 −84
  34. src/io/source.c +4 −4
  35. src/io/source.h +1 −1
  36. src/io/source_avcodec.c +2 −3
  37. src/lvec.c +4 −4
  38. src/lvec.h +9 −19
  39. src/mathutils.h +4 −5
  40. src/musicutils.h +21 −10
  41. src/onset/onset.h +4 −4
  42. src/onset/peakpicker.h +4 −4
  43. src/pitch/pitch.h +4 −4
  44. src/pitch/pitchfcomb.h +4 −6
  45. src/pitch/pitchmcomb.h +4 −4
  46. src/pitch/pitchschmitt.h +4 −4
  47. src/pitch/pitchspecacf.h +3 −3
  48. src/pitch/pitchyin.h +4 −4
  49. src/pitch/pitchyinfft.h +4 −4
  50. src/spectral/fft.h +10 −8
  51. src/spectral/filterbank.c +1 −1
  52. src/spectral/filterbank.h +4 −4
  53. src/spectral/filterbank_mel.h +4 −4
  54. src/spectral/mfcc.c +1 −1
  55. src/spectral/mfcc.h +4 −4
  56. src/spectral/phasevoc.h +4 −4
  57. src/spectral/specdesc.h +29 −29
  58. src/spectral/tss.h +4 −4
  59. src/synth/sampler.c +1 −1
  60. src/synth/sampler.h +3 −3
  61. src/synth/wavetable.c +2 −2
  62. src/synth/wavetable.h +3 −3
  63. src/tempo/beattracking.h +4 −4
  64. src/tempo/tempo.h +4 −4
  65. src/temporal/a_weighting.h +4 −4
  66. src/temporal/biquad.h +4 −4
  67. src/temporal/c_weighting.h +4 −4
  68. src/temporal/filter.h +4 −4
  69. src/temporal/resampler.h +4 −4
  70. src/types.h +4 −4
  71. src/utils/hist.h +4 −4
  72. src/utils/parameter.h +0 −1
  73. src/utils/scale.h +4 −4
  74. src/vecutils.c +12 −23
  75. src/vecutils.h +5 −83
  76. src/wscript_build +3 −1
  77. tests/src/io/test-source_multi.c +1 −1
  78. tests/src/spectral/test-mfcc.c +2 −2
  79. tests/src/spectral/test-phasevoc-jack.c +0 −101
  80. tests/src/spectral/test-phasevoc.c +1 −1
  81. tests/src/test-cvec.c +6 −6
  82. tests/src/test-fmat.c +1 −1
  83. tests/utils_tests.h +17 −0
  84. tests/wscript_build +0 −4
  85. wscript +31 −9
ChangeLog+1−1
@@ -10,7 +10,7 @@ · 9 unmodified lines
1010 * Memory management: allocation and freeing of memory has been optimized in
1111 many ways. Several memory leaks and out of bound access have been fixed.
1212
13− * Optimization: the FFT, central to most algorithm, can now be computed
13+ * Optimization: the FFT, central to most algorithms, can now be computed
1414 using different optimized algorithms, depending on what is available on your
1515 platform (FFTW, Ooura, or vDSP). Other simple optimization tricks are
1616 included. Most can be deactivated by configuring the build accordingly.
doc/web.cfg+1−3
@@ -769,15 +769,13 @@ RECURSIVE = YES · 768 unmodified lines
769769 # run.
770770
771771 EXCLUDE = ../src/aubio_priv.h \
772− ../src/mathutils \
773− .h \
772+ ../src/mathutils.h \
774773 ../src/io/audio_unit.h \
775774 ../src/io/source_sndfile.h \
776775 ../src/io/source_apple_audio.h \
777776 ../src/io/source_avcodec.h \
778777 ../src/io/sink_sndfile.h \
779778 ../src/io/sink_apple_audio.h \
780− ../src/io/sndfileio.h \
781779 ../src/onset/peakpicker.h \
782780 ../src/pitch/pitchmcomb.h \
783781 ../src/pitch/pitchyin.h \
examples/aubionotes.c+2−2
@@ -51,14 +51,14 @@ process_block(fvec_t *ibuf, fvec_t *obuf) { · 50 unmodified lines
5151 aubio_onset_do(o, ibuf, onset);
5252
5353 aubio_pitch_do (pitch, ibuf, pitch_obuf);
54− smpl_t new_pitch = fvec_read_sample(pitch_obuf, 0);
54+ smpl_t new_pitch = fvec_get_sample(pitch_obuf, 0);
5555 if(median){
5656 note_append(note_buffer, new_pitch);
5757 }
5858
5959 /* curlevel is negatif or 1 if silence */
6060 smpl_t curlevel = aubio_level_detection(ibuf, silence_threshold);
61− if (fvec_read_sample(onset, 0)) {
61+ if (fvec_get_sample(onset, 0)) {
6262 /* test for silence */
6363 if (curlevel == 1.) {
6464 if (median) isready = 0;
examples/aubioonset.c+9−8
@@ -28,16 +28,13 @@ aubio_onset_t *o; · 27 unmodified lines
2828 aubio_wavetable_t *wavetable;
2929 fvec_t *onset;
3030 smpl_t is_onset;
31−uint_t is_silence = 0.;
3231
3332 void
3433 process_block(fvec_t *ibuf, fvec_t *obuf) {
3534 fvec_zeros(obuf);
3635 aubio_onset_do (o, ibuf, onset);
37− if (silence_threshold != -90.)
38− is_silence = aubio_silence_detection(ibuf, silence_threshold);
39− is_onset = fvec_read_sample(onset, 0);
40− if ( is_onset && !is_silence ) {
36+ is_onset = fvec_get_sample(onset, 0);
37+ if ( is_onset ) {
4138 aubio_wavetable_play ( wavetable );
4239 } else {
4340 aubio_wavetable_stop ( wavetable );
@@ -51,7 +48,7 @@ process_block(fvec_t *ibuf, fvec_t *obuf) { · 7 unmodified lines
5148 void
5249 process_print (void)
5350 {
54− if ( is_onset && !is_silence ) {
51+ if ( is_onset ) {
5552 outmsg ("%f\n", aubio_onset_get_last_s (o) );
5653 }
5754 }
@@ -63,11 +60,15 @@ int main(int argc, char **argv) { · 5 unmodified lines
6360 verbmsg ("onset method: %s, ", onset_method);
6461 verbmsg ("buffer_size: %d, ", buffer_size);
6562 verbmsg ("hop_size: %d, ", hop_size);
66− verbmsg ("threshold: %f, ", silence_threshold);
63+ verbmsg ("silence: %f, ", silence_threshold);
6764 verbmsg ("threshold: %f\n", onset_threshold);
6865
6966 o = new_aubio_onset (onset_method, buffer_size, hop_size, samplerate);
70− if (onset_threshold != 0.) aubio_onset_set_threshold (o, onset_threshold);
67+ if (onset_threshold != 0.)
68+ aubio_onset_set_threshold (o, onset_threshold);
69+ if (silence_threshold != -90.)
70+ aubio_onset_set_silence (o, silence_threshold);
71+
7172 onset = new_fvec (1);
7273
7374 wavetable = new_aubio_wavetable (samplerate, hop_size);
examples/aubiopitch.c+9−4
@@ -32,7 +32,7 @@ void · 31 unmodified lines
3232 process_block(fvec_t * ibuf, fvec_t * obuf) {
3333 fvec_zeros(obuf);
3434 aubio_pitch_do (o, ibuf, pitch);
35− smpl_t freq = fvec_read_sample(pitch, 0);
35+ smpl_t freq = fvec_get_sample(pitch, 0);
3636 aubio_wavetable_set_amp ( wavetable, aubio_level_lin (ibuf) );
3737 aubio_wavetable_set_freq ( wavetable, freq );
3838
@@ -44,7 +44,7 @@ process_block(fvec_t * ibuf, fvec_t * obuf) { · 5 unmodified lines
4444
4545 void
4646 process_print (void) {
47− smpl_t pitch_found = fvec_read_sample(pitch, 0);
47+ smpl_t pitch_found = fvec_get_sample(pitch, 0);
4848 outmsg("%f %f\n",(blocks)
4949 *hop_size/(float)samplerate, pitch_found);
5050 }
@@ -63,8 +63,13 @@ int main(int argc, char **argv) { · 12 unmodified lines
6363 verbmsg ("tolerance: %f\n", pitch_tolerance);
6464
6565 o = new_aubio_pitch (pitch_method, buffer_size, hop_size, samplerate);
66− if (pitch_tolerance != 0.) aubio_pitch_set_tolerance (o, pitch_tolerance);
67− if (pitch_unit != NULL) aubio_pitch_set_unit (o, pitch_unit);
66+ if (pitch_tolerance != 0.)
67+ aubio_pitch_set_tolerance (o, pitch_tolerance);
68+ if (silence_threshold != -90.)
69+ aubio_pitch_set_silence (o, silence_threshold);
70+ if (pitch_unit != NULL)
71+ aubio_pitch_set_unit (o, pitch_unit);
72+
6873 pitch = new_fvec (1);
6974
7075 wavetable = new_aubio_wavetable (samplerate, hop_size);
examples/aubiotrack.c+1−5
@@ -28,13 +28,11 @@ aubio_tempo_t * tempo; · 27 unmodified lines
2828 aubio_wavetable_t *wavetable;
2929 fvec_t * tempo_out;
3030 smpl_t is_beat = 0;
31−smpl_t is_onset = 0;
3231 uint_t is_silence = 0.;
3332
3433 void process_block(fvec_t * ibuf, fvec_t *obuf) {
3534 aubio_tempo_do (tempo, ibuf, tempo_out);
36− is_beat = fvec_read_sample (tempo_out, 0);
37− is_onset = fvec_read_sample (tempo_out, 1);
35+ is_beat = fvec_get_sample (tempo_out, 0);
3836 if (silence_threshold != -90.)
3937 is_silence = aubio_silence_detection(ibuf, silence_threshold);
4038 fvec_zeros (obuf);
@@ -53,8 +51,6 @@ void process_print (void) { · 12 unmodified lines
5351 if ( is_beat && !is_silence ) {
5452 outmsg("%f\n", aubio_tempo_get_last_s(tempo) );
5553 }
56− //if ( is_onset )
57− // outmsg(" \t \t%f\n",(blocks)*hop_size/(float)samplerate);
5854 }
5955
6056 int main(int argc, char **argv) {
examples/jackio.c+2−2
@@ -252,9 +252,9 @@ static int block_process(aubio_jack_t *dev, · 251 unmodified lines
252252 unsigned int j; /*frames*/
253253 for (j=0;j<(unsigned)nframes;j++) {
254254 /* put synthnew in output */
255− output[0][j] = fvec_read_sample(dev->obuf, dev->pos);
255+ output[0][j] = fvec_get_sample(dev->obuf, dev->pos);
256256 /* write input to datanew */
257− fvec_write_sample(dev->ibuf, input[0][j], dev->pos);
257+ fvec_set_sample(dev->ibuf, input[0][j], dev->pos);
258258 /*time for fft*/
259259 if (dev->pos == (int)(dev->hop_size) - 1) {
260260 /* block loop */
examples/parse_args.h+3−3
@@ -61,9 +61,9 @@ usage (FILE * stream, int exit_code) · 60 unmodified lines
6161 {
6262 fprintf (stream, "usage: %s [ options ] \n", prog_name);
6363 fprintf (stream,
64− " -i --input input type\n"
64+ " -i --input input file\n"
6565 #ifdef PROG_HAS_OUTPUT
66− " -o --output output type\n"
66+ " -o --output output file\n"
6767 #endif
6868 " -r --samplerate select samplerate\n"
6969 " -B --bufsize set buffer size\n"
@@ -172,7 +172,7 @@ parse_args (int argc, char **argv) · 102 unmodified lines
172172 case 'H':
173173 hop_size = atoi (optarg);
174174 break;
175− case 'O': /*onset type */
175+ case 'O': /*onset method */
176176 onset_method = optarg;
177177 break;
178178 case 't': /* threshold value for onset */
examples/utils.c+3−3
@@ -83,7 +83,7 @@ examples_common_init (int argc, char **argv) · 82 unmodified lines
8383 debug ("Opening files ...\n");
8484 this_source = new_aubio_source ((char_t*)source_uri, samplerate, hop_size);
8585 if (this_source == NULL) {
86− outmsg ("Could not open input file %s\n", source_uri);
86+ errmsg ("Error: could not open input file %s\n", source_uri);
8787 exit (1);
8888 }
8989 if (samplerate == 0) {
@@ -92,13 +92,13 @@ examples_common_init (int argc, char **argv) · 2 unmodified lines
9292 if (sink_uri != NULL) {
9393 uint_t sink_exists = (access(sink_uri, F_OK) == 0 );
9494 if (!force_overwrite && sink_exists) {
95− outmsg ("Output file %s already exists, use -f to overwrite.\n",
95+ errmsg ("Error: output file %s already exists, use -f to overwrite.\n",
9696 sink_uri);
9797 exit (1);
9898 }
9999 this_sink = new_aubio_sink ((char_t*)sink_uri, samplerate);
100100 if (this_sink == NULL) {
101− outmsg ("Could not open output file %s\n", sink_uri);
101+ errmsg ("Error: could not create output file %s\n", sink_uri);
102102 exit (1);
103103 }
104104 }
examples/wscript_build+4−0
@@ -1,5 +1,8 @@
11 # vim:set syntax=python:
22
3+uselib = []
4+uselib += ['JACK']
5+
36 utils_source = ['utils.c', 'jackio.c']
47 programs_source = ctx.path.ant_glob('*.c', excl = utils_source)
58
@@ -7,6 +10,7 @@ programs_source = ctx.path.ant_glob('*.c', excl = utils_source) · 1 unmodified line
710 bld(features = 'c',
811 source = utils_source,
912 includes = ['../src'],
13+ uselib = uselib,
1014 target = 'utilsio')
1115
1216 # loop over all *.c filenames in examples to build them all
python/demos/demo_bpm_extract.py+0−0

File mode changed from 100644 to 100755.

python/demos/demo_mel-energy.py+2−1
@@ -61,8 +61,9 @@ if 1: · 60 unmodified lines
6161 ax.xaxis.set_visible(False)
6262 ax.yaxis.set_visible(False)
6363 ax.axis(xmax = all_desc_times[-1], xmin = all_desc_times[0])
64− ax.annotate('band %d' % i, xy=(-10, 10), xycoords='axes points',
64+ ax.annotate('band %d' % i, xy=(-10, 0), xycoords='axes points',
6565 horizontalalignment='right', verticalalignment='bottom',
66+ size = 'xx-small',
6667 )
6768 set_xlabels_sample2time( ax, all_desc_times[-1], samplerate)
6869 #plt.ylabel('spectral descriptor value')
python/demos/demo_pitch.py+8−4
@@ -56,9 +56,11 @@ confidences = array(confidences[skip:]) · 55 unmodified lines
5656 times = [t * hop_s for t in range(len(pitches))]
5757
5858 fig = plt.figure()
59+
5960 ax1 = fig.add_subplot(311)
6061 ax1 = get_waveform_plot(filename, samplerate = samplerate, block_size = hop_s, ax = ax1)
61−ax1.set_xticklabels([])
62+plt.setp(ax1.get_xticklabels(), visible = False)
63+ax1.set_xlabel('')
6264
6365 def array_from_text_file(filename, dtype = 'float'):
6466 import os.path
@@ -87,7 +89,8 @@ cleaned_pitches = ma.masked_where(confidences < tolerance, cleaned_pitches) · 22 unmodified lines
8789 ax2.plot(times, cleaned_pitches, '.-')
8890 #ax2.axis( ymin = 0.9 * cleaned_pitches.min(), ymax = 1.1 * cleaned_pitches.max() )
8991 #ax2.axis( ymin = 55, ymax = 70 )
90−ax2.set_xticklabels([])
92+plt.setp(ax2.get_xticklabels(), visible = False)
93+ax2.set_ylabel('f0 (Hz)')
9194
9295 # plot confidence
9396 ax3 = fig.add_subplot(313, sharex = ax1)
@@ -96,6 +99,7 @@ ax3.plot(times, confidences) · 2 unmodified lines
9699 # draw a line at tolerance
97100 ax3.plot(times, [tolerance]*len(confidences))
98101 ax3.axis( xmin = times[0], xmax = times[-1])
99−plt.show()
102+ax3.set_ylabel('condidence')
100103 set_xlabels_sample2time(ax3, times[-1], samplerate)
101−#plt.savefig(os.path.basename(filename) + '.png', dpi=200)
104+plt.show()
105+#plt.savefig(os.path.basename(filename) + '.svg')
python/demos/demo_specdesc.py+1−1
@@ -71,7 +71,7 @@ if 1: · 70 unmodified lines
7171 ax.xaxis.set_visible(False)
7272 ax.yaxis.set_visible(False)
7373 ax.axis(xmax = all_desc_times[-1], xmin = all_desc_times[0])
74− ax.annotate(method, xy=(-10, 10), xycoords='axes points',
74+ ax.annotate(method, xy=(-10, 0), xycoords='axes points',
7575 horizontalalignment='right', verticalalignment='bottom',
7676 )
7777 set_xlabels_sample2time(ax, all_desc_times[-1], samplerate)
python/ext/aubio-types.h+2−0
@@ -68,3 +68,5 @@ extern PyTypeObject Py_fftType; · 67 unmodified lines
6868
6969 extern PyTypeObject Py_pvocType;
7070
71+extern PyTypeObject Py_sourceType;
72+
python/ext/aubiomodule.c+3−0
@@ -198,6 +198,7 @@ init_aubio (void) · 197 unmodified lines
198198 || (PyType_Ready (&Py_filterbankType) < 0)
199199 || (PyType_Ready (&Py_fftType) < 0)
200200 || (PyType_Ready (&Py_pvocType) < 0)
201+ || (PyType_Ready (&Py_sourceType) < 0)
201202 // generated objects
202203 || (generated_types_ready() < 0 )
203204 ) {
@@ -226,6 +227,8 @@ init_aubio (void) · 22 unmodified lines
226227 PyModule_AddObject (m, "fft", (PyObject *) & Py_fftType);
227228 Py_INCREF (&Py_pvocType);
228229 PyModule_AddObject (m, "pvoc", (PyObject *) & Py_pvocType);
230+ Py_INCREF (&Py_sourceType);
231+ PyModule_AddObject (m, "source", (PyObject *) & Py_sourceType);
229232
230233 // add generated objects
231234 add_generated_objects(m);
python/ext/aubioproxy.c+21−3
@@ -35,7 +35,13 @@ PyAubio_ArrayToCFvec (PyObject *input) { · 34 unmodified lines
3535 // vec = new_fvec (vec->length);
3636 // no need to really allocate fvec, just its struct member
3737 vec = (fvec_t *)malloc(sizeof(fvec_t));
38− vec->length = PyArray_SIZE ((PyArrayObject *)array);
38+ long length = PyArray_SIZE ((PyArrayObject *)array);
39+ if (length > 0) {
40+ vec->length = (uint_t)length;
41+ } else {
42+ PyErr_SetString (PyExc_ValueError, "input array size should be greater than 0");
43+ goto fail;
44+ }
3945 vec->data = (smpl_t *) PyArray_GETPTR1 ((PyArrayObject *)array, 0);
4046
4147 } else if (PyObject_TypeCheck (input, &PyList_Type)) {
@@ -130,8 +136,20 @@ PyAubio_ArrayToCFmat (PyObject *input) { · 88 unmodified lines
130136
131137 // no need to really allocate fvec, just its struct member
132138 mat = (fmat_t *)malloc(sizeof(fmat_t));
133− mat->length = PyArray_DIM ((PyArrayObject *)array, 1);
134− mat->height = PyArray_DIM ((PyArrayObject *)array, 0);
139+ long length = PyArray_DIM ((PyArrayObject *)array, 1);
140+ if (length > 0) {
141+ mat->length = (uint_t)length;
142+ } else {
143+ PyErr_SetString (PyExc_ValueError, "input array dimension 1 should be greater than 0");
144+ goto fail;
145+ }
146+ long height = PyArray_DIM ((PyArrayObject *)array, 0);
147+ if (height > 0) {
148+ mat->height = (uint_t)height;
149+ } else {
150+ PyErr_SetString (PyExc_ValueError, "input array dimension 0 should be greater than 0");
151+ goto fail;
152+ }
135153 mat->data = (smpl_t **)malloc(sizeof(smpl_t*) * mat->height);
136154 for (i=0; i< mat->height; i++) {
137155 mat->data[i] = (smpl_t*)PyArray_GETPTR1 ((PyArrayObject *)array, i);
python/ext/py-fft.c+0−4
@@ -25,10 +25,6 @@ Py_fft_new (PyTypeObject * type, PyObject * args, PyObject * kwds) · 24 unmodified lines
2525
2626 self->win_s = Py_default_vector_length;
2727
28− if (self == NULL) {
29− return NULL;
30− }
31−
3228 if (win_s > 0) {
3329 self->win_s = win_s;
3430 } else if (win_s < 0) {
python/ext/py-source.c+137−0
@@ -0,0 +1,137 @@
1+// WARNING: this file is generated, DO NOT EDIT
2+
3+// WARNING: if you haven't read the first line yet, please do so
4+#include "aubiowraphell.h"
5+
6+typedef struct
7+{
8+ PyObject_HEAD
9+ aubio_source_t * o;
10+ char_t* uri;
11+ uint_t samplerate;
12+ uint_t hop_size;
13+} Py_source;
14+
15+static char Py_source_doc[] = "source object";
16+
17+static PyObject *
18+Py_source_new (PyTypeObject * pytype, PyObject * args, PyObject * kwds)
19+{
20+ Py_source *self;
21+ char_t* uri = NULL;
22+ uint_t samplerate = 0;
23+ uint_t hop_size = 0;
24+ static char *kwlist[] = { "uri", "samplerate", "hop_size", NULL };
25+
26+ if (!PyArg_ParseTupleAndKeywords (args, kwds, "|sII", kwlist,
27+ &uri, &samplerate, &hop_size)) {
28+ return NULL;
29+ }
30+
31+ self = (Py_source *) pytype->tp_alloc (pytype, 0);
32+
33+ if (self == NULL) {
34+ return NULL;
35+ }
36+
37+ self->uri = "none";
38+ if (uri != NULL) {
39+ self->uri = uri;
40+ }
41+
42+ self->samplerate = 0;
43+ if ((sint_t)samplerate > 0) {
44+ self->samplerate = samplerate;
45+ } else if ((sint_t)samplerate < 0) {
46+ PyErr_SetString (PyExc_ValueError,
47+ "can not use negative value for samplerate");
48+ return NULL;
49+ }
50+
51+ self->hop_size = Py_default_vector_length / 2;
52+ if ((sint_t)hop_size > 0) {
53+ self->hop_size = hop_size;
54+ } else if ((sint_t)hop_size < 0) {
55+ PyErr_SetString (PyExc_ValueError,
56+ "can not use negative value for hop_size");
57+ return NULL;
58+ }
59+
60+ return (PyObject *) self;
61+}
62+
63+static int
64+Py_source_init (Py_source * self, PyObject * args, PyObject * kwds)
65+{
66+ self->o = new_aubio_source ( self->uri, self->samplerate, self->hop_size );
67+ if (self->o == NULL) {
68+ PyErr_SetString (PyExc_StandardError, "error creating object");
69+ return -1;
70+ }
71+ self->samplerate = aubio_source_get_samplerate ( self->o );
72+
73+ return 0;
74+}
75+
76+AUBIO_DEL(source)
77+
78+/* function Py_source_do */
79+static PyObject *
80+Py_source_do(Py_source * self, PyObject * args)
81+{
82+
83+
84+ /* output vectors prototypes */
85+ fvec_t* read_to;
86+ uint_t read;
87+
88+
89+
90+
91+
92+
93+ /* creating output read_to as a new_fvec of length self->hop_size */
94+ read_to = new_fvec (self->hop_size);
95+ read = 0;
96+
97+
98+ /* compute _do function */
99+ aubio_source_do (self->o, read_to, &read);
100+
101+ PyObject *outputs = PyList_New(0);
102+ PyList_Append( outputs, (PyObject *)PyAubio_CFvecToArray (read_to));
103+ //del_fvec (read_to);
104+ PyList_Append( outputs, (PyObject *)PyInt_FromLong (read));
105+ return outputs;
106+}
107+
108+AUBIO_MEMBERS_START(source)
109+ {"uri", T_STRING, offsetof (Py_source, uri), READONLY, ""},
110+ {"samplerate", T_INT, offsetof (Py_source, samplerate), READONLY, ""},
111+ {"hop_size", T_INT, offsetof (Py_source, hop_size), READONLY, ""},
112+AUBIO_MEMBERS_STOP(source)
113+
114+
115+static PyObject *
116+Pyaubio_source_get_samplerate (Py_source *self, PyObject *unused)
117+{
118+ uint_t tmp = aubio_source_get_samplerate (self->o);
119+ return (PyObject *)PyInt_FromLong (tmp);
120+}
121+
122+static PyObject *
123+Pyaubio_source_get_channels (Py_source *self, PyObject *unused)
124+{
125+ uint_t tmp = aubio_source_get_channels (self->o);
126+ return (PyObject *)PyInt_FromLong (tmp);
127+}
128+
129+static PyMethodDef Py_source_methods[] = {
130+ {"get_samplerate", (PyCFunction) Pyaubio_source_get_samplerate,
131+ METH_NOARGS, ""},
132+ {"get_channels", (PyCFunction) Pyaubio_source_get_channels,
133+ METH_NOARGS, ""},
134+ {NULL} /* sentinel */
135+};
136+
137+AUBIO_TYPEOBJECT(source, "aubio.source")
python/lib/gen_pyobject.py+2−2
@@ -239,9 +239,9 @@ Py_%(name)s_new (PyTypeObject * pytype, PyObject * args, PyObject * kwds) · 238 unmodified lines
239239 s += """\
240240
241241 self->%(pname)s = %(defval)s;
242− if (%(pname)s > 0) {
242+ if ((sint_t)%(pname)s > 0) {
243243 self->%(pname)s = %(pname)s;
244− } else if (%(pname)s < 0) {
244+ } else if ((sint_t)%(pname)s < 0) {
245245 PyErr_SetString (PyExc_ValueError,
246246 "can not use negative value for %(pname)s");
247247 return NULL;
python/lib/generator.py+1−0
@@ -56,6 +56,7 @@ def generate_object_files(output_path): · 55 unmodified lines
5656 'pitchyinfft',
5757 'sink_apple_audio',
5858 'sink_sndfile',
59+ 'source',
5960 'source_apple_audio',
6061 'source_sndfile',
6162 'source_avcodec',
python/setup.py+1−0
@@ -53,6 +53,7 @@ aubio_extension = Extension("aubio._aubio", [ · 52 unmodified lines
5353 "ext/py-filterbank.c",
5454 "ext/py-fft.c",
5555 "ext/py-phasevoc.c",
56+ "ext/py-source.c",
5657 # generated files
5758 ] + generated_object_files,
5859 include_dirs = include_dirs,
src/aubio.h+1−2
@@ -184,7 +184,6 @@ extern "C" · 183 unmodified lines
184184 #include "tempo/tempo.h"
185185 #include "io/source.h"
186186 #include "io/sink.h"
187−#include "io/audio_unit.h"
188187 #include "synth/sampler.h"
189188 #include "synth/wavetable.h"
190189 #include "utils/parameter.h"
@@ -196,7 +195,7 @@ extern "C" · 5 unmodified lines
196195 #include "io/source_avcodec.h"
197196 #include "io/sink_sndfile.h"
198197 #include "io/sink_apple_audio.h"
199−#include "io/sndfileio.h"
198+#include "io/audio_unit.h"
200199 #include "onset/peakpicker.h"
201200 #include "pitch/pitchmcomb.h"
202201 #include "pitch/pitchyin.h"
src/aubio_priv.h+3−3
@@ -24,8 +24,8 @@ · 23 unmodified lines
2424 * This file is for inclusion from _within_ the library only.
2525 */
2626
27−#ifndef _AUBIO_PRIV_H
28−#define _AUBIO_PRIV_H
27+#ifndef _AUBIO__PRIV_H
28+#define _AUBIO__PRIV_H
2929
3030 /*********************
3131 *
@@ -217,4 +217,4 @@ typedef enum { · 185 unmodified lines
217217
218218 #define UNUSED __attribute__((unused))
219219
220−#endif/*_AUBIO_PRIV_H*/
220+#endif /* _AUBIO__PRIV_H */
src/cvec.c+23−18
@@ -38,22 +38,27 @@ void del_cvec(cvec_t *s) { · 37 unmodified lines
3838 AUBIO_FREE(s);
3939 }
4040
41−void cvec_write_norm(cvec_t *s, smpl_t data, uint_t position) {
41+void cvec_norm_set_sample (cvec_t *s, smpl_t data, uint_t position) {
4242 s->norm[position] = data;
4343 }
44−void cvec_write_phas(cvec_t *s, smpl_t data, uint_t position) {
44+
45+void cvec_phas_set_sample (cvec_t *s, smpl_t data, uint_t position) {
4546 s->phas[position] = data;
4647 }
47−smpl_t cvec_read_norm(cvec_t *s, uint_t position) {
48+
49+smpl_t cvec_norm_get_sample (cvec_t *s, uint_t position) {
4850 return s->norm[position];
4951 }
50−smpl_t cvec_read_phas(cvec_t *s, uint_t position) {
52+
53+smpl_t cvec_phas_get_sample (cvec_t *s, uint_t position) {
5154 return s->phas[position];
5255 }
53−smpl_t * cvec_get_norm(cvec_t *s) {
56+
57+smpl_t * cvec_norm_get_data (cvec_t *s) {
5458 return s->norm;
5559 }
56−smpl_t * cvec_get_phas(cvec_t *s) {
60+
61+smpl_t * cvec_phas_get_data (cvec_t *s) {
5762 return s->phas;
5863 }
5964
@@ -91,45 +96,45 @@ void cvec_copy(cvec_t *s, cvec_t *t) { · 31 unmodified lines
9196 #endif
9297 }
9398
94−void cvec_set_all_norm(cvec_t *s, smpl_t val) {
99+void cvec_norm_set_all (cvec_t *s, smpl_t val) {
95100 uint_t j;
96101 for (j=0; j< s->length; j++) {
97102 s->norm[j] = val;
98103 }
99104 }
100105
101−void cvec_zeros_norm(cvec_t *s) {
106+void cvec_norm_zeros(cvec_t *s) {
102107 #if HAVE_MEMCPY_HACKS
103108 memset(s->norm, 0, s->length * sizeof(smpl_t));
104109 #else
105− cvec_set_all_norm(s, 0.);
110+ cvec_norm_set_all (s, 0.);
106111 #endif
107112 }
108113
109−void cvec_ones_norm(cvec_t *s) {
110− cvec_set_all_norm(s, 1.);
114+void cvec_norm_ones(cvec_t *s) {
115+ cvec_norm_set_all (s, 1.);
111116 }
112117
113−void cvec_set_all_phas(cvec_t *s, smpl_t val) {
118+void cvec_phas_set_all (cvec_t *s, smpl_t val) {
114119 uint_t j;
115120 for (j=0; j< s->length; j++) {
116121 s->phas[j] = val;
117122 }
118123 }
119124
120−void cvec_zeros_phas(cvec_t *s) {
125+void cvec_phas_zeros(cvec_t *s) {
121126 #if HAVE_MEMCPY_HACKS
122127 memset(s->phas, 0, s->length * sizeof(smpl_t));
123128 #else
124− cvec_set_all_phas(s, 0.);
129+ cvec_phas_set_all (s, 0.);
125130 #endif
126131 }
127132
128−void cvec_ones_phas(cvec_t *s) {
129− cvec_set_all_phas(s, 1.);
133+void cvec_phas_ones(cvec_t *s) {
134+ cvec_phas_set_all (s, 1.);
130135 }
131136
132137 void cvec_zeros(cvec_t *s) {
133− cvec_zeros_norm(s);
134− cvec_zeros_phas(s);
138+ cvec_norm_zeros(s);
139+ cvec_phas_zeros(s);
135140 }
src/cvec.h+52−40
@@ -1,5 +1,5 @@
11 /*
2− Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org>
2+ Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org>
33
44 This file is part of aubio.
55
@@ -18,8 +18,8 @@ · 12 unmodified lines
1818
1919 */
2020
21−#ifndef _CVEC_H
22−#define _CVEC_H
21+#ifndef _AUBIO__CVEC_H
22+#define _AUBIO__CVEC_H
2323
2424 #ifdef __cplusplus
2525 extern "C" {
@@ -27,17 +27,17 @@ extern "C" { · 1 unmodified line
2727
2828 /** \file
2929
30− Vector of complex-valued data
30+ Vector of complex-valued data, stored in polar coordinates
3131
3232 This file specifies the ::cvec_t buffer type, which is used throughout aubio
3333 to store complex data. Complex values are stored in terms of ::cvec_t.phas
34− and norm, within size/2+1 long vectors of ::smpl_t.
34+ and norm, within 2 vectors of ::smpl_t of size (size/2+1) each.
3535
3636 \example test-cvec.c
3737
3838 */
3939
40−/** Buffer for complex data
40+/** Vector of real-valued phase and spectrum data
4141
4242 \code
4343
@@ -78,78 +78,91 @@ typedef struct { · 34 unmodified lines
7878
7979 */
8080 cvec_t * new_cvec(uint_t length);
81+
8182 /** cvec_t buffer deletion function
8283
8384 \param s buffer to delete as returned by new_cvec()
8485
8586 */
8687 void del_cvec(cvec_t *s);
88+
8789 /** write norm value in a complex buffer
8890
89− Note that this function is not used in the aubio library, since the same
90− result can be obtained by assigning vec->norm[position]. Its purpose
91− is to access these values from wrappers, as created by swig.
91+ This is equivalent to:
92+ \code
93+ s->norm[position] = val;
94+ \endcode
9295
9396 \param s vector to write to
94− \param data norm value to write in s->norm[position]
97+ \param val norm value to write in s->norm[position]
9598 \param position sample position to write to
9699
97100 */
98−void cvec_write_norm(cvec_t *s, smpl_t data, uint_t position);
101+void cvec_norm_set_sample (cvec_t *s, smpl_t val, uint_t position);
102+
99103 /** write phase value in a complex buffer
100104
101− Note that this function is not used in the aubio library, since the same
102− result can be obtained by assigning vec->phas[position]. Its purpose
103− is to access these values from wrappers, as created by swig.
105+ This is equivalent to:
106+ \code
107+ s->phas[position] = val;
108+ \endcode
104109
105110 \param s vector to write to
106− \param data phase value to write in s->phas[position]
111+ \param val phase value to write in s->phas[position]
107112 \param position sample position to write to
108113
109114 */
110−void cvec_write_phas(cvec_t *s, smpl_t data, uint_t position);
115+void cvec_phas_set_sample (cvec_t *s, smpl_t val, uint_t position);
116+
111117 /** read norm value from a complex buffer
112118
113− Note that this function is not used in the aubio library, since the same
114− result can be obtained with vec->norm[position]. Its purpose is to
115− access these values from wrappers, as created by swig.
119+ This is equivalent to:
120+ \code
121+ smpl_t foo = s->norm[position];
122+ \endcode
116123
117124 \param s vector to read from
118125 \param position sample position to read from
119126
120127 */
121−smpl_t cvec_read_norm(cvec_t *s, uint_t position);
128+smpl_t cvec_norm_get_sample (cvec_t *s, uint_t position);
129+
122130 /** read phase value from a complex buffer
123131
124− Note that this function is not used in the aubio library, since the same
125− result can be obtained with vec->phas[position]. Its purpose is to
126− access these values from wrappers, as created by swig.
132+ This is equivalent to:
133+ \code
134+ smpl_t foo = s->phas[position];
135+ \endcode
127136
128137 \param s vector to read from
129138 \param position sample position to read from
139+ \returns the value of the sample at position
130140
131141 */
132−smpl_t cvec_read_phas(cvec_t *s, uint_t position);
142+smpl_t cvec_phas_get_sample (cvec_t *s, uint_t position);
143+
133144 /** read norm data from a complex buffer
134145
135− Note that this function is not used in the aubio library, since the same
136− result can be obtained with vec->norm. Its purpose is to access these values
137− from wrappers, as created by swig.
146+ \code
147+ smpl_t *data = s->norm;
148+ \endcode
138149
139150 \param s vector to read from
140151
141152 */
142−smpl_t * cvec_get_norm(cvec_t *s);
153+smpl_t * cvec_norm_get_data (cvec_t *s);
154+
143155 /** read phase data from a complex buffer
144156
145− Note that this function is not used in the aubio library, since the same
146− result can be obtained with vec->phas. Its purpose is to access these values
147− from wrappers, as created by swig.
157+ This is equivalent to:
158+ \code
159+ smpl_t *data = s->phas;
160+ \endcode
148161
149162 \param s vector to read from
150163
151164 */
152−smpl_t * cvec_get_phas(cvec_t *s);
165+smpl_t * cvec_phas_get_data (cvec_t *s);
153166
154167 /** print out cvec data
155168
@@ -172,21 +185,21 @@ void cvec_copy(cvec_t *s, cvec_t *t); · 16 unmodified lines
172185 \param val value to set elements to
173186
174187 */
175−void cvec_set_all_norm(cvec_t *s, smpl_t val);
188+void cvec_norm_set_all (cvec_t *s, smpl_t val);
176189
177190 /** set all norm elements to zero
178191
179192 \param s vector to modify
180193
181194 */
182−void cvec_zeros_norm(cvec_t *s);
195+void cvec_norm_zeros(cvec_t *s);
183196
184197 /** set all norm elements to one
185198
186199 \param s vector to modify
187200
188201 */
189−void cvec_ones_norm(cvec_t *s);
202+void cvec_norm_ones(cvec_t *s);
190203
191204 /** set all phase elements to a given value
192205
@@ -194,21 +207,21 @@ void cvec_ones_norm(cvec_t *s); · 1 unmodified line
194207 \param val value to set elements to
195208
196209 */
197−void cvec_set_all_phas(cvec_t *s, smpl_t val);
210+void cvec_phas_set_all (cvec_t *s, smpl_t val);
198211
199212 /** set all phase elements to zero
200213
201214 \param s vector to modify
202215
203216 */
204−void cvec_zeros_phas(cvec_t *s);
217+void cvec_phas_zeros(cvec_t *s);
205218
206219 /** set all phase elements to one
207220
208221 \param s vector to modify
209222
210223 */
211−void cvec_ones_phas(cvec_t *s);
224+void cvec_phas_ones(cvec_t *s);
212225
213226 /** set all norm and phas elements to zero
214227
@@ -221,5 +234,4 @@ void cvec_zeros(cvec_t *s); · 6 unmodified lines
221234 }
222235 #endif
223236
224−#endif /* _CVEC_H */
225−
237+#endif /* _AUBIO__CVEC_H */
src/fmat.c+9−6
@@ -21,7 +21,7 @@ · 20 unmodified lines
2121 #include "aubio_priv.h"
2222 #include "fmat.h"
2323
24−fmat_t * new_fmat (uint_t length, uint_t height) {
24+fmat_t * new_fmat (uint_t height, uint_t length) {
2525 if ((sint_t)length <= 0 || (sint_t)height <= 0 ) {
2626 return NULL;
2727 }
@@ -48,21 +48,24 @@ void del_fmat (fmat_t *s) { · 20 unmodified lines
4848 AUBIO_FREE(s);
4949 }
5050
51−void fmat_write_sample(fmat_t *s, smpl_t data, uint_t channel, uint_t position) {
51+void fmat_set_sample(fmat_t *s, smpl_t data, uint_t channel, uint_t position) {
5252 s->data[channel][position] = data;
5353 }
54−smpl_t fmat_read_sample(fmat_t *s, uint_t channel, uint_t position) {
54+
55+smpl_t fmat_get_sample(fmat_t *s, uint_t channel, uint_t position) {
5556 return s->data[channel][position];
5657 }
57−void fmat_put_channel(fmat_t *s, smpl_t * data, uint_t channel) {
58− s->data[channel] = data;
59−}
58+
6059 void fmat_get_channel(fmat_t *s, uint_t channel, fvec_t *output) {
6160 output->data = s->data[channel];
6261 output->length = s->length;
6362 return;
6463 }
6564
65+smpl_t * fmat_get_channel_data(fmat_t *s, uint_t channel) {
66+ return s->data[channel];
67+}
68+
6669 smpl_t ** fmat_get_data(fmat_t *s) {
6770 return s->data;
6871 }
src/fmat.h+16−31
@@ -1,5 +1,5 @@
11 /*
2− Copyright (C) 2009 Paul Brossier <piem@aubio.org>
2+ Copyright (C) 2009-2013 Paul Brossier <piem@aubio.org>
33
44 This file is part of aubio.
55
@@ -18,8 +18,8 @@ · 12 unmodified lines
1818
1919 */
2020
21−#ifndef _FMAT_H
22−#define _FMAT_H
21+#ifndef _AUBIO__FMAT_H
22+#define _AUBIO__FMAT_H
2323
2424 #ifdef __cplusplus
2525 extern "C" {
@@ -49,30 +49,25 @@ typedef struct { · 23 unmodified lines
4949 \param height the height of the matrix to create
5050
5151 */
52−fmat_t * new_fmat(uint_t length, uint_t height);
52+fmat_t * new_fmat(uint_t height, uint_t length);
53+
5354 /** fmat_t buffer deletion function
5455
5556 \param s buffer to delete as returned by new_fmat()
5657
5758 */
5859 void del_fmat(fmat_t *s);
59−/** read sample value in a buffer
6060
61− Note that this function is not used in the aubio library, since the same
62− result can be obtained using vec->data[channel][position]. Its purpose is to
63− access these values from wrappers, as created by swig.
61+/** read sample value in a buffer
6462
6563 \param s vector to read from
6664 \param channel channel to read from
6765 \param position sample position to read from
6866
6967 */
70−smpl_t fmat_read_sample(fmat_t *s, uint_t channel, uint_t position);
71−/** write sample value in a buffer
68+smpl_t fmat_get_sample(fmat_t *s, uint_t channel, uint_t position);
7269
73− Note that this function is not used in the aubio library, since the same
74− result can be obtained by assigning vec->data[channel][position]. Its purpose
75− is to access these values from wrappers, as created by swig.
70+/** write sample value in a buffer
7671
7772 \param s vector to write to
7873 \param data value to write in s->data[channel][position]
@@ -80,12 +75,9 @@ smpl_t fmat_read_sample(fmat_t *s, uint_t channel, uint_t position); · 1 unmodified line
8075 \param position sample position to write to
8176
8277 */
83−void fmat_write_sample(fmat_t *s, smpl_t data, uint_t channel, uint_t position);
84−/** read channel vector from a buffer
78+void fmat_set_sample(fmat_t *s, smpl_t data, uint_t channel, uint_t position);
8579
86− Note that this function is not used in the aubio library, since the same
87− result can be obtained with vec->data[channel]. Its purpose is to access
88− these values from wrappers, as created by swig.
80+/** read channel vector from a buffer
8981
9082 \param s vector to read from
9183 \param channel channel to read from
@@ -93,23 +85,16 @@ void fmat_write_sample(fmat_t *s, smpl_t data, uint_t channel, uint_t position) · 1 unmodified line
9385
9486 */
9587 void fmat_get_channel (fmat_t *s, uint_t channel, fvec_t *output);
96−/** write channel vector into a buffer
9788
98− Note that this function is not used in the aubio library, since the same
99− result can be obtained by assigning vec->data[channel]. Its purpose is to
100− access these values from wrappers, as created by swig.
89+/** get vector buffer from an fmat data
10190
102− \param s vector to write to
103− \param data vector of [length] values to write
104− \param channel channel to write to
91+ \param s vector to read from
92+ \param channel channel to read from
10593
10694 */
107−void fmat_put_channel(fmat_t *s, smpl_t * data, uint_t channel);
108−/** read data from a buffer
95+smpl_t * fmat_get_channel_data (fmat_t *s, uint_t channel);
10996
110− Note that this function is not used in the aubio library, since the same
111− result can be obtained with vec->data. Its purpose is to access these values
112− from wrappers, as created by swig.
97+/** read data from a buffer
11398
11499 \param s vector to read from
115100
@@ -175,4 +160,4 @@ void fmat_copy(fmat_t *s, fmat_t *t); · 59 unmodified lines
175160 }
176161 #endif
177162
178−#endif /* _FMAT_H */
163+#endif /* _AUBIO__FMAT_H */
src/fvec.c+5−5
@@ -36,11 +36,11 @@ void del_fvec(fvec_t *s) { · 35 unmodified lines
3636 AUBIO_FREE(s);
3737 }
3838
39−void fvec_write_sample(fvec_t *s, smpl_t data, uint_t position) {
39+void fvec_set_sample(fvec_t *s, smpl_t data, uint_t position) {
4040 s->data[position] = data;
4141 }
4242
43−smpl_t fvec_read_sample(fvec_t *s, uint_t position) {
43+smpl_t fvec_get_sample(fvec_t *s, uint_t position) {
4444 return s->data[position];
4545 }
4646
@@ -58,7 +58,7 @@ void fvec_print(fvec_t *s) { · 11 unmodified lines
5858 AUBIO_MSG("\n");
5959 }
6060
61−void fvec_set(fvec_t *s, smpl_t val) {
61+void fvec_set_all (fvec_t *s, smpl_t val) {
6262 uint_t j;
6363 for (j=0; j< s->length; j++) {
6464 s->data[j] = val;
@@ -69,12 +69,12 @@ void fvec_zeros(fvec_t *s) { · 4 unmodified lines
6969 #if HAVE_MEMCPY_HACKS
7070 memset(s->data, 0, s->length * sizeof(smpl_t));
7171 #else
72− fvec_set(s, 0.);
72+ fvec_set_all (s, 0.);
7373 #endif
7474 }
7575
7676 void fvec_ones(fvec_t *s) {
77− fvec_set(s, 1.);
77+ fvec_set_all (s, 1.);
7878 }
7979
8080 void fvec_rev(fvec_t *s) {
src/fvec.h+10−19
@@ -1,5 +1,5 @@
11 /*
2− Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org>
2+ Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org>
33
44 This file is part of aubio.
55
@@ -18,8 +18,8 @@ · 12 unmodified lines
1818
1919 */
2020
21−#ifndef _FVEC_H
22−#define _FVEC_H
21+#ifndef _AUBIO__FVEC_H
22+#define _AUBIO__FVEC_H
2323
2424 #ifdef __cplusplus
2525 extern "C" {
@@ -75,42 +75,33 @@ typedef struct { · 49 unmodified lines
7575
7676 */
7777 fvec_t * new_fvec(uint_t length);
78+
7879 /** fvec_t buffer deletion function
7980
8081 \param s buffer to delete as returned by new_fvec()
8182
8283 */
8384 void del_fvec(fvec_t *s);
84−/** read sample value in a buffer
8585
86− Note that this function is not used in the aubio library, since the same
87− result can be obtained using vec->data[position]. Its purpose is to
88− access these values from wrappers, as created by swig.
86+/** read sample value in a buffer
8987
9088 \param s vector to read from
9189 \param position sample position to read from
9290
9391 */
94−smpl_t fvec_read_sample(fvec_t *s, uint_t position);
95−/** write sample value in a buffer
92+smpl_t fvec_get_sample(fvec_t *s, uint_t position);
9693
97− Note that this function is not used in the aubio library, since the same
98− result can be obtained by assigning vec->data[position]. Its purpose
99− is to access these values from wrappers, as created by swig.
94+/** write sample value in a buffer
10095
10196 \param s vector to write to
10297 \param data value to write in s->data[position]
10398 \param position sample position to write to
10499
105100 */
106−void fvec_write_sample(fvec_t *s, smpl_t data, uint_t position);
101+void fvec_set_sample(fvec_t *s, smpl_t data, uint_t position);
107102
108103 /** read data from a buffer
109104
110− Note that this function is not used in the aubio library, since the same
111− result can be obtained with vec->data. Its purpose is to access these values
112− from wrappers, as created by swig.
113−
114105 \param s vector to read from
115106
116107 */
@@ -129,7 +120,7 @@ void fvec_print(fvec_t *s); · 12 unmodified lines
129120 \param val value to set elements to
130121
131122 */
132−void fvec_set(fvec_t *s, smpl_t val);
123+void fvec_set_all (fvec_t *s, smpl_t val);
133124
134125 /** set all elements to zero
135126
@@ -175,4 +166,4 @@ void fvec_copy(fvec_t *s, fvec_t *t); · 39 unmodified lines
175166 }
176167 #endif
177168
178−#endif /* _FVEC_H */
169+#endif /* _AUBIO__FVEC_H */
src/io/audio_unit.c+2−2
@@ -104,8 +104,8 @@ aubio_audio_unit_t * new_aubio_audio_unit(uint_t samplerate, · 103 unmodified lines
104104 o->au_ios_inbuf = AUBIO_ARRAY(SInt16, AU_IOS_MAX_FRAMES * o->hw_input_channels);
105105
106106 /* the floats coming from and to the device callback */
107− o->output_frames = new_fmat(blocksize, sw_output_channels);
108− o->input_frames = new_fmat(blocksize, sw_input_channels);
107+ o->output_frames = new_fmat(sw_output_channels, blocksize);
108+ o->input_frames = new_fmat(sw_input_channels, blocksize);
109109
110110 /* check for some sizes */
111111 if ( o->hw_output_channels != o->output_frames->height ) {
src/io/sndfileio.c+0−254
@@ -1,254 +0,0 @@
1−/*
2− Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org>
3−
4− This file is part of aubio.
5−
6− aubio is free software: you can redistribute it and/or modify
7− it under the terms of the GNU General Public License as published by
8− the Free Software Foundation, either version 3 of the License, or
9− (at your option) any later version.
10−
11− aubio is distributed in the hope that it will be useful,
12− but WITHOUT ANY WARRANTY; without even the implied warranty of
13− MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14− GNU General Public License for more details.
15−
16− You should have received a copy of the GNU General Public License
17− along with aubio. If not, see <http://www.gnu.org/licenses/>.
18−
19−*/
20−
21−#include "config.h"
22−
23−#ifdef HAVE_SNDFILE
24−
25−#include <string.h>
26−
27−#include <sndfile.h>
28−
29−#include "aubio_priv.h"
30−#include "fvec.h"
31−#include "sndfileio.h"
32−#include "mathutils.h"
33−
34−#define MAX_CHANNELS 6
35−#define MAX_SIZE 4096
36−
37−struct _aubio_sndfile_t {
38− SNDFILE *handle;
39− int samplerate;
40− int channels;
41− int format;
42− float *tmpdata; /** scratch pad for interleaving/deinterleaving. */
43− int size; /** store the size to check if realloc needed */
44−};
45−
46−aubio_sndfile_t * new_aubio_sndfile_ro(const char* outputname) {
47− aubio_sndfile_t * f = AUBIO_NEW(aubio_sndfile_t);
48− SF_INFO sfinfo;
49− AUBIO_MEMSET(&sfinfo, 0, sizeof (sfinfo));
50−
51− f->handle = sf_open (outputname, SFM_READ, &sfinfo);
52−
53− if (f->handle == NULL) {
54− AUBIO_ERR("Failed opening %s: %s\n", outputname,
55− sf_strerror (NULL)); /* libsndfile err msg */
56− return NULL;
57− }
58−
59− if (sfinfo.channels > MAX_CHANNELS) {
60− AUBIO_ERR("Not able to process more than %d channels\n", MAX_CHANNELS);
61− return NULL;
62− }
63−
64− f->size = MAX_SIZE*sfinfo.channels;
65− f->tmpdata = AUBIO_ARRAY(float,f->size);
66− /* get input specs */
67− f->samplerate = sfinfo.samplerate;
68− f->channels = sfinfo.channels;
69− f->format = sfinfo.format;
70−
71− return f;
72−}
73−
74−int aubio_sndfile_open_wo(aubio_sndfile_t * f, const char* inputname) {
75− SF_INFO sfinfo;
76− AUBIO_MEMSET(&sfinfo, 0, sizeof (sfinfo));
77−
78− /* define file output spec */
79− sfinfo.samplerate = f->samplerate;
80− sfinfo.channels = f->channels;
81− sfinfo.format = f->format;
82−
83− if (! (f->handle = sf_open (inputname, SFM_WRITE, &sfinfo))) {
84− AUBIO_ERR("Not able to open output file %s.\n", inputname);
85− AUBIO_ERR("%s\n",sf_strerror (NULL)); /* libsndfile err msg */
86− AUBIO_QUIT(AUBIO_FAIL);
87− }
88−
89− if (sfinfo.channels > MAX_CHANNELS) {
90− AUBIO_ERR("Not able to process more than %d channels\n", MAX_CHANNELS);
91− AUBIO_QUIT(AUBIO_FAIL);
92− }
93− f->size = MAX_SIZE*sfinfo.channels;
94− f->tmpdata = AUBIO_ARRAY(float,f->size);
95− return AUBIO_OK;
96−}
97−
98−/* setup file struct from existing one */
99−aubio_sndfile_t * new_aubio_sndfile_wo(aubio_sndfile_t * fmodel, const char *outputname) {
100− aubio_sndfile_t * f = AUBIO_NEW(aubio_sndfile_t);
101− f->samplerate = fmodel->samplerate;
102− f->channels = 1; //fmodel->channels;
103− f->format = fmodel->format;
104− aubio_sndfile_open_wo(f, outputname);
105− return f;
106−}
107−
108−
109−/* return 0 if properly closed, 1 otherwise */
110−int del_aubio_sndfile(aubio_sndfile_t * f) {
111− if (sf_close(f->handle)) {
112− AUBIO_ERR("Error closing file.");
113− puts (sf_strerror (NULL));
114− return 1;
115− }
116− AUBIO_FREE(f->tmpdata);
117− AUBIO_FREE(f);
118− //AUBIO_DBG("File closed.\n");
119− return 0;
120−}
121−
122−/**************************************************************
123− *
124− * Read write methods
125− *
126− */
127−
128−
129−/* read frames from file in data
130− * return the number of frames actually read */
131−int aubio_sndfile_read(aubio_sndfile_t * f, int frames, fvec_t ** read) {
132− sf_count_t read_frames;
133− int i,j, channels = f->channels;
134− int nsamples = frames*channels;
135− int aread;
136− smpl_t *pread;
137−
138− /* allocate data for de/interleaving reallocated when needed. */
139− if (nsamples >= f->size) {
140− AUBIO_ERR("Maximum aubio_sndfile_read buffer size exceeded.");
141− return -1;
142− /*
143− AUBIO_FREE(f->tmpdata);
144− f->tmpdata = AUBIO_ARRAY(float,nsamples);
145− */
146− }
147− //f->size = nsamples;
148−
149− /* do actual reading */
150− read_frames = sf_read_float (f->handle, f->tmpdata, nsamples);
151−
152− aread = (int)FLOOR(read_frames/(float)channels);
153−
154− /* de-interleaving data */
155− for (i=0; i<channels; i++) {
156− pread = (smpl_t *)fvec_get_data(read[i]);
157− for (j=0; j<aread; j++) {
158− pread[j] = (smpl_t)f->tmpdata[channels*j+i];
159− }
160− }
161− return aread;
162−}
163−
164−int
165−aubio_sndfile_read_mono (aubio_sndfile_t * f, int frames, fvec_t * read)
166−{
167− sf_count_t read_frames;
168− int i, j, channels = f->channels;
169− int nsamples = frames * channels;
170− int aread;
171− smpl_t *pread;
172−
173− /* allocate data for de/interleaving reallocated when needed. */
174− if (nsamples >= f->size) {
175− AUBIO_ERR ("Maximum aubio_sndfile_read buffer size exceeded.");
176− return -1;
177− /*
178− AUBIO_FREE(f->tmpdata);
179− f->tmpdata = AUBIO_ARRAY(float,nsamples);
180− */
181− }
182− //f->size = nsamples;
183−
184− /* do actual reading */
185− read_frames = sf_read_float (f->handle, f->tmpdata, nsamples);
186−
187− aread = (int) FLOOR (read_frames / (float) channels);
188−
189− /* de-interleaving data */
190− pread = (smpl_t *) fvec_get_data (read);
191− for (i = 0; i < channels; i++) {
192− for (j = 0; j < aread; j++) {
193− pread[j] += (smpl_t) f->tmpdata[channels * j + i];
194− }
195− }
196− for (j = 0; j < aread; j++) {
197− pread[j] /= (smpl_t)channels;
198− }
199−
200− return aread;
201−}
202−
203−/* write 'frames' samples to file from data
204− * return the number of frames actually written
205− */
206−int aubio_sndfile_write(aubio_sndfile_t * f, int frames, fvec_t ** write) {
207− sf_count_t written_frames = 0;
208− int i, j, channels = f->channels;
209− int nsamples = channels*frames;
210− smpl_t *pwrite;
211−
212− /* allocate data for de/interleaving reallocated when needed. */
213− if (nsamples >= f->size) {
214− AUBIO_ERR("Maximum aubio_sndfile_write buffer size exceeded.");
215− return -1;
216− /*
217− AUBIO_FREE(f->tmpdata);
218− f->tmpdata = AUBIO_ARRAY(float,nsamples);
219− */
220− }
221− //f->size = nsamples;
222−
223− /* interleaving data */
224− for (i=0; i<channels; i++) {
225− pwrite = (smpl_t *)fvec_get_data(write[i]);
226− for (j=0; j<frames; j++) {
227− f->tmpdata[channels*j+i] = (float)pwrite[j];
228− }
229− }
230− written_frames = sf_write_float (f->handle, f->tmpdata, nsamples);
231− return written_frames/channels;
232−}
233−
234−/*******************************************************************
235− *
236− * Get object info
237− *
238− */
239−
240−uint_t aubio_sndfile_channels(aubio_sndfile_t * f) {
241− return f->channels;
242−}
243−
244−uint_t aubio_sndfile_samplerate(aubio_sndfile_t * f) {
245− return f->samplerate;
246−}
247−
248−void aubio_sndfile_info(aubio_sndfile_t * f) {
249− AUBIO_DBG("srate : %d\n", f->samplerate);
250− AUBIO_DBG("channels : %d\n", f->channels);
251− AUBIO_DBG("format : %d\n", f->format);
252−}
253−
254−#endif /* HAVE_SNDFILE */
src/io/sndfileio.h+0−84
@@ -1,84 +0,0 @@
1−/*
2− Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org>
3−
4− This file is part of aubio.
5−
6− aubio is free software: you can redistribute it and/or modify
7− it under the terms of the GNU General Public License as published by
8− the Free Software Foundation, either version 3 of the License, or
9− (at your option) any later version.
10−
11− aubio is distributed in the hope that it will be useful,
12− but WITHOUT ANY WARRANTY; without even the implied warranty of
13− MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14− GNU General Public License for more details.
15−
16− You should have received a copy of the GNU General Public License
17− along with aubio. If not, see <http://www.gnu.org/licenses/>.
18−
19−*/
20−
21−#ifndef SNDFILEIO_H
22−#define SNDFILEIO_H
23−
24−/** \file
25−
26− sndfile functions
27−
28− */
29−
30−#ifdef __cplusplus
31−extern "C" {
32−#endif
33−
34−/**
35− * sndfile object
36− */
37−typedef struct _aubio_sndfile_t aubio_sndfile_t;
38−/**
39− * Open a sound file for reading
40− */
41−aubio_sndfile_t * new_aubio_sndfile_ro (const char * inputfile);
42−/**
43− * Copy file model from previously opened sound file.
44− */
45−aubio_sndfile_t * new_aubio_sndfile_wo(aubio_sndfile_t * existingfile, const char * outputname);
46−/**
47− * Open a sound file for writing
48− */
49−int aubio_sndfile_open_wo (aubio_sndfile_t * file, const char * outputname);
50−/**
51− * Read frames data from file into an array of buffers
52− */
53−int aubio_sndfile_read(aubio_sndfile_t * file, int frames, fvec_t ** read);
54−/**
55− * Read frames data from file into a single buffer
56− */
57−int aubio_sndfile_read_mono (aubio_sndfile_t * f, int frames, fvec_t * read);
58−/**
59− * Write data of length frames to file
60− */
61−int aubio_sndfile_write(aubio_sndfile_t * file, int frames, fvec_t ** write);
62−/**
63− * Close file and delete file object
64− */
65−int del_aubio_sndfile(aubio_sndfile_t * file);
66−/**
67− * Return some files facts
68− */
69−void aubio_sndfile_info(aubio_sndfile_t * file);
70−/**
71− * Return number of channel in file
72− */
73−uint_t aubio_sndfile_channels(aubio_sndfile_t * file);
74−/**
75− * Return samplerate of a file (Hz)
76− */
77−uint_t aubio_sndfile_samplerate(aubio_sndfile_t * file);
78−
79−#ifdef __cplusplus
80−}
81−#endif
82−
83−#endif
84−
src/io/source.c+4−4
@@ -23,9 +23,9 @@ · 22 unmodified lines
2323 #include "fvec.h"
2424 #include "fmat.h"
2525 #include "io/source.h"
26−#ifdef HAVE_AVCODEC
26+#ifdef HAVE_LIBAV
2727 #include "io/source_avcodec.h"
28−#endif /* HAVE_AVCODEC */
28+#endif /* HAVE_LIBAV */
2929 #ifdef __APPLE__
3030 #include "io/source_apple_audio.h"
3131 #endif /* __APPLE__ */
@@ -52,7 +52,7 @@ struct _aubio_source_t { · 20 unmodified lines
5252
5353 aubio_source_t * new_aubio_source(char_t * uri, uint_t samplerate, uint_t hop_size) {
5454 aubio_source_t * s = AUBIO_NEW(aubio_source_t);
55−#if HAVE_AVCODEC
55+#if HAVE_LIBAV
5656 s->source = (void *)new_aubio_source_avcodec(uri, samplerate, hop_size);
5757 if (s->source) {
5858 s->s_do = (aubio_source_do_t)(aubio_source_avcodec_do);
@@ -63,7 +63,7 @@ aubio_source_t * new_aubio_source(char_t * uri, uint_t samplerate, uint_t hop_si · 4 unmodified lines
6363 s->s_del = (del_aubio_source_t)(del_aubio_source_avcodec);
6464 return s;
6565 }
66−#endif /* HAVE_AVCODEC */
66+#endif /* HAVE_LIBAV */
6767 #ifdef __APPLE__
6868 s->source = (void *)new_aubio_source_apple_audio(uri, samplerate, hop_size);
6969 if (s->source) {
src/io/source.h+1−1
@@ -40,7 +40,7 @@ · 39 unmodified lines
4040
4141 On Mac and iOS platforms, aubio should be compiled with CoreAudio [Extended
4242 Audio File Services]
43− (https://developer.apple.com/library/mac/documentation/musicaudio/CAAudioTooboxRef/_index.html).
43+ (https://developer.apple.com/library/mac/documentation/MusicAudio/Reference/ExtendedAudioFileServicesReference/Reference/reference.html).
4444 This provides access to most common audio file formats, including compressed
4545 ones.
4646
src/io/source_avcodec.c+2−3
@@ -21,9 +21,8 @@ · 20 unmodified lines
2121
2222 #include "config.h"
2323
24−#ifdef HAVE_AVCODEC
24+#ifdef HAVE_LIBAV
2525
26−#include <sndfile.h>
2726 #include <libavcodec/avcodec.h>
2827 #include <libavformat/avformat.h>
2928 #include <libavresample/avresample.h>
@@ -402,4 +401,4 @@ void del_aubio_source_avcodec(aubio_source_avcodec_t * s){ · 372 unmodified lines
402401 AUBIO_FREE(s);
403402 }
404403
405−#endif /* HAVE_SNDFILE */
404+#endif /* HAVE_LIBAV */
src/lvec.c+4−4
@@ -39,7 +39,7 @@ void del_lvec(lvec_t *s) { · 38 unmodified lines
3939 void lvec_write_sample(lvec_t *s, lsmp_t data, uint_t position) {
4040 s->data[position] = data;
4141 }
42−lsmp_t lvec_read_sample(lvec_t *s, uint_t position) {
42+lsmp_t lvec_get_sample(lvec_t *s, uint_t position) {
4343 return s->data[position];
4444 }
4545
@@ -57,7 +57,7 @@ void lvec_print(lvec_t *s) { · 11 unmodified lines
5757 AUBIO_MSG("\n");
5858 }
5959
60−void lvec_set(lvec_t *s, smpl_t val) {
60+void lvec_set_all (lvec_t *s, smpl_t val) {
6161 uint_t j;
6262 for (j=0; j< s->length; j++) {
6363 s->data[j] = val;
@@ -68,11 +68,11 @@ void lvec_zeros(lvec_t *s) { · 4 unmodified lines
6868 #if HAVE_MEMCPY_HACKS
6969 memset(s->data, 0, s->length * sizeof(lsmp_t));
7070 #else
71− lvec_set(s, 0.);
71+ lvec_set_all (s, 0.);
7272 #endif
7373 }
7474
7575 void lvec_ones(lvec_t *s) {
76− lvec_set(s, 1.);
76+ lvec_set_all (s, 1.);
7777 }
7878
src/lvec.h+9−19
@@ -1,5 +1,5 @@
11 /*
2− Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org>
2+ Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org>
33
44 This file is part of aubio.
55
@@ -18,8 +18,8 @@ · 12 unmodified lines
1818
1919 */
2020
21−#ifndef _LVEC_H
22−#define _LVEC_H
21+#ifndef _AUBIO__LVEC_H
22+#define _AUBIO__LVEC_H
2323
2424 #ifdef __cplusplus
2525 extern "C" {
@@ -57,36 +57,26 @@ lvec_t * new_lvec(uint_t length); · 31 unmodified lines
5757
5858 */
5959 void del_lvec(lvec_t *s);
60−/** read sample value in a buffer
6160
62− Note that this function is not used in the aubio library, since the same
63− result can be obtained using vec->data[position]. Its purpose is to
64− access these values from wrappers, as created by swig.
61+/** read sample value in a buffer
6562
6663 \param s vector to read from
6764 \param position sample position to read from
6865
6966 */
70−lsmp_t lvec_read_sample(lvec_t *s, uint_t position);
71−/** write sample value in a buffer
67+lsmp_t lvec_get_sample(lvec_t *s, uint_t position);
7268
73− Note that this function is not used in the aubio library, since the same
74− result can be obtained by assigning vec->data[position]. Its purpose
75− is to access these values from wrappers, as created by swig.
69+/** write sample value in a buffer
7670
7771 \param s vector to write to
7872 \param data value to write in s->data[position]
7973 \param position sample position to write to
8074
8175 */
82−void lvec_write_sample(lvec_t *s, lsmp_t data, uint_t position);
76+void lvec_set_sample(lvec_t *s, lsmp_t data, uint_t position);
8377
8478 /** read data from a buffer
8579
86− Note that this function is not used in the aubio library, since the same
87− result can be obtained with vec->data. Its purpose is to access these values
88− from wrappers, as created by swig.
89−
9080 \param s vector to read from
9181
9282 */
@@ -105,7 +95,7 @@ void lvec_print(lvec_t *s); · 12 unmodified lines
10595 \param val value to set elements to
10696
10797 */
108−void lvec_set(lvec_t *s, smpl_t val);
98+void lvec_set_all(lvec_t *s, smpl_t val);
10999
110100 /** set all elements to zero
111101
@@ -125,4 +115,4 @@ void lvec_ones(lvec_t *s); · 13 unmodified lines
125115 }
126116 #endif
127117
128−#endif /* _LVEC_H */
118+#endif /* _AUBIO__LVEC_H */
src/mathutils.h+4−5
@@ -1,5 +1,5 @@
11 /*
2− Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org>
2+ Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org>
33
44 This file is part of aubio.
55
@@ -27,8 +27,8 @@ · 21 unmodified lines
2727
2828 */
2929
30−#ifndef MATHUTILS_H
31−#define MATHUTILS_H
30+#ifndef _AUBIO_MATHUTILS_H
31+#define _AUBIO_MATHUTILS_H
3232
3333 #include "fvec.h"
3434 #include "musicutils.h"
@@ -282,5 +282,4 @@ void aubio_autocorr (fvec_t * input, fvec_t * output); · 247 unmodified lines
282282 }
283283 #endif
284284
285−#endif
286−
285+#endif /* _AUBIO_MATHUTILS_H */
src/musicutils.h+21−10
@@ -1,5 +1,5 @@
11 /*
2− Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org>
2+ Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org>
33
44 This file is part of aubio.
55
@@ -22,15 +22,32 @@ · 16 unmodified lines
2222 * various functions useful in audio signal processing
2323 */
2424
25−#ifndef MUSICUTILS_H
26−#define MUSICUTILS_H
25+#ifndef _AUBIO__MUSICUTILS_H
26+#define _AUBIO__MUSICUTILS_H
2727
2828 #ifdef __cplusplus
2929 extern "C" {
3030 #endif
3131
3232 /** create window
33+
34+ \param window_type type of the window to create
35+ \param size length of the window to create (see fvec_set_window())
3336
37+*/
38+fvec_t *new_aubio_window (char_t * window_type, uint_t size);
39+
40+/** set elements of a vector to window coefficients
41+
42+ \param window exsting ::fvec_t to use
43+ \param window_type type of the window to create
44+
45+ List of available window types: "rectangle", "hamming", "hanning",
46+ "hanningz", "blackman", "blackman_harris", "gaussian", "welch", "parzen",
47+ "default".
48+
49+ "default" is equivalent to "hanningz".
50+
3451 References:
3552
3653 - <a href="http://en.wikipedia.org/wiki/Window_function">Window
@@ -42,11 +59,6 @@ Uni- versity of Verona, Italy, 2000. · 5 unmodified lines
4259 (<a href="http://profs.sci.univr.it/%7Edafx/Final-Papers/ps/Bernardini.ps.gz">
4360 ps.gz</a>)
4461
45−*/
46−fvec_t *new_aubio_window (char_t * window_type, uint_t size);
47−
48−/** set elements of a vector to window coefficients
49−
5062 */
5163 uint_t fvec_set_window (fvec_t * window, char_t * window_type);
5264
@@ -148,5 +160,4 @@ smpl_t aubio_level_detection (fvec_t * v, smpl_t threshold); · 95 unmodified lines
148160 }
149161 #endif
150162
151−#endif
152−
163+#endif /* _AUBIO__MUSICUTILS_H */
src/onset/onset.h+4−4
@@ -1,5 +1,5 @@
11 /*
2− Copyright (C) 2006-2009 Paul Brossier <piem@aubio.org>
2+ Copyright (C) 2006-2013 Paul Brossier <piem@aubio.org>
33
44 This file is part of aubio.
55
@@ -39,8 +39,8 @@ · 33 unmodified lines
3939 */
4040
4141
42−#ifndef ONSET_H
43−#define ONSET_H
42+#ifndef _AUBIO_ONSET_H
43+#define _AUBIO_ONSET_H
4444
4545 #ifdef __cplusplus
4646 extern "C" {
@@ -268,4 +268,4 @@ void del_aubio_onset(aubio_onset_t * o); · 221 unmodified lines
268268 }
269269 #endif
270270
271−#endif /* ONSET_H */
271+#endif /* _AUBIO_ONSET_H */
src/onset/peakpicker.h+4−4
@@ -1,5 +1,5 @@
11 /*
2− Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org>
2+ Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org>
33
44 This file is part of aubio.
55
@@ -26,8 +26,8 @@ · 20 unmodified lines
2626
2727 */
2828
29−#ifndef PEAKPICK_H
30−#define PEAKPICK_H
29+#ifndef _AUBIO_PEAKPICK_H
30+#define _AUBIO_PEAKPICK_H
3131
3232 #ifdef __cplusplus
3333 extern "C" {
@@ -54,4 +54,4 @@ smpl_t aubio_peakpicker_get_threshold(aubio_peakpicker_t * p); · 20 unmodified lines
5454 }
5555 #endif
5656
57−#endif /* PEAKPICK_H */
57+#endif /* _AUBIO_PEAKPICK_H */
src/pitch/pitch.h+4−4
@@ -1,5 +1,5 @@
11 /*
2− Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org>
2+ Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org>
33
44 This file is part of aubio.
55
@@ -18,8 +18,8 @@ · 12 unmodified lines
1818
1919 */
2020
21−#ifndef PITCH_H
22−#define PITCH_H
21+#ifndef _AUBIO_PITCH_H
22+#define _AUBIO_PITCH_H
2323
2424 #ifdef __cplusplus
2525 extern "C" {
@@ -179,4 +179,4 @@ smpl_t aubio_pitch_get_confidence (aubio_pitch_t * o); · 153 unmodified lines
179179 }
180180 #endif
181181
182−#endif /*PITCH_H*/
182+#endif /* _AUBIO_PITCH_H */
src/pitch/pitchfcomb.h+4−6
@@ -1,5 +1,5 @@
11 /*
2− Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org>
2+ Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org>
33
44 This file is part of aubio.
55
@@ -34,8 +34,8 @@ · 28 unmodified lines
3434
3535 */
3636
37−#ifndef _PITCHFCOMB_H
38−#define _PITCHFCOMB_H
37+#ifndef _AUBIO_PITCHFCOMB_H
38+#define _AUBIO_PITCHFCOMB_H
3939
4040 #ifdef __cplusplus
4141 extern "C" {
@@ -73,6 +73,4 @@ void del_aubio_pitchfcomb (aubio_pitchfcomb_t * p); · 31 unmodified lines
7373 }
7474 #endif
7575
76−#endif /* _PITCHFCOMB_H */
77−
78−
76+#endif /* _AUBIO_PITCHFCOMB_H */
src/pitch/pitchmcomb.h+4−4
@@ -1,5 +1,5 @@
11 /*
2− Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org>
2+ Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org>
33
44 This file is part of aubio.
55
@@ -35,8 +35,8 @@ · 29 unmodified lines
3535
3636 */
3737
38−#ifndef PITCHMCOMB_H
39−#define PITCHMCOMB_H
38+#ifndef _AUBIO_PITCHMCOMB_H
39+#define _AUBIO_PITCHMCOMB_H
4040
4141 #ifdef __cplusplus
4242 extern "C" {
@@ -74,4 +74,4 @@ void del_aubio_pitchmcomb (aubio_pitchmcomb_t * p); · 31 unmodified lines
7474 }
7575 #endif
7676
77−#endif /* PITCHMCOMB_H */
77+#endif /* _AUBIO_PITCHMCOMB_H */
src/pitch/pitchschmitt.h+4−4
@@ -1,5 +1,5 @@
11 /*
2− Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org>
2+ Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org>
33
44 This file is part of aubio.
55
@@ -34,8 +34,8 @@ · 28 unmodified lines
3434
3535 */
3636
37−#ifndef _PITCHSCHMITT_H
38−#define _PITCHSCHMITT_H
37+#ifndef _AUBIO_PITCHSCHMITT_H
38+#define _AUBIO_PITCHSCHMITT_H
3939
4040 #ifdef __cplusplus
4141 extern "C" {
@@ -72,5 +72,5 @@ void del_aubio_pitchschmitt (aubio_pitchschmitt_t * p); · 30 unmodified lines
7272 }
7373 #endif
7474
75−#endif /* _PITCHSCHMITT_H */
75+#endif /* _AUBIO_PITCHSCHMITT_H */
7676
src/pitch/pitchspecacf.h+3−3
@@ -38,8 +38,8 @@ · 37 unmodified lines
3838
3939 */
4040
41−#ifndef AUBIO_PITCHSPECACF_H
42−#define AUBIO_PITCHSPECACF_H
41+#ifndef _AUBIO_PITCHSPECACF_H
42+#define _AUBIO_PITCHSPECACF_H
4343
4444 #ifdef __cplusplus
4545 extern "C" {
@@ -100,4 +100,4 @@ smpl_t aubio_pitchspecacf_get_confidence (aubio_pitchspecacf_t * o); · 54 unmodified lines
100100 }
101101 #endif
102102
103−#endif /*AUBIO_PITCHSPECACF_H*/
103+#endif /* _AUBIO_PITCHSPECACF_H */
src/pitch/pitchyin.h+4−4
@@ -1,5 +1,5 @@
11 /*
2− Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org>
2+ Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org>
33
44 This file is part of aubio.
55
@@ -34,8 +34,8 @@ · 28 unmodified lines
3434
3535 */
3636
37−#ifndef PITCHYIN_H
38−#define PITCHYIN_H
37+#ifndef _AUBIO_PITCHYIN_H
38+#define _AUBIO_PITCHYIN_H
3939
4040 #ifdef __cplusplus
4141 extern "C" {
@@ -96,4 +96,4 @@ smpl_t aubio_pitchyin_get_confidence (aubio_pitchyin_t * o); · 54 unmodified lines
9696 }
9797 #endif
9898
99−#endif /*PITCHYIN_H*/
99+#endif /* _AUBIO_PITCHYIN_H */
src/pitch/pitchyinfft.h+4−4
@@ -1,5 +1,5 @@
11 /*
2− Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org>
2+ Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org>
33
44 This file is part of aubio.
55
@@ -35,8 +35,8 @@ · 29 unmodified lines
3535
3636 */
3737
38−#ifndef PITCHYINFFT_H
39−#define PITCHYINFFT_H
38+#ifndef _AUBIO_PITCHYINFFT_H
39+#define _AUBIO_PITCHYINFFT_H
4040
4141 #ifdef __cplusplus
4242 extern "C" {
@@ -96,4 +96,4 @@ smpl_t aubio_pitchyinfft_get_confidence (aubio_pitchyinfft_t * o); · 53 unmodified lines
9696 }
9797 #endif
9898
99−#endif /*PITCHYINFFT_H*/
99+#endif /* _AUBIO_PITCHYINFFT_H */
src/spectral/fft.h+10−8
@@ -1,5 +1,5 @@
11 /*
2− Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org>
2+ Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org>
33
44 This file is part of aubio.
55
@@ -22,12 +22,17 @@ · 16 unmodified lines
2222
2323 Fast Fourier Transform
2424
25+ Depending on how aubio was compiled, FFT are computed using one of:
26+ - [Ooura](http://www.kurims.kyoto-u.ac.jp/~ooura/fft.html)
27+ - [FFTW3](http://www.fftw.org)
28+ - [vDSP](https://developer.apple.com/library/mac/#documentation/Accelerate/Reference/vDSPRef/Reference/reference.html)
29+
2530 \example src/spectral/test-fft.c
2631
2732 */
2833
29−#ifndef FFT_H_
30−#define FFT_H_
34+#ifndef _AUBIO_FFT_H
35+#define _AUBIO_FFT_H
3136
3237 #ifdef __cplusplus
3338 extern "C" {
@@ -35,10 +40,7 @@ extern "C" { · 1 unmodified line
3540
3641 /** FFT object
3742
38− This object computes forward and backward FFTs, using the complex type to
39− store the results. The phase vocoder or aubio_mfft_t objects should be
40− preferred to using directly aubio_fft_t. The FFT are computed using FFTW3
41− (although support for another library could be added).
43+ This object computes forward and backward FFTs.
4244
4345 */
4446 typedef struct _aubio_fft_t aubio_fft_t;
@@ -139,4 +141,4 @@ void aubio_fft_get_real(cvec_t * spectrum, fvec_t * compspec); · 94 unmodified lines
139141 }
140142 #endif
141143
142−#endif // FFT_H_
144+#endif /* _AUBIO_FFT_H */
src/spectral/filterbank.c+1−1
@@ -43,7 +43,7 @@ new_aubio_filterbank (uint_t n_filters, uint_t win_s) · 42 unmodified lines
4343 fb->n_filters = n_filters;
4444
4545 /* allocate filter tables, a matrix of length win_s and of height n_filters */
46− fb->filters = new_fmat (win_s / 2 + 1, n_filters);
46+ fb->filters = new_fmat (n_filters, win_s / 2 + 1);
4747
4848 return fb;
4949 }
src/spectral/filterbank.h+4−4
@@ -1,5 +1,5 @@
11 /*
2− Copyright (C) 2007-2009 Paul Brossier <piem@aubio.org>
2+ Copyright (C) 2007-2013 Paul Brossier <piem@aubio.org>
33 and Amaury Hazan <ahazan@iua.upf.edu>
44
55 This file is part of aubio.
@@ -29,8 +29,8 @@ · 23 unmodified lines
2929
3030 */
3131
32−#ifndef FILTERBANK_H
33−#define FILTERBANK_H
32+#ifndef _AUBIO_FILTERBANK_H
33+#define _AUBIO_FILTERBANK_H
3434
3535 #ifdef __cplusplus
3636 extern "C"
@@ -87,4 +87,4 @@ uint_t aubio_filterbank_set_coeffs (aubio_filterbank_t * f, fmat_t * filters); · 50 unmodified lines
8787 }
8888 #endif
8989
90−#endif // FILTERBANK_H
90+#endif /* _AUBIO_FILTERBANK_H */
src/spectral/filterbank_mel.h+4−4
@@ -1,5 +1,5 @@
11 /*
2− Copyright (C) 2007-2009 Paul Brossier <piem@aubio.org>
2+ Copyright (C) 2007-2013 Paul Brossier <piem@aubio.org>
33 and Amaury Hazan <ahazan@iua.upf.edu>
44
55 This file is part of aubio.
@@ -31,8 +31,8 @@ · 25 unmodified lines
3131
3232 */
3333
34−#ifndef FILTERBANK_MEL_H
35−#define FILTERBANK_MEL_H
34+#ifndef _AUBIO_FILTERBANK_MEL_H
35+#define _AUBIO_FILTERBANK_MEL_H
3636
3737 #ifdef __cplusplus
3838 extern "C"
@@ -69,4 +69,4 @@ uint_t aubio_filterbank_set_mel_coeffs_slaney (aubio_filterbank_t * fb, · 30 unmodified lines
6969 }
7070 #endif
7171
72−#endif // FILTERBANK_MEL_H
72+#endif /* _AUBIO_FILTERBANK_MEL_H */
src/spectral/mfcc.c+1−1
@@ -66,7 +66,7 @@ new_aubio_mfcc (uint_t win_s, uint_t n_filters, uint_t n_coefs, · 65 unmodified lines
6666 /* allocating buffers */
6767 mfcc->in_dct = new_fvec (n_filters);
6868
69− mfcc->dct_coeffs = new_fmat (n_coefs, n_filters);
69+ mfcc->dct_coeffs = new_fmat (n_filters, n_coefs);
7070
7171 /* compute DCT transform dct_coeffs[i][j] as
7272 cos ( j * (i+.5) * PI / n_filters ) */
src/spectral/mfcc.h+4−4
@@ -1,5 +1,5 @@
11 /*
2− Copyright (C) 2007-2009 Paul Brossier <piem@aubio.org>
2+ Copyright (C) 2007-2013 Paul Brossier <piem@aubio.org>
33 and Amaury Hazan <ahazan@iua.upf.edu>
44
55 This file is part of aubio.
@@ -27,8 +27,8 @@ · 21 unmodified lines
2727
2828 */
2929
30−#ifndef MFCC_H
31−#define MFCC_H
30+#ifndef _AUBIO_MFCC_H
31+#define _AUBIO_MFCC_H
3232
3333 #ifdef __cplusplus
3434 extern "C"
@@ -69,4 +69,4 @@ void aubio_mfcc_do (aubio_mfcc_t * mf, cvec_t * in, fvec_t * out); · 34 unmodified lines
6969 }
7070 #endif
7171
72−#endif // MFCC_H
72+#endif /* _AUBIO_MFCC_H */
src/spectral/phasevoc.h+4−4
@@ -1,5 +1,5 @@
11 /*
2− Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org>
2+ Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org>
33
44 This file is part of aubio.
55
@@ -31,8 +31,8 @@ · 25 unmodified lines
3131
3232 */
3333
34−#ifndef _PHASEVOC_H
35−#define _PHASEVOC_H
34+#ifndef _AUBIO_PHASEVOC_H
35+#define _AUBIO_PHASEVOC_H
3636
3737 #ifdef __cplusplus
3838 extern "C" {
@@ -99,4 +99,4 @@ uint_t aubio_pvoc_get_hop(aubio_pvoc_t* pv); · 60 unmodified lines
9999 }
100100 #endif
101101
102−#endif
102+#endif /* _AUBIO_PHASEVOC_H */
src/spectral/specdesc.h+29−29
@@ -1,5 +1,5 @@
11 /*
2− Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org>
2+ Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org>
33
44 This file is part of aubio.
55
@@ -19,13 +19,13 @@ · 13 unmodified lines
1919 */
2020
2121 /** \file
22−
22+
2323 Spectral description functions
24−
24+
2525 All of the following spectral description functions take as arguments the FFT
2626 of a windowed signal (as created with aubio_pvoc). They output one smpl_t per
2727 buffer (stored in a vector of size [1]).
28−
28+
2929 \section specdesc Spectral description functions
3030
3131 A list of the spectral description methods currently available follows.
@@ -34,54 +34,54 @@ · 2 unmodified lines
3434
3535 These functions are designed to raise at notes attacks in music signals.
3636
37− \b \p energy : Energy based onset detection function
38−
37+ \b \p energy : Energy based onset detection function
38+
3939 This function calculates the local energy of the input spectral frame.
40−
40+
4141 \b \p hfc : High Frequency Content onset detection function
42−
42+
4343 This method computes the High Frequency Content (HFC) of the input spectral
4444 frame. The resulting function is efficient at detecting percussive onsets.
4545
4646 Paul Masri. Computer modeling of Sound for Transformation and Synthesis of
4747 Musical Signal. PhD dissertation, University of Bristol, UK, 1996.
4848
49− \b \p complex : Complex Domain Method onset detection function
50−
49+ \b \p complex : Complex Domain Method onset detection function
50+
5151 Christopher Duxbury, Mike E. Davies, and Mark B. Sandler. Complex domain
5252 onset detection for musical signals. In Proceedings of the Digital Audio
5353 Effects Conference, DAFx-03, pages 90-93, London, UK, 2003.
5454
55− \b \p phase : Phase Based Method onset detection function
55+ \b \p phase : Phase Based Method onset detection function
5656
5757 Juan-Pablo Bello, Mike P. Davies, and Mark B. Sandler. Phase-based note onset
5858 detection for music signals. In Proceedings of the IEEE International
5959 Conference on Acoustics Speech and Signal Processing, pages 441­444,
6060 Hong-Kong, 2003.
6161
62− \b \p specdiff : Spectral difference method onset detection function
62+ \b \p specdiff : Spectral difference method onset detection function
6363
6464 Jonhatan Foote and Shingo Uchihashi. The beat spectrum: a new approach to
6565 rhythm analysis. In IEEE International Conference on Multimedia and Expo
6666 (ICME 2001), pages 881­884, Tokyo, Japan, August 2001.
6767
68− \b \p kl : Kullback-Liebler onset detection function
69−
68+ \b \p kl : Kullback-Liebler onset detection function
69+
7070 Stephen Hainsworth and Malcom Macleod. Onset detection in music audio
7171 signals. In Proceedings of the International Computer Music Conference
7272 (ICMC), Singapore, 2003.
7373
74− \b \p mkl : Modified Kullback-Liebler onset detection function
74+ \b \p mkl : Modified Kullback-Liebler onset detection function
7575
7676 Paul Brossier, ``Automatic annotation of musical audio for interactive
7777 systems'', Chapter 2, Temporal segmentation, PhD thesis, Centre for Digital
7878 music, Queen Mary University of London, London, UK, 2006.
7979
80− \b \p specflux : Spectral Flux
80+ \b \p specflux : Spectral Flux
8181
8282 Simon Dixon, Onset Detection Revisited, in ``Proceedings of the 9th
8383 International Conference on Digital Audio Effects'' (DAFx-06), Montreal,
84− Canada, 2006.
84+ Canada, 2006.
8585
8686 \subsection shapedesc Spectral shape descriptors
8787
@@ -92,14 +92,14 @@ · 4 unmodified lines
9292 Project Report 2004 (<a
9393 href="http://www.ircam.fr/anasyn/peeters/ARTICLES/Peeters_2003_cuidadoaudiofeatures.pdf">pdf</a>)
9494
95− \b \p centroid : Spectral centroid
95+ \b \p centroid : Spectral centroid
9696
9797 The spectral centroid represents the barycenter of the spectrum.
9898
9999 \e Note: This function returns the result in bin. To get the spectral
100− centroid in Hz, aubio_bintofreq() should be used.
100+ centroid in Hz, aubio_bintofreq() should be used.
101101
102− \b \p spread : Spectral spread
102+ \b \p spread : Spectral spread
103103
104104 The spectral spread is the variance of the spectral distribution around its
105105 centroid.
@@ -125,14 +125,14 @@ · 19 unmodified lines
125125 See also <a href="http://en.wikipedia.org/wiki/Kurtosis">Kurtosis</a> on
126126 Wikipedia.
127127
128− \b \p slope : Spectral slope
128+ \b \p slope : Spectral slope
129129
130130 The spectral slope represents decreasing rate of the spectral amplitude,
131131 computed using a linear regression.
132132
133133 \b \p decrease : Spectral decrease
134134
135− The spectral decrease is another representation of the decreasing rate,
135+ The spectral decrease is another representation of the decreasing rate,
136136 based on perceptual criteria.
137137
138138 \b \p rolloff : Spectral roll-off
@@ -145,8 +145,8 @@ · 6 unmodified lines
145145 */
146146
147147
148−#ifndef ONSETDETECTION_H
149−#define ONSETDETECTION_H
148+#ifndef _AUBIO_SPECDESC_H
149+#define _AUBIO_SPECDESC_H
150150
151151 #ifdef __cplusplus
152152 extern "C" {
@@ -155,10 +155,10 @@ extern "C" { · 2 unmodified lines
155155 /** spectral description structure */
156156 typedef struct _aubio_specdesc_t aubio_specdesc_t;
157157
158−/** execute spectral description function on a spectral frame
158+/** execute spectral description function on a spectral frame
159159
160160 Generic function to compute spectral detescription.
161−
161+
162162 \param o spectral description object as returned by new_aubio_specdesc()
163163 \param fftgrain input signal spectrum as computed by aubio_pvoc_do
164164 \param desc output vector (one sample long, to send to the peak picking)
@@ -167,7 +167,7 @@ typedef struct _aubio_specdesc_t aubio_specdesc_t; · 2 unmodified lines
167167 void aubio_specdesc_do (aubio_specdesc_t * o, cvec_t * fftgrain,
168168 fvec_t * desc);
169169
170−/** creation of a spectral description object
170+/** creation of a spectral description object
171171
172172 \param method spectral description method
173173 \param buf_size length of the input spectrum frame
@@ -180,7 +180,7 @@ void aubio_specdesc_do (aubio_specdesc_t * o, cvec_t * fftgrain, · 6 unmodified lines
180180 */
181181 aubio_specdesc_t *new_aubio_specdesc (char_t * method, uint_t buf_size);
182182
183−/** deletion of a spectral descriptor
183+/** deletion of a spectral descriptor
184184
185185 \param o spectral descriptor object as returned by new_aubio_specdesc()
186186
@@ -191,4 +191,4 @@ void del_aubio_specdesc (aubio_specdesc_t * o); · 4 unmodified lines
191191 }
192192 #endif
193193
194−#endif /* ONSETDETECTION_H */
194+#endif /* _AUBIO_SPECDESC_H */
src/spectral/tss.h+4−4
@@ -1,5 +1,5 @@
11 /*
2− Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org>
2+ Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org>
33
44 This file is part of aubio.
55
@@ -36,8 +36,8 @@ · 30 unmodified lines
3636
3737 */
3838
39−#ifndef TSS_H
40−#define TSS_H
39+#ifndef _AUBIO_TSS_H
40+#define _AUBIO_TSS_H
4141
4242 #ifdef __cplusplus
4343 extern "C" {
@@ -100,4 +100,4 @@ uint_t aubio_tss_set_beta (aubio_tss_t * o, smpl_t beta); · 56 unmodified lines
100100 }
101101 #endif
102102
103−#endif /*TSS_H*/
103+#endif /* _AUBIO_TSS_H */
src/synth/sampler.c+1−1
@@ -42,7 +42,7 @@ aubio_sampler_t *new_aubio_sampler(uint_t samplerate, uint_t blocksize) · 41 unmodified lines
4242 s->samplerate = samplerate;
4343 s->blocksize = blocksize;
4444 s->source_output = new_fvec(blocksize);
45− s->source_output_multi = new_fmat(blocksize, 4);
45+ s->source_output_multi = new_fmat(4, blocksize);
4646 s->source = NULL;
4747 s->playing = 0;
4848 return s;
src/synth/sampler.h+3−3
@@ -18,8 +18,8 @@ · 17 unmodified lines
1818
1919 */
2020
21−#ifndef _AUBIO_SYNTH_SAMPLER_H
22−#define _AUBIO_SYNTH_SAMPLER_H
21+#ifndef _AUBIO_SAMPLER_H
22+#define _AUBIO_SAMPLER_H
2323
2424 /** \file
2525
@@ -137,4 +137,4 @@ void del_aubio_sampler( aubio_sampler_t * o ); · 111 unmodified lines
137137 }
138138 #endif
139139
140−#endif /* _AUBIO_SYNTH_SAMPLER_H */
140+#endif /* _AUBIO_SAMPLER_H */
src/synth/wavetable.c+2−2
@@ -97,7 +97,7 @@ void aubio_wavetable_do ( aubio_wavetable_t * s, fvec_t * input, fvec_t * output · 96 unmodified lines
9797 aubio_parameter_get_next_value ( s->freq );
9898 aubio_parameter_get_next_value ( s->amp );
9999 }
100− fvec_set(output, 0.);
100+ fvec_zeros (output);
101101 }
102102 // add input to output if needed
103103 if (input && input != output) {
@@ -130,7 +130,7 @@ void aubio_wavetable_do_multi ( aubio_wavetable_t * s, fmat_t * input, fmat_t * · 26 unmodified lines
130130 aubio_parameter_get_next_value ( s->freq );
131131 aubio_parameter_get_next_value ( s->amp );
132132 }
133− fmat_set(output, 0.);
133+ fmat_zeros (output);
134134 }
135135 // add output to input if needed
136136 if (input && input != output) {
src/synth/wavetable.h+3−3
@@ -18,8 +18,8 @@ · 17 unmodified lines
1818
1919 */
2020
21−#ifndef _AUBIO_SYNTH_WAVETABLE_H
22−#define _AUBIO_SYNTH_WAVETABLE_H
21+#ifndef _AUBIO_WAVETABLE_H
22+#define _AUBIO_WAVETABLE_H
2323
2424 /** \file
2525
@@ -175,4 +175,4 @@ void del_aubio_wavetable( aubio_wavetable_t * o ); · 149 unmodified lines
175175 }
176176 #endif
177177
178−#endif /* _AUBIO_SYNTH_WAVETABLE_H */
178+#endif /* _AUBIO_WAVETABLE_H */
src/tempo/beattracking.h+4−4
@@ -1,5 +1,5 @@
11 /*
2− Copyright (C) 2003-2009 Matthew Davies and Paul Brossier <piem@aubio.org>
2+ Copyright (C) 2003-2013 Matthew Davies and Paul Brossier <piem@aubio.org>
33
44 This file is part of aubio.
55
@@ -36,8 +36,8 @@ · 30 unmodified lines
3636 \example tempo/test-beattracking.c
3737
3838 */
39−#ifndef BEATTRACKING_H
40−#define BEATTRACKING_H
39+#ifndef _AUBIO_BEATTRACKING_H
40+#define _AUBIO_BEATTRACKING_H
4141
4242 #ifdef __cplusplus
4343 extern "C" {
@@ -98,4 +98,4 @@ void del_aubio_beattracking(aubio_beattracking_t * p); · 54 unmodified lines
9898 }
9999 #endif
100100
101−#endif /* BEATTRACKING_H */
101+#endif /* _AUBIO_BEATTRACKING_H */
src/tempo/tempo.h+4−4
@@ -1,5 +1,5 @@
11 /*
2− Copyright (C) 2006-2009 Paul Brossier <piem@aubio.org>
2+ Copyright (C) 2006-2013 Paul Brossier <piem@aubio.org>
33
44 This file is part of aubio.
55
@@ -30,8 +30,8 @@ · 24 unmodified lines
3030
3131 */
3232
33−#ifndef TEMPO_H
34−#define TEMPO_H
33+#ifndef _AUBIO_TEMPO_H
34+#define _AUBIO_TEMPO_H
3535
3636 #ifdef __cplusplus
3737 extern "C" {
@@ -133,4 +133,4 @@ void del_aubio_tempo(aubio_tempo_t * o); · 95 unmodified lines
133133 }
134134 #endif
135135
136−#endif /* TEMPO_H */
136+#endif /* _AUBIO_TEMPO_H */
src/temporal/a_weighting.h+4−4
@@ -1,5 +1,5 @@
11 /*
2− Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org>
2+ Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org>
33
44 This file is part of aubio.
55
@@ -18,8 +18,8 @@ · 12 unmodified lines
1818
1919 */
2020
21−#ifndef _ADESIGN_H
22−#define _ADESIGN_H
21+#ifndef _AUBIO_FILTER_A_DESIGN_H
22+#define _AUBIO_FILTER_A_DESIGN_H
2323
2424 /** \file
2525
@@ -85,4 +85,4 @@ uint_t aubio_filter_set_a_weighting (aubio_filter_t * f, uint_t samplerate); · 59 unmodified lines
8585 }
8686 #endif
8787
88−#endif /* _ADESIGN_H */
88+#endif /* _AUBIO_FILTER_A_DESIGN_H */
src/temporal/biquad.h+4−4
@@ -1,5 +1,5 @@
11 /*
2− Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org>
2+ Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org>
33
44 This file is part of aubio.
55
@@ -18,8 +18,8 @@ · 12 unmodified lines
1818
1919 */
2020
21−#ifndef BIQUAD_H
22−#define BIQUAD_H
21+#ifndef _AUBIO_FILTER_BIQUAD_H
22+#define _AUBIO_FILTER_BIQUAD_H
2323
2424 /** \file
2525
@@ -72,4 +72,4 @@ aubio_filter_t *new_aubio_filter_biquad (lsmp_t b0, lsmp_t b1, lsmp_t b2, · 46 unmodified lines
7272 }
7373 #endif
7474
75−#endif /*BIQUAD_H*/
75+#endif /* _AUBIO_FILTER_BIQUAD_H */
src/temporal/c_weighting.h+4−4
@@ -1,5 +1,5 @@
11 /*
2− Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org>
2+ Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org>
33
44 This file is part of aubio.
55
@@ -18,8 +18,8 @@ · 12 unmodified lines
1818
1919 */
2020
21−#ifndef _CDESIGN_H
22−#define _CDESIGN_H
21+#ifndef _AUBIO_FILTER_C_DESIGN_H
22+#define _AUBIO_FILTER_C_DESIGN_H
2323
2424 /** \file
2525
@@ -85,4 +85,4 @@ uint_t aubio_filter_set_c_weighting (aubio_filter_t * f, uint_t samplerate); · 59 unmodified lines
8585 }
8686 #endif
8787
88−#endif /* _CDESIGN_H */
88+#endif /* _AUBIO_FILTER_C_DESIGN_H */
src/temporal/filter.h+4−4
@@ -1,5 +1,5 @@
11 /*
2− Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org>
2+ Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org>
33
44 This file is part of aubio.
55
@@ -18,8 +18,8 @@ · 12 unmodified lines
1818
1919 */
2020
21−#ifndef FILTER_H
22−#define FILTER_H
21+#ifndef _AUBIO_FILTER_H
22+#define _AUBIO_FILTER_H
2323
2424 /** \file
2525
@@ -173,4 +173,4 @@ void del_aubio_filter (aubio_filter_t * f); · 147 unmodified lines
173173 }
174174 #endif
175175
176−#endif /*FILTER_H*/
176+#endif /* _AUBIO_FILTER_H */
src/temporal/resampler.h+4−4
@@ -1,5 +1,5 @@
11 /*
2− Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org>
2+ Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org>
33
44 This file is part of aubio.
55
@@ -18,8 +18,8 @@ · 12 unmodified lines
1818
1919 */
2020
21−#ifndef _RESAMPLE_H
22−#define _RESAMPLE_H
21+#ifndef _AUBIO_RESAMPLER_H
22+#define _AUBIO_RESAMPLER_H
2323
2424 /** \file
2525
@@ -62,4 +62,4 @@ void aubio_resampler_do (aubio_resampler_t * s, fvec_t * input, · 36 unmodified lines
6262 }
6363 #endif
6464
65−#endif /* _RESAMPLE_H */
65+#endif /* _AUBIO_RESAMPLER_H */
src/types.h+4−4
@@ -1,5 +1,5 @@
11 /*
2− Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org>
2+ Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org>
33
44 This file is part of aubio.
55
@@ -18,8 +18,8 @@ · 12 unmodified lines
1818
1919 */
2020
21−#ifndef AUBIO_TYPES_H
22−#define AUBIO_TYPES_H
21+#ifndef _AUBIO__TYPES_H
22+#define _AUBIO__TYPES_H
2323
2424 /** \file
2525
@@ -67,4 +67,4 @@ typedef char char_t; · 41 unmodified lines
6767 }
6868 #endif
6969
70−#endif/*AUBIO_TYPES_H*/
70+#endif /* _AUBIO__TYPES_H */
src/utils/hist.h+4−4
@@ -1,5 +1,5 @@
11 /*
2− Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org>
2+ Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org>
33
44 This file is part of aubio.
55
@@ -25,8 +25,8 @@ · 19 unmodified lines
2525 * Big hacks to implement an histogram
2626 */
2727
28−#ifndef HIST_H
29−#define HIST_H
28+#ifndef _AUBIO_HIST_H
29+#define _AUBIO_HIST_H
3030
3131 #ifdef __cplusplus
3232 extern "C" {
@@ -60,4 +60,4 @@ void aubio_hist_dyn_notnull (aubio_hist_t *s, fvec_t *input); · 27 unmodified lines
6060 }
6161 #endif
6262
63−#endif
63+#endif /* _AUBIO_HIST_H */
src/utils/parameter.h+0−1
@@ -157,4 +157,3 @@ void del_aubio_parameter( aubio_parameter_t * param ); · 156 unmodified lines
157157 #endif
158158
159159 #endif /* _AUBIO_PARAMETER_H */
160−
src/utils/scale.h+4−4
@@ -1,5 +1,5 @@
11 /*
2− Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org>
2+ Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org>
33
44 This file is part of aubio.
55
@@ -28,8 +28,8 @@ · 22 unmodified lines
2828 \f$ y = (x - ilow)*(ohig-olow)/(ihig-ilow) + olow \f$
2929
3030 */
31−#ifndef SCALE_H
32−#define SCALE_H
31+#ifndef _AUBIO_SCALE_H
32+#define _AUBIO_SCALE_H
3333
3434 #ifdef __cplusplus
3535 extern "C" {
@@ -77,4 +77,4 @@ uint_t aubio_scale_set_limits (aubio_scale_t *s, smpl_t ilow, smpl_t ihig, · 41 unmodified lines
7777 }
7878 #endif
7979
80−#endif
80+#endif /* _AUBIO_SCALE_H */
src/vecutils.c+12−23
@@ -14,22 +14,20 @@ void TYPE ## _ ## OPNAME (TYPE ## _t *o) \ · 13 unmodified lines
1414 } \
1515 }
1616
17−#define AUBIO_OP_C_AND_F(OPNAME, OP) \
18− AUBIO_OP(OPNAME, OP, fvec, data) \
19− AUBIO_OP(OPNAME, OP, cvec, norm)
17+#define AUBIO_OP_C(OPNAME, OP) \
18+ AUBIO_OP(OPNAME, OP, fvec, data)
2019
21−AUBIO_OP_C_AND_F(exp, EXP)
22−AUBIO_OP_C_AND_F(cos, COS)
23−AUBIO_OP_C_AND_F(sin, SIN)
24−AUBIO_OP_C_AND_F(abs, ABS)
25−AUBIO_OP_C_AND_F(sqrt, SQRT)
26−AUBIO_OP_C_AND_F(log10, SAFE_LOG10)
27−AUBIO_OP_C_AND_F(log, SAFE_LOG)
28−AUBIO_OP_C_AND_F(floor, FLOOR)
29−AUBIO_OP_C_AND_F(ceil, CEIL)
30−AUBIO_OP_C_AND_F(round, ROUND)
20+AUBIO_OP_C(exp, EXP)
21+AUBIO_OP_C(cos, COS)
22+AUBIO_OP_C(sin, SIN)
23+AUBIO_OP_C(abs, ABS)
24+AUBIO_OP_C(sqrt, SQRT)
25+AUBIO_OP_C(log10, SAFE_LOG10)
26+AUBIO_OP_C(log, SAFE_LOG)
27+AUBIO_OP_C(floor, FLOOR)
28+AUBIO_OP_C(ceil, CEIL)
29+AUBIO_OP_C(round, ROUND)
3130
32−//AUBIO_OP_C_AND_F(pow, POW)
3331 void fvec_pow (fvec_t *s, smpl_t power)
3432 {
3533 uint_t j;
@@ -37,12 +35,3 @@ void fvec_pow (fvec_t *s, smpl_t power) · 1 unmodified line
3735 s->data[j] = POW(s->data[j], power);
3836 }
3937 }
40−
41−void cvec_pow (cvec_t *s, smpl_t power)
42−{
43− uint_t j;
44− for (j = 0; j < s->length; j++) {
45− s->norm[j] = POW(s->norm[j], power);
46− }
47−}
48−
src/vecutils.h+5−83
@@ -1,5 +1,5 @@
11 /*
2− Copyright (C) 2009 Paul Brossier <piem@aubio.org>
2+ Copyright (C) 2009-2013 Paul Brossier <piem@aubio.org>
33
44 This file is part of aubio.
55
@@ -20,12 +20,12 @@ · 14 unmodified lines
2020
2121 /** \file
2222
23− Utility functions for ::fvec_t and ::cvec_t objects
23+ Utility functions for ::fvec_t
2424
2525 */
2626
27−#ifndef _VECUTILS_H
28−#define _VECUTILS_H
27+#ifndef _AUBIO__VECUTILS_H
28+#define _AUBIO__VECUTILS_H
2929
3030 #ifdef __cplusplus
3131 extern "C" {
@@ -109,86 +109,8 @@ void fvec_round (fvec_t *s); · 77 unmodified lines
109109 */
110110 void fvec_pow (fvec_t *s, smpl_t pow);
111111
112−/** compute \f$e^x\f$ of each vector norm elements
113−
114− \param s vector to modify
115−
116−*/
117−void cvec_exp (cvec_t *s);
118−
119−/** compute \f$cos(x)\f$ of each vector norm elements
120−
121− \param s vector to modify
122−
123−*/
124−void cvec_cos (cvec_t *s);
125−
126−/** compute \f$sin(x)\f$ of each vector norm elements
127−
128− \param s vector to modify
129−
130−*/
131−void cvec_sin (cvec_t *s);
132−
133−/** compute the \f$abs(x)\f$ of each vector norm elements
134−
135− \param s vector to modify
136−
137−*/
138−void cvec_abs (cvec_t *s);
139−
140−/** compute the \f$sqrt(x)\f$ of each vector norm elements
141−
142− \param s vector to modify
143−
144−*/
145−void cvec_sqrt (cvec_t *s);
146−
147−/** compute the \f$log10(x)\f$ of each vector norm elements
148−
149− \param s vector to modify
150−
151−*/
152−void cvec_log10 (cvec_t *s);
153−
154−/** compute the \f$log(x)\f$ of each vector norm elements
155−
156− \param s vector to modify
157−
158−*/
159−void cvec_log (cvec_t *s);
160−
161−/** compute the \f$floor(x)\f$ of each vector norm elements
162−
163− \param s vector to modify
164−
165−*/
166−void cvec_floor (cvec_t *s);
167−
168−/** compute the \f$ceil(x)\f$ of each vector norm elements
169−
170− \param s vector to modify
171−
172−*/
173−void cvec_ceil (cvec_t *s);
174−
175−/** compute the \f$round(x)\f$ of each vector norm elements
176−
177− \param s vector to modify
178−
179−*/
180−void cvec_round (cvec_t *s);
181−
182−/** raise each vector norm elements to the power pow
183−
184− \param s vector to modify
185− \param pow power to raise to
186−
187−*/
188−void cvec_pow (cvec_t *s, smpl_t pow);
189−
190112 #ifdef __cplusplus
191113 }
192114 #endif
193115
194−#endif /*_VECUTILS_H*/
116+#endif /* _AUBIO__VECUTILS_H */
src/wscript_build+3−1
@@ -9,7 +9,6 @@ uselib += ['AVCODEC'] · 8 unmodified lines
99 uselib += ['AVFORMAT']
1010 uselib += ['AVRESAMPLE']
1111 uselib += ['AVUTIL']
12−uselib += ['JACK']
1312
1413 ctx(features = 'c',
1514 source = source,
@@ -21,12 +20,15 @@ ctx(features = 'c', · 5 unmodified lines
2120 # build libaubio.so (cshlib) and/or libaubio.a (cstlib)
2221 if ctx.env['DEST_OS'] in ['ios', 'iosimulator']:
2322 build_features = ['cstlib']
23+elif ctx.env['DEST_OS'] in ['win32', 'win64']:
24+ build_features = ['cshlib']
2425 else: #linux, darwin, android, mingw, ...
2526 build_features = ['cshlib', 'cstlib']
2627
2728 for target in build_features:
2829 ctx(features = 'c ' + target,
2930 use = ['lib_objects'], #source = source,
31+ lib = 'm',
3032 target = 'aubio',
3133 install_path = '${PREFIX}/lib',
3234 vnum = ctx.env['LIB_VERSION'])
tests/src/io/test-source_multi.c+1−1
@@ -38,7 +38,7 @@ int main (int argc, char **argv) · 37 unmodified lines
3838
3939 if ( n_channels == 0 ) n_channels = aubio_source_get_channels(s);
4040
41− fmat_t *mat = new_fmat(hop_size, n_channels);
41+ fmat_t *mat = new_fmat(n_channels, hop_size);
4242
4343 do {
4444 aubio_source_do_multi (s, mat, &read);
tests/src/spectral/test-mfcc.c+2−2
@@ -12,11 +12,11 @@ int main () · 11 unmodified lines
1212 // create mfcc object
1313 aubio_mfcc_t *o = new_aubio_mfcc (win_s, n_filters, n_coefs, samplerate);
1414
15− cvec_set_all_norm (in, 1.);
15+ cvec_norm_set_all (in, 1.);
1616 aubio_mfcc_do (o, in, out);
1717 fvec_print (out);
1818
19− cvec_set_all_norm (in, .5);
19+ cvec_norm_set_all (in, .5);
2020 aubio_mfcc_do (o, in, out);
2121 fvec_print (out);
2222
tests/src/spectral/test-phasevoc-jack.c+0−101
@@ -1,101 +0,0 @@
1−/** Test for phase vocoder in jack
2− *
3− * This program should start correctly, when jackd is started or when
4− * using JACK_START_SERVER=true and reconstruct each audio input channel
5− * on the corresponding output channel with some strange effects and a
6− * delay equal to the hop size (hop_s).
7− *
8− */
9−
10−#include <stdio.h>
11−#include <unistd.h> /* sleep() */
12−#include <aubio.h>
13−#ifdef HAVE_JACK
14−#include "jackio.h"
15−#endif /* HAVE_JACK */
16−
17−uint_t testing = 0; // change this to 1 to listen
18−
19−uint_t win_s = 512; // window size
20−uint_t hop_s = 128; // hop size
21−uint_t channels = 2; // number of audio channels
22−uint_t midiin = 4; // number of midi input channels
23−uint_t midiout = 2; // number of midi output channels
24−uint_t pos = 0; // frames%dspblocksize for jack loop
25−
26−fvec_t * in[2];
27−cvec_t * fftgrain[2];
28−fvec_t * out[2];
29−
30−aubio_pvoc_t * pv[2];
31−
32−int aubio_process(float **input, float **output, int nframes);
33−
34−int main ()
35−{
36− /* allocate some memory */
37− uint_t i;
38− for (i=0;i<channels;i++) {
39− in[i] = new_fvec (hop_s); /* input buffer */
40− fftgrain[i] = new_cvec (win_s); /* fft norm and phase */
41− out[i] = new_fvec (hop_s); /* output buffer */
42− /* allocate fft and other memory space */
43− pv[i] = new_aubio_pvoc(win_s,hop_s);
44− }
45−
46−#ifdef HAVE_JACK
47− aubio_jack_t * jack_setup;
48− jack_setup = new_aubio_jack(channels, channels,
49− midiin, midiout,
50− (aubio_process_func_t)aubio_process);
51− aubio_jack_activate(jack_setup);
52− /* stay in main jack loop for 1 seconds only */
53− do {
54− sleep(1);
55− } while(testing);
56− aubio_jack_close(jack_setup);
57−#else
58− fprintf(stderr, "WARNING: no jack support\n");
59−#endif
60−
61− for (i=0;i<channels;i++) {
62− del_aubio_pvoc(pv[i]);
63− del_cvec(fftgrain[i]);
64− del_fvec(in[i]);
65− del_fvec(out[i]);
66− }
67− aubio_cleanup();
68− return 0;
69−}
70−
71−int aubio_process(float **input, float **output, int nframes) {
72− uint_t i; /*channels*/
73− uint_t j; /*frames*/
74− for (j=0;j<(unsigned)nframes;j++) {
75− for (i=0;i<channels;i++) {
76− /* write input to datanew */
77− fvec_write_sample(in[i], input[i][j], pos);
78− /* put synthnew in output */
79− output[i][j] = fvec_read_sample(out[i], pos);
80− }
81− /*time for fft*/
82− if (pos == hop_s-1) {
83− /* block loop */
84− for (i=0;i<channels;i++) {
85− aubio_pvoc_do (pv[i], in[i], fftgrain[i]);
86− // zero phases of first channel
87− for (i=0;i<fftgrain[i]->length;i++) fftgrain[0]->phas[i] = 0.;
88− // double phases of second channel
89− for (i=0;i<fftgrain[i]->length;i++) {
90− fftgrain[1]->phas[i] =
91− aubio_unwrap2pi (fftgrain[1]->phas[i] * 2.);
92− }
93− // copy second channel to third one
94− aubio_pvoc_rdo(pv[i], fftgrain[i], out[i]);
95− pos = -1;
96− }
97− }
98− pos++;
99− }
100− return 0;
101−}
tests/src/spectral/test-phasevoc.c+1−1
@@ -14,7 +14,7 @@ int main () · 13 unmodified lines
1414 aubio_pvoc_t * pv = new_aubio_pvoc(win_s,hop_s);
1515
1616 // fill input with some data
17− fvec_set (in, 1.);
17+ fvec_set_all (in, 1.);
1818 fvec_print (in);
1919
2020 while ( n-- ) {
tests/src/test-cvec.c+6−6
@@ -19,7 +19,7 @@ int main () · 18 unmodified lines
1919 }
2020
2121 // set all vector elements to `0`
22− cvec_zeros_norm(complex_vector);
22+ cvec_norm_zeros(complex_vector);
2323 for ( i = 0; i < complex_vector->length; i++ ) {
2424 assert( complex_vector->norm[i] == 0. );
2525 // assert( complex_vector->phas[i] == 0 );
@@ -27,7 +27,7 @@ int main () · 1 unmodified line
2727 cvec_print(complex_vector);
2828
2929 // set all vector elements to `1`
30− cvec_ones_norm(complex_vector);
30+ cvec_norm_ones(complex_vector);
3131 for ( i = 0; i < complex_vector->length; i++ ) {
3232 assert( complex_vector->norm[i] == 1. );
3333 // assert( complex_vector->phas[i] == 0 );
@@ -35,10 +35,10 @@ int main () · 1 unmodified line
3535 cvec_print(complex_vector);
3636
3737 cvec_zeros(complex_vector);
38− cvec_zeros_phas(complex_vector);
39− cvec_zeros_norm(complex_vector);
40− cvec_ones_norm(complex_vector);
41− cvec_ones_phas(complex_vector);
38+ cvec_phas_zeros(complex_vector);
39+ cvec_norm_zeros(complex_vector);
40+ cvec_norm_ones(complex_vector);
41+ cvec_phas_ones(complex_vector);
4242 cvec_copy(complex_vector, complex_vector);
4343
4444 // destroy it
tests/src/test-fmat.c+1−1
@@ -8,7 +8,7 @@ int main () · 7 unmodified lines
88 {
99 uint_t height = 3, length = 9, i, j;
1010 // create fmat_t object
11− fmat_t * mat = new_fmat (length, height);
11+ fmat_t * mat = new_fmat (height, length);
1212 for ( i = 0; i < mat->height; i++ ) {
1313 for ( j = 0; j < mat->length; j++ ) {
1414 // all elements are already initialized to 0.
tests/utils_tests.h+17−0
@@ -3,12 +3,29 @@ · 2 unmodified lines
33 #include <stdio.h>
44 #include <math.h>
55 #include <assert.h>
6+#include "config.h"
67
78 #define PRINT_ERR(format, args...) fprintf(stderr, "AUBIO-TESTS ERROR: " format , ##args)
89 #define PRINT_MSG(format, args...) fprintf(stdout, format , ##args)
910 #define PRINT_DBG(format, args...) fprintf(stderr, format , ##args)
1011 #define PRINT_WRN(format, args...) fprintf(stderr, "AUBIO-TESTS WARNING: " format, ##args)
1112
13+#ifdef HAVE_WIN_HACKS
14+// http://en.wikipedia.org/wiki/Linear_congruential_generator
15+// no srandom/random on win32
16+
17+uint_t srandom_seed = 1029;
18+
19+void srandom(uint_t new_seed) {
20+ srandom_seed = new_seed;
21+}
22+
23+uint_t random(void) {
24+ srandom_seed = 1664525 * srandom_seed + 1013904223;
25+ return srandom_seed;
26+}
27+#endif
28+
1229 void utils_init_random () {
1330 time_t now = time(0);
1431 struct tm *tm_struct = localtime(&now);
tests/wscript_build+0−4
@@ -4,10 +4,6 @@ for target_name in ctx.path.ant_glob('src/**/*.c'): · 3 unmodified lines
44 uselib = []
55 includes = ['../src', '.']
66 extra_source = []
7− if str(target_name).endswith('-jack.c') and ctx.env['JACK']:
8− uselib += ['JACK']
9− includes += ['../examples']
10− extra_source += ['../examples/jackio.c']
117
128 bld(features = 'c cprogram test',
139 lib = 'm',
wscript+31−9
@@ -84,15 +84,19 @@ def configure(ctx): · 83 unmodified lines
8484 ctx.load('compiler_c')
8585 ctx.load('waf_unit_test')
8686 ctx.load('gnu_dirs')
87− ctx.env.CFLAGS += ['-g', '-Wall', '-Wextra', '-fPIC']
87+
88+ ctx.env.CFLAGS += ['-g', '-Wall', '-Wextra']
8889
8990 target_platform = Options.platform
9091 if ctx.options.target_platform:
9192 target_platform = ctx.options.target_platform
9293 ctx.env['DEST_OS'] = target_platform
9394
94− if target_platform == 'win32':
95− ctx.env['shlib_PATTERN'] = 'lib%s.dll'
95+ if target_platform not in ['win32', 'win64']:
96+ ctx.env.CFLAGS += ['-fPIC']
97+ else:
98+ ctx.define('HAVE_WIN_HACKS', 1)
99+ ctx.env['cshlib_PATTERN'] = 'lib%s.dll'
96100
97101 if target_platform == 'darwin':
98102 ctx.env.CFLAGS += ['-arch', 'i386', '-arch', 'x86_64']
@@ -200,7 +204,7 @@ def configure(ctx): · 101 unmodified lines
200204
201205 # check for jack
202206 if (ctx.options.enable_jack != False):
203− ctx.check_cfg(package = 'jack', atleast_version = '0.15.0',
207+ ctx.check_cfg(package = 'jack',
204208 args = '--cflags --libs', mandatory = False)
205209
206210 # check for libav
@@ -213,6 +217,12 @@ def configure(ctx): · 6 unmodified lines
213217 args = '--cflags --libs', uselib_store = 'AVUTIL', mandatory = False)
214218 ctx.check_cfg(package = 'libavresample', atleast_version = '1.0.1',
215219 args = '--cflags --libs', uselib_store = 'AVRESAMPLE', mandatory = False)
220+ if all ( 'HAVE_' + i in ctx.env.define_key
221+ for i in ['AVCODEC', 'AVFORMAT', 'AVUTIL', 'AVRESAMPLE'] ):
222+ ctx.define('HAVE_LIBAV', 1)
223+ ctx.msg('Checking for all libav libraries', 'yes')
224+ else:
225+ ctx.msg('Checking for all libav libraries', 'not found', color = 'YELLOW')
216226
217227 # use memcpy hacks
218228 if (ctx.options.enable_memcpy == True):
@@ -233,6 +243,12 @@ def configure(ctx): · 14 unmodified lines
233243 except ctx.errors.ConfigurationError:
234244 ctx.to_log('txt2man was not found (ignoring)')
235245
246+ # check if doxygen is installed, optional
247+ try:
248+ ctx.find_program('doxygen', var='DOXYGEN')
249+ except ctx.errors.ConfigurationError:
250+ ctx.to_log('doxygen was not found (ignoring)')
251+
236252 def build(bld):
237253 bld.env['VERSION'] = VERSION
238254 bld.env['LIB_VERSION'] = LIB_VERSION
@@ -247,7 +263,7 @@ def build(bld): · 8 unmodified lines
247263
248264 bld( source = 'aubio.pc.in' )
249265
250− # build manpages from sgml files
266+ # build manpages from txt files using txt2man
251267 if bld.env['TXT2MAN']:
252268 from waflib import TaskGen
253269 if 'MANDIR' not in bld.env:
@@ -266,10 +282,15 @@ def build(bld): · 12 unmodified lines
266282 )
267283 bld( source = bld.path.ant_glob('doc/*.txt') )
268284
269− """
270− bld(rule = 'doxygen ${SRC}', source = 'web.cfg') #, target = 'doc/web/index.html')
271− """
272−
285+ # build documentation from source files using doxygen
286+ if bld.env['DOXYGEN']:
287+ bld( name = 'doxygen', rule = 'doxygen ${SRC} > /dev/null',
288+ source = 'doc/web.cfg',
289+ cwd = 'doc')
290+ bld.install_files( '${PREFIX}' + '/share/doc/libaubio-doc',
291+ bld.path.ant_glob('doc/web/html/**'),
292+ cwd = bld.path.find_dir ('doc/web'),
293+ relative_trick = True)
273294
274295 def shutdown(bld):
275296 from waflib import Logs
@@ -287,3 +308,4 @@ def dist(ctx): · 11 unmodified lines
287308 ctx.excl += ' **/doc/full/* **/doc/web/*'
288309 ctx.excl += ' **/python/*.db'
289310 ctx.excl += ' **/python.old/*'
311+ ctx.excl += ' **/python/tests/sounds'

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t