- Timestamp:
- Aug 22, 2005, 10:59:13 PM (19 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:
- 3ec9d9c
- Parents:
- 98ef4df
- Location:
- src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mathutils.c
r98ef4df r79c2e52 346 346 347 347 smpl_t aubio_freqtomidi(smpl_t freq) { 348 smpl_t midi = freq/6.875; 349 /* log(freq/A-2)/log(2) */ 350 midi = LOG(midi)/0.69314718055995; 351 midi *= 12; 352 midi -= 3; 353 return midi; 348 /* log(freq/A-2)/log(2) */ 349 smpl_t midi = freq/6.875; 350 midi = LOG(midi)/0.69314718055995; 351 midi *= 12; 352 midi -= 3; 353 return midi; 354 } 355 356 smpl_t aubio_miditofreq(smpl_t midi) { 357 smpl_t freq = (midi+3.)/12.; 358 freq = EXP(freq*0.69314718055995); 359 freq *= 6.875; 360 return freq; 354 361 } 355 362 … … 359 366 } 360 367 361 362 368 smpl_t aubio_bintomidi(smpl_t bin, smpl_t samplerate, smpl_t fftsize) { 363 369 smpl_t midi = aubio_bintofreq(bin,samplerate,fftsize); 364 370 return aubio_freqtomidi(midi); 371 } 372 373 smpl_t aubio_freqtobin(smpl_t freq, smpl_t samplerate, smpl_t fftsize) { 374 smpl_t bin = fftsize/samplerate; 375 return freq*bin; 376 } 377 378 smpl_t aubio_miditobin(smpl_t midi, smpl_t samplerate, smpl_t fftsize) { 379 smpl_t freq = aubio_miditofreq(midi); 380 return aubio_freqtobin(freq,samplerate,fftsize); 365 381 } 366 382 -
src/mathutils.h
r98ef4df r79c2e52 231 231 232 232 smpl_t aubio_bintomidi(smpl_t bin, smpl_t samplerate, smpl_t fftsize); 233 smpl_t aubio_miditobin(smpl_t midi, smpl_t samplerate, smpl_t fftsize); 233 234 smpl_t aubio_bintofreq(smpl_t bin, smpl_t samplerate, smpl_t fftsize); 235 smpl_t aubio_freqtobin(smpl_t freq, smpl_t samplerate, smpl_t fftsize); 234 236 smpl_t aubio_freqtomidi(smpl_t freq); 237 smpl_t aubio_miditofreq(smpl_t midi); 235 238 236 239 uint_t aubio_silence_detection(fvec_t * ibuf, smpl_t threshold);
Note: See TracChangeset
for help on using the changeset viewer.