Ignore:
Timestamp:
Nov 4, 2013, 3:28:24 PM (10 years ago)
Author:
Paul Brossier <piem@piem.org>
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
Message:

examples/: use wavetable to play pitch and to replace woodblock

File:
1 edited

Legend:

Unmodified
Added
Removed
  • examples/aubiopitch.c

    r509e8f9 rf3617e7  
    2424
    2525aubio_pitch_t *o;
     26aubio_wavetable_t *wavetable;
    2627fvec_t *pitch;
    2728
     
    3940      /* block loop */
    4041      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 );
    4547      } else {
    46         fvec_zeros (obuf);
     48        aubio_wavetable_set_freq ( wavetable, 0.0 );
    4749      }
     50      aubio_wavetable_do (wavetable, obuf, obuf);
    4851      /* end of block loop */
    4952      pos = -1; /* so it will be zero next j loop */
     
    6770  pitch = new_fvec (1);
    6871
     72  wavetable = new_aubio_wavetable (samplerate, overlap_size);
     73  aubio_wavetable_play ( wavetable );
     74
    6975  examples_common_process(aubio_process,process_print);
    7076
    7177  del_aubio_pitch (o);
     78  del_aubio_wavetable (wavetable);
    7279  del_fvec (pitch);
    7380
Note: See TracChangeset for help on using the changeset viewer.