I'm working on a voice changer. My plan is to make it so that it can change your voice in various different ways, but right now I'm just trying to make it change your voice to "chipmunk voice" or a high pitch voice. I have successfully programmed an algorithm that can perform a DFT and an inverse DFT on a recording of my voice. But now I am stuck trying to figure out how to create the "chipmunk voice". I assume you would just change the fundamental frequency of the clip, but how would I do this? How do I modify the DFT to get my desired outcome? What's the best method for this? Apologies in advance if I sound like a noob, but any help (preferably in the most simple terms possible) would be greatly appreciated!
-
1$\begingroup$ why do you want to use the DFT to do pitch shifting? $\endgroup$– robert bristow-johnsonSep 29, 2022 at 5:06
-
1$\begingroup$ Fun fact: the voice effect that you get from breathing Helium is not a pitch shift, it's just transform of the formants. Fundamental and harmonics stay where they are and you still sound like a chipmunk :-) $\endgroup$– HilmarSep 29, 2022 at 11:49
-
$\begingroup$ I’m trying to make an autotune program, that’s the end goal. $\endgroup$– BigChungus443Sep 29, 2022 at 16:21
-
$\begingroup$ I've edited my answer to give you a little detail on auto-tune. $\endgroup$– JdipSep 29, 2022 at 17:10
1 Answer
Putting aside the obvious "resample and play-back at original sampling rate" method, there are many ways to do pitch shifting. Some algorithms work in the time domain (PSOLA is the most commonly named), some in the frequency domain (Phase Vocoder) or time-frequency domain.
These aren't trivial algorithms to implement (time-domain based algorithms are probably easier to understand/implement, but also come with undesired artifacts for most applications) and can be very sensitive to the parameter choices dependent on the desired results.
I strongly suggest you start researching the subject (a simple google search such as "pitch shifting algorithms for voice" would help), try different methods and come back with questions on specific methods! Hope this at least guides you in the right direction.
EDIT Regarding Auto-tune
Auto-tune at its most basic is a two-step process:
- Pitch Detection
- Pitch shift (Auto-tune is based on the phase vocoder method mentioned above)
There are many different ways to realize both these steps. I'll suggest again that you do some research on each of these if you actually want to implement all of this yourself. If you just want the effect, there are plenty of open-source or proprietary software that does this for you.
Here are some references to get you started:
-
$\begingroup$ Thank you, and yes I am trying to implement it myself. I've done research on the phase vocoder. Correct me if I am wrong but it seems to work by taking the FFT of overlapping windows, modifying them, and then performing an IFFT. I am just confused on how the actual modification happens. more specifically how do you modify frequency while retaining duration. I have been doing research and have found many sources that explain how it works, but they don't give much insight on how to actually implement it. I guess that's where I am stuck. Ill modify my original question $\endgroup$ Sep 29, 2022 at 17:20
-
-
$\begingroup$ most often when the phase vocoder is applied to a single voice to either pitch shift it or time scale it, because the harmonics are not locked in to each other, the result can sound sorta "phasey" because the waveshape is changing. if it's not a full-band orchestra, sometimes time-domain pitch shifting or time scaling sounds better. $\endgroup$ Sep 30, 2022 at 1:08