}
smpl_t aubio_freqtomidi(smpl_t freq) {
- smpl_t midi = freq/6.875;
- /* log(freq/A-2)/log(2) */
- midi = LOG(midi)/0.69314718055995;
- midi *= 12;
- midi -= 3;
- return midi;
+ /* log(freq/A-2)/log(2) */
+ smpl_t midi = freq/6.875;
+ midi = LOG(midi)/0.69314718055995;
+ midi *= 12;
+ midi -= 3;
+ return midi;
+}
+
+smpl_t aubio_miditofreq(smpl_t midi) {
+ smpl_t freq = (midi+3.)/12.;
+ freq = EXP(freq*0.69314718055995);
+ freq *= 6.875;
+ return freq;
}
smpl_t aubio_bintofreq(smpl_t bin, smpl_t samplerate, smpl_t fftsize) {
return freq*bin;
}
-
smpl_t aubio_bintomidi(smpl_t bin, smpl_t samplerate, smpl_t fftsize) {
smpl_t midi = aubio_bintofreq(bin,samplerate,fftsize);
return aubio_freqtomidi(midi);
}
+smpl_t aubio_freqtobin(smpl_t freq, smpl_t samplerate, smpl_t fftsize) {
+ smpl_t bin = fftsize/samplerate;
+ return freq*bin;
+}
+
+smpl_t aubio_miditobin(smpl_t midi, smpl_t samplerate, smpl_t fftsize) {
+ smpl_t freq = aubio_miditofreq(midi);
+ return aubio_freqtobin(freq,samplerate,fftsize);
+}
+
/** returns 1 if wassilence is 0 and RMS(ibuf)<threshold
uint_t vec_peakpick(fvec_t * input, uint_t pos);
smpl_t aubio_bintomidi(smpl_t bin, smpl_t samplerate, smpl_t fftsize);
+smpl_t aubio_miditobin(smpl_t midi, smpl_t samplerate, smpl_t fftsize);
smpl_t aubio_bintofreq(smpl_t bin, smpl_t samplerate, smpl_t fftsize);
+smpl_t aubio_freqtobin(smpl_t freq, smpl_t samplerate, smpl_t fftsize);
smpl_t aubio_freqtomidi(smpl_t freq);
+smpl_t aubio_miditofreq(smpl_t midi);
uint_t aubio_silence_detection(fvec_t * ibuf, smpl_t threshold);
smpl_t aubio_level_detection(fvec_t * ibuf, smpl_t threshold);
smpl_t aubio_quadfrac(smpl_t s0, smpl_t s1, smpl_t s2, smpl_t pf);
uint_t vec_peakpick(fvec_t * input, uint_t pos);
smpl_t aubio_bintomidi(smpl_t bin, smpl_t samplerate, smpl_t fftsize);
+smpl_t aubio_miditobin(smpl_t midi, smpl_t samplerate, smpl_t fftsize);
smpl_t aubio_bintofreq(smpl_t bin, smpl_t samplerate, smpl_t fftsize);
+smpl_t aubio_freqtobin(smpl_t freq, smpl_t samplerate, smpl_t fftsize);
smpl_t aubio_freqtomidi(smpl_t freq);
+smpl_t aubio_miditofreq(smpl_t midi);
uint_t aubio_silence_detection(fvec_t * ibuf, smpl_t threshold);
smpl_t aubio_level_detection(fvec_t * ibuf, smpl_t threshold);