aubio_onset_do(o, ibuf, onset);
aubio_pitch_do (pitch, ibuf, pitch_obuf);
- smpl_t new_pitch = fvec_read_sample(pitch_obuf, 0);
+ smpl_t new_pitch = fvec_get_sample(pitch_obuf, 0);
if(median){
note_append(note_buffer, new_pitch);
}
/* curlevel is negatif or 1 if silence */
smpl_t curlevel = aubio_level_detection(ibuf, silence_threshold);
- if (fvec_read_sample(onset, 0)) {
+ if (fvec_get_sample(onset, 0)) {
/* test for silence */
if (curlevel == 1.) {
if (median) isready = 0;
process_block(fvec_t *ibuf, fvec_t *obuf) {
fvec_zeros(obuf);
aubio_onset_do (o, ibuf, onset);
- is_onset = fvec_read_sample(onset, 0);
+ is_onset = fvec_get_sample(onset, 0);
if ( is_onset ) {
aubio_wavetable_play ( wavetable );
} else {
process_block(fvec_t * ibuf, fvec_t * obuf) {
fvec_zeros(obuf);
aubio_pitch_do (o, ibuf, pitch);
- smpl_t freq = fvec_read_sample(pitch, 0);
+ smpl_t freq = fvec_get_sample(pitch, 0);
aubio_wavetable_set_amp ( wavetable, aubio_level_lin (ibuf) );
aubio_wavetable_set_freq ( wavetable, freq );
void
process_print (void) {
- smpl_t pitch_found = fvec_read_sample(pitch, 0);
+ smpl_t pitch_found = fvec_get_sample(pitch, 0);
outmsg("%f %f\n",(blocks)
*hop_size/(float)samplerate, pitch_found);
}
aubio_pitch_set_silence (o, silence_threshold);
if (pitch_unit != NULL)
aubio_pitch_set_unit (o, pitch_unit);
+
pitch = new_fvec (1);
wavetable = new_aubio_wavetable (samplerate, hop_size);
aubio_wavetable_t *wavetable;
fvec_t * tempo_out;
smpl_t is_beat = 0;
-smpl_t is_onset = 0;
uint_t is_silence = 0.;
void process_block(fvec_t * ibuf, fvec_t *obuf) {
aubio_tempo_do (tempo, ibuf, tempo_out);
- is_beat = fvec_read_sample (tempo_out, 0);
- is_onset = fvec_read_sample (tempo_out, 1);
+ is_beat = fvec_get_sample (tempo_out, 0);
if (silence_threshold != -90.)
is_silence = aubio_silence_detection(ibuf, silence_threshold);
fvec_zeros (obuf);
if ( is_beat && !is_silence ) {
outmsg("%f\n", aubio_tempo_get_last_s(tempo) );
}
- //if ( is_onset )
- // outmsg(" \t \t%f\n",(blocks)*hop_size/(float)samplerate);
}
int main(int argc, char **argv) {
unsigned int j; /*frames*/
for (j=0;j<(unsigned)nframes;j++) {
/* put synthnew in output */
- output[0][j] = fvec_read_sample(dev->obuf, dev->pos);
+ output[0][j] = fvec_get_sample(dev->obuf, dev->pos);
/* write input to datanew */
- fvec_write_sample(dev->ibuf, input[0][j], dev->pos);
+ fvec_set_sample(dev->ibuf, input[0][j], dev->pos);
/*time for fft*/
if (dev->pos == (int)(dev->hop_size) - 1) {
/* block loop */
AUBIO_FREE(s);
}
-void fvec_write_sample(fvec_t *s, smpl_t data, uint_t position) {
+void fvec_set_sample(fvec_t *s, smpl_t data, uint_t position) {
s->data[position] = data;
}
-smpl_t fvec_read_sample(fvec_t *s, uint_t position) {
+smpl_t fvec_get_sample(fvec_t *s, uint_t position) {
return s->data[position];
}
AUBIO_MSG("\n");
}
-void fvec_set(fvec_t *s, smpl_t val) {
+void fvec_set_all (fvec_t *s, smpl_t val) {
uint_t j;
for (j=0; j< s->length; j++) {
s->data[j] = val;
#if HAVE_MEMCPY_HACKS
memset(s->data, 0, s->length * sizeof(smpl_t));
#else
- fvec_set(s, 0.);
+ fvec_set_all (s, 0.);
#endif
}
void fvec_ones(fvec_t *s) {
- fvec_set(s, 1.);
+ fvec_set_all (s, 1.);
}
void fvec_rev(fvec_t *s) {
*/
fvec_t * new_fvec(uint_t length);
+
/** fvec_t buffer deletion function
\param s buffer to delete as returned by new_fvec()
*/
void del_fvec(fvec_t *s);
+
/** read sample value in a buffer
Note that this function is not used in the aubio library, since the same
\param position sample position to read from
*/
-smpl_t fvec_read_sample(fvec_t *s, uint_t position);
+smpl_t fvec_get_sample(fvec_t *s, uint_t position);
+
/** write sample value in a buffer
Note that this function is not used in the aubio library, since the same
\param position sample position to write to
*/
-void fvec_write_sample(fvec_t *s, smpl_t data, uint_t position);
+void fvec_set_sample(fvec_t *s, smpl_t data, uint_t position);
/** read data from a buffer
\param val value to set elements to
*/
-void fvec_set(fvec_t *s, smpl_t val);
+void fvec_set_all (fvec_t *s, smpl_t val);
/** set all elements to zero
for (j=0;j<(unsigned)nframes;j++) {
for (i=0;i<channels;i++) {
/* write input to datanew */
- fvec_write_sample(in[i], input[i][j], pos);
+ fvec_set_sample(in[i], input[i][j], pos);
/* put synthnew in output */
- output[i][j] = fvec_read_sample(out[i], pos);
+ output[i][j] = fvec_get_sample(out[i], pos);
}
/*time for fft*/
if (pos == hop_s-1) {
aubio_pvoc_t * pv = new_aubio_pvoc(win_s,hop_s);
// fill input with some data
- fvec_set (in, 1.);
+ fvec_set_all (in, 1.);
fvec_print (in);
while ( n-- ) {