Giter Site home page Giter Site logo

Comments (7)

jamiebullock avatar jamiebullock commented on September 25, 2024

Nope, in fact, xtract_f0(), xtract_failsafe_f0() and xtract_wavelet_f0() all take a block of audio samples, not the magnitude coefficients as input. I've found xtract_wavelet_f0() to be the most reliable method.

from libxtract.

q-depot avatar q-depot commented on September 25, 2024

f0 works properly with the pcm data thanks to clarify this, I'll have a go witht the wavelet method too.
I reckon generally it would be good if the doc could specify the input type for each function, some of the functions already do it, some other are a bit more confusing.

thanks.

from libxtract.

q-depot avatar q-depot commented on September 25, 2024

none of the f0 functions work with frequencies below 100Hz, wavelet_f0 flicker between 0 and the frequency value(in this case 65Hz), is it a bug? they all work find with frequencies above 100Hz.

screen shot 2013-07-08 at 13 44 39

from libxtract.

jamiebullock avatar jamiebullock commented on September 25, 2024

Have you tried increasing the block size? The accuracy of F0 detectors is generally a function of block size, where larger block size means more accurate detection, and better ability to detect lower frequencies. To go below 100Hz, you probably need a blocksize of 2048. This isn't unique to LibXtract, you will find this issue with other pitch detectors also.

If you're worried about introducing latency, you could overlap blocks for the f0() functions.

from libxtract.

q-depot avatar q-depot commented on September 25, 2024

this is quite interesting, at the moment I'm using a blocksize of 1024 which also lead me to a question, does the Xtract blocksize has to match the input PCM sample count or can I just take half of it?

The blocksize from the Cinder audio pcm buffer is usually 2048, but the blocksize I'm using in libxtract is 1024, which means I only take the first 1024 values from the pcm buffer, is this a problem?
Also does the fft size need to be half of the blocksize or can it be anything power of 2?(128, 256 ..)

Going back to the issue above, using 2048 as blocksize is not ideal, in theory I want to use the smallest useful blocksize to boost the performance, can you please explain what you mean with overlapping blocks?

thanks.

from libxtract.

q-depot avatar q-depot commented on September 25, 2024

.. and one more question, how bad/inaccurate do you reckon is to cut off all the frequencies below 100Hz from the F0 functions?
Do you think this is an acceptable trade off or should I do something about?

from libxtract.

jamiebullock avatar jamiebullock commented on September 25, 2024

OK...

  • You can use any block size N with most of the xtract functions. xtract_spectrum() needs a power-of-two though
  • If you have an audio buffer of, say, 2048 samples, and you pass that buffer as *data to e.g. xtract_spectrum() with an N of 1024, you will get the spectrum of half of your audio block. Unless you have an overlapping scheme in place (see below) this is probably not what you want
  • The FFT size can technically be any power-of-two, however typically you will want to do something like:
double spectrum[BLOCKSIZE] = {0};
xtract_init_fft(BLOCKSIZE, XTRACT_SPECTRUM);
xtract[XTRACT_SPECTRUM](windowed, BLOCKSIZE, &argd[0], spectrum);
  • Here spectrum will contain N/2 magnitude coefficients and N/2 frequencies
  • If you want to improve F0 resolution without compromising latency, you can use a blocksize of e.g. 1024 for all features except F0, for which you use 2048. For your very first block you don't compute F0 (or compute it with N=1024). For all consecutive blocks, you compute F0 using 2048 samples taken from the previous block + the current block. You therefore need to always retain the previous audio block for this purpose

Regarding the Cinder blocksize of 2048 — is there a way to adjust this? You aren't reducing latency by using 1024 for libxtract if you're getting blocks of 2048 samples from your audio callback, you're just missing data. Basically you need to find a way to reduce the Cinder blocksize.

from libxtract.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.