Unified · Split
| @@ -10,7 +10,7 @@ · 9 unmodified lines | |||
| 10 | * Memory management: allocation and freeing of memory has been optimized in | 10 | * Memory management: allocation and freeing of memory has been optimized in |
| 11 | many ways. Several memory leaks and out of bound access have been fixed. | 11 | many ways. Several memory leaks and out of bound access have been fixed. |
| 12 | 12 | ||
| 13 | * Optimization: the FFT, central to most algorithm, can now be computed | 13 | * Optimization: the FFT, central to most algorithms, can now be computed |
| 14 | using different optimized algorithms, depending on what is available on your | 14 | using different optimized algorithms, depending on what is available on your |
| 15 | platform (FFTW, Ooura, or vDSP). Other simple optimization tricks are | 15 | platform (FFTW, Ooura, or vDSP). Other simple optimization tricks are |
| 16 | included. Most can be deactivated by configuring the build accordingly. | 16 | included. Most can be deactivated by configuring the build accordingly. |
| @@ -769,15 +769,13 @@ RECURSIVE = YES · 768 unmodified lines | |||
| 769 | # run. | 769 | # run. |
| 770 | 770 | ||
| 771 | EXCLUDE = ../src/aubio_priv.h \ | 771 | EXCLUDE = ../src/aubio_priv.h \ |
| 772 | ../src/mathutils \ | 772 | ../src/mathutils.h \ |
| 773 | .h \ | ||
| 774 | ../src/io/audio_unit.h \ | 773 | ../src/io/audio_unit.h \ |
| 775 | ../src/io/source_sndfile.h \ | 774 | ../src/io/source_sndfile.h \ |
| 776 | ../src/io/source_apple_audio.h \ | 775 | ../src/io/source_apple_audio.h \ |
| 777 | ../src/io/source_avcodec.h \ | 776 | ../src/io/source_avcodec.h \ |
| 778 | ../src/io/sink_sndfile.h \ | 777 | ../src/io/sink_sndfile.h \ |
| 779 | ../src/io/sink_apple_audio.h \ | 778 | ../src/io/sink_apple_audio.h \ |
| 780 | ../src/io/sndfileio.h \ | ||
| 781 | ../src/onset/peakpicker.h \ | 779 | ../src/onset/peakpicker.h \ |
| 782 | ../src/pitch/pitchmcomb.h \ | 780 | ../src/pitch/pitchmcomb.h \ |
| 783 | ../src/pitch/pitchyin.h \ | 781 | ../src/pitch/pitchyin.h \ |
| @@ -51,14 +51,14 @@ process_block(fvec_t *ibuf, fvec_t *obuf) { · 50 unmodified lines | |||
| 51 | aubio_onset_do(o, ibuf, onset); | 51 | aubio_onset_do(o, ibuf, onset); |
| 52 | 52 | ||
| 53 | aubio_pitch_do (pitch, ibuf, pitch_obuf); | 53 | 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); |
| 55 | if(median){ | 55 | if(median){ |
| 56 | note_append(note_buffer, new_pitch); | 56 | note_append(note_buffer, new_pitch); |
| 57 | } | 57 | } |
| 58 | 58 | ||
| 59 | /* curlevel is negatif or 1 if silence */ | 59 | /* curlevel is negatif or 1 if silence */ |
| 60 | smpl_t curlevel = aubio_level_detection(ibuf, silence_threshold); | 60 | smpl_t curlevel = aubio_level_detection(ibuf, silence_threshold); |
| 61 | if (fvec_read_sample(onset, 0)) { | 61 | if (fvec_get_sample(onset, 0)) { |
| 62 | /* test for silence */ | 62 | /* test for silence */ |
| 63 | if (curlevel == 1.) { | 63 | if (curlevel == 1.) { |
| 64 | if (median) isready = 0; | 64 | if (median) isready = 0; |
| @@ -28,16 +28,13 @@ aubio_onset_t *o; · 27 unmodified lines | |||
| 28 | aubio_wavetable_t *wavetable; | 28 | aubio_wavetable_t *wavetable; |
| 29 | fvec_t *onset; | 29 | fvec_t *onset; |
| 30 | smpl_t is_onset; | 30 | smpl_t is_onset; |
| 31 | uint_t is_silence = 0.; | ||
| 32 | 31 | ||
| 33 | void | 32 | void |
| 34 | process_block(fvec_t *ibuf, fvec_t *obuf) { | 33 | process_block(fvec_t *ibuf, fvec_t *obuf) { |
| 35 | fvec_zeros(obuf); | 34 | fvec_zeros(obuf); |
| 36 | aubio_onset_do (o, ibuf, onset); | 35 | aubio_onset_do (o, ibuf, onset); |
| 37 | if (silence_threshold != -90.) | 36 | is_onset = fvec_get_sample(onset, 0); |
| 38 | is_silence = aubio_silence_detection(ibuf, silence_threshold); | 37 | if ( is_onset ) { |
| 39 | is_onset = fvec_read_sample(onset, 0); | ||
| 40 | if ( is_onset && !is_silence ) { | ||
| 41 | aubio_wavetable_play ( wavetable ); | 38 | aubio_wavetable_play ( wavetable ); |
| 42 | } else { | 39 | } else { |
| 43 | aubio_wavetable_stop ( wavetable ); | 40 | aubio_wavetable_stop ( wavetable ); |
| @@ -51,7 +48,7 @@ process_block(fvec_t *ibuf, fvec_t *obuf) { · 7 unmodified lines | |||
| 51 | void | 48 | void |
| 52 | process_print (void) | 49 | process_print (void) |
| 53 | { | 50 | { |
| 54 | if ( is_onset && !is_silence ) { | 51 | if ( is_onset ) { |
| 55 | outmsg ("%f\n", aubio_onset_get_last_s (o) ); | 52 | outmsg ("%f\n", aubio_onset_get_last_s (o) ); |
| 56 | } | 53 | } |
| 57 | } | 54 | } |
| @@ -63,11 +60,15 @@ int main(int argc, char **argv) { · 5 unmodified lines | |||
| 63 | verbmsg ("onset method: %s, ", onset_method); | 60 | verbmsg ("onset method: %s, ", onset_method); |
| 64 | verbmsg ("buffer_size: %d, ", buffer_size); | 61 | verbmsg ("buffer_size: %d, ", buffer_size); |
| 65 | verbmsg ("hop_size: %d, ", hop_size); | 62 | verbmsg ("hop_size: %d, ", hop_size); |
| 66 | verbmsg ("threshold: %f, ", silence_threshold); | 63 | verbmsg ("silence: %f, ", silence_threshold); |
| 67 | verbmsg ("threshold: %f\n", onset_threshold); | 64 | verbmsg ("threshold: %f\n", onset_threshold); |
| 68 | 65 | ||
| 69 | o = new_aubio_onset (onset_method, buffer_size, hop_size, samplerate); | 66 | 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 | |||
| 71 | onset = new_fvec (1); | 72 | onset = new_fvec (1); |
| 72 | 73 | ||
| 73 | wavetable = new_aubio_wavetable (samplerate, hop_size); | 74 | wavetable = new_aubio_wavetable (samplerate, hop_size); |
| @@ -32,7 +32,7 @@ void · 31 unmodified lines | |||
| 32 | process_block(fvec_t * ibuf, fvec_t * obuf) { | 32 | process_block(fvec_t * ibuf, fvec_t * obuf) { |
| 33 | fvec_zeros(obuf); | 33 | fvec_zeros(obuf); |
| 34 | aubio_pitch_do (o, ibuf, pitch); | 34 | aubio_pitch_do (o, ibuf, pitch); |
| 35 | smpl_t freq = fvec_read_sample(pitch, 0); | 35 | smpl_t freq = fvec_get_sample(pitch, 0); |
| 36 | aubio_wavetable_set_amp ( wavetable, aubio_level_lin (ibuf) ); | 36 | aubio_wavetable_set_amp ( wavetable, aubio_level_lin (ibuf) ); |
| 37 | aubio_wavetable_set_freq ( wavetable, freq ); | 37 | aubio_wavetable_set_freq ( wavetable, freq ); |
| 38 | 38 | ||
| @@ -44,7 +44,7 @@ process_block(fvec_t * ibuf, fvec_t * obuf) { · 5 unmodified lines | |||
| 44 | 44 | ||
| 45 | void | 45 | void |
| 46 | process_print (void) { | 46 | process_print (void) { |
| 47 | smpl_t pitch_found = fvec_read_sample(pitch, 0); | 47 | smpl_t pitch_found = fvec_get_sample(pitch, 0); |
| 48 | outmsg("%f %f\n",(blocks) | 48 | outmsg("%f %f\n",(blocks) |
| 49 | *hop_size/(float)samplerate, pitch_found); | 49 | *hop_size/(float)samplerate, pitch_found); |
| 50 | } | 50 | } |
| @@ -63,8 +63,13 @@ int main(int argc, char **argv) { · 12 unmodified lines | |||
| 63 | verbmsg ("tolerance: %f\n", pitch_tolerance); | 63 | verbmsg ("tolerance: %f\n", pitch_tolerance); |
| 64 | 64 | ||
| 65 | o = new_aubio_pitch (pitch_method, buffer_size, hop_size, samplerate); | 65 | o = new_aubio_pitch (pitch_method, buffer_size, hop_size, samplerate); |
| 66 | if (pitch_tolerance != 0.) aubio_pitch_set_tolerance (o, pitch_tolerance); | 66 | if (pitch_tolerance != 0.) |
| 67 | if (pitch_unit != NULL) aubio_pitch_set_unit (o, pitch_unit); | 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 | |||
| 68 | pitch = new_fvec (1); | 73 | pitch = new_fvec (1); |
| 69 | 74 | ||
| 70 | wavetable = new_aubio_wavetable (samplerate, hop_size); | 75 | wavetable = new_aubio_wavetable (samplerate, hop_size); |
| @@ -28,13 +28,11 @@ aubio_tempo_t * tempo; · 27 unmodified lines | |||
| 28 | aubio_wavetable_t *wavetable; | 28 | aubio_wavetable_t *wavetable; |
| 29 | fvec_t * tempo_out; | 29 | fvec_t * tempo_out; |
| 30 | smpl_t is_beat = 0; | 30 | smpl_t is_beat = 0; |
| 31 | smpl_t is_onset = 0; | ||
| 32 | uint_t is_silence = 0.; | 31 | uint_t is_silence = 0.; |
| 33 | 32 | ||
| 34 | void process_block(fvec_t * ibuf, fvec_t *obuf) { | 33 | void process_block(fvec_t * ibuf, fvec_t *obuf) { |
| 35 | aubio_tempo_do (tempo, ibuf, tempo_out); | 34 | aubio_tempo_do (tempo, ibuf, tempo_out); |
| 36 | is_beat = fvec_read_sample (tempo_out, 0); | 35 | is_beat = fvec_get_sample (tempo_out, 0); |
| 37 | is_onset = fvec_read_sample (tempo_out, 1); | ||
| 38 | if (silence_threshold != -90.) | 36 | if (silence_threshold != -90.) |
| 39 | is_silence = aubio_silence_detection(ibuf, silence_threshold); | 37 | is_silence = aubio_silence_detection(ibuf, silence_threshold); |
| 40 | fvec_zeros (obuf); | 38 | fvec_zeros (obuf); |
| @@ -53,8 +51,6 @@ void process_print (void) { · 12 unmodified lines | |||
| 53 | if ( is_beat && !is_silence ) { | 51 | if ( is_beat && !is_silence ) { |
| 54 | outmsg("%f\n", aubio_tempo_get_last_s(tempo) ); | 52 | outmsg("%f\n", aubio_tempo_get_last_s(tempo) ); |
| 55 | } | 53 | } |
| 56 | //if ( is_onset ) | ||
| 57 | // outmsg(" \t \t%f\n",(blocks)*hop_size/(float)samplerate); | ||
| 58 | } | 54 | } |
| 59 | 55 | ||
| 60 | int main(int argc, char **argv) { | 56 | int main(int argc, char **argv) { |
| @@ -252,9 +252,9 @@ static int block_process(aubio_jack_t *dev, · 251 unmodified lines | |||
| 252 | unsigned int j; /*frames*/ | 252 | unsigned int j; /*frames*/ |
| 253 | for (j=0;j<(unsigned)nframes;j++) { | 253 | for (j=0;j<(unsigned)nframes;j++) { |
| 254 | /* put synthnew in output */ | 254 | /* 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); |
| 256 | /* write input to datanew */ | 256 | /* 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); |
| 258 | /*time for fft*/ | 258 | /*time for fft*/ |
| 259 | if (dev->pos == (int)(dev->hop_size) - 1) { | 259 | if (dev->pos == (int)(dev->hop_size) - 1) { |
| 260 | /* block loop */ | 260 | /* block loop */ |
| @@ -61,9 +61,9 @@ usage (FILE * stream, int exit_code) · 60 unmodified lines | |||
| 61 | { | 61 | { |
| 62 | fprintf (stream, "usage: %s [ options ] \n", prog_name); | 62 | fprintf (stream, "usage: %s [ options ] \n", prog_name); |
| 63 | fprintf (stream, | 63 | fprintf (stream, |
| 64 | " -i --input input type\n" | 64 | " -i --input input file\n" |
| 65 | #ifdef PROG_HAS_OUTPUT | 65 | #ifdef PROG_HAS_OUTPUT |
| 66 | " -o --output output type\n" | 66 | " -o --output output file\n" |
| 67 | #endif | 67 | #endif |
| 68 | " -r --samplerate select samplerate\n" | 68 | " -r --samplerate select samplerate\n" |
| 69 | " -B --bufsize set buffer size\n" | 69 | " -B --bufsize set buffer size\n" |
| @@ -172,7 +172,7 @@ parse_args (int argc, char **argv) · 102 unmodified lines | |||
| 172 | case 'H': | 172 | case 'H': |
| 173 | hop_size = atoi (optarg); | 173 | hop_size = atoi (optarg); |
| 174 | break; | 174 | break; |
| 175 | case 'O': /*onset type */ | 175 | case 'O': /*onset method */ |
| 176 | onset_method = optarg; | 176 | onset_method = optarg; |
| 177 | break; | 177 | break; |
| 178 | case 't': /* threshold value for onset */ | 178 | case 't': /* threshold value for onset */ |
| @@ -83,7 +83,7 @@ examples_common_init (int argc, char **argv) · 82 unmodified lines | |||
| 83 | debug ("Opening files ...\n"); | 83 | debug ("Opening files ...\n"); |
| 84 | this_source = new_aubio_source ((char_t*)source_uri, samplerate, hop_size); | 84 | this_source = new_aubio_source ((char_t*)source_uri, samplerate, hop_size); |
| 85 | if (this_source == NULL) { | 85 | 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); |
| 87 | exit (1); | 87 | exit (1); |
| 88 | } | 88 | } |
| 89 | if (samplerate == 0) { | 89 | if (samplerate == 0) { |
| @@ -92,13 +92,13 @@ examples_common_init (int argc, char **argv) · 2 unmodified lines | |||
| 92 | if (sink_uri != NULL) { | 92 | if (sink_uri != NULL) { |
| 93 | uint_t sink_exists = (access(sink_uri, F_OK) == 0 ); | 93 | uint_t sink_exists = (access(sink_uri, F_OK) == 0 ); |
| 94 | if (!force_overwrite && sink_exists) { | 94 | 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", |
| 96 | sink_uri); | 96 | sink_uri); |
| 97 | exit (1); | 97 | exit (1); |
| 98 | } | 98 | } |
| 99 | this_sink = new_aubio_sink ((char_t*)sink_uri, samplerate); | 99 | this_sink = new_aubio_sink ((char_t*)sink_uri, samplerate); |
| 100 | if (this_sink == NULL) { | 100 | 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); |
| 102 | exit (1); | 102 | exit (1); |
| 103 | } | 103 | } |
| 104 | } | 104 | } |
| @@ -1,5 +1,8 @@ | |||
| 1 | # vim:set syntax=python: | 1 | # vim:set syntax=python: |
| 2 | 2 | ||
| 3 | uselib = [] | ||
| 4 | uselib += ['JACK'] | ||
| 5 | |||
| 3 | utils_source = ['utils.c', 'jackio.c'] | 6 | utils_source = ['utils.c', 'jackio.c'] |
| 4 | programs_source = ctx.path.ant_glob('*.c', excl = utils_source) | 7 | programs_source = ctx.path.ant_glob('*.c', excl = utils_source) |
| 5 | 8 | ||
| @@ -7,6 +10,7 @@ programs_source = ctx.path.ant_glob('*.c', excl = utils_source) · 1 unmodified line | |||
| 7 | bld(features = 'c', | 10 | bld(features = 'c', |
| 8 | source = utils_source, | 11 | source = utils_source, |
| 9 | includes = ['../src'], | 12 | includes = ['../src'], |
| 13 | uselib = uselib, | ||
| 10 | target = 'utilsio') | 14 | target = 'utilsio') |
| 11 | 15 | ||
| 12 | # loop over all *.c filenames in examples to build them all | 16 | # loop over all *.c filenames in examples to build them all |
File mode changed from 100644 to 100755.
| @@ -61,8 +61,9 @@ if 1: · 60 unmodified lines | |||
| 61 | ax.xaxis.set_visible(False) | 61 | ax.xaxis.set_visible(False) |
| 62 | ax.yaxis.set_visible(False) | 62 | ax.yaxis.set_visible(False) |
| 63 | ax.axis(xmax = all_desc_times[-1], xmin = all_desc_times[0]) | 63 | 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', |
| 65 | horizontalalignment='right', verticalalignment='bottom', | 65 | horizontalalignment='right', verticalalignment='bottom', |
| 66 | size = 'xx-small', | ||
| 66 | ) | 67 | ) |
| 67 | set_xlabels_sample2time( ax, all_desc_times[-1], samplerate) | 68 | set_xlabels_sample2time( ax, all_desc_times[-1], samplerate) |
| 68 | #plt.ylabel('spectral descriptor value') | 69 | #plt.ylabel('spectral descriptor value') |
| @@ -56,9 +56,11 @@ confidences = array(confidences[skip:]) · 55 unmodified lines | |||
| 56 | times = [t * hop_s for t in range(len(pitches))] | 56 | times = [t * hop_s for t in range(len(pitches))] |
| 57 | 57 | ||
| 58 | fig = plt.figure() | 58 | fig = plt.figure() |
| 59 | |||
| 59 | ax1 = fig.add_subplot(311) | 60 | ax1 = fig.add_subplot(311) |
| 60 | ax1 = get_waveform_plot(filename, samplerate = samplerate, block_size = hop_s, ax = ax1) | 61 | 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('') | ||
| 62 | 64 | ||
| 63 | def array_from_text_file(filename, dtype = 'float'): | 65 | def array_from_text_file(filename, dtype = 'float'): |
| 64 | import os.path | 66 | import os.path |
| @@ -87,7 +89,8 @@ cleaned_pitches = ma.masked_where(confidences < tolerance, cleaned_pitches) · 22 unmodified lines | |||
| 87 | ax2.plot(times, cleaned_pitches, '.-') | 89 | ax2.plot(times, cleaned_pitches, '.-') |
| 88 | #ax2.axis( ymin = 0.9 * cleaned_pitches.min(), ymax = 1.1 * cleaned_pitches.max() ) | 90 | #ax2.axis( ymin = 0.9 * cleaned_pitches.min(), ymax = 1.1 * cleaned_pitches.max() ) |
| 89 | #ax2.axis( ymin = 55, ymax = 70 ) | 91 | #ax2.axis( ymin = 55, ymax = 70 ) |
| 90 | ax2.set_xticklabels([]) | 92 | plt.setp(ax2.get_xticklabels(), visible = False) |
| 93 | ax2.set_ylabel('f0 (Hz)') | ||
| 91 | 94 | ||
| 92 | # plot confidence | 95 | # plot confidence |
| 93 | ax3 = fig.add_subplot(313, sharex = ax1) | 96 | ax3 = fig.add_subplot(313, sharex = ax1) |
| @@ -96,6 +99,7 @@ ax3.plot(times, confidences) · 2 unmodified lines | |||
| 96 | # draw a line at tolerance | 99 | # draw a line at tolerance |
| 97 | ax3.plot(times, [tolerance]*len(confidences)) | 100 | ax3.plot(times, [tolerance]*len(confidences)) |
| 98 | ax3.axis( xmin = times[0], xmax = times[-1]) | 101 | ax3.axis( xmin = times[0], xmax = times[-1]) |
| 99 | plt.show() | 102 | ax3.set_ylabel('condidence') |
| 100 | set_xlabels_sample2time(ax3, times[-1], samplerate) | 103 | 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') | ||
| @@ -71,7 +71,7 @@ if 1: · 70 unmodified lines | |||
| 71 | ax.xaxis.set_visible(False) | 71 | ax.xaxis.set_visible(False) |
| 72 | ax.yaxis.set_visible(False) | 72 | ax.yaxis.set_visible(False) |
| 73 | ax.axis(xmax = all_desc_times[-1], xmin = all_desc_times[0]) | 73 | 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', |
| 75 | horizontalalignment='right', verticalalignment='bottom', | 75 | horizontalalignment='right', verticalalignment='bottom', |
| 76 | ) | 76 | ) |
| 77 | set_xlabels_sample2time(ax, all_desc_times[-1], samplerate) | 77 | set_xlabels_sample2time(ax, all_desc_times[-1], samplerate) |
| @@ -68,3 +68,5 @@ extern PyTypeObject Py_fftType; · 67 unmodified lines | |||
| 68 | 68 | ||
| 69 | extern PyTypeObject Py_pvocType; | 69 | extern PyTypeObject Py_pvocType; |
| 70 | 70 | ||
| 71 | extern PyTypeObject Py_sourceType; | ||
| 72 | |||
| @@ -198,6 +198,7 @@ init_aubio (void) · 197 unmodified lines | |||
| 198 | || (PyType_Ready (&Py_filterbankType) < 0) | 198 | || (PyType_Ready (&Py_filterbankType) < 0) |
| 199 | || (PyType_Ready (&Py_fftType) < 0) | 199 | || (PyType_Ready (&Py_fftType) < 0) |
| 200 | || (PyType_Ready (&Py_pvocType) < 0) | 200 | || (PyType_Ready (&Py_pvocType) < 0) |
| 201 | || (PyType_Ready (&Py_sourceType) < 0) | ||
| 201 | // generated objects | 202 | // generated objects |
| 202 | || (generated_types_ready() < 0 ) | 203 | || (generated_types_ready() < 0 ) |
| 203 | ) { | 204 | ) { |
| @@ -226,6 +227,8 @@ init_aubio (void) · 22 unmodified lines | |||
| 226 | PyModule_AddObject (m, "fft", (PyObject *) & Py_fftType); | 227 | PyModule_AddObject (m, "fft", (PyObject *) & Py_fftType); |
| 227 | Py_INCREF (&Py_pvocType); | 228 | Py_INCREF (&Py_pvocType); |
| 228 | PyModule_AddObject (m, "pvoc", (PyObject *) & Py_pvocType); | 229 | PyModule_AddObject (m, "pvoc", (PyObject *) & Py_pvocType); |
| 230 | Py_INCREF (&Py_sourceType); | ||
| 231 | PyModule_AddObject (m, "source", (PyObject *) & Py_sourceType); | ||
| 229 | 232 | ||
| 230 | // add generated objects | 233 | // add generated objects |
| 231 | add_generated_objects(m); | 234 | add_generated_objects(m); |
| @@ -35,7 +35,13 @@ PyAubio_ArrayToCFvec (PyObject *input) { · 34 unmodified lines | |||
| 35 | // vec = new_fvec (vec->length); | 35 | // vec = new_fvec (vec->length); |
| 36 | // no need to really allocate fvec, just its struct member | 36 | // no need to really allocate fvec, just its struct member |
| 37 | vec = (fvec_t *)malloc(sizeof(fvec_t)); | 37 | 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 | } | ||
| 39 | vec->data = (smpl_t *) PyArray_GETPTR1 ((PyArrayObject *)array, 0); | 45 | vec->data = (smpl_t *) PyArray_GETPTR1 ((PyArrayObject *)array, 0); |
| 40 | 46 | ||
| 41 | } else if (PyObject_TypeCheck (input, &PyList_Type)) { | 47 | } else if (PyObject_TypeCheck (input, &PyList_Type)) { |
| @@ -130,8 +136,20 @@ PyAubio_ArrayToCFmat (PyObject *input) { · 88 unmodified lines | |||
| 130 | 136 | ||
| 131 | // no need to really allocate fvec, just its struct member | 137 | // no need to really allocate fvec, just its struct member |
| 132 | mat = (fmat_t *)malloc(sizeof(fmat_t)); | 138 | mat = (fmat_t *)malloc(sizeof(fmat_t)); |
| 133 | mat->length = PyArray_DIM ((PyArrayObject *)array, 1); | 139 | long length = PyArray_DIM ((PyArrayObject *)array, 1); |
| 134 | mat->height = PyArray_DIM ((PyArrayObject *)array, 0); | 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 | } | ||
| 135 | mat->data = (smpl_t **)malloc(sizeof(smpl_t*) * mat->height); | 153 | mat->data = (smpl_t **)malloc(sizeof(smpl_t*) * mat->height); |
| 136 | for (i=0; i< mat->height; i++) { | 154 | for (i=0; i< mat->height; i++) { |
| 137 | mat->data[i] = (smpl_t*)PyArray_GETPTR1 ((PyArrayObject *)array, i); | 155 | mat->data[i] = (smpl_t*)PyArray_GETPTR1 ((PyArrayObject *)array, i); |
| @@ -25,10 +25,6 @@ Py_fft_new (PyTypeObject * type, PyObject * args, PyObject * kwds) · 24 unmodified lines | |||
| 25 | 25 | ||
| 26 | self->win_s = Py_default_vector_length; | 26 | self->win_s = Py_default_vector_length; |
| 27 | 27 | ||
| 28 | if (self == NULL) { | ||
| 29 | return NULL; | ||
| 30 | } | ||
| 31 | |||
| 32 | if (win_s > 0) { | 28 | if (win_s > 0) { |
| 33 | self->win_s = win_s; | 29 | self->win_s = win_s; |
| 34 | } else if (win_s < 0) { | 30 | } else if (win_s < 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") | ||
| @@ -239,9 +239,9 @@ Py_%(name)s_new (PyTypeObject * pytype, PyObject * args, PyObject * kwds) · 238 unmodified lines | |||
| 239 | s += """\ | 239 | s += """\ |
| 240 | 240 | ||
| 241 | self->%(pname)s = %(defval)s; | 241 | self->%(pname)s = %(defval)s; |
| 242 | if (%(pname)s > 0) { | 242 | if ((sint_t)%(pname)s > 0) { |
| 243 | self->%(pname)s = %(pname)s; | 243 | self->%(pname)s = %(pname)s; |
| 244 | } else if (%(pname)s < 0) { | 244 | } else if ((sint_t)%(pname)s < 0) { |
| 245 | PyErr_SetString (PyExc_ValueError, | 245 | PyErr_SetString (PyExc_ValueError, |
| 246 | "can not use negative value for %(pname)s"); | 246 | "can not use negative value for %(pname)s"); |
| 247 | return NULL; | 247 | return NULL; |
| @@ -56,6 +56,7 @@ def generate_object_files(output_path): · 55 unmodified lines | |||
| 56 | 'pitchyinfft', | 56 | 'pitchyinfft', |
| 57 | 'sink_apple_audio', | 57 | 'sink_apple_audio', |
| 58 | 'sink_sndfile', | 58 | 'sink_sndfile', |
| 59 | 'source', | ||
| 59 | 'source_apple_audio', | 60 | 'source_apple_audio', |
| 60 | 'source_sndfile', | 61 | 'source_sndfile', |
| 61 | 'source_avcodec', | 62 | 'source_avcodec', |
| @@ -53,6 +53,7 @@ aubio_extension = Extension("aubio._aubio", [ · 52 unmodified lines | |||
| 53 | "ext/py-filterbank.c", | 53 | "ext/py-filterbank.c", |
| 54 | "ext/py-fft.c", | 54 | "ext/py-fft.c", |
| 55 | "ext/py-phasevoc.c", | 55 | "ext/py-phasevoc.c", |
| 56 | "ext/py-source.c", | ||
| 56 | # generated files | 57 | # generated files |
| 57 | ] + generated_object_files, | 58 | ] + generated_object_files, |
| 58 | include_dirs = include_dirs, | 59 | include_dirs = include_dirs, |
| @@ -184,7 +184,6 @@ extern "C" · 183 unmodified lines | |||
| 184 | #include "tempo/tempo.h" | 184 | #include "tempo/tempo.h" |
| 185 | #include "io/source.h" | 185 | #include "io/source.h" |
| 186 | #include "io/sink.h" | 186 | #include "io/sink.h" |
| 187 | #include "io/audio_unit.h" | ||
| 188 | #include "synth/sampler.h" | 187 | #include "synth/sampler.h" |
| 189 | #include "synth/wavetable.h" | 188 | #include "synth/wavetable.h" |
| 190 | #include "utils/parameter.h" | 189 | #include "utils/parameter.h" |
| @@ -196,7 +195,7 @@ extern "C" · 5 unmodified lines | |||
| 196 | #include "io/source_avcodec.h" | 195 | #include "io/source_avcodec.h" |
| 197 | #include "io/sink_sndfile.h" | 196 | #include "io/sink_sndfile.h" |
| 198 | #include "io/sink_apple_audio.h" | 197 | #include "io/sink_apple_audio.h" |
| 199 | #include "io/sndfileio.h" | 198 | #include "io/audio_unit.h" |
| 200 | #include "onset/peakpicker.h" | 199 | #include "onset/peakpicker.h" |
| 201 | #include "pitch/pitchmcomb.h" | 200 | #include "pitch/pitchmcomb.h" |
| 202 | #include "pitch/pitchyin.h" | 201 | #include "pitch/pitchyin.h" |
| @@ -24,8 +24,8 @@ · 23 unmodified lines | |||
| 24 | * This file is for inclusion from _within_ the library only. | 24 | * This file is for inclusion from _within_ the library only. |
| 25 | */ | 25 | */ |
| 26 | 26 | ||
| 27 | #ifndef _AUBIO_PRIV_H | 27 | #ifndef _AUBIO__PRIV_H |
| 28 | #define _AUBIO_PRIV_H | 28 | #define _AUBIO__PRIV_H |
| 29 | 29 | ||
| 30 | /********************* | 30 | /********************* |
| 31 | * | 31 | * |
| @@ -217,4 +217,4 @@ typedef enum { · 185 unmodified lines | |||
| 217 | 217 | ||
| 218 | #define UNUSED __attribute__((unused)) | 218 | #define UNUSED __attribute__((unused)) |
| 219 | 219 | ||
| 220 | #endif/*_AUBIO_PRIV_H*/ | 220 | #endif /* _AUBIO__PRIV_H */ |
| @@ -38,22 +38,27 @@ void del_cvec(cvec_t *s) { · 37 unmodified lines | |||
| 38 | AUBIO_FREE(s); | 38 | AUBIO_FREE(s); |
| 39 | } | 39 | } |
| 40 | 40 | ||
| 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) { |
| 42 | s->norm[position] = data; | 42 | s->norm[position] = data; |
| 43 | } | 43 | } |
| 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) { | ||
| 45 | s->phas[position] = data; | 46 | s->phas[position] = data; |
| 46 | } | 47 | } |
| 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) { | ||
| 48 | return s->norm[position]; | 50 | return s->norm[position]; |
| 49 | } | 51 | } |
| 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) { | ||
| 51 | return s->phas[position]; | 54 | return s->phas[position]; |
| 52 | } | 55 | } |
| 53 | smpl_t * cvec_get_norm(cvec_t *s) { | 56 | |
| 57 | smpl_t * cvec_norm_get_data (cvec_t *s) { | ||
| 54 | return s->norm; | 58 | return s->norm; |
| 55 | } | 59 | } |
| 56 | smpl_t * cvec_get_phas(cvec_t *s) { | 60 | |
| 61 | smpl_t * cvec_phas_get_data (cvec_t *s) { | ||
| 57 | return s->phas; | 62 | return s->phas; |
| 58 | } | 63 | } |
| 59 | 64 | ||
| @@ -91,45 +96,45 @@ void cvec_copy(cvec_t *s, cvec_t *t) { · 31 unmodified lines | |||
| 91 | #endif | 96 | #endif |
| 92 | } | 97 | } |
| 93 | 98 | ||
| 94 | void cvec_set_all_norm(cvec_t *s, smpl_t val) { | 99 | void cvec_norm_set_all (cvec_t *s, smpl_t val) { |
| 95 | uint_t j; | 100 | uint_t j; |
| 96 | for (j=0; j< s->length; j++) { | 101 | for (j=0; j< s->length; j++) { |
| 97 | s->norm[j] = val; | 102 | s->norm[j] = val; |
| 98 | } | 103 | } |
| 99 | } | 104 | } |
| 100 | 105 | ||
| 101 | void cvec_zeros_norm(cvec_t *s) { | 106 | void cvec_norm_zeros(cvec_t *s) { |
| 102 | #if HAVE_MEMCPY_HACKS | 107 | #if HAVE_MEMCPY_HACKS |
| 103 | memset(s->norm, 0, s->length * sizeof(smpl_t)); | 108 | memset(s->norm, 0, s->length * sizeof(smpl_t)); |
| 104 | #else | 109 | #else |
| 105 | cvec_set_all_norm(s, 0.); | 110 | cvec_norm_set_all (s, 0.); |
| 106 | #endif | 111 | #endif |
| 107 | } | 112 | } |
| 108 | 113 | ||
| 109 | void cvec_ones_norm(cvec_t *s) { | 114 | void cvec_norm_ones(cvec_t *s) { |
| 110 | cvec_set_all_norm(s, 1.); | 115 | cvec_norm_set_all (s, 1.); |
| 111 | } | 116 | } |
| 112 | 117 | ||
| 113 | void cvec_set_all_phas(cvec_t *s, smpl_t val) { | 118 | void cvec_phas_set_all (cvec_t *s, smpl_t val) { |
| 114 | uint_t j; | 119 | uint_t j; |
| 115 | for (j=0; j< s->length; j++) { | 120 | for (j=0; j< s->length; j++) { |
| 116 | s->phas[j] = val; | 121 | s->phas[j] = val; |
| 117 | } | 122 | } |
| 118 | } | 123 | } |
| 119 | 124 | ||
| 120 | void cvec_zeros_phas(cvec_t *s) { | 125 | void cvec_phas_zeros(cvec_t *s) { |
| 121 | #if HAVE_MEMCPY_HACKS | 126 | #if HAVE_MEMCPY_HACKS |
| 122 | memset(s->phas, 0, s->length * sizeof(smpl_t)); | 127 | memset(s->phas, 0, s->length * sizeof(smpl_t)); |
| 123 | #else | 128 | #else |
| 124 | cvec_set_all_phas(s, 0.); | 129 | cvec_phas_set_all (s, 0.); |
| 125 | #endif | 130 | #endif |
| 126 | } | 131 | } |
| 127 | 132 | ||
| 128 | void cvec_ones_phas(cvec_t *s) { | 133 | void cvec_phas_ones(cvec_t *s) { |
| 129 | cvec_set_all_phas(s, 1.); | 134 | cvec_phas_set_all (s, 1.); |
| 130 | } | 135 | } |
| 131 | 136 | ||
| 132 | void cvec_zeros(cvec_t *s) { | 137 | void cvec_zeros(cvec_t *s) { |
| 133 | cvec_zeros_norm(s); | 138 | cvec_norm_zeros(s); |
| 134 | cvec_zeros_phas(s); | 139 | cvec_phas_zeros(s); |
| 135 | } | 140 | } |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org> | 2 | Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org> |
| 3 | 3 | ||
| 4 | This file is part of aubio. | 4 | This file is part of aubio. |
| 5 | 5 | ||
| @@ -18,8 +18,8 @@ · 12 unmodified lines | |||
| 18 | 18 | ||
| 19 | */ | 19 | */ |
| 20 | 20 | ||
| 21 | #ifndef _CVEC_H | 21 | #ifndef _AUBIO__CVEC_H |
| 22 | #define _CVEC_H | 22 | #define _AUBIO__CVEC_H |
| 23 | 23 | ||
| 24 | #ifdef __cplusplus | 24 | #ifdef __cplusplus |
| 25 | extern "C" { | 25 | extern "C" { |
| @@ -27,17 +27,17 @@ extern "C" { · 1 unmodified line | |||
| 27 | 27 | ||
| 28 | /** \file | 28 | /** \file |
| 29 | 29 | ||
| 30 | Vector of complex-valued data | 30 | Vector of complex-valued data, stored in polar coordinates |
| 31 | 31 | ||
| 32 | This file specifies the ::cvec_t buffer type, which is used throughout aubio | 32 | This file specifies the ::cvec_t buffer type, which is used throughout aubio |
| 33 | to store complex data. Complex values are stored in terms of ::cvec_t.phas | 33 | 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. |
| 35 | 35 | ||
| 36 | \example test-cvec.c | 36 | \example test-cvec.c |
| 37 | 37 | ||
| 38 | */ | 38 | */ |
| 39 | 39 | ||
| 40 | /** Buffer for complex data | 40 | /** Vector of real-valued phase and spectrum data |
| 41 | 41 | ||
| 42 | \code | 42 | \code |
| 43 | 43 | ||
| @@ -78,78 +78,91 @@ typedef struct { · 34 unmodified lines | |||
| 78 | 78 | ||
| 79 | */ | 79 | */ |
| 80 | cvec_t * new_cvec(uint_t length); | 80 | cvec_t * new_cvec(uint_t length); |
| 81 | |||
| 81 | /** cvec_t buffer deletion function | 82 | /** cvec_t buffer deletion function |
| 82 | 83 | ||
| 83 | \param s buffer to delete as returned by new_cvec() | 84 | \param s buffer to delete as returned by new_cvec() |
| 84 | 85 | ||
| 85 | */ | 86 | */ |
| 86 | void del_cvec(cvec_t *s); | 87 | void del_cvec(cvec_t *s); |
| 88 | |||
| 87 | /** write norm value in a complex buffer | 89 | /** write norm value in a complex buffer |
| 88 | 90 | ||
| 89 | Note that this function is not used in the aubio library, since the same | 91 | This is equivalent to: |
| 90 | result can be obtained by assigning vec->norm[position]. Its purpose | 92 | \code |
| 91 | is to access these values from wrappers, as created by swig. | 93 | s->norm[position] = val; |
| 94 | \endcode | ||
| 92 | 95 | ||
| 93 | \param s vector to write to | 96 | \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] |
| 95 | \param position sample position to write to | 98 | \param position sample position to write to |
| 96 | 99 | ||
| 97 | */ | 100 | */ |
| 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 | |||
| 99 | /** write phase value in a complex buffer | 103 | /** write phase value in a complex buffer |
| 100 | 104 | ||
| 101 | Note that this function is not used in the aubio library, since the same | 105 | This is equivalent to: |
| 102 | result can be obtained by assigning vec->phas[position]. Its purpose | 106 | \code |
| 103 | is to access these values from wrappers, as created by swig. | 107 | s->phas[position] = val; |
| 108 | \endcode | ||
| 104 | 109 | ||
| 105 | \param s vector to write to | 110 | \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] |
| 107 | \param position sample position to write to | 112 | \param position sample position to write to |
| 108 | 113 | ||
| 109 | */ | 114 | */ |
| 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 | |||
| 111 | /** read norm value from a complex buffer | 117 | /** read norm value from a complex buffer |
| 112 | 118 | ||
| 113 | Note that this function is not used in the aubio library, since the same | 119 | This is equivalent to: |
| 114 | result can be obtained with vec->norm[position]. Its purpose is to | 120 | \code |
| 115 | access these values from wrappers, as created by swig. | 121 | smpl_t foo = s->norm[position]; |
| 122 | \endcode | ||
| 116 | 123 | ||
| 117 | \param s vector to read from | 124 | \param s vector to read from |
| 118 | \param position sample position to read from | 125 | \param position sample position to read from |
| 119 | 126 | ||
| 120 | */ | 127 | */ |
| 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 | |||
| 122 | /** read phase value from a complex buffer | 130 | /** read phase value from a complex buffer |
| 123 | 131 | ||
| 124 | Note that this function is not used in the aubio library, since the same | 132 | This is equivalent to: |
| 125 | result can be obtained with vec->phas[position]. Its purpose is to | 133 | \code |
| 126 | access these values from wrappers, as created by swig. | 134 | smpl_t foo = s->phas[position]; |
| 135 | \endcode | ||
| 127 | 136 | ||
| 128 | \param s vector to read from | 137 | \param s vector to read from |
| 129 | \param position sample position to read from | 138 | \param position sample position to read from |
| 139 | \returns the value of the sample at position | ||
| 130 | 140 | ||
| 131 | */ | 141 | */ |
| 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 | |||
| 133 | /** read norm data from a complex buffer | 144 | /** read norm data from a complex buffer |
| 134 | 145 | ||
| 135 | Note that this function is not used in the aubio library, since the same | 146 | \code |
| 136 | result can be obtained with vec->norm. Its purpose is to access these values | 147 | smpl_t *data = s->norm; |
| 137 | from wrappers, as created by swig. | 148 | \endcode |
| 138 | 149 | ||
| 139 | \param s vector to read from | 150 | \param s vector to read from |
| 140 | 151 | ||
| 141 | */ | 152 | */ |
| 142 | smpl_t * cvec_get_norm(cvec_t *s); | 153 | smpl_t * cvec_norm_get_data (cvec_t *s); |
| 154 | |||
| 143 | /** read phase data from a complex buffer | 155 | /** read phase data from a complex buffer |
| 144 | 156 | ||
| 145 | Note that this function is not used in the aubio library, since the same | 157 | This is equivalent to: |
| 146 | result can be obtained with vec->phas. Its purpose is to access these values | 158 | \code |
| 147 | from wrappers, as created by swig. | 159 | smpl_t *data = s->phas; |
| 160 | \endcode | ||
| 148 | 161 | ||
| 149 | \param s vector to read from | 162 | \param s vector to read from |
| 150 | 163 | ||
| 151 | */ | 164 | */ |
| 152 | smpl_t * cvec_get_phas(cvec_t *s); | 165 | smpl_t * cvec_phas_get_data (cvec_t *s); |
| 153 | 166 | ||
| 154 | /** print out cvec data | 167 | /** print out cvec data |
| 155 | 168 | ||
| @@ -172,21 +185,21 @@ void cvec_copy(cvec_t *s, cvec_t *t); · 16 unmodified lines | |||
| 172 | \param val value to set elements to | 185 | \param val value to set elements to |
| 173 | 186 | ||
| 174 | */ | 187 | */ |
| 175 | void cvec_set_all_norm(cvec_t *s, smpl_t val); | 188 | void cvec_norm_set_all (cvec_t *s, smpl_t val); |
| 176 | 189 | ||
| 177 | /** set all norm elements to zero | 190 | /** set all norm elements to zero |
| 178 | 191 | ||
| 179 | \param s vector to modify | 192 | \param s vector to modify |
| 180 | 193 | ||
| 181 | */ | 194 | */ |
| 182 | void cvec_zeros_norm(cvec_t *s); | 195 | void cvec_norm_zeros(cvec_t *s); |
| 183 | 196 | ||
| 184 | /** set all norm elements to one | 197 | /** set all norm elements to one |
| 185 | 198 | ||
| 186 | \param s vector to modify | 199 | \param s vector to modify |
| 187 | 200 | ||
| 188 | */ | 201 | */ |
| 189 | void cvec_ones_norm(cvec_t *s); | 202 | void cvec_norm_ones(cvec_t *s); |
| 190 | 203 | ||
| 191 | /** set all phase elements to a given value | 204 | /** set all phase elements to a given value |
| 192 | 205 | ||
| @@ -194,21 +207,21 @@ void cvec_ones_norm(cvec_t *s); · 1 unmodified line | |||
| 194 | \param val value to set elements to | 207 | \param val value to set elements to |
| 195 | 208 | ||
| 196 | */ | 209 | */ |
| 197 | void cvec_set_all_phas(cvec_t *s, smpl_t val); | 210 | void cvec_phas_set_all (cvec_t *s, smpl_t val); |
| 198 | 211 | ||
| 199 | /** set all phase elements to zero | 212 | /** set all phase elements to zero |
| 200 | 213 | ||
| 201 | \param s vector to modify | 214 | \param s vector to modify |
| 202 | 215 | ||
| 203 | */ | 216 | */ |
| 204 | void cvec_zeros_phas(cvec_t *s); | 217 | void cvec_phas_zeros(cvec_t *s); |
| 205 | 218 | ||
| 206 | /** set all phase elements to one | 219 | /** set all phase elements to one |
| 207 | 220 | ||
| 208 | \param s vector to modify | 221 | \param s vector to modify |
| 209 | 222 | ||
| 210 | */ | 223 | */ |
| 211 | void cvec_ones_phas(cvec_t *s); | 224 | void cvec_phas_ones(cvec_t *s); |
| 212 | 225 | ||
| 213 | /** set all norm and phas elements to zero | 226 | /** set all norm and phas elements to zero |
| 214 | 227 | ||
| @@ -221,5 +234,4 @@ void cvec_zeros(cvec_t *s); · 6 unmodified lines | |||
| 221 | } | 234 | } |
| 222 | #endif | 235 | #endif |
| 223 | 236 | ||
| 224 | #endif /* _CVEC_H */ | 237 | #endif /* _AUBIO__CVEC_H */ |
| 225 | |||
| @@ -21,7 +21,7 @@ · 20 unmodified lines | |||
| 21 | #include "aubio_priv.h" | 21 | #include "aubio_priv.h" |
| 22 | #include "fmat.h" | 22 | #include "fmat.h" |
| 23 | 23 | ||
| 24 | fmat_t * new_fmat (uint_t length, uint_t height) { | 24 | fmat_t * new_fmat (uint_t height, uint_t length) { |
| 25 | if ((sint_t)length <= 0 || (sint_t)height <= 0 ) { | 25 | if ((sint_t)length <= 0 || (sint_t)height <= 0 ) { |
| 26 | return NULL; | 26 | return NULL; |
| 27 | } | 27 | } |
| @@ -48,21 +48,24 @@ void del_fmat (fmat_t *s) { · 20 unmodified lines | |||
| 48 | AUBIO_FREE(s); | 48 | AUBIO_FREE(s); |
| 49 | } | 49 | } |
| 50 | 50 | ||
| 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) { |
| 52 | s->data[channel][position] = data; | 52 | s->data[channel][position] = data; |
| 53 | } | 53 | } |
| 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) { | ||
| 55 | return s->data[channel][position]; | 56 | return s->data[channel][position]; |
| 56 | } | 57 | } |
| 57 | void fmat_put_channel(fmat_t *s, smpl_t * data, uint_t channel) { | 58 | |
| 58 | s->data[channel] = data; | ||
| 59 | } | ||
| 60 | void fmat_get_channel(fmat_t *s, uint_t channel, fvec_t *output) { | 59 | void fmat_get_channel(fmat_t *s, uint_t channel, fvec_t *output) { |
| 61 | output->data = s->data[channel]; | 60 | output->data = s->data[channel]; |
| 62 | output->length = s->length; | 61 | output->length = s->length; |
| 63 | return; | 62 | return; |
| 64 | } | 63 | } |
| 65 | 64 | ||
| 65 | smpl_t * fmat_get_channel_data(fmat_t *s, uint_t channel) { | ||
| 66 | return s->data[channel]; | ||
| 67 | } | ||
| 68 | |||
| 66 | smpl_t ** fmat_get_data(fmat_t *s) { | 69 | smpl_t ** fmat_get_data(fmat_t *s) { |
| 67 | return s->data; | 70 | return s->data; |
| 68 | } | 71 | } |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | Copyright (C) 2009 Paul Brossier <piem@aubio.org> | 2 | Copyright (C) 2009-2013 Paul Brossier <piem@aubio.org> |
| 3 | 3 | ||
| 4 | This file is part of aubio. | 4 | This file is part of aubio. |
| 5 | 5 | ||
| @@ -18,8 +18,8 @@ · 12 unmodified lines | |||
| 18 | 18 | ||
| 19 | */ | 19 | */ |
| 20 | 20 | ||
| 21 | #ifndef _FMAT_H | 21 | #ifndef _AUBIO__FMAT_H |
| 22 | #define _FMAT_H | 22 | #define _AUBIO__FMAT_H |
| 23 | 23 | ||
| 24 | #ifdef __cplusplus | 24 | #ifdef __cplusplus |
| 25 | extern "C" { | 25 | extern "C" { |
| @@ -49,30 +49,25 @@ typedef struct { · 23 unmodified lines | |||
| 49 | \param height the height of the matrix to create | 49 | \param height the height of the matrix to create |
| 50 | 50 | ||
| 51 | */ | 51 | */ |
| 52 | fmat_t * new_fmat(uint_t length, uint_t height); | 52 | fmat_t * new_fmat(uint_t height, uint_t length); |
| 53 | |||
| 53 | /** fmat_t buffer deletion function | 54 | /** fmat_t buffer deletion function |
| 54 | 55 | ||
| 55 | \param s buffer to delete as returned by new_fmat() | 56 | \param s buffer to delete as returned by new_fmat() |
| 56 | 57 | ||
| 57 | */ | 58 | */ |
| 58 | void del_fmat(fmat_t *s); | 59 | void del_fmat(fmat_t *s); |
| 59 | /** read sample value in a buffer | ||
| 60 | 60 | ||
| 61 | Note that this function is not used in the aubio library, since the same | 61 | /** read sample value in a buffer |
| 62 | result can be obtained using vec->data[channel][position]. Its purpose is to | ||
| 63 | access these values from wrappers, as created by swig. | ||
| 64 | 62 | ||
| 65 | \param s vector to read from | 63 | \param s vector to read from |
| 66 | \param channel channel to read from | 64 | \param channel channel to read from |
| 67 | \param position sample position to read from | 65 | \param position sample position to read from |
| 68 | 66 | ||
| 69 | */ | 67 | */ |
| 70 | smpl_t fmat_read_sample(fmat_t *s, uint_t channel, uint_t position); | 68 | smpl_t fmat_get_sample(fmat_t *s, uint_t channel, uint_t position); |
| 71 | /** write sample value in a buffer | ||
| 72 | 69 | ||
| 73 | Note that this function is not used in the aubio library, since the same | 70 | /** write sample value in a buffer |
| 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. | ||
| 76 | 71 | ||
| 77 | \param s vector to write to | 72 | \param s vector to write to |
| 78 | \param data value to write in s->data[channel][position] | 73 | \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 | |||
| 80 | \param position sample position to write to | 75 | \param position sample position to write to |
| 81 | 76 | ||
| 82 | */ | 77 | */ |
| 83 | void fmat_write_sample(fmat_t *s, smpl_t data, uint_t channel, uint_t position); | 78 | void fmat_set_sample(fmat_t *s, smpl_t data, uint_t channel, uint_t position); |
| 84 | /** read channel vector from a buffer | ||
| 85 | 79 | ||
| 86 | Note that this function is not used in the aubio library, since the same | 80 | /** read channel vector from a buffer |
| 87 | result can be obtained with vec->data[channel]. Its purpose is to access | ||
| 88 | these values from wrappers, as created by swig. | ||
| 89 | 81 | ||
| 90 | \param s vector to read from | 82 | \param s vector to read from |
| 91 | \param channel channel to read from | 83 | \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 | |||
| 93 | 85 | ||
| 94 | */ | 86 | */ |
| 95 | void fmat_get_channel (fmat_t *s, uint_t channel, fvec_t *output); | 87 | void fmat_get_channel (fmat_t *s, uint_t channel, fvec_t *output); |
| 96 | /** write channel vector into a buffer | ||
| 97 | 88 | ||
| 98 | Note that this function is not used in the aubio library, since the same | 89 | /** get vector buffer from an fmat data |
| 99 | result can be obtained by assigning vec->data[channel]. Its purpose is to | ||
| 100 | access these values from wrappers, as created by swig. | ||
| 101 | 90 | ||
| 102 | \param s vector to write to | 91 | \param s vector to read from |
| 103 | \param data vector of [length] values to write | 92 | \param channel channel to read from |
| 104 | \param channel channel to write to | ||
| 105 | 93 | ||
| 106 | */ | 94 | */ |
| 107 | void fmat_put_channel(fmat_t *s, smpl_t * data, uint_t channel); | 95 | smpl_t * fmat_get_channel_data (fmat_t *s, uint_t channel); |
| 108 | /** read data from a buffer | ||
| 109 | 96 | ||
| 110 | Note that this function is not used in the aubio library, since the same | 97 | /** read data from a buffer |
| 111 | result can be obtained with vec->data. Its purpose is to access these values | ||
| 112 | from wrappers, as created by swig. | ||
| 113 | 98 | ||
| 114 | \param s vector to read from | 99 | \param s vector to read from |
| 115 | 100 | ||
| @@ -175,4 +160,4 @@ void fmat_copy(fmat_t *s, fmat_t *t); · 59 unmodified lines | |||
| 175 | } | 160 | } |
| 176 | #endif | 161 | #endif |
| 177 | 162 | ||
| 178 | #endif /* _FMAT_H */ | 163 | #endif /* _AUBIO__FMAT_H */ |
| @@ -36,11 +36,11 @@ void del_fvec(fvec_t *s) { · 35 unmodified lines | |||
| 36 | AUBIO_FREE(s); | 36 | AUBIO_FREE(s); |
| 37 | } | 37 | } |
| 38 | 38 | ||
| 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) { |
| 40 | s->data[position] = data; | 40 | s->data[position] = data; |
| 41 | } | 41 | } |
| 42 | 42 | ||
| 43 | smpl_t fvec_read_sample(fvec_t *s, uint_t position) { | 43 | smpl_t fvec_get_sample(fvec_t *s, uint_t position) { |
| 44 | return s->data[position]; | 44 | return s->data[position]; |
| 45 | } | 45 | } |
| 46 | 46 | ||
| @@ -58,7 +58,7 @@ void fvec_print(fvec_t *s) { · 11 unmodified lines | |||
| 58 | AUBIO_MSG("\n"); | 58 | AUBIO_MSG("\n"); |
| 59 | } | 59 | } |
| 60 | 60 | ||
| 61 | void fvec_set(fvec_t *s, smpl_t val) { | 61 | void fvec_set_all (fvec_t *s, smpl_t val) { |
| 62 | uint_t j; | 62 | uint_t j; |
| 63 | for (j=0; j< s->length; j++) { | 63 | for (j=0; j< s->length; j++) { |
| 64 | s->data[j] = val; | 64 | s->data[j] = val; |
| @@ -69,12 +69,12 @@ void fvec_zeros(fvec_t *s) { · 4 unmodified lines | |||
| 69 | #if HAVE_MEMCPY_HACKS | 69 | #if HAVE_MEMCPY_HACKS |
| 70 | memset(s->data, 0, s->length * sizeof(smpl_t)); | 70 | memset(s->data, 0, s->length * sizeof(smpl_t)); |
| 71 | #else | 71 | #else |
| 72 | fvec_set(s, 0.); | 72 | fvec_set_all (s, 0.); |
| 73 | #endif | 73 | #endif |
| 74 | } | 74 | } |
| 75 | 75 | ||
| 76 | void fvec_ones(fvec_t *s) { | 76 | void fvec_ones(fvec_t *s) { |
| 77 | fvec_set(s, 1.); | 77 | fvec_set_all (s, 1.); |
| 78 | } | 78 | } |
| 79 | 79 | ||
| 80 | void fvec_rev(fvec_t *s) { | 80 | void fvec_rev(fvec_t *s) { |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org> | 2 | Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org> |
| 3 | 3 | ||
| 4 | This file is part of aubio. | 4 | This file is part of aubio. |
| 5 | 5 | ||
| @@ -18,8 +18,8 @@ · 12 unmodified lines | |||
| 18 | 18 | ||
| 19 | */ | 19 | */ |
| 20 | 20 | ||
| 21 | #ifndef _FVEC_H | 21 | #ifndef _AUBIO__FVEC_H |
| 22 | #define _FVEC_H | 22 | #define _AUBIO__FVEC_H |
| 23 | 23 | ||
| 24 | #ifdef __cplusplus | 24 | #ifdef __cplusplus |
| 25 | extern "C" { | 25 | extern "C" { |
| @@ -75,42 +75,33 @@ typedef struct { · 49 unmodified lines | |||
| 75 | 75 | ||
| 76 | */ | 76 | */ |
| 77 | fvec_t * new_fvec(uint_t length); | 77 | fvec_t * new_fvec(uint_t length); |
| 78 | |||
| 78 | /** fvec_t buffer deletion function | 79 | /** fvec_t buffer deletion function |
| 79 | 80 | ||
| 80 | \param s buffer to delete as returned by new_fvec() | 81 | \param s buffer to delete as returned by new_fvec() |
| 81 | 82 | ||
| 82 | */ | 83 | */ |
| 83 | void del_fvec(fvec_t *s); | 84 | void del_fvec(fvec_t *s); |
| 84 | /** read sample value in a buffer | ||
| 85 | 85 | ||
| 86 | Note that this function is not used in the aubio library, since the same | 86 | /** read sample value in a buffer |
| 87 | result can be obtained using vec->data[position]. Its purpose is to | ||
| 88 | access these values from wrappers, as created by swig. | ||
| 89 | 87 | ||
| 90 | \param s vector to read from | 88 | \param s vector to read from |
| 91 | \param position sample position to read from | 89 | \param position sample position to read from |
| 92 | 90 | ||
| 93 | */ | 91 | */ |
| 94 | smpl_t fvec_read_sample(fvec_t *s, uint_t position); | 92 | smpl_t fvec_get_sample(fvec_t *s, uint_t position); |
| 95 | /** write sample value in a buffer | ||
| 96 | 93 | ||
| 97 | Note that this function is not used in the aubio library, since the same | 94 | /** write sample value in a buffer |
| 98 | result can be obtained by assigning vec->data[position]. Its purpose | ||
| 99 | is to access these values from wrappers, as created by swig. | ||
| 100 | 95 | ||
| 101 | \param s vector to write to | 96 | \param s vector to write to |
| 102 | \param data value to write in s->data[position] | 97 | \param data value to write in s->data[position] |
| 103 | \param position sample position to write to | 98 | \param position sample position to write to |
| 104 | 99 | ||
| 105 | */ | 100 | */ |
| 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); |
| 107 | 102 | ||
| 108 | /** read data from a buffer | 103 | /** read data from a buffer |
| 109 | 104 | ||
| 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 | |||
| 114 | \param s vector to read from | 105 | \param s vector to read from |
| 115 | 106 | ||
| 116 | */ | 107 | */ |
| @@ -129,7 +120,7 @@ void fvec_print(fvec_t *s); · 12 unmodified lines | |||
| 129 | \param val value to set elements to | 120 | \param val value to set elements to |
| 130 | 121 | ||
| 131 | */ | 122 | */ |
| 132 | void fvec_set(fvec_t *s, smpl_t val); | 123 | void fvec_set_all (fvec_t *s, smpl_t val); |
| 133 | 124 | ||
| 134 | /** set all elements to zero | 125 | /** set all elements to zero |
| 135 | 126 | ||
| @@ -175,4 +166,4 @@ void fvec_copy(fvec_t *s, fvec_t *t); · 39 unmodified lines | |||
| 175 | } | 166 | } |
| 176 | #endif | 167 | #endif |
| 177 | 168 | ||
| 178 | #endif /* _FVEC_H */ | 169 | #endif /* _AUBIO__FVEC_H */ |
| @@ -104,8 +104,8 @@ aubio_audio_unit_t * new_aubio_audio_unit(uint_t samplerate, · 103 unmodified lines | |||
| 104 | o->au_ios_inbuf = AUBIO_ARRAY(SInt16, AU_IOS_MAX_FRAMES * o->hw_input_channels); | 104 | o->au_ios_inbuf = AUBIO_ARRAY(SInt16, AU_IOS_MAX_FRAMES * o->hw_input_channels); |
| 105 | 105 | ||
| 106 | /* the floats coming from and to the device callback */ | 106 | /* the floats coming from and to the device callback */ |
| 107 | o->output_frames = new_fmat(blocksize, sw_output_channels); | 107 | o->output_frames = new_fmat(sw_output_channels, blocksize); |
| 108 | o->input_frames = new_fmat(blocksize, sw_input_channels); | 108 | o->input_frames = new_fmat(sw_input_channels, blocksize); |
| 109 | 109 | ||
| 110 | /* check for some sizes */ | 110 | /* check for some sizes */ |
| 111 | if ( o->hw_output_channels != o->output_frames->height ) { | 111 | if ( o->hw_output_channels != o->output_frames->height ) { |
| @@ -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 */ | ||
| @@ -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 | |||
| @@ -23,9 +23,9 @@ · 22 unmodified lines | |||
| 23 | #include "fvec.h" | 23 | #include "fvec.h" |
| 24 | #include "fmat.h" | 24 | #include "fmat.h" |
| 25 | #include "io/source.h" | 25 | #include "io/source.h" |
| 26 | #ifdef HAVE_AVCODEC | 26 | #ifdef HAVE_LIBAV |
| 27 | #include "io/source_avcodec.h" | 27 | #include "io/source_avcodec.h" |
| 28 | #endif /* HAVE_AVCODEC */ | 28 | #endif /* HAVE_LIBAV */ |
| 29 | #ifdef __APPLE__ | 29 | #ifdef __APPLE__ |
| 30 | #include "io/source_apple_audio.h" | 30 | #include "io/source_apple_audio.h" |
| 31 | #endif /* __APPLE__ */ | 31 | #endif /* __APPLE__ */ |
| @@ -52,7 +52,7 @@ struct _aubio_source_t { · 20 unmodified lines | |||
| 52 | 52 | ||
| 53 | aubio_source_t * new_aubio_source(char_t * uri, uint_t samplerate, uint_t hop_size) { | 53 | aubio_source_t * new_aubio_source(char_t * uri, uint_t samplerate, uint_t hop_size) { |
| 54 | aubio_source_t * s = AUBIO_NEW(aubio_source_t); | 54 | aubio_source_t * s = AUBIO_NEW(aubio_source_t); |
| 55 | #if HAVE_AVCODEC | 55 | #if HAVE_LIBAV |
| 56 | s->source = (void *)new_aubio_source_avcodec(uri, samplerate, hop_size); | 56 | s->source = (void *)new_aubio_source_avcodec(uri, samplerate, hop_size); |
| 57 | if (s->source) { | 57 | if (s->source) { |
| 58 | s->s_do = (aubio_source_do_t)(aubio_source_avcodec_do); | 58 | 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 | |||
| 63 | s->s_del = (del_aubio_source_t)(del_aubio_source_avcodec); | 63 | s->s_del = (del_aubio_source_t)(del_aubio_source_avcodec); |
| 64 | return s; | 64 | return s; |
| 65 | } | 65 | } |
| 66 | #endif /* HAVE_AVCODEC */ | 66 | #endif /* HAVE_LIBAV */ |
| 67 | #ifdef __APPLE__ | 67 | #ifdef __APPLE__ |
| 68 | s->source = (void *)new_aubio_source_apple_audio(uri, samplerate, hop_size); | 68 | s->source = (void *)new_aubio_source_apple_audio(uri, samplerate, hop_size); |
| 69 | if (s->source) { | 69 | if (s->source) { |
| @@ -40,7 +40,7 @@ · 39 unmodified lines | |||
| 40 | 40 | ||
| 41 | On Mac and iOS platforms, aubio should be compiled with CoreAudio [Extended | 41 | On Mac and iOS platforms, aubio should be compiled with CoreAudio [Extended |
| 42 | Audio File Services] | 42 | 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). |
| 44 | This provides access to most common audio file formats, including compressed | 44 | This provides access to most common audio file formats, including compressed |
| 45 | ones. | 45 | ones. |
| 46 | 46 | ||
| @@ -21,9 +21,8 @@ · 20 unmodified lines | |||
| 21 | 21 | ||
| 22 | #include "config.h" | 22 | #include "config.h" |
| 23 | 23 | ||
| 24 | #ifdef HAVE_AVCODEC | 24 | #ifdef HAVE_LIBAV |
| 25 | 25 | ||
| 26 | #include <sndfile.h> | ||
| 27 | #include <libavcodec/avcodec.h> | 26 | #include <libavcodec/avcodec.h> |
| 28 | #include <libavformat/avformat.h> | 27 | #include <libavformat/avformat.h> |
| 29 | #include <libavresample/avresample.h> | 28 | #include <libavresample/avresample.h> |
| @@ -402,4 +401,4 @@ void del_aubio_source_avcodec(aubio_source_avcodec_t * s){ · 372 unmodified lines | |||
| 402 | AUBIO_FREE(s); | 401 | AUBIO_FREE(s); |
| 403 | } | 402 | } |
| 404 | 403 | ||
| 405 | #endif /* HAVE_SNDFILE */ | 404 | #endif /* HAVE_LIBAV */ |
| @@ -39,7 +39,7 @@ void del_lvec(lvec_t *s) { · 38 unmodified lines | |||
| 39 | void lvec_write_sample(lvec_t *s, lsmp_t data, uint_t position) { | 39 | void lvec_write_sample(lvec_t *s, lsmp_t data, uint_t position) { |
| 40 | s->data[position] = data; | 40 | s->data[position] = data; |
| 41 | } | 41 | } |
| 42 | lsmp_t lvec_read_sample(lvec_t *s, uint_t position) { | 42 | lsmp_t lvec_get_sample(lvec_t *s, uint_t position) { |
| 43 | return s->data[position]; | 43 | return s->data[position]; |
| 44 | } | 44 | } |
| 45 | 45 | ||
| @@ -57,7 +57,7 @@ void lvec_print(lvec_t *s) { · 11 unmodified lines | |||
| 57 | AUBIO_MSG("\n"); | 57 | AUBIO_MSG("\n"); |
| 58 | } | 58 | } |
| 59 | 59 | ||
| 60 | void lvec_set(lvec_t *s, smpl_t val) { | 60 | void lvec_set_all (lvec_t *s, smpl_t val) { |
| 61 | uint_t j; | 61 | uint_t j; |
| 62 | for (j=0; j< s->length; j++) { | 62 | for (j=0; j< s->length; j++) { |
| 63 | s->data[j] = val; | 63 | s->data[j] = val; |
| @@ -68,11 +68,11 @@ void lvec_zeros(lvec_t *s) { · 4 unmodified lines | |||
| 68 | #if HAVE_MEMCPY_HACKS | 68 | #if HAVE_MEMCPY_HACKS |
| 69 | memset(s->data, 0, s->length * sizeof(lsmp_t)); | 69 | memset(s->data, 0, s->length * sizeof(lsmp_t)); |
| 70 | #else | 70 | #else |
| 71 | lvec_set(s, 0.); | 71 | lvec_set_all (s, 0.); |
| 72 | #endif | 72 | #endif |
| 73 | } | 73 | } |
| 74 | 74 | ||
| 75 | void lvec_ones(lvec_t *s) { | 75 | void lvec_ones(lvec_t *s) { |
| 76 | lvec_set(s, 1.); | 76 | lvec_set_all (s, 1.); |
| 77 | } | 77 | } |
| 78 | 78 | ||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org> | 2 | Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org> |
| 3 | 3 | ||
| 4 | This file is part of aubio. | 4 | This file is part of aubio. |
| 5 | 5 | ||
| @@ -18,8 +18,8 @@ · 12 unmodified lines | |||
| 18 | 18 | ||
| 19 | */ | 19 | */ |
| 20 | 20 | ||
| 21 | #ifndef _LVEC_H | 21 | #ifndef _AUBIO__LVEC_H |
| 22 | #define _LVEC_H | 22 | #define _AUBIO__LVEC_H |
| 23 | 23 | ||
| 24 | #ifdef __cplusplus | 24 | #ifdef __cplusplus |
| 25 | extern "C" { | 25 | extern "C" { |
| @@ -57,36 +57,26 @@ lvec_t * new_lvec(uint_t length); · 31 unmodified lines | |||
| 57 | 57 | ||
| 58 | */ | 58 | */ |
| 59 | void del_lvec(lvec_t *s); | 59 | void del_lvec(lvec_t *s); |
| 60 | /** read sample value in a buffer | ||
| 61 | 60 | ||
| 62 | Note that this function is not used in the aubio library, since the same | 61 | /** read sample value in a buffer |
| 63 | result can be obtained using vec->data[position]. Its purpose is to | ||
| 64 | access these values from wrappers, as created by swig. | ||
| 65 | 62 | ||
| 66 | \param s vector to read from | 63 | \param s vector to read from |
| 67 | \param position sample position to read from | 64 | \param position sample position to read from |
| 68 | 65 | ||
| 69 | */ | 66 | */ |
| 70 | lsmp_t lvec_read_sample(lvec_t *s, uint_t position); | 67 | lsmp_t lvec_get_sample(lvec_t *s, uint_t position); |
| 71 | /** write sample value in a buffer | ||
| 72 | 68 | ||
| 73 | Note that this function is not used in the aubio library, since the same | 69 | /** write sample value in a buffer |
| 74 | result can be obtained by assigning vec->data[position]. Its purpose | ||
| 75 | is to access these values from wrappers, as created by swig. | ||
| 76 | 70 | ||
| 77 | \param s vector to write to | 71 | \param s vector to write to |
| 78 | \param data value to write in s->data[position] | 72 | \param data value to write in s->data[position] |
| 79 | \param position sample position to write to | 73 | \param position sample position to write to |
| 80 | 74 | ||
| 81 | */ | 75 | */ |
| 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); |
| 83 | 77 | ||
| 84 | /** read data from a buffer | 78 | /** read data from a buffer |
| 85 | 79 | ||
| 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 | |||
| 90 | \param s vector to read from | 80 | \param s vector to read from |
| 91 | 81 | ||
| 92 | */ | 82 | */ |
| @@ -105,7 +95,7 @@ void lvec_print(lvec_t *s); · 12 unmodified lines | |||
| 105 | \param val value to set elements to | 95 | \param val value to set elements to |
| 106 | 96 | ||
| 107 | */ | 97 | */ |
| 108 | void lvec_set(lvec_t *s, smpl_t val); | 98 | void lvec_set_all(lvec_t *s, smpl_t val); |
| 109 | 99 | ||
| 110 | /** set all elements to zero | 100 | /** set all elements to zero |
| 111 | 101 | ||
| @@ -125,4 +115,4 @@ void lvec_ones(lvec_t *s); · 13 unmodified lines | |||
| 125 | } | 115 | } |
| 126 | #endif | 116 | #endif |
| 127 | 117 | ||
| 128 | #endif /* _LVEC_H */ | 118 | #endif /* _AUBIO__LVEC_H */ |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org> | 2 | Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org> |
| 3 | 3 | ||
| 4 | This file is part of aubio. | 4 | This file is part of aubio. |
| 5 | 5 | ||
| @@ -27,8 +27,8 @@ · 21 unmodified lines | |||
| 27 | 27 | ||
| 28 | */ | 28 | */ |
| 29 | 29 | ||
| 30 | #ifndef MATHUTILS_H | 30 | #ifndef _AUBIO_MATHUTILS_H |
| 31 | #define MATHUTILS_H | 31 | #define _AUBIO_MATHUTILS_H |
| 32 | 32 | ||
| 33 | #include "fvec.h" | 33 | #include "fvec.h" |
| 34 | #include "musicutils.h" | 34 | #include "musicutils.h" |
| @@ -282,5 +282,4 @@ void aubio_autocorr (fvec_t * input, fvec_t * output); · 247 unmodified lines | |||
| 282 | } | 282 | } |
| 283 | #endif | 283 | #endif |
| 284 | 284 | ||
| 285 | #endif | 285 | #endif /* _AUBIO_MATHUTILS_H */ |
| 286 | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org> | 2 | Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org> |
| 3 | 3 | ||
| 4 | This file is part of aubio. | 4 | This file is part of aubio. |
| 5 | 5 | ||
| @@ -22,15 +22,32 @@ · 16 unmodified lines | |||
| 22 | * various functions useful in audio signal processing | 22 | * various functions useful in audio signal processing |
| 23 | */ | 23 | */ |
| 24 | 24 | ||
| 25 | #ifndef MUSICUTILS_H | 25 | #ifndef _AUBIO__MUSICUTILS_H |
| 26 | #define MUSICUTILS_H | 26 | #define _AUBIO__MUSICUTILS_H |
| 27 | 27 | ||
| 28 | #ifdef __cplusplus | 28 | #ifdef __cplusplus |
| 29 | extern "C" { | 29 | extern "C" { |
| 30 | #endif | 30 | #endif |
| 31 | 31 | ||
| 32 | /** create window | 32 | /** 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()) | ||
| 33 | 36 | ||
| 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 | |||
| 34 | References: | 51 | References: |
| 35 | 52 | ||
| 36 | - <a href="http://en.wikipedia.org/wiki/Window_function">Window | 53 | - <a href="http://en.wikipedia.org/wiki/Window_function">Window |
| @@ -42,11 +59,6 @@ Uni- versity of Verona, Italy, 2000. · 5 unmodified lines | |||
| 42 | (<a href="http://profs.sci.univr.it/%7Edafx/Final-Papers/ps/Bernardini.ps.gz"> | 59 | (<a href="http://profs.sci.univr.it/%7Edafx/Final-Papers/ps/Bernardini.ps.gz"> |
| 43 | ps.gz</a>) | 60 | ps.gz</a>) |
| 44 | 61 | ||
| 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 | |||
| 50 | */ | 62 | */ |
| 51 | uint_t fvec_set_window (fvec_t * window, char_t * window_type); | 63 | uint_t fvec_set_window (fvec_t * window, char_t * window_type); |
| 52 | 64 | ||
| @@ -148,5 +160,4 @@ smpl_t aubio_level_detection (fvec_t * v, smpl_t threshold); · 95 unmodified lines | |||
| 148 | } | 160 | } |
| 149 | #endif | 161 | #endif |
| 150 | 162 | ||
| 151 | #endif | 163 | #endif /* _AUBIO__MUSICUTILS_H */ |
| 152 | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | Copyright (C) 2006-2009 Paul Brossier <piem@aubio.org> | 2 | Copyright (C) 2006-2013 Paul Brossier <piem@aubio.org> |
| 3 | 3 | ||
| 4 | This file is part of aubio. | 4 | This file is part of aubio. |
| 5 | 5 | ||
| @@ -39,8 +39,8 @@ · 33 unmodified lines | |||
| 39 | */ | 39 | */ |
| 40 | 40 | ||
| 41 | 41 | ||
| 42 | #ifndef ONSET_H | 42 | #ifndef _AUBIO_ONSET_H |
| 43 | #define ONSET_H | 43 | #define _AUBIO_ONSET_H |
| 44 | 44 | ||
| 45 | #ifdef __cplusplus | 45 | #ifdef __cplusplus |
| 46 | extern "C" { | 46 | extern "C" { |
| @@ -268,4 +268,4 @@ void del_aubio_onset(aubio_onset_t * o); · 221 unmodified lines | |||
| 268 | } | 268 | } |
| 269 | #endif | 269 | #endif |
| 270 | 270 | ||
| 271 | #endif /* ONSET_H */ | 271 | #endif /* _AUBIO_ONSET_H */ |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org> | 2 | Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org> |
| 3 | 3 | ||
| 4 | This file is part of aubio. | 4 | This file is part of aubio. |
| 5 | 5 | ||
| @@ -26,8 +26,8 @@ · 20 unmodified lines | |||
| 26 | 26 | ||
| 27 | */ | 27 | */ |
| 28 | 28 | ||
| 29 | #ifndef PEAKPICK_H | 29 | #ifndef _AUBIO_PEAKPICK_H |
| 30 | #define PEAKPICK_H | 30 | #define _AUBIO_PEAKPICK_H |
| 31 | 31 | ||
| 32 | #ifdef __cplusplus | 32 | #ifdef __cplusplus |
| 33 | extern "C" { | 33 | extern "C" { |
| @@ -54,4 +54,4 @@ smpl_t aubio_peakpicker_get_threshold(aubio_peakpicker_t * p); · 20 unmodified lines | |||
| 54 | } | 54 | } |
| 55 | #endif | 55 | #endif |
| 56 | 56 | ||
| 57 | #endif /* PEAKPICK_H */ | 57 | #endif /* _AUBIO_PEAKPICK_H */ |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org> | 2 | Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org> |
| 3 | 3 | ||
| 4 | This file is part of aubio. | 4 | This file is part of aubio. |
| 5 | 5 | ||
| @@ -18,8 +18,8 @@ · 12 unmodified lines | |||
| 18 | 18 | ||
| 19 | */ | 19 | */ |
| 20 | 20 | ||
| 21 | #ifndef PITCH_H | 21 | #ifndef _AUBIO_PITCH_H |
| 22 | #define PITCH_H | 22 | #define _AUBIO_PITCH_H |
| 23 | 23 | ||
| 24 | #ifdef __cplusplus | 24 | #ifdef __cplusplus |
| 25 | extern "C" { | 25 | extern "C" { |
| @@ -179,4 +179,4 @@ smpl_t aubio_pitch_get_confidence (aubio_pitch_t * o); · 153 unmodified lines | |||
| 179 | } | 179 | } |
| 180 | #endif | 180 | #endif |
| 181 | 181 | ||
| 182 | #endif /*PITCH_H*/ | 182 | #endif /* _AUBIO_PITCH_H */ |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org> | 2 | Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org> |
| 3 | 3 | ||
| 4 | This file is part of aubio. | 4 | This file is part of aubio. |
| 5 | 5 | ||
| @@ -34,8 +34,8 @@ · 28 unmodified lines | |||
| 34 | 34 | ||
| 35 | */ | 35 | */ |
| 36 | 36 | ||
| 37 | #ifndef _PITCHFCOMB_H | 37 | #ifndef _AUBIO_PITCHFCOMB_H |
| 38 | #define _PITCHFCOMB_H | 38 | #define _AUBIO_PITCHFCOMB_H |
| 39 | 39 | ||
| 40 | #ifdef __cplusplus | 40 | #ifdef __cplusplus |
| 41 | extern "C" { | 41 | extern "C" { |
| @@ -73,6 +73,4 @@ void del_aubio_pitchfcomb (aubio_pitchfcomb_t * p); · 31 unmodified lines | |||
| 73 | } | 73 | } |
| 74 | #endif | 74 | #endif |
| 75 | 75 | ||
| 76 | #endif /* _PITCHFCOMB_H */ | 76 | #endif /* _AUBIO_PITCHFCOMB_H */ |
| 77 | |||
| 78 | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org> | 2 | Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org> |
| 3 | 3 | ||
| 4 | This file is part of aubio. | 4 | This file is part of aubio. |
| 5 | 5 | ||
| @@ -35,8 +35,8 @@ · 29 unmodified lines | |||
| 35 | 35 | ||
| 36 | */ | 36 | */ |
| 37 | 37 | ||
| 38 | #ifndef PITCHMCOMB_H | 38 | #ifndef _AUBIO_PITCHMCOMB_H |
| 39 | #define PITCHMCOMB_H | 39 | #define _AUBIO_PITCHMCOMB_H |
| 40 | 40 | ||
| 41 | #ifdef __cplusplus | 41 | #ifdef __cplusplus |
| 42 | extern "C" { | 42 | extern "C" { |
| @@ -74,4 +74,4 @@ void del_aubio_pitchmcomb (aubio_pitchmcomb_t * p); · 31 unmodified lines | |||
| 74 | } | 74 | } |
| 75 | #endif | 75 | #endif |
| 76 | 76 | ||
| 77 | #endif /* PITCHMCOMB_H */ | 77 | #endif /* _AUBIO_PITCHMCOMB_H */ |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org> | 2 | Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org> |
| 3 | 3 | ||
| 4 | This file is part of aubio. | 4 | This file is part of aubio. |
| 5 | 5 | ||
| @@ -34,8 +34,8 @@ · 28 unmodified lines | |||
| 34 | 34 | ||
| 35 | */ | 35 | */ |
| 36 | 36 | ||
| 37 | #ifndef _PITCHSCHMITT_H | 37 | #ifndef _AUBIO_PITCHSCHMITT_H |
| 38 | #define _PITCHSCHMITT_H | 38 | #define _AUBIO_PITCHSCHMITT_H |
| 39 | 39 | ||
| 40 | #ifdef __cplusplus | 40 | #ifdef __cplusplus |
| 41 | extern "C" { | 41 | extern "C" { |
| @@ -72,5 +72,5 @@ void del_aubio_pitchschmitt (aubio_pitchschmitt_t * p); · 30 unmodified lines | |||
| 72 | } | 72 | } |
| 73 | #endif | 73 | #endif |
| 74 | 74 | ||
| 75 | #endif /* _PITCHSCHMITT_H */ | 75 | #endif /* _AUBIO_PITCHSCHMITT_H */ |
| 76 | 76 | ||
| @@ -38,8 +38,8 @@ · 37 unmodified lines | |||
| 38 | 38 | ||
| 39 | */ | 39 | */ |
| 40 | 40 | ||
| 41 | #ifndef AUBIO_PITCHSPECACF_H | 41 | #ifndef _AUBIO_PITCHSPECACF_H |
| 42 | #define AUBIO_PITCHSPECACF_H | 42 | #define _AUBIO_PITCHSPECACF_H |
| 43 | 43 | ||
| 44 | #ifdef __cplusplus | 44 | #ifdef __cplusplus |
| 45 | extern "C" { | 45 | extern "C" { |
| @@ -100,4 +100,4 @@ smpl_t aubio_pitchspecacf_get_confidence (aubio_pitchspecacf_t * o); · 54 unmodified lines | |||
| 100 | } | 100 | } |
| 101 | #endif | 101 | #endif |
| 102 | 102 | ||
| 103 | #endif /*AUBIO_PITCHSPECACF_H*/ | 103 | #endif /* _AUBIO_PITCHSPECACF_H */ |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org> | 2 | Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org> |
| 3 | 3 | ||
| 4 | This file is part of aubio. | 4 | This file is part of aubio. |
| 5 | 5 | ||
| @@ -34,8 +34,8 @@ · 28 unmodified lines | |||
| 34 | 34 | ||
| 35 | */ | 35 | */ |
| 36 | 36 | ||
| 37 | #ifndef PITCHYIN_H | 37 | #ifndef _AUBIO_PITCHYIN_H |
| 38 | #define PITCHYIN_H | 38 | #define _AUBIO_PITCHYIN_H |
| 39 | 39 | ||
| 40 | #ifdef __cplusplus | 40 | #ifdef __cplusplus |
| 41 | extern "C" { | 41 | extern "C" { |
| @@ -96,4 +96,4 @@ smpl_t aubio_pitchyin_get_confidence (aubio_pitchyin_t * o); · 54 unmodified lines | |||
| 96 | } | 96 | } |
| 97 | #endif | 97 | #endif |
| 98 | 98 | ||
| 99 | #endif /*PITCHYIN_H*/ | 99 | #endif /* _AUBIO_PITCHYIN_H */ |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org> | 2 | Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org> |
| 3 | 3 | ||
| 4 | This file is part of aubio. | 4 | This file is part of aubio. |
| 5 | 5 | ||
| @@ -35,8 +35,8 @@ · 29 unmodified lines | |||
| 35 | 35 | ||
| 36 | */ | 36 | */ |
| 37 | 37 | ||
| 38 | #ifndef PITCHYINFFT_H | 38 | #ifndef _AUBIO_PITCHYINFFT_H |
| 39 | #define PITCHYINFFT_H | 39 | #define _AUBIO_PITCHYINFFT_H |
| 40 | 40 | ||
| 41 | #ifdef __cplusplus | 41 | #ifdef __cplusplus |
| 42 | extern "C" { | 42 | extern "C" { |
| @@ -96,4 +96,4 @@ smpl_t aubio_pitchyinfft_get_confidence (aubio_pitchyinfft_t * o); · 53 unmodified lines | |||
| 96 | } | 96 | } |
| 97 | #endif | 97 | #endif |
| 98 | 98 | ||
| 99 | #endif /*PITCHYINFFT_H*/ | 99 | #endif /* _AUBIO_PITCHYINFFT_H */ |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org> | 2 | Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org> |
| 3 | 3 | ||
| 4 | This file is part of aubio. | 4 | This file is part of aubio. |
| 5 | 5 | ||
| @@ -22,12 +22,17 @@ · 16 unmodified lines | |||
| 22 | 22 | ||
| 23 | Fast Fourier Transform | 23 | Fast Fourier Transform |
| 24 | 24 | ||
| 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 | |||
| 25 | \example src/spectral/test-fft.c | 30 | \example src/spectral/test-fft.c |
| 26 | 31 | ||
| 27 | */ | 32 | */ |
| 28 | 33 | ||
| 29 | #ifndef FFT_H_ | 34 | #ifndef _AUBIO_FFT_H |
| 30 | #define FFT_H_ | 35 | #define _AUBIO_FFT_H |
| 31 | 36 | ||
| 32 | #ifdef __cplusplus | 37 | #ifdef __cplusplus |
| 33 | extern "C" { | 38 | extern "C" { |
| @@ -35,10 +40,7 @@ extern "C" { · 1 unmodified line | |||
| 35 | 40 | ||
| 36 | /** FFT object | 41 | /** FFT object |
| 37 | 42 | ||
| 38 | This object computes forward and backward FFTs, using the complex type to | 43 | This object computes forward and backward FFTs. |
| 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). | ||
| 42 | 44 | ||
| 43 | */ | 45 | */ |
| 44 | typedef struct _aubio_fft_t aubio_fft_t; | 46 | 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 | |||
| 139 | } | 141 | } |
| 140 | #endif | 142 | #endif |
| 141 | 143 | ||
| 142 | #endif // FFT_H_ | 144 | #endif /* _AUBIO_FFT_H */ |
| @@ -43,7 +43,7 @@ new_aubio_filterbank (uint_t n_filters, uint_t win_s) · 42 unmodified lines | |||
| 43 | fb->n_filters = n_filters; | 43 | fb->n_filters = n_filters; |
| 44 | 44 | ||
| 45 | /* allocate filter tables, a matrix of length win_s and of height n_filters */ | 45 | /* 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); |
| 47 | 47 | ||
| 48 | return fb; | 48 | return fb; |
| 49 | } | 49 | } |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | Copyright (C) 2007-2009 Paul Brossier <piem@aubio.org> | 2 | Copyright (C) 2007-2013 Paul Brossier <piem@aubio.org> |
| 3 | and Amaury Hazan <ahazan@iua.upf.edu> | 3 | and Amaury Hazan <ahazan@iua.upf.edu> |
| 4 | 4 | ||
| 5 | This file is part of aubio. | 5 | This file is part of aubio. |
| @@ -29,8 +29,8 @@ · 23 unmodified lines | |||
| 29 | 29 | ||
| 30 | */ | 30 | */ |
| 31 | 31 | ||
| 32 | #ifndef FILTERBANK_H | 32 | #ifndef _AUBIO_FILTERBANK_H |
| 33 | #define FILTERBANK_H | 33 | #define _AUBIO_FILTERBANK_H |
| 34 | 34 | ||
| 35 | #ifdef __cplusplus | 35 | #ifdef __cplusplus |
| 36 | extern "C" | 36 | extern "C" |
| @@ -87,4 +87,4 @@ uint_t aubio_filterbank_set_coeffs (aubio_filterbank_t * f, fmat_t * filters); · 50 unmodified lines | |||
| 87 | } | 87 | } |
| 88 | #endif | 88 | #endif |
| 89 | 89 | ||
| 90 | #endif // FILTERBANK_H | 90 | #endif /* _AUBIO_FILTERBANK_H */ |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | Copyright (C) 2007-2009 Paul Brossier <piem@aubio.org> | 2 | Copyright (C) 2007-2013 Paul Brossier <piem@aubio.org> |
| 3 | and Amaury Hazan <ahazan@iua.upf.edu> | 3 | and Amaury Hazan <ahazan@iua.upf.edu> |
| 4 | 4 | ||
| 5 | This file is part of aubio. | 5 | This file is part of aubio. |
| @@ -31,8 +31,8 @@ · 25 unmodified lines | |||
| 31 | 31 | ||
| 32 | */ | 32 | */ |
| 33 | 33 | ||
| 34 | #ifndef FILTERBANK_MEL_H | 34 | #ifndef _AUBIO_FILTERBANK_MEL_H |
| 35 | #define FILTERBANK_MEL_H | 35 | #define _AUBIO_FILTERBANK_MEL_H |
| 36 | 36 | ||
| 37 | #ifdef __cplusplus | 37 | #ifdef __cplusplus |
| 38 | extern "C" | 38 | extern "C" |
| @@ -69,4 +69,4 @@ uint_t aubio_filterbank_set_mel_coeffs_slaney (aubio_filterbank_t * fb, · 30 unmodified lines | |||
| 69 | } | 69 | } |
| 70 | #endif | 70 | #endif |
| 71 | 71 | ||
| 72 | #endif // FILTERBANK_MEL_H | 72 | #endif /* _AUBIO_FILTERBANK_MEL_H */ |
| @@ -66,7 +66,7 @@ new_aubio_mfcc (uint_t win_s, uint_t n_filters, uint_t n_coefs, · 65 unmodified lines | |||
| 66 | /* allocating buffers */ | 66 | /* allocating buffers */ |
| 67 | mfcc->in_dct = new_fvec (n_filters); | 67 | mfcc->in_dct = new_fvec (n_filters); |
| 68 | 68 | ||
| 69 | mfcc->dct_coeffs = new_fmat (n_coefs, n_filters); | 69 | mfcc->dct_coeffs = new_fmat (n_filters, n_coefs); |
| 70 | 70 | ||
| 71 | /* compute DCT transform dct_coeffs[i][j] as | 71 | /* compute DCT transform dct_coeffs[i][j] as |
| 72 | cos ( j * (i+.5) * PI / n_filters ) */ | 72 | cos ( j * (i+.5) * PI / n_filters ) */ |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | Copyright (C) 2007-2009 Paul Brossier <piem@aubio.org> | 2 | Copyright (C) 2007-2013 Paul Brossier <piem@aubio.org> |
| 3 | and Amaury Hazan <ahazan@iua.upf.edu> | 3 | and Amaury Hazan <ahazan@iua.upf.edu> |
| 4 | 4 | ||
| 5 | This file is part of aubio. | 5 | This file is part of aubio. |
| @@ -27,8 +27,8 @@ · 21 unmodified lines | |||
| 27 | 27 | ||
| 28 | */ | 28 | */ |
| 29 | 29 | ||
| 30 | #ifndef MFCC_H | 30 | #ifndef _AUBIO_MFCC_H |
| 31 | #define MFCC_H | 31 | #define _AUBIO_MFCC_H |
| 32 | 32 | ||
| 33 | #ifdef __cplusplus | 33 | #ifdef __cplusplus |
| 34 | extern "C" | 34 | extern "C" |
| @@ -69,4 +69,4 @@ void aubio_mfcc_do (aubio_mfcc_t * mf, cvec_t * in, fvec_t * out); · 34 unmodified lines | |||
| 69 | } | 69 | } |
| 70 | #endif | 70 | #endif |
| 71 | 71 | ||
| 72 | #endif // MFCC_H | 72 | #endif /* _AUBIO_MFCC_H */ |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org> | 2 | Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org> |
| 3 | 3 | ||
| 4 | This file is part of aubio. | 4 | This file is part of aubio. |
| 5 | 5 | ||
| @@ -31,8 +31,8 @@ · 25 unmodified lines | |||
| 31 | 31 | ||
| 32 | */ | 32 | */ |
| 33 | 33 | ||
| 34 | #ifndef _PHASEVOC_H | 34 | #ifndef _AUBIO_PHASEVOC_H |
| 35 | #define _PHASEVOC_H | 35 | #define _AUBIO_PHASEVOC_H |
| 36 | 36 | ||
| 37 | #ifdef __cplusplus | 37 | #ifdef __cplusplus |
| 38 | extern "C" { | 38 | extern "C" { |
| @@ -99,4 +99,4 @@ uint_t aubio_pvoc_get_hop(aubio_pvoc_t* pv); · 60 unmodified lines | |||
| 99 | } | 99 | } |
| 100 | #endif | 100 | #endif |
| 101 | 101 | ||
| 102 | #endif | 102 | #endif /* _AUBIO_PHASEVOC_H */ |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org> | 2 | Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org> |
| 3 | 3 | ||
| 4 | This file is part of aubio. | 4 | This file is part of aubio. |
| 5 | 5 | ||
| @@ -19,13 +19,13 @@ · 13 unmodified lines | |||
| 19 | */ | 19 | */ |
| 20 | 20 | ||
| 21 | /** \file | 21 | /** \file |
| 22 | 22 | ||
| 23 | Spectral description functions | 23 | Spectral description functions |
| 24 | 24 | ||
| 25 | All of the following spectral description functions take as arguments the FFT | 25 | All of the following spectral description functions take as arguments the FFT |
| 26 | of a windowed signal (as created with aubio_pvoc). They output one smpl_t per | 26 | of a windowed signal (as created with aubio_pvoc). They output one smpl_t per |
| 27 | buffer (stored in a vector of size [1]). | 27 | buffer (stored in a vector of size [1]). |
| 28 | 28 | ||
| 29 | \section specdesc Spectral description functions | 29 | \section specdesc Spectral description functions |
| 30 | 30 | ||
| 31 | A list of the spectral description methods currently available follows. | 31 | A list of the spectral description methods currently available follows. |
| @@ -34,54 +34,54 @@ · 2 unmodified lines | |||
| 34 | 34 | ||
| 35 | These functions are designed to raise at notes attacks in music signals. | 35 | These functions are designed to raise at notes attacks in music signals. |
| 36 | 36 | ||
| 37 | \b \p energy : Energy based onset detection function | 37 | \b \p energy : Energy based onset detection function |
| 38 | 38 | ||
| 39 | This function calculates the local energy of the input spectral frame. | 39 | This function calculates the local energy of the input spectral frame. |
| 40 | 40 | ||
| 41 | \b \p hfc : High Frequency Content onset detection function | 41 | \b \p hfc : High Frequency Content onset detection function |
| 42 | 42 | ||
| 43 | This method computes the High Frequency Content (HFC) of the input spectral | 43 | This method computes the High Frequency Content (HFC) of the input spectral |
| 44 | frame. The resulting function is efficient at detecting percussive onsets. | 44 | frame. The resulting function is efficient at detecting percussive onsets. |
| 45 | 45 | ||
| 46 | Paul Masri. Computer modeling of Sound for Transformation and Synthesis of | 46 | Paul Masri. Computer modeling of Sound for Transformation and Synthesis of |
| 47 | Musical Signal. PhD dissertation, University of Bristol, UK, 1996. | 47 | Musical Signal. PhD dissertation, University of Bristol, UK, 1996. |
| 48 | 48 | ||
| 49 | \b \p complex : Complex Domain Method onset detection function | 49 | \b \p complex : Complex Domain Method onset detection function |
| 50 | 50 | ||
| 51 | Christopher Duxbury, Mike E. Davies, and Mark B. Sandler. Complex domain | 51 | Christopher Duxbury, Mike E. Davies, and Mark B. Sandler. Complex domain |
| 52 | onset detection for musical signals. In Proceedings of the Digital Audio | 52 | onset detection for musical signals. In Proceedings of the Digital Audio |
| 53 | Effects Conference, DAFx-03, pages 90-93, London, UK, 2003. | 53 | Effects Conference, DAFx-03, pages 90-93, London, UK, 2003. |
| 54 | 54 | ||
| 55 | \b \p phase : Phase Based Method onset detection function | 55 | \b \p phase : Phase Based Method onset detection function |
| 56 | 56 | ||
| 57 | Juan-Pablo Bello, Mike P. Davies, and Mark B. Sandler. Phase-based note onset | 57 | Juan-Pablo Bello, Mike P. Davies, and Mark B. Sandler. Phase-based note onset |
| 58 | detection for music signals. In Proceedings of the IEEE International | 58 | detection for music signals. In Proceedings of the IEEE International |
| 59 | Conference on Acoustics Speech and Signal Processing, pages 441444, | 59 | Conference on Acoustics Speech and Signal Processing, pages 441444, |
| 60 | Hong-Kong, 2003. | 60 | Hong-Kong, 2003. |
| 61 | 61 | ||
| 62 | \b \p specdiff : Spectral difference method onset detection function | 62 | \b \p specdiff : Spectral difference method onset detection function |
| 63 | 63 | ||
| 64 | Jonhatan Foote and Shingo Uchihashi. The beat spectrum: a new approach to | 64 | Jonhatan Foote and Shingo Uchihashi. The beat spectrum: a new approach to |
| 65 | rhythm analysis. In IEEE International Conference on Multimedia and Expo | 65 | rhythm analysis. In IEEE International Conference on Multimedia and Expo |
| 66 | (ICME 2001), pages 881884, Tokyo, Japan, August 2001. | 66 | (ICME 2001), pages 881884, Tokyo, Japan, August 2001. |
| 67 | 67 | ||
| 68 | \b \p kl : Kullback-Liebler onset detection function | 68 | \b \p kl : Kullback-Liebler onset detection function |
| 69 | 69 | ||
| 70 | Stephen Hainsworth and Malcom Macleod. Onset detection in music audio | 70 | Stephen Hainsworth and Malcom Macleod. Onset detection in music audio |
| 71 | signals. In Proceedings of the International Computer Music Conference | 71 | signals. In Proceedings of the International Computer Music Conference |
| 72 | (ICMC), Singapore, 2003. | 72 | (ICMC), Singapore, 2003. |
| 73 | 73 | ||
| 74 | \b \p mkl : Modified Kullback-Liebler onset detection function | 74 | \b \p mkl : Modified Kullback-Liebler onset detection function |
| 75 | 75 | ||
| 76 | Paul Brossier, ``Automatic annotation of musical audio for interactive | 76 | Paul Brossier, ``Automatic annotation of musical audio for interactive |
| 77 | systems'', Chapter 2, Temporal segmentation, PhD thesis, Centre for Digital | 77 | systems'', Chapter 2, Temporal segmentation, PhD thesis, Centre for Digital |
| 78 | music, Queen Mary University of London, London, UK, 2006. | 78 | music, Queen Mary University of London, London, UK, 2006. |
| 79 | 79 | ||
| 80 | \b \p specflux : Spectral Flux | 80 | \b \p specflux : Spectral Flux |
| 81 | 81 | ||
| 82 | Simon Dixon, Onset Detection Revisited, in ``Proceedings of the 9th | 82 | Simon Dixon, Onset Detection Revisited, in ``Proceedings of the 9th |
| 83 | International Conference on Digital Audio Effects'' (DAFx-06), Montreal, | 83 | International Conference on Digital Audio Effects'' (DAFx-06), Montreal, |
| 84 | Canada, 2006. | 84 | Canada, 2006. |
| 85 | 85 | ||
| 86 | \subsection shapedesc Spectral shape descriptors | 86 | \subsection shapedesc Spectral shape descriptors |
| 87 | 87 | ||
| @@ -92,14 +92,14 @@ · 4 unmodified lines | |||
| 92 | Project Report 2004 (<a | 92 | Project Report 2004 (<a |
| 93 | href="http://www.ircam.fr/anasyn/peeters/ARTICLES/Peeters_2003_cuidadoaudiofeatures.pdf">pdf</a>) | 93 | href="http://www.ircam.fr/anasyn/peeters/ARTICLES/Peeters_2003_cuidadoaudiofeatures.pdf">pdf</a>) |
| 94 | 94 | ||
| 95 | \b \p centroid : Spectral centroid | 95 | \b \p centroid : Spectral centroid |
| 96 | 96 | ||
| 97 | The spectral centroid represents the barycenter of the spectrum. | 97 | The spectral centroid represents the barycenter of the spectrum. |
| 98 | 98 | ||
| 99 | \e Note: This function returns the result in bin. To get the spectral | 99 | \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. |
| 101 | 101 | ||
| 102 | \b \p spread : Spectral spread | 102 | \b \p spread : Spectral spread |
| 103 | 103 | ||
| 104 | The spectral spread is the variance of the spectral distribution around its | 104 | The spectral spread is the variance of the spectral distribution around its |
| 105 | centroid. | 105 | centroid. |
| @@ -125,14 +125,14 @@ · 19 unmodified lines | |||
| 125 | See also <a href="http://en.wikipedia.org/wiki/Kurtosis">Kurtosis</a> on | 125 | See also <a href="http://en.wikipedia.org/wiki/Kurtosis">Kurtosis</a> on |
| 126 | Wikipedia. | 126 | Wikipedia. |
| 127 | 127 | ||
| 128 | \b \p slope : Spectral slope | 128 | \b \p slope : Spectral slope |
| 129 | 129 | ||
| 130 | The spectral slope represents decreasing rate of the spectral amplitude, | 130 | The spectral slope represents decreasing rate of the spectral amplitude, |
| 131 | computed using a linear regression. | 131 | computed using a linear regression. |
| 132 | 132 | ||
| 133 | \b \p decrease : Spectral decrease | 133 | \b \p decrease : Spectral decrease |
| 134 | 134 | ||
| 135 | The spectral decrease is another representation of the decreasing rate, | 135 | The spectral decrease is another representation of the decreasing rate, |
| 136 | based on perceptual criteria. | 136 | based on perceptual criteria. |
| 137 | 137 | ||
| 138 | \b \p rolloff : Spectral roll-off | 138 | \b \p rolloff : Spectral roll-off |
| @@ -145,8 +145,8 @@ · 6 unmodified lines | |||
| 145 | */ | 145 | */ |
| 146 | 146 | ||
| 147 | 147 | ||
| 148 | #ifndef ONSETDETECTION_H | 148 | #ifndef _AUBIO_SPECDESC_H |
| 149 | #define ONSETDETECTION_H | 149 | #define _AUBIO_SPECDESC_H |
| 150 | 150 | ||
| 151 | #ifdef __cplusplus | 151 | #ifdef __cplusplus |
| 152 | extern "C" { | 152 | extern "C" { |
| @@ -155,10 +155,10 @@ extern "C" { · 2 unmodified lines | |||
| 155 | /** spectral description structure */ | 155 | /** spectral description structure */ |
| 156 | typedef struct _aubio_specdesc_t aubio_specdesc_t; | 156 | typedef struct _aubio_specdesc_t aubio_specdesc_t; |
| 157 | 157 | ||
| 158 | /** execute spectral description function on a spectral frame | 158 | /** execute spectral description function on a spectral frame |
| 159 | 159 | ||
| 160 | Generic function to compute spectral detescription. | 160 | Generic function to compute spectral detescription. |
| 161 | 161 | ||
| 162 | \param o spectral description object as returned by new_aubio_specdesc() | 162 | \param o spectral description object as returned by new_aubio_specdesc() |
| 163 | \param fftgrain input signal spectrum as computed by aubio_pvoc_do | 163 | \param fftgrain input signal spectrum as computed by aubio_pvoc_do |
| 164 | \param desc output vector (one sample long, to send to the peak picking) | 164 | \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 | |||
| 167 | void aubio_specdesc_do (aubio_specdesc_t * o, cvec_t * fftgrain, | 167 | void aubio_specdesc_do (aubio_specdesc_t * o, cvec_t * fftgrain, |
| 168 | fvec_t * desc); | 168 | fvec_t * desc); |
| 169 | 169 | ||
| 170 | /** creation of a spectral description object | 170 | /** creation of a spectral description object |
| 171 | 171 | ||
| 172 | \param method spectral description method | 172 | \param method spectral description method |
| 173 | \param buf_size length of the input spectrum frame | 173 | \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 | |||
| 180 | */ | 180 | */ |
| 181 | aubio_specdesc_t *new_aubio_specdesc (char_t * method, uint_t buf_size); | 181 | aubio_specdesc_t *new_aubio_specdesc (char_t * method, uint_t buf_size); |
| 182 | 182 | ||
| 183 | /** deletion of a spectral descriptor | 183 | /** deletion of a spectral descriptor |
| 184 | 184 | ||
| 185 | \param o spectral descriptor object as returned by new_aubio_specdesc() | 185 | \param o spectral descriptor object as returned by new_aubio_specdesc() |
| 186 | 186 | ||
| @@ -191,4 +191,4 @@ void del_aubio_specdesc (aubio_specdesc_t * o); · 4 unmodified lines | |||
| 191 | } | 191 | } |
| 192 | #endif | 192 | #endif |
| 193 | 193 | ||
| 194 | #endif /* ONSETDETECTION_H */ | 194 | #endif /* _AUBIO_SPECDESC_H */ |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org> | 2 | Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org> |
| 3 | 3 | ||
| 4 | This file is part of aubio. | 4 | This file is part of aubio. |
| 5 | 5 | ||
| @@ -36,8 +36,8 @@ · 30 unmodified lines | |||
| 36 | 36 | ||
| 37 | */ | 37 | */ |
| 38 | 38 | ||
| 39 | #ifndef TSS_H | 39 | #ifndef _AUBIO_TSS_H |
| 40 | #define TSS_H | 40 | #define _AUBIO_TSS_H |
| 41 | 41 | ||
| 42 | #ifdef __cplusplus | 42 | #ifdef __cplusplus |
| 43 | extern "C" { | 43 | extern "C" { |
| @@ -100,4 +100,4 @@ uint_t aubio_tss_set_beta (aubio_tss_t * o, smpl_t beta); · 56 unmodified lines | |||
| 100 | } | 100 | } |
| 101 | #endif | 101 | #endif |
| 102 | 102 | ||
| 103 | #endif /*TSS_H*/ | 103 | #endif /* _AUBIO_TSS_H */ |
| @@ -42,7 +42,7 @@ aubio_sampler_t *new_aubio_sampler(uint_t samplerate, uint_t blocksize) · 41 unmodified lines | |||
| 42 | s->samplerate = samplerate; | 42 | s->samplerate = samplerate; |
| 43 | s->blocksize = blocksize; | 43 | s->blocksize = blocksize; |
| 44 | s->source_output = new_fvec(blocksize); | 44 | s->source_output = new_fvec(blocksize); |
| 45 | s->source_output_multi = new_fmat(blocksize, 4); | 45 | s->source_output_multi = new_fmat(4, blocksize); |
| 46 | s->source = NULL; | 46 | s->source = NULL; |
| 47 | s->playing = 0; | 47 | s->playing = 0; |
| 48 | return s; | 48 | return s; |
| @@ -18,8 +18,8 @@ · 17 unmodified lines | |||
| 18 | 18 | ||
| 19 | */ | 19 | */ |
| 20 | 20 | ||
| 21 | #ifndef _AUBIO_SYNTH_SAMPLER_H | 21 | #ifndef _AUBIO_SAMPLER_H |
| 22 | #define _AUBIO_SYNTH_SAMPLER_H | 22 | #define _AUBIO_SAMPLER_H |
| 23 | 23 | ||
| 24 | /** \file | 24 | /** \file |
| 25 | 25 | ||
| @@ -137,4 +137,4 @@ void del_aubio_sampler( aubio_sampler_t * o ); · 111 unmodified lines | |||
| 137 | } | 137 | } |
| 138 | #endif | 138 | #endif |
| 139 | 139 | ||
| 140 | #endif /* _AUBIO_SYNTH_SAMPLER_H */ | 140 | #endif /* _AUBIO_SAMPLER_H */ |
| @@ -97,7 +97,7 @@ void aubio_wavetable_do ( aubio_wavetable_t * s, fvec_t * input, fvec_t * output · 96 unmodified lines | |||
| 97 | aubio_parameter_get_next_value ( s->freq ); | 97 | aubio_parameter_get_next_value ( s->freq ); |
| 98 | aubio_parameter_get_next_value ( s->amp ); | 98 | aubio_parameter_get_next_value ( s->amp ); |
| 99 | } | 99 | } |
| 100 | fvec_set(output, 0.); | 100 | fvec_zeros (output); |
| 101 | } | 101 | } |
| 102 | // add input to output if needed | 102 | // add input to output if needed |
| 103 | if (input && input != output) { | 103 | 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 | |||
| 130 | aubio_parameter_get_next_value ( s->freq ); | 130 | aubio_parameter_get_next_value ( s->freq ); |
| 131 | aubio_parameter_get_next_value ( s->amp ); | 131 | aubio_parameter_get_next_value ( s->amp ); |
| 132 | } | 132 | } |
| 133 | fmat_set(output, 0.); | 133 | fmat_zeros (output); |
| 134 | } | 134 | } |
| 135 | // add output to input if needed | 135 | // add output to input if needed |
| 136 | if (input && input != output) { | 136 | if (input && input != output) { |
| @@ -18,8 +18,8 @@ · 17 unmodified lines | |||
| 18 | 18 | ||
| 19 | */ | 19 | */ |
| 20 | 20 | ||
| 21 | #ifndef _AUBIO_SYNTH_WAVETABLE_H | 21 | #ifndef _AUBIO_WAVETABLE_H |
| 22 | #define _AUBIO_SYNTH_WAVETABLE_H | 22 | #define _AUBIO_WAVETABLE_H |
| 23 | 23 | ||
| 24 | /** \file | 24 | /** \file |
| 25 | 25 | ||
| @@ -175,4 +175,4 @@ void del_aubio_wavetable( aubio_wavetable_t * o ); · 149 unmodified lines | |||
| 175 | } | 175 | } |
| 176 | #endif | 176 | #endif |
| 177 | 177 | ||
| 178 | #endif /* _AUBIO_SYNTH_WAVETABLE_H */ | 178 | #endif /* _AUBIO_WAVETABLE_H */ |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 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> |
| 3 | 3 | ||
| 4 | This file is part of aubio. | 4 | This file is part of aubio. |
| 5 | 5 | ||
| @@ -36,8 +36,8 @@ · 30 unmodified lines | |||
| 36 | \example tempo/test-beattracking.c | 36 | \example tempo/test-beattracking.c |
| 37 | 37 | ||
| 38 | */ | 38 | */ |
| 39 | #ifndef BEATTRACKING_H | 39 | #ifndef _AUBIO_BEATTRACKING_H |
| 40 | #define BEATTRACKING_H | 40 | #define _AUBIO_BEATTRACKING_H |
| 41 | 41 | ||
| 42 | #ifdef __cplusplus | 42 | #ifdef __cplusplus |
| 43 | extern "C" { | 43 | extern "C" { |
| @@ -98,4 +98,4 @@ void del_aubio_beattracking(aubio_beattracking_t * p); · 54 unmodified lines | |||
| 98 | } | 98 | } |
| 99 | #endif | 99 | #endif |
| 100 | 100 | ||
| 101 | #endif /* BEATTRACKING_H */ | 101 | #endif /* _AUBIO_BEATTRACKING_H */ |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | Copyright (C) 2006-2009 Paul Brossier <piem@aubio.org> | 2 | Copyright (C) 2006-2013 Paul Brossier <piem@aubio.org> |
| 3 | 3 | ||
| 4 | This file is part of aubio. | 4 | This file is part of aubio. |
| 5 | 5 | ||
| @@ -30,8 +30,8 @@ · 24 unmodified lines | |||
| 30 | 30 | ||
| 31 | */ | 31 | */ |
| 32 | 32 | ||
| 33 | #ifndef TEMPO_H | 33 | #ifndef _AUBIO_TEMPO_H |
| 34 | #define TEMPO_H | 34 | #define _AUBIO_TEMPO_H |
| 35 | 35 | ||
| 36 | #ifdef __cplusplus | 36 | #ifdef __cplusplus |
| 37 | extern "C" { | 37 | extern "C" { |
| @@ -133,4 +133,4 @@ void del_aubio_tempo(aubio_tempo_t * o); · 95 unmodified lines | |||
| 133 | } | 133 | } |
| 134 | #endif | 134 | #endif |
| 135 | 135 | ||
| 136 | #endif /* TEMPO_H */ | 136 | #endif /* _AUBIO_TEMPO_H */ |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org> | 2 | Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org> |
| 3 | 3 | ||
| 4 | This file is part of aubio. | 4 | This file is part of aubio. |
| 5 | 5 | ||
| @@ -18,8 +18,8 @@ · 12 unmodified lines | |||
| 18 | 18 | ||
| 19 | */ | 19 | */ |
| 20 | 20 | ||
| 21 | #ifndef _ADESIGN_H | 21 | #ifndef _AUBIO_FILTER_A_DESIGN_H |
| 22 | #define _ADESIGN_H | 22 | #define _AUBIO_FILTER_A_DESIGN_H |
| 23 | 23 | ||
| 24 | /** \file | 24 | /** \file |
| 25 | 25 | ||
| @@ -85,4 +85,4 @@ uint_t aubio_filter_set_a_weighting (aubio_filter_t * f, uint_t samplerate); · 59 unmodified lines | |||
| 85 | } | 85 | } |
| 86 | #endif | 86 | #endif |
| 87 | 87 | ||
| 88 | #endif /* _ADESIGN_H */ | 88 | #endif /* _AUBIO_FILTER_A_DESIGN_H */ |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org> | 2 | Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org> |
| 3 | 3 | ||
| 4 | This file is part of aubio. | 4 | This file is part of aubio. |
| 5 | 5 | ||
| @@ -18,8 +18,8 @@ · 12 unmodified lines | |||
| 18 | 18 | ||
| 19 | */ | 19 | */ |
| 20 | 20 | ||
| 21 | #ifndef BIQUAD_H | 21 | #ifndef _AUBIO_FILTER_BIQUAD_H |
| 22 | #define BIQUAD_H | 22 | #define _AUBIO_FILTER_BIQUAD_H |
| 23 | 23 | ||
| 24 | /** \file | 24 | /** \file |
| 25 | 25 | ||
| @@ -72,4 +72,4 @@ aubio_filter_t *new_aubio_filter_biquad (lsmp_t b0, lsmp_t b1, lsmp_t b2, · 46 unmodified lines | |||
| 72 | } | 72 | } |
| 73 | #endif | 73 | #endif |
| 74 | 74 | ||
| 75 | #endif /*BIQUAD_H*/ | 75 | #endif /* _AUBIO_FILTER_BIQUAD_H */ |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org> | 2 | Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org> |
| 3 | 3 | ||
| 4 | This file is part of aubio. | 4 | This file is part of aubio. |
| 5 | 5 | ||
| @@ -18,8 +18,8 @@ · 12 unmodified lines | |||
| 18 | 18 | ||
| 19 | */ | 19 | */ |
| 20 | 20 | ||
| 21 | #ifndef _CDESIGN_H | 21 | #ifndef _AUBIO_FILTER_C_DESIGN_H |
| 22 | #define _CDESIGN_H | 22 | #define _AUBIO_FILTER_C_DESIGN_H |
| 23 | 23 | ||
| 24 | /** \file | 24 | /** \file |
| 25 | 25 | ||
| @@ -85,4 +85,4 @@ uint_t aubio_filter_set_c_weighting (aubio_filter_t * f, uint_t samplerate); · 59 unmodified lines | |||
| 85 | } | 85 | } |
| 86 | #endif | 86 | #endif |
| 87 | 87 | ||
| 88 | #endif /* _CDESIGN_H */ | 88 | #endif /* _AUBIO_FILTER_C_DESIGN_H */ |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org> | 2 | Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org> |
| 3 | 3 | ||
| 4 | This file is part of aubio. | 4 | This file is part of aubio. |
| 5 | 5 | ||
| @@ -18,8 +18,8 @@ · 12 unmodified lines | |||
| 18 | 18 | ||
| 19 | */ | 19 | */ |
| 20 | 20 | ||
| 21 | #ifndef FILTER_H | 21 | #ifndef _AUBIO_FILTER_H |
| 22 | #define FILTER_H | 22 | #define _AUBIO_FILTER_H |
| 23 | 23 | ||
| 24 | /** \file | 24 | /** \file |
| 25 | 25 | ||
| @@ -173,4 +173,4 @@ void del_aubio_filter (aubio_filter_t * f); · 147 unmodified lines | |||
| 173 | } | 173 | } |
| 174 | #endif | 174 | #endif |
| 175 | 175 | ||
| 176 | #endif /*FILTER_H*/ | 176 | #endif /* _AUBIO_FILTER_H */ |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org> | 2 | Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org> |
| 3 | 3 | ||
| 4 | This file is part of aubio. | 4 | This file is part of aubio. |
| 5 | 5 | ||
| @@ -18,8 +18,8 @@ · 12 unmodified lines | |||
| 18 | 18 | ||
| 19 | */ | 19 | */ |
| 20 | 20 | ||
| 21 | #ifndef _RESAMPLE_H | 21 | #ifndef _AUBIO_RESAMPLER_H |
| 22 | #define _RESAMPLE_H | 22 | #define _AUBIO_RESAMPLER_H |
| 23 | 23 | ||
| 24 | /** \file | 24 | /** \file |
| 25 | 25 | ||
| @@ -62,4 +62,4 @@ void aubio_resampler_do (aubio_resampler_t * s, fvec_t * input, · 36 unmodified lines | |||
| 62 | } | 62 | } |
| 63 | #endif | 63 | #endif |
| 64 | 64 | ||
| 65 | #endif /* _RESAMPLE_H */ | 65 | #endif /* _AUBIO_RESAMPLER_H */ |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org> | 2 | Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org> |
| 3 | 3 | ||
| 4 | This file is part of aubio. | 4 | This file is part of aubio. |
| 5 | 5 | ||
| @@ -18,8 +18,8 @@ · 12 unmodified lines | |||
| 18 | 18 | ||
| 19 | */ | 19 | */ |
| 20 | 20 | ||
| 21 | #ifndef AUBIO_TYPES_H | 21 | #ifndef _AUBIO__TYPES_H |
| 22 | #define AUBIO_TYPES_H | 22 | #define _AUBIO__TYPES_H |
| 23 | 23 | ||
| 24 | /** \file | 24 | /** \file |
| 25 | 25 | ||
| @@ -67,4 +67,4 @@ typedef char char_t; · 41 unmodified lines | |||
| 67 | } | 67 | } |
| 68 | #endif | 68 | #endif |
| 69 | 69 | ||
| 70 | #endif/*AUBIO_TYPES_H*/ | 70 | #endif /* _AUBIO__TYPES_H */ |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org> | 2 | Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org> |
| 3 | 3 | ||
| 4 | This file is part of aubio. | 4 | This file is part of aubio. |
| 5 | 5 | ||
| @@ -25,8 +25,8 @@ · 19 unmodified lines | |||
| 25 | * Big hacks to implement an histogram | 25 | * Big hacks to implement an histogram |
| 26 | */ | 26 | */ |
| 27 | 27 | ||
| 28 | #ifndef HIST_H | 28 | #ifndef _AUBIO_HIST_H |
| 29 | #define HIST_H | 29 | #define _AUBIO_HIST_H |
| 30 | 30 | ||
| 31 | #ifdef __cplusplus | 31 | #ifdef __cplusplus |
| 32 | extern "C" { | 32 | extern "C" { |
| @@ -60,4 +60,4 @@ void aubio_hist_dyn_notnull (aubio_hist_t *s, fvec_t *input); · 27 unmodified lines | |||
| 60 | } | 60 | } |
| 61 | #endif | 61 | #endif |
| 62 | 62 | ||
| 63 | #endif | 63 | #endif /* _AUBIO_HIST_H */ |
| @@ -157,4 +157,3 @@ void del_aubio_parameter( aubio_parameter_t * param ); · 156 unmodified lines | |||
| 157 | #endif | 157 | #endif |
| 158 | 158 | ||
| 159 | #endif /* _AUBIO_PARAMETER_H */ | 159 | #endif /* _AUBIO_PARAMETER_H */ |
| 160 | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org> | 2 | Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org> |
| 3 | 3 | ||
| 4 | This file is part of aubio. | 4 | This file is part of aubio. |
| 5 | 5 | ||
| @@ -28,8 +28,8 @@ · 22 unmodified lines | |||
| 28 | \f$ y = (x - ilow)*(ohig-olow)/(ihig-ilow) + olow \f$ | 28 | \f$ y = (x - ilow)*(ohig-olow)/(ihig-ilow) + olow \f$ |
| 29 | 29 | ||
| 30 | */ | 30 | */ |
| 31 | #ifndef SCALE_H | 31 | #ifndef _AUBIO_SCALE_H |
| 32 | #define SCALE_H | 32 | #define _AUBIO_SCALE_H |
| 33 | 33 | ||
| 34 | #ifdef __cplusplus | 34 | #ifdef __cplusplus |
| 35 | extern "C" { | 35 | 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 | |||
| 77 | } | 77 | } |
| 78 | #endif | 78 | #endif |
| 79 | 79 | ||
| 80 | #endif | 80 | #endif /* _AUBIO_SCALE_H */ |
| @@ -14,22 +14,20 @@ void TYPE ## _ ## OPNAME (TYPE ## _t *o) \ · 13 unmodified lines | |||
| 14 | } \ | 14 | } \ |
| 15 | } | 15 | } |
| 16 | 16 | ||
| 17 | #define AUBIO_OP_C_AND_F(OPNAME, OP) \ | 17 | #define AUBIO_OP_C(OPNAME, OP) \ |
| 18 | AUBIO_OP(OPNAME, OP, fvec, data) \ | 18 | AUBIO_OP(OPNAME, OP, fvec, data) |
| 19 | AUBIO_OP(OPNAME, OP, cvec, norm) | ||
| 20 | 19 | ||
| 21 | AUBIO_OP_C_AND_F(exp, EXP) | 20 | AUBIO_OP_C(exp, EXP) |
| 22 | AUBIO_OP_C_AND_F(cos, COS) | 21 | AUBIO_OP_C(cos, COS) |
| 23 | AUBIO_OP_C_AND_F(sin, SIN) | 22 | AUBIO_OP_C(sin, SIN) |
| 24 | AUBIO_OP_C_AND_F(abs, ABS) | 23 | AUBIO_OP_C(abs, ABS) |
| 25 | AUBIO_OP_C_AND_F(sqrt, SQRT) | 24 | AUBIO_OP_C(sqrt, SQRT) |
| 26 | AUBIO_OP_C_AND_F(log10, SAFE_LOG10) | 25 | AUBIO_OP_C(log10, SAFE_LOG10) |
| 27 | AUBIO_OP_C_AND_F(log, SAFE_LOG) | 26 | AUBIO_OP_C(log, SAFE_LOG) |
| 28 | AUBIO_OP_C_AND_F(floor, FLOOR) | 27 | AUBIO_OP_C(floor, FLOOR) |
| 29 | AUBIO_OP_C_AND_F(ceil, CEIL) | 28 | AUBIO_OP_C(ceil, CEIL) |
| 30 | AUBIO_OP_C_AND_F(round, ROUND) | 29 | AUBIO_OP_C(round, ROUND) |
| 31 | 30 | ||
| 32 | //AUBIO_OP_C_AND_F(pow, POW) | ||
| 33 | void fvec_pow (fvec_t *s, smpl_t power) | 31 | void fvec_pow (fvec_t *s, smpl_t power) |
| 34 | { | 32 | { |
| 35 | uint_t j; | 33 | uint_t j; |
| @@ -37,12 +35,3 @@ void fvec_pow (fvec_t *s, smpl_t power) · 1 unmodified line | |||
| 37 | s->data[j] = POW(s->data[j], power); | 35 | s->data[j] = POW(s->data[j], power); |
| 38 | } | 36 | } |
| 39 | } | 37 | } |
| 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 | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | Copyright (C) 2009 Paul Brossier <piem@aubio.org> | 2 | Copyright (C) 2009-2013 Paul Brossier <piem@aubio.org> |
| 3 | 3 | ||
| 4 | This file is part of aubio. | 4 | This file is part of aubio. |
| 5 | 5 | ||
| @@ -20,12 +20,12 @@ · 14 unmodified lines | |||
| 20 | 20 | ||
| 21 | /** \file | 21 | /** \file |
| 22 | 22 | ||
| 23 | Utility functions for ::fvec_t and ::cvec_t objects | 23 | Utility functions for ::fvec_t |
| 24 | 24 | ||
| 25 | */ | 25 | */ |
| 26 | 26 | ||
| 27 | #ifndef _VECUTILS_H | 27 | #ifndef _AUBIO__VECUTILS_H |
| 28 | #define _VECUTILS_H | 28 | #define _AUBIO__VECUTILS_H |
| 29 | 29 | ||
| 30 | #ifdef __cplusplus | 30 | #ifdef __cplusplus |
| 31 | extern "C" { | 31 | extern "C" { |
| @@ -109,86 +109,8 @@ void fvec_round (fvec_t *s); · 77 unmodified lines | |||
| 109 | */ | 109 | */ |
| 110 | void fvec_pow (fvec_t *s, smpl_t pow); | 110 | void fvec_pow (fvec_t *s, smpl_t pow); |
| 111 | 111 | ||
| 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 | |||
| 190 | #ifdef __cplusplus | 112 | #ifdef __cplusplus |
| 191 | } | 113 | } |
| 192 | #endif | 114 | #endif |
| 193 | 115 | ||
| 194 | #endif /*_VECUTILS_H*/ | 116 | #endif /* _AUBIO__VECUTILS_H */ |
| @@ -9,7 +9,6 @@ uselib += ['AVCODEC'] · 8 unmodified lines | |||
| 9 | uselib += ['AVFORMAT'] | 9 | uselib += ['AVFORMAT'] |
| 10 | uselib += ['AVRESAMPLE'] | 10 | uselib += ['AVRESAMPLE'] |
| 11 | uselib += ['AVUTIL'] | 11 | uselib += ['AVUTIL'] |
| 12 | uselib += ['JACK'] | ||
| 13 | 12 | ||
| 14 | ctx(features = 'c', | 13 | ctx(features = 'c', |
| 15 | source = source, | 14 | source = source, |
| @@ -21,12 +20,15 @@ ctx(features = 'c', · 5 unmodified lines | |||
| 21 | # build libaubio.so (cshlib) and/or libaubio.a (cstlib) | 20 | # build libaubio.so (cshlib) and/or libaubio.a (cstlib) |
| 22 | if ctx.env['DEST_OS'] in ['ios', 'iosimulator']: | 21 | if ctx.env['DEST_OS'] in ['ios', 'iosimulator']: |
| 23 | build_features = ['cstlib'] | 22 | build_features = ['cstlib'] |
| 23 | elif ctx.env['DEST_OS'] in ['win32', 'win64']: | ||
| 24 | build_features = ['cshlib'] | ||
| 24 | else: #linux, darwin, android, mingw, ... | 25 | else: #linux, darwin, android, mingw, ... |
| 25 | build_features = ['cshlib', 'cstlib'] | 26 | build_features = ['cshlib', 'cstlib'] |
| 26 | 27 | ||
| 27 | for target in build_features: | 28 | for target in build_features: |
| 28 | ctx(features = 'c ' + target, | 29 | ctx(features = 'c ' + target, |
| 29 | use = ['lib_objects'], #source = source, | 30 | use = ['lib_objects'], #source = source, |
| 31 | lib = 'm', | ||
| 30 | target = 'aubio', | 32 | target = 'aubio', |
| 31 | install_path = '${PREFIX}/lib', | 33 | install_path = '${PREFIX}/lib', |
| 32 | vnum = ctx.env['LIB_VERSION']) | 34 | vnum = ctx.env['LIB_VERSION']) |
| @@ -38,7 +38,7 @@ int main (int argc, char **argv) · 37 unmodified lines | |||
| 38 | 38 | ||
| 39 | if ( n_channels == 0 ) n_channels = aubio_source_get_channels(s); | 39 | if ( n_channels == 0 ) n_channels = aubio_source_get_channels(s); |
| 40 | 40 | ||
| 41 | fmat_t *mat = new_fmat(hop_size, n_channels); | 41 | fmat_t *mat = new_fmat(n_channels, hop_size); |
| 42 | 42 | ||
| 43 | do { | 43 | do { |
| 44 | aubio_source_do_multi (s, mat, &read); | 44 | aubio_source_do_multi (s, mat, &read); |
| @@ -12,11 +12,11 @@ int main () · 11 unmodified lines | |||
| 12 | // create mfcc object | 12 | // create mfcc object |
| 13 | aubio_mfcc_t *o = new_aubio_mfcc (win_s, n_filters, n_coefs, samplerate); | 13 | aubio_mfcc_t *o = new_aubio_mfcc (win_s, n_filters, n_coefs, samplerate); |
| 14 | 14 | ||
| 15 | cvec_set_all_norm (in, 1.); | 15 | cvec_norm_set_all (in, 1.); |
| 16 | aubio_mfcc_do (o, in, out); | 16 | aubio_mfcc_do (o, in, out); |
| 17 | fvec_print (out); | 17 | fvec_print (out); |
| 18 | 18 | ||
| 19 | cvec_set_all_norm (in, .5); | 19 | cvec_norm_set_all (in, .5); |
| 20 | aubio_mfcc_do (o, in, out); | 20 | aubio_mfcc_do (o, in, out); |
| 21 | fvec_print (out); | 21 | fvec_print (out); |
| 22 | 22 | ||
| @@ -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 | } | ||
| @@ -14,7 +14,7 @@ int main () · 13 unmodified lines | |||
| 14 | aubio_pvoc_t * pv = new_aubio_pvoc(win_s,hop_s); | 14 | aubio_pvoc_t * pv = new_aubio_pvoc(win_s,hop_s); |
| 15 | 15 | ||
| 16 | // fill input with some data | 16 | // fill input with some data |
| 17 | fvec_set (in, 1.); | 17 | fvec_set_all (in, 1.); |
| 18 | fvec_print (in); | 18 | fvec_print (in); |
| 19 | 19 | ||
| 20 | while ( n-- ) { | 20 | while ( n-- ) { |
| @@ -19,7 +19,7 @@ int main () · 18 unmodified lines | |||
| 19 | } | 19 | } |
| 20 | 20 | ||
| 21 | // set all vector elements to `0` | 21 | // set all vector elements to `0` |
| 22 | cvec_zeros_norm(complex_vector); | 22 | cvec_norm_zeros(complex_vector); |
| 23 | for ( i = 0; i < complex_vector->length; i++ ) { | 23 | for ( i = 0; i < complex_vector->length; i++ ) { |
| 24 | assert( complex_vector->norm[i] == 0. ); | 24 | assert( complex_vector->norm[i] == 0. ); |
| 25 | // assert( complex_vector->phas[i] == 0 ); | 25 | // assert( complex_vector->phas[i] == 0 ); |
| @@ -27,7 +27,7 @@ int main () · 1 unmodified line | |||
| 27 | cvec_print(complex_vector); | 27 | cvec_print(complex_vector); |
| 28 | 28 | ||
| 29 | // set all vector elements to `1` | 29 | // set all vector elements to `1` |
| 30 | cvec_ones_norm(complex_vector); | 30 | cvec_norm_ones(complex_vector); |
| 31 | for ( i = 0; i < complex_vector->length; i++ ) { | 31 | for ( i = 0; i < complex_vector->length; i++ ) { |
| 32 | assert( complex_vector->norm[i] == 1. ); | 32 | assert( complex_vector->norm[i] == 1. ); |
| 33 | // assert( complex_vector->phas[i] == 0 ); | 33 | // assert( complex_vector->phas[i] == 0 ); |
| @@ -35,10 +35,10 @@ int main () · 1 unmodified line | |||
| 35 | cvec_print(complex_vector); | 35 | cvec_print(complex_vector); |
| 36 | 36 | ||
| 37 | cvec_zeros(complex_vector); | 37 | cvec_zeros(complex_vector); |
| 38 | cvec_zeros_phas(complex_vector); | 38 | cvec_phas_zeros(complex_vector); |
| 39 | cvec_zeros_norm(complex_vector); | 39 | cvec_norm_zeros(complex_vector); |
| 40 | cvec_ones_norm(complex_vector); | 40 | cvec_norm_ones(complex_vector); |
| 41 | cvec_ones_phas(complex_vector); | 41 | cvec_phas_ones(complex_vector); |
| 42 | cvec_copy(complex_vector, complex_vector); | 42 | cvec_copy(complex_vector, complex_vector); |
| 43 | 43 | ||
| 44 | // destroy it | 44 | // destroy it |
| @@ -8,7 +8,7 @@ int main () · 7 unmodified lines | |||
| 8 | { | 8 | { |
| 9 | uint_t height = 3, length = 9, i, j; | 9 | uint_t height = 3, length = 9, i, j; |
| 10 | // create fmat_t object | 10 | // create fmat_t object |
| 11 | fmat_t * mat = new_fmat (length, height); | 11 | fmat_t * mat = new_fmat (height, length); |
| 12 | for ( i = 0; i < mat->height; i++ ) { | 12 | for ( i = 0; i < mat->height; i++ ) { |
| 13 | for ( j = 0; j < mat->length; j++ ) { | 13 | for ( j = 0; j < mat->length; j++ ) { |
| 14 | // all elements are already initialized to 0. | 14 | // all elements are already initialized to 0. |
| @@ -3,12 +3,29 @@ · 2 unmodified lines | |||
| 3 | #include <stdio.h> | 3 | #include <stdio.h> |
| 4 | #include <math.h> | 4 | #include <math.h> |
| 5 | #include <assert.h> | 5 | #include <assert.h> |
| 6 | #include "config.h" | ||
| 6 | 7 | ||
| 7 | #define PRINT_ERR(format, args...) fprintf(stderr, "AUBIO-TESTS ERROR: " format , ##args) | 8 | #define PRINT_ERR(format, args...) fprintf(stderr, "AUBIO-TESTS ERROR: " format , ##args) |
| 8 | #define PRINT_MSG(format, args...) fprintf(stdout, format , ##args) | 9 | #define PRINT_MSG(format, args...) fprintf(stdout, format , ##args) |
| 9 | #define PRINT_DBG(format, args...) fprintf(stderr, format , ##args) | 10 | #define PRINT_DBG(format, args...) fprintf(stderr, format , ##args) |
| 10 | #define PRINT_WRN(format, args...) fprintf(stderr, "AUBIO-TESTS WARNING: " format, ##args) | 11 | #define PRINT_WRN(format, args...) fprintf(stderr, "AUBIO-TESTS WARNING: " format, ##args) |
| 11 | 12 | ||
| 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 | |||
| 12 | void utils_init_random () { | 29 | void utils_init_random () { |
| 13 | time_t now = time(0); | 30 | time_t now = time(0); |
| 14 | struct tm *tm_struct = localtime(&now); | 31 | struct tm *tm_struct = localtime(&now); |
| @@ -4,10 +4,6 @@ for target_name in ctx.path.ant_glob('src/**/*.c'): · 3 unmodified lines | |||
| 4 | uselib = [] | 4 | uselib = [] |
| 5 | includes = ['../src', '.'] | 5 | includes = ['../src', '.'] |
| 6 | extra_source = [] | 6 | 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'] | ||
| 11 | 7 | ||
| 12 | bld(features = 'c cprogram test', | 8 | bld(features = 'c cprogram test', |
| 13 | lib = 'm', | 9 | lib = 'm', |
| @@ -84,15 +84,19 @@ def configure(ctx): · 83 unmodified lines | |||
| 84 | ctx.load('compiler_c') | 84 | ctx.load('compiler_c') |
| 85 | ctx.load('waf_unit_test') | 85 | ctx.load('waf_unit_test') |
| 86 | ctx.load('gnu_dirs') | 86 | ctx.load('gnu_dirs') |
| 87 | ctx.env.CFLAGS += ['-g', '-Wall', '-Wextra', '-fPIC'] | 87 | |
| 88 | ctx.env.CFLAGS += ['-g', '-Wall', '-Wextra'] | ||
| 88 | 89 | ||
| 89 | target_platform = Options.platform | 90 | target_platform = Options.platform |
| 90 | if ctx.options.target_platform: | 91 | if ctx.options.target_platform: |
| 91 | target_platform = ctx.options.target_platform | 92 | target_platform = ctx.options.target_platform |
| 92 | ctx.env['DEST_OS'] = target_platform | 93 | ctx.env['DEST_OS'] = target_platform |
| 93 | 94 | ||
| 94 | if target_platform == 'win32': | 95 | if target_platform not in ['win32', 'win64']: |
| 95 | ctx.env['shlib_PATTERN'] = 'lib%s.dll' | 96 | ctx.env.CFLAGS += ['-fPIC'] |
| 97 | else: | ||
| 98 | ctx.define('HAVE_WIN_HACKS', 1) | ||
| 99 | ctx.env['cshlib_PATTERN'] = 'lib%s.dll' | ||
| 96 | 100 | ||
| 97 | if target_platform == 'darwin': | 101 | if target_platform == 'darwin': |
| 98 | ctx.env.CFLAGS += ['-arch', 'i386', '-arch', 'x86_64'] | 102 | ctx.env.CFLAGS += ['-arch', 'i386', '-arch', 'x86_64'] |
| @@ -200,7 +204,7 @@ def configure(ctx): · 101 unmodified lines | |||
| 200 | 204 | ||
| 201 | # check for jack | 205 | # check for jack |
| 202 | if (ctx.options.enable_jack != False): | 206 | if (ctx.options.enable_jack != False): |
| 203 | ctx.check_cfg(package = 'jack', atleast_version = '0.15.0', | 207 | ctx.check_cfg(package = 'jack', |
| 204 | args = '--cflags --libs', mandatory = False) | 208 | args = '--cflags --libs', mandatory = False) |
| 205 | 209 | ||
| 206 | # check for libav | 210 | # check for libav |
| @@ -213,6 +217,12 @@ def configure(ctx): · 6 unmodified lines | |||
| 213 | args = '--cflags --libs', uselib_store = 'AVUTIL', mandatory = False) | 217 | args = '--cflags --libs', uselib_store = 'AVUTIL', mandatory = False) |
| 214 | ctx.check_cfg(package = 'libavresample', atleast_version = '1.0.1', | 218 | ctx.check_cfg(package = 'libavresample', atleast_version = '1.0.1', |
| 215 | args = '--cflags --libs', uselib_store = 'AVRESAMPLE', mandatory = False) | 219 | 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') | ||
| 216 | 226 | ||
| 217 | # use memcpy hacks | 227 | # use memcpy hacks |
| 218 | if (ctx.options.enable_memcpy == True): | 228 | if (ctx.options.enable_memcpy == True): |
| @@ -233,6 +243,12 @@ def configure(ctx): · 14 unmodified lines | |||
| 233 | except ctx.errors.ConfigurationError: | 243 | except ctx.errors.ConfigurationError: |
| 234 | ctx.to_log('txt2man was not found (ignoring)') | 244 | ctx.to_log('txt2man was not found (ignoring)') |
| 235 | 245 | ||
| 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 | |||
| 236 | def build(bld): | 252 | def build(bld): |
| 237 | bld.env['VERSION'] = VERSION | 253 | bld.env['VERSION'] = VERSION |
| 238 | bld.env['LIB_VERSION'] = LIB_VERSION | 254 | bld.env['LIB_VERSION'] = LIB_VERSION |
| @@ -247,7 +263,7 @@ def build(bld): · 8 unmodified lines | |||
| 247 | 263 | ||
| 248 | bld( source = 'aubio.pc.in' ) | 264 | bld( source = 'aubio.pc.in' ) |
| 249 | 265 | ||
| 250 | # build manpages from sgml files | 266 | # build manpages from txt files using txt2man |
| 251 | if bld.env['TXT2MAN']: | 267 | if bld.env['TXT2MAN']: |
| 252 | from waflib import TaskGen | 268 | from waflib import TaskGen |
| 253 | if 'MANDIR' not in bld.env: | 269 | if 'MANDIR' not in bld.env: |
| @@ -266,10 +282,15 @@ def build(bld): · 12 unmodified lines | |||
| 266 | ) | 282 | ) |
| 267 | bld( source = bld.path.ant_glob('doc/*.txt') ) | 283 | bld( source = bld.path.ant_glob('doc/*.txt') ) |
| 268 | 284 | ||
| 269 | """ | 285 | # build documentation from source files using doxygen |
| 270 | bld(rule = 'doxygen ${SRC}', source = 'web.cfg') #, target = 'doc/web/index.html') | 286 | if bld.env['DOXYGEN']: |
| 271 | """ | 287 | bld( name = 'doxygen', rule = 'doxygen ${SRC} > /dev/null', |
| 272 | 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) | ||
| 273 | 294 | ||
| 274 | def shutdown(bld): | 295 | def shutdown(bld): |
| 275 | from waflib import Logs | 296 | from waflib import Logs |
| @@ -287,3 +308,4 @@ def dist(ctx): · 11 unmodified lines | |||
| 287 | ctx.excl += ' **/doc/full/* **/doc/web/*' | 308 | ctx.excl += ' **/doc/full/* **/doc/web/*' |
| 288 | ctx.excl += ' **/python/*.db' | 309 | ctx.excl += ' **/python/*.db' |
| 289 | ctx.excl += ' **/python.old/*' | 310 | ctx.excl += ' **/python.old/*' |
| 311 | ctx.excl += ' **/python/tests/sounds' | ||