1. IMPORTANT:
    We launched a new online community and this space is now closed. This community will be available as a read-only resources until further notice.
    JOIN US HERE

Formant Osc-like effect on audio source

Discussion in 'REAKTOR' started by carloskleiber, Mar 17, 2009.

Thread Status:
Not open for further replies.
  1. Aleksandr Smirnov

    Aleksandr Smirnov NI Product Owner

    Messages:
    1,539
    Thanks! Okay, I'm looking forward to your comments!
     
  2. BertAnt

    BertAnt NI Product Owner

    Messages:
    414
    Hi Alex,

    I've tried the sample you've included, and it seems both setups (mine and yours) works fine with the detection, so i guess the waveform is an ideal one for starter, it seems to have a strong fundamental frequency and not much overtones or high frequency that can cause false-crossing and make things difficult.

    I found that your setup will cover more range than mine with the use of 1-pole LP only, as it only lowers the higher freq without cutting it too much, but the problem is it probably still susceptible to false crossing for waveforms that are having too much overtones (like guitar humbucker pickup signal), which the only way i found is using a more deep filtering, with the cost of reduced working range.

    That just gives me an idea, a lot of filter combination (which can be made selectable with a switch) can be included to find which one works the best, it'll make the pitch detector more flexible for detecting pitch on wide range of different waveform characteristics..
     
  3. Aleksandr Smirnov

    Aleksandr Smirnov NI Product Owner

    Messages:
    1,539
    This is a good idea. You choose few methods which work best for you and implement them all in Reaktor with switch, so user will be able to choose what fits for his pitch detection better. The further theoretical development of this project is to determine "basis pitch". What do I mean by this? I mean lower note that can be used for example as bassline for current sample. Say, we have some guitar chords and we've detected it's pitch, everything is okay. But it is varying in both of our projects and we want to get stable "basis pitch" which we can use as sub note so it will fit to that sample. Does it make sense? This can be implemented using compare logic - by counting minimum value of pitch detected note probably.
     
  4. PeterW

    PeterW NI Product Owner

    Messages:
    182
    How about sending the input signal to a bank of bandpass filters set, say, an octave apart. Then detect the output of each filter separately and only use the detected result from lowest frequency filter with an output to determine the pitch?
     
  5. BertAnt

    BertAnt NI Product Owner

    Messages:
    414
    What you mean is the exact root / base pitch value ? I haven't really thought of this, but i think for a sample we can just determine the most dominant pitch value from each crossing result. With an array containing each result, it can be easily calculated using probabilistic method such as averaging or finding the highest occurences ones. I once have implemented this by using a simple self filling stacks, then find the average from the last 8 value. But for realtime use this made the response slower, so i'm not really using it much anymore.

    That seems to be really interesting, zero-crossing is simple and CPU friendly, so several crossing detector shouldn't be using too much CPU i think. I'm gonna try it, hopefully it'll have a nice result..
     
  6. Aleksandr Smirnov

    Aleksandr Smirnov NI Product Owner

    Messages:
    1,539
    I've started with simplest example of how to detect root pitch. Take a look at attached ensemble. It just outputs for sub-sine oscillator lowest of detected pitches. I thought about developing it further - making some kind of counter that will count say three most often occurred low pitches among detected pitches and will send the one with maximum value on output as root pitch (basis). This could be implemented with arrays as you mentioned as well. But as I'm not familiar with them on macro level, I could probably try to implement it inside core cell. Anyway, Bert keep us updated about your result as well with Peter's idea. Thanks for keeping it up!
     

    Attached Files:

  7. Pandas

    Pandas NI Product Owner

    Messages:
    305
    Hey all,

    I've been reading this thread with great interest.

    I think that finding the right settings for the filter stage before the zero crossing detection is essential for the process.

    I've been thinking about another possible way to go. I haven't tried it, and i won't find the time to in the coming days either, but i thought i'd share it anyways...

    If you would start supposing that you have one Pitch to detect, and a periodic waveform, you could isolate a very small part of the sample, long enough to contain at least 2 zero crossings for the lowest frequency to be detected (for 20Hz that would be 2x1/20= 10ms). Store this fragment in a table. Next you iterate through through the table, while at each iteration increasing the cutoff of the filter. The first setting where you get zero crossings is the fundamental.
    You need an event table to do this, and it'll probably be quite expensive CPU-wise, but it might be efficient. It means 441 samples to be read out at each iteration if you want to go as low as 20Hz.

    Anyways, this is just my theoretical fantasy, i don't know if it'd actually work...
     
  8. BertAnt

    BertAnt NI Product Owner

    Messages:
    414
    Event Table probably will do the job too, it's just that i'm not too familiar with it, i certainly should check out your tutorial to get the feel of it ;) . Also to reduce error further, you could use Event Separators after F to P module to reject pitches that are too low or high, so they don't get into the basis pitch calculation.


    Yes, please, i'd love to have a ready to use arrays in core cell just like your counters..

    I'll do my best :)

    Interesting one, but if we want to do anything iterative with some sort of buffering for detecting pitch i think it's better to use FFT, as zero-crossing loses its advantage in speed and simplicity if it used this way. But that just my opinion..

    It sounds pretty similar to the way Freq-Tracker work though, which self-iterates within itself with the frequency modulated BP filter until it finds the 'right' freq/pitch. It just that the 1-pole LP at the beginning sometimes is not enough, but add another adjustable LP filter and it will do the job very well.
     
  9. Aleksandr Smirnov

    Aleksandr Smirnov NI Product Owner

    Messages:
    1,539
    I've made some short buggy ensemble, that's not finished yet and has only basic idea in it. Basically when you press gate and play sample it records values of detected pitch in Event Table, so you can look at them in real time. When you wrote them, you should read them using ReadX knob (this can be further automated of course, when it becomes more serious project). It then will show you in "Basis Pitch" minimum from detected pitch and you can send it to your bass oscillator. Then you should reset it and start again if you want to detect it again. The ideal and not buggy project will look automated tool for detecting root pitch and analyzing tool for pitch detection as well. Also, I have to work on avoiding last number in Event Table (it is always the lowest) and I could set the length of Event Table only using Grain Cloud sampler as it has position output. Have no idea how to make without it.. ohh, yes, it can be made with some oscillator which plays at the same pitch so pitch detection graph will be written inside Event Table with same time as sample plays. So, just an idea..
     

    Attached Files:

  10. Pandas

    Pandas NI Product Owner

    Messages:
    305
    Good point. Although i was thinking that for efficient pitch tracking you need dynamic filter settings- i think there's no one for all workable setting. This was just a top of mind thought.

    If you'd really study this topic, there's probably ways to send feedback to the filter and have it set it's own optimal cutoff, but that's currently beyond my knowledge of dsp i'm afraid...
     
  11. Aleksandr Smirnov

    Aleksandr Smirnov NI Product Owner

    Messages:
    1,539
    It can be done, although it is extremely hard stuff for me. But I can imagine 3 filters for beginning with different cutoff and defining which filter does the best zero-crossing according to it's cutoff. When define optimal cutoff which lies between 2 filters which work better than 3rd one. This will take ages to implement tho.
     
  12. Pandas

    Pandas NI Product Owner

    Messages:
    305
    Pitch detection is hard- i've tried it with limited succes (which is not meant as a reference or something), and eventually given up.

    I still think the iteration approach is easier to implement than the fft approach though, and should be possible in almost realtime. If only because i've never used the ezfft macro's.
     
  13. BertAnt

    BertAnt NI Product Owner

    Messages:
    414
    I don't get it.. what is exactly the sub-sine and for what use is it ? Is it for comparing with the sample 'overall' pitch ?

    I realize now that i'm too focused on realtime and performance oriented pitch tracking, and completely unaware of this kind of usage. Nice one !

    I know, that's why i tend to do it on limited range. It seems too hard to do on wide range, that's why good professional pitch detector don't use zero-crossing anymore. But i still love zero-crossing because it's very expressive and responsive, it's the 'real' pitch tracking method because there isn't any analyzing in it, purely analog method.

    I've mentioned it earlier, Freq-Tracker has been using this feedback method to find the optimal cutoff with its frequency output being sent back to the BP filter F input. It's kinda tuning itself to the strongest freq/pitch, although not necessarily the fundamental one.

    Hard doesn't mean impossible, with discussion like this it will become easier as we share thoughts and ideas, so i think you shouldn't given up at all (unless you really want to do something else better than it).

    Perhaps a new thread like this, but focusing on FFT ? I'd love to have that, as all the stuff on the net just gives me headache with butterflies flying around my head :)
     
  14. Aleksandr Smirnov

    Aleksandr Smirnov NI Product Owner

    Messages:
    1,539
    Yes, just like sub bass line for root pitch. I'll explain now. Say we defined pitch with our method, but as usual vocal doesn't stay on one defined pitch note, as well as some guitar sample with several chords, it's varying through some pitch diapason. As usual it is some chord progression (Minor, Major etc.). It has it's root note, if we mean by root pitch note that is the one that we define most often. But it's not usual that lowest basis note for chord progression. What I was trying to do in this ensemble with this sub-sine oscillator is to find lowest note of that chord, at least it was the very first attempt to do it. Sometimes root note can be defined as basis note of chord progression, sometimes not. Sorry, I'm not very familiar with all these terms, especially in english, hopefully you got my idea.

    New thread on FFT sounds like a good idea to me. At least after long period of time I'll get what is it finally.. :D
     
  15. BertAnt

    BertAnt NI Product Owner

    Messages:
    414
    Thanks for the explanation, now i'm beginning to understand it..
     
Thread Status:
Not open for further replies.