2

I am trying to find a way to pitch shift frequencies in an audio file within a specified range down to a certain amount. For example, I could select 5khz to 10khz and shift them down X amount, but the rest of the frequencies below 5khz remain unchanged (or at least what the addition of the above to it would be).

I'd really like a solution that could do this real time (like a DSP), but just doing it to an audio file in software would be good enough.

It would also be nice to have this done programmatically rather than manually cause I want this done to a lot of files.

3
  • 1
    Well I managed to use audacity to add a high pass filter, then pitch shift, then add original track with low pass filter, then play them both together. This kind of works.
    – Synaps3
    Jul 6, 2018 at 1:59
  • 1
    Your comment is exactly what I would have suggested, and how effects are split between frequency ranges all the time. You might post that as an answer and accept it. Jul 7, 2018 at 5:14
  • There is a mathematical way to do this, however I am not up to date on Fourier transforms. You'd need to look up transformation to the frequency domain, selective adjustment at the frequencies you require, and then transformation back.
    – Rory Alsop
    Jul 11, 2018 at 7:46

1 Answer 1

1

Like said in the comments, the fist thing to do is to separate the frequencies we want to affect from the rest. This can be done using LPF/HPF combo to form a BPF (I find it easier to set my cutoff frequencies using 2 filters rather than a BPF because with BPFs you have a center frequency and bandwidth (Q) which requires some calculations to figure out the cutoff frequencies).

But filtering will give you one track with just the selected frequency range and the original which also includes the selected range. So mixing the two would contain the selected frequency range as it originally was, as well as the pitch shifted bit.

In order to 'subtract' the selected frequency range from the original, we need to phase reverse the filtered version (before pitch shifting) and mix it at 0db with the original. This will give us the original minus the freq. range we took out that we can now mix with the filtered and pitch shifted version.

One last thing to pay attention to, especially if this is done programmatically is the timing. Since the signal path is split and then re-joined, we must delay the faster side so that it mixes with the slower (the one that takes longer to process) at exactly the right time.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.