Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 3 of 3

Thread: Autotune / Pitch correction

  1. #1
    Junior Member
    Join Date
    Apr 2019
    Posts
    2

    Autotune / Pitch correction

    Hiya! have you built autotune / pitch correction with teensy and audio shield? I could use notefreq & granular from audio system design tool but it doesn't come together in my head, would you give me some advises?

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    19,920
    Quote Originally Posted by amismyk View Post
    would you give me some advises?
    First, if you haven't used the granular pitch shift, start by just doing some simple listening tests. Sometimes it works pretty well if you get the length parameter right. Other times, it's, well... pretty granular. Become familiar with how it really sounds before you dive into listening while it's being controlled by other code.

    Likewise, if you haven't used the note detection, before you try building a complex project, just run it on some of the types of sounds you're hoping to process and watch the numbers in the serial monitor.

    Once you have these 2 tested, you're going to need a strategy for how to update the pitch shift based on the measurements. There are a couple ways you might do this. The simplest probably looks like analying the pitch of the incoming audio and averaging the last several measurements. Maybe scale or weight them, so more recent count more strongly, but enough averaging so 1 errant reading doesn't instantly throw you into a rapidly terrible result. Then compute the required shift and update the granular effect. Repeat at whatever rate you're able to get the pitch measurements.

    Another less obvious strategy might look like analyzing the pitch shift output, rather than the direct signal input. Then you'd probably use something like the Arduino PID Library to analyze the difference between the actual output and the pitch you desire, where your code takes the PID output and uses it to control the pitch shifting.

    If you get any of this working, I hope you'll be willing to share info & maybe even code? I know many other people would find it really interesting.

    I should also mention, on my "bucket list" after the Teensy 4.0 release is much better pitch shifting in the audio library. Today we don't really have enough CPU power on Teensy 3.x to do high quality pitch shift, but when we have a 600 MHz board much better pitch shift should become possible.

  3. #3
    Junior Member
    Join Date
    Apr 2019
    Posts
    2
    Quote Originally Posted by PaulStoffregen View Post
    First, if you haven't used the granular pitch shift, start by just doing some simple listening tests. Sometimes it works pretty well if you get the length parameter right. Other times, it's, well... pretty granular. Become familiar with how it really sounds before you dive into listening while it's being controlled by other code.

    Likewise, if you haven't used the note detection, before you try building a complex project, just run it on some of the types of sounds you're hoping to process and watch the numbers in the serial monitor.

    Once you have these 2 tested, you're going to need a strategy for how to update the pitch shift based on the measurements. There are a couple ways you might do this. The simplest probably looks like analying the pitch of the incoming audio and averaging the last several measurements. Maybe scale or weight them, so more recent count more strongly, but enough averaging so 1 errant reading doesn't instantly throw you into a rapidly terrible result. Then compute the required shift and update the granular effect. Repeat at whatever rate you're able to get the pitch measurements.

    Another less obvious strategy might look like analyzing the pitch shift output, rather than the direct signal input. Then you'd probably use something like the Arduino PID Library to analyze the difference between the actual output and the pitch you desire, where your code takes the PID output and uses it to control the pitch shifting.

    If you get any of this working, I hope you'll be willing to share info & maybe even code? I know many other people would find it really interesting.

    I should also mention, on my "bucket list" after the Teensy 4.0 release is much better pitch shifting in the audio library. Today we don't really have enough CPU power on Teensy 3.x to do high quality pitch shift, but when we have a 600 MHz board much better pitch shift should become possible.
    Thank you Paul!
    it really helps me to think!
    I found what I was missing, pitch shift. I can do it with granualr object in the design tool tho, it also makes my brain a bit messy, I will update if I get meaningful results

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •