Post Go back to editing

Karaoke key change using ADI pitch transposer alogrithm

Hi,

I would like to implement the key change function for a karaoke machine using ADAU1451.

I tried the ADI pitch transposer algorithm for the key change function.

First, I don't know how to set the parameters  'Delay Reserved', 'Frequency Shift Slider', and 'Max Shift' to achieve +/-4 semitones pitch change. The information in the wiki Analog Devices doesn't show clearly how to set those parameters.

https://wiki.analog.com/resources/tools-software/sigmastudio/toolbox/adialgorithms/pitchmodification/pitchtransposer

Second, I set 'delay reserved' to 1000, while the 'max shift' is 100. I can heard obviously that the volume does not keep stable, like vibrato effect . Can it be more stable?

Thanks in advance!

Jim.

  •      Hello Jim,

         Unfortunately, the answer to your second question appears to be, no.  The standard ADI pitch shifter works with a circular buffer which simultaneously records samples at the input sample rate, while pulling them out at a different rate to achieve the pitch change.  The splices between these snippets of audio cause the vibrato.

         Third-party developers such as base10 labs offer licensed algorithms for this function.  Such are available on a trial basis for some SigmaDSPs (such as the humble ADAU1701, see below).  ADI may be able to recommend this outfit or another third party to provide a better pitch changer for the Sigma300 (ADAU145x).

         Given the performance of the stock pitch transposer, the following may be moot -- but here's how to get your semitone pitch shifts.  Use the data-controlled version and drive it with a Lookup Table (LUT) as shown below.  The LUT contents are a bit more complex than what the wiki suggests -- its numbers depend upon the amount of delay reserved as well as the desired pitch change and the sample rate.  With 2000 samples reserved at 48K, the LUT shown below provides plus or minus six semitones.  The attached project runs on the ADAU1452MINIZ eval board -- I tested it using the 440 Hz (middle A) tone oscillator and a guitar tuner app:

         BTW -- I used to host karaoke and have had experience with several key changers, none of which provided truly clean audio.  Thus I encouraged my singers to pick songs within their range.  For example, to stick with rock and singer-songwriter artists, while staying safely away from vocal "hot-shots."  Besides, although having absolutely no musical talent I've been cursed with perfect pitch, thus cannot stand to hear any song away from its original key.

         Best regards,

         Bob

    1452-KeyChange.dspproj.zip
  • Hello Bob,

    Thanks a lot for your help. The SigmaDSP project is very useful.

    From you table, I can get more information about how to calculate the control input. I notice that the frequency shift is dependent on the "Delay Reserved".  Can you help to clarify how to calcuate the LUT output? Is the LUT output  calculated using the following equation?

    LUT output=(delta pitch %)/(sample frequency*Delay Reserved/1000)

    If we would like to evaluate base10 labs advanced pitch shifter, how can we get the trial version of the algorithm?

    Also thanks for you suggestions about that singers should pick songs with their range.

    With best regards,

    Jim.

  •      Hello Jim,

         Sorry I didn't notice your follow-up questions until now.  I had attempted to find a more general formula for the lookup.  Its relation with the delay reserved appeared somehow nonlinear so I gave up on defining it exactly (given that the algorithm doesn't perform very well anyway).  Generally the more samples reserved the better the sound, but above 2000 we run into diminishing returns.

         If you have access to a ADAU1701 board, you could go ahead and evaluate this version of base10's pitch transposer.  I don't know if they have one for the ADAU1452 -- they (or another developer) might need to build it from scratch.  Someone at ADI could recommend such a third-party developer, should you desire to go that route.  

         BTW, I also had attempted several schematics using multiple ADI pitch shifters to somehow average out or cancel out the vibrato, but ran into phase issues, producing instead a tremelo effect.  This moment I just thought of yet another possible idea -- If I get to try this and it helps, I'll share it.

    Edit    6/18/17  --  OK,  I tested my latest idea and it didn't help.  Since it's been said that the pitch shifter has trouble handling multiple frequencies at once, I tried splitting the music into frequency bands, each with their own transposer.  As with my other methods, it traded tremelo for vibrato.

     

         Best regards,

         Bob

  • Hello Bob,

    Thanks a lot for your further information.

    As our product will use ADAU1451, the maximum delay reserved for the pitch transposer we can use is 1000. Could you tell me how you find the values in the lookup table if there is no exact equation?

    ADI recommended me to contact base10 labs by email directly. I will contact them if our management doesn't satisfy with the effect of the ADI pitch transposer algorithm.

    Thanks a lot for your great effort to try to the cancel out the vibrato effect using different approaches.

    Could you also tell me whether the ADI pitch transposer algorithm is based on PSOLA algorithm?

    Thanks and best regards,

    Jim Yam.

  •      Hello Jim,

         The LUT contents were determined empirically by running tests, experimenting until a guitar tuner app on my phone showed an approximately correct result.  Then assuming that the relationship between the ADI Pitch Transposer's data input and its pitch shift is proportional, I devised the spreadsheet and table.  Below I added a column for 1K samples reserved.  Note that the 1K numbers are not exactly double those for 2000 samples reserved, indicating the nonlinearity I had described earlier:

         I attached the spreadsheet (Open Office format) and the revised project should that help.  Likely you have already noticed that SigmaStudio doesn't save your Delay Reserved setting with the project -- I tend to excuse bugs like this since this wonderful software is made available free of charge.

         It appears that the ADI Pitch algorithm does use something like PSOLA, although its developer(s) at ADI would have to weigh in on that to know for sure.  I don't have access to SigmaStudio's internals.  PSOLA works well for voice; not so much for music.

         Best regards,

         Bob

    attachments.zip
  • Hello Bob,

    Many thanks for your help to attach the spreadsheet for calculating the LUT for 1K samples reserved. You're brilliant to find the relationship between the ADI Pitch Transposer's data input and its pitch shift. I thought you designed the pitch transposer algorithm and worked in  ADI before.

    I find that some algorithms in Sigmastudio studio are not well documented which makes the programmers difficult to use them easily. And I need to ask the smart people like you in the engineer zone to use them.

    As you said, PSOLA doesn't work so well for music, could you suggest which method works well with music and can be implemented in ADAU1452? I know that phase vocoder can perform quite good for music but ADAU1452 can't perform FFT/IFFT for this kind of algorithm.

    Thanks and best regards,

    Jim.

  •      Hello Jim,

         Glad to help with the spreadsheet.  Wherever documentation is lacking, often us users end up testing to reverse engineer a particular algorithm enough to approximately describe its operation -- and that's as good as it gets.  You can tell who on the forum works for ADI by the tiny triangle next to their name.

         Actually the ADAU1452 can do FFT and IFFT -- the trouble is, there isn't much we can program in SigmaStudio to perform frequency-domain operations -- for example, see 1452 FFT Capability .  This is where custom developers who can program the chip directly come in.    I'm afraid I'm not familiar with advanced pitch techniques such as phase vocoder, so I can't be of additional help.

         Best regards,

         Bob

  • Hello Bob,

    Many thanks for your information.

    As Sigmastudio is made available free of charge, I should excuse it lacks documentation sometimes. I will try to reverse engineer an algorithm when it lacks documentation.

    Thanks for the link for the discussion of 1452 FFT capability. I hope that the new version of Sigmastudio can perform some complex arithmetic functionality so that FFT of a small chunk data can be implemented and it has more built-in controls.

    I will try to study some advanced pitch shifting techniques and hope that they can be implemented in 1452.

    Best regards,

    Jim.