- Timestamp:
- Nov 4, 2013, 3:28:24 PM (11 years ago)
- Branches:
- feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master, pitchshift, sampler, timestretch, yinfft+
- Children:
- e97d0b3
- Parents:
- 509e8f9
- Location:
- examples
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
examples/aubionotes.c
r509e8f9 rf3617e7 89 89 90 90 for (pos = 0; pos < overlap_size; pos++){ 91 obuf->data[pos] = woodblock->data[pos];91 //obuf->data[pos] = woodblock->data[pos]; 92 92 } 93 93 } -
examples/aubioonset.c
r509e8f9 rf3617e7 21 21 #include "utils.h" 22 22 23 u nsigned int pos = 0; /*frames%dspblocksize*/23 uint_t pos = 0; /*frames%dspblocksize*/ 24 24 25 25 aubio_onset_t *o; 26 aubio_wavetable_t *wavetable; 26 27 fvec_t *onset; 27 28 … … 38 39 if (pos == overlap_size-1) { 39 40 /* block loop */ 41 fvec_zeros(obuf); 40 42 aubio_onset_do (o, ibuf, onset); 41 43 if ( fvec_read_sample(onset, 0) ) { 42 fvec_copy (woodblock, obuf);44 aubio_wavetable_play ( wavetable ); 43 45 } else { 44 fvec_zeros (obuf);46 aubio_wavetable_stop ( wavetable ); 45 47 } 48 aubio_wavetable_do (wavetable, ibuf, obuf); 46 49 /* end of block loop */ 47 50 pos = -1; /* so it will be zero next j loop */ … … 73 76 onset = new_fvec (1); 74 77 78 wavetable = new_aubio_wavetable (samplerate, overlap_size); 79 aubio_wavetable_set_freq ( wavetable, 2450.); 80 //aubio_sampler_load (sampler, "/archives/sounds/woodblock.aiff"); 81 75 82 examples_common_process(aubio_process,process_print); 76 83 77 84 del_aubio_onset (o); 85 del_aubio_wavetable (wavetable); 78 86 del_fvec (onset); 79 87 -
examples/aubiopitch.c
r509e8f9 rf3617e7 24 24 25 25 aubio_pitch_t *o; 26 aubio_wavetable_t *wavetable; 26 27 fvec_t *pitch; 27 28 … … 39 40 /* block loop */ 40 41 aubio_pitch_do (o, ibuf, pitch); 41 if (fvec_read_sample(pitch, 0)) { 42 for (pos = 0; pos < overlap_size; pos++){ 43 // TODO, play sine at this freq 44 } 42 smpl_t freq = fvec_read_sample(pitch, 0); 43 smpl_t amp = powf(10., aubio_db_spl(ibuf)*.05 ); 44 aubio_wavetable_set_amp ( wavetable, amp ); 45 if (freq != 0.0) { 46 aubio_wavetable_set_freq ( wavetable, freq ); 45 47 } else { 46 fvec_zeros (obuf);48 aubio_wavetable_set_freq ( wavetable, 0.0 ); 47 49 } 50 aubio_wavetable_do (wavetable, obuf, obuf); 48 51 /* end of block loop */ 49 52 pos = -1; /* so it will be zero next j loop */ … … 67 70 pitch = new_fvec (1); 68 71 72 wavetable = new_aubio_wavetable (samplerate, overlap_size); 73 aubio_wavetable_play ( wavetable ); 74 69 75 examples_common_process(aubio_process,process_print); 70 76 71 77 del_aubio_pitch (o); 78 del_aubio_wavetable (wavetable); 72 79 del_fvec (pitch); 73 80 -
examples/aubiotrack.c
r509e8f9 rf3617e7 19 19 */ 20 20 21 #include <aubio.h>22 21 #include "utils.h" 23 22 24 23 uint_t pos = 0; /* frames%dspblocksize */ 24 aubio_tempo_t * bt = NULL; 25 aubio_wavetable_t *wavetable; 25 26 fvec_t * tempo_out = NULL; 26 aubio_tempo_t * bt = NULL;27 27 smpl_t istactus = 0; 28 28 smpl_t isonset = 0; … … 38 38 } 39 39 /*time for fft*/ 40 if (pos == overlap_size-1) { 40 if (pos == overlap_size-1) { 41 41 /* block loop */ 42 42 aubio_tempo_do (bt,ibuf,tempo_out); 43 43 istactus = fvec_read_sample (tempo_out, 0); 44 44 isonset = fvec_read_sample (tempo_out, 1); 45 fvec_zeros (obuf); 45 46 if (istactus > 0.) { 46 fvec_copy (woodblock, obuf);47 aubio_wavetable_play ( wavetable ); 47 48 } else { 48 fvec_zeros (obuf);49 aubio_wavetable_stop ( wavetable ); 49 50 } 51 aubio_wavetable_do (wavetable, ibuf, obuf); 50 52 /* end of block loop */ 51 53 pos = -1; /* so it will be zero next j loop */ … … 57 59 58 60 static void process_print (void) { 59 60 61 outmsg("%f\n",((smpl_t)(frames*overlap_size)+(istactus-1.)*overlap_size)/(smpl_t)samplerate);62 63 64 65 61 if (sink_uri == NULL) { 62 if (istactus) { 63 outmsg("%f\n",((smpl_t)(frames*overlap_size)+(istactus-1.)*overlap_size)/(smpl_t)samplerate); 64 } 65 if (isonset && verbose) 66 outmsg(" \t \t%f\n",(frames)*overlap_size/(float)samplerate); 67 } 66 68 } 67 69 … … 77 79 if (threshold != 0.) aubio_tempo_set_threshold (bt, threshold); 78 80 81 wavetable = new_aubio_wavetable (samplerate, overlap_size); 82 aubio_wavetable_set_freq ( wavetable, 2450.); 83 //aubio_sampler_load (sampler, "/archives/sounds/woodblock.aiff"); 84 79 85 examples_common_process(aubio_process,process_print); 80 86 81 87 del_aubio_tempo(bt); 88 del_aubio_wavetable (wavetable); 82 89 del_fvec(tempo_out); 83 90 -
examples/utils.c
r509e8f9 rf3617e7 66 66 fvec_t *ibuf; 67 67 fvec_t *obuf; 68 fvec_t *woodblock;69 68 70 69 /* badly redeclare some things */ … … 246 245 #endif /* HAVE_LASH */ 247 246 248 woodblock = new_fvec (overlap_size);249 //TODO create woodblock sound250 251 247 ibuf = new_fvec (overlap_size); 252 248 obuf = new_fvec (overlap_size); … … 259 255 del_fvec (ibuf); 260 256 del_fvec (obuf); 261 del_fvec (woodblock);262 257 aubio_cleanup (); 263 258 } -
examples/utils.h
r509e8f9 rf3617e7 77 77 extern fvec_t *ibuf; 78 78 extern fvec_t *obuf; 79 extern fvec_t *woodblock;
Note: See TracChangeset
for help on using the changeset viewer.