# 0.2 Auto-tune: implementation

 Page 1 / 1
Implementation of auto-tune in MATLAB.

## Overview of algorithm

When pitch shifting is mentioned, most people immediately associate it with frequency shifting. Frequency shifting can be easily achieved by simply modulating the input signal by a sinusoid; however, employing such a method creates a ring modulation effect, which is not the desired effect in this case. Thus, pitch shifting and frequency shifting are not the same thing. A true pitch shift can be realized by resampling the input signal. Unfortunately, this method changes the duration of the input signal, which is also not a desired effect. It turns out that a slight modification of the second method (resampling) can be used to accurately pitch shift a signal. In order to implement (crude) auto-tuning, we just need to break up the input signal into small windows and pitch shift each window by an appropriate amount. More sophisticated phase correction algorithms are required to remove the distortions that result.

Below is a schematic that summarizes our implementation.

We will now outline our MATLAB implementation of auto-tuning. The algorithm can be broken down into three major steps:

## 1. determining the shift ratio for a window

The input signal is first divided into windows of length 256, modulating by Hanning windows. To increase frequency resolution, the window is zero-padded so that its length is 512. The frequency spectrum of each window is then computed using a 512-point FFT. To find the dominant note in the window, the largest peak within a specified frequency range is selected. It does not matter whether we select the peak corresponding to the fundamental frequency or a harmonic since since both are expected to be out of tune by the same ratio. The frequency of the note is easily found from the index of the peak by a linear mapping: the first peak corresponds to a frequency of 0 Hz, and the last peak corresonds to the sampling frequency.

The next step is to find the frequency on the chromatic scale (440 Hz multiplied by integer powers of the twelvth root of 2) that the identified peak needs to be shifted to. To do this, we simply map the identified peak to the closest key on the piano and find the corresponding frequency of the note. The shift ratio is the frequency corresponding to the closest piano key divided by the dominant frequency in the frequency spectrum.

## 2. pitch shifting a window

To pitch shift a window, we must first stretch/compress the window in time and then resample the window. In order to raise the pitch, we need to expand the window since we would like to resample at a higher frequency; similarly, lowering the pitch requires shrinking the window. For clarity, we will assume for the remainder of the section that we are interesting in raising the pitch for a given window. The steps involved in lowering the pitch are analagous.

In order to expand the window, we subdivide the window into smaller overlapping frames each of length 64, with 75% overlap, modulated by Hanning windows. Thus, each frame begins 16 samples after the previous frame begins. For a window of length 256, this will result in 13 frames. The 13 frames are then spaced out and added together so that the expanded window is larger than the original window by a factor of the shift ratio determined in the previous section.

We have now managed to stretch the window in time, but in doing so we have completely destroyed the linear phase of the window. Thus, the phase must be reconstructed. This is done by taking the FFT of each frame, adding the expected linear phase offset to the FFT coefficients in each frame by looking at the phase difference between the current frame and the previous frame, and finally taking an inverse-FFT to get the corrected frame in the time domain. We used an external package to handle these phase corrections.

To complete the pitch shift, we need to resample the window at a rate higher by a factor of the shift ratio. This is achieved by a simple linear interpolation. Note that the original length of the window is preserved since we have expanded the window and resampled the window using the same ratio.

## 3. recombining the windows

Finally, the pitch shifted windows are combined together. Currently, there is no phase correction after recombination, and as a result, there is audible distortion in the output. Resolving the phase discrepancies for the entire signal is a rather challenging project since the phase is nonlinear. We encourage others to expand on and improve our implementation of this final stage of the algorithm by adding phase correction.

suppose you are the manager of a perfect competitive firm. your total cost of production is given by TC=100+Q2 suppose you are told that the price of their services is \$60 1. how much output should you produce to maximise profit? show calculations 2. determine the level of profit
220
ezhilarasan
what is price control
importance of scale of preference
what are the factors that affect international organization
Organizational structure,communication,mission
Ogunsola
what is international organization
discuss how international organization affect business in Nigeria
Imeobong
An international organization is an organization with an international membership, scope, or presence.
Avishek
thanks
Imeobong
importance of scale of preference
Offei
demand curve
Raphael
demand uuu
Raphael
uu
Raphael
supply curve
Raphael
what is price control
Raphael
what are the factors that affect demand and commodity
if a firm stays on the same isoquant it means ? a. output missteps decrease b. output must stay. the same c. output must increase d. quantity of labour and capital employed must remain the same e. none
A
Were
A
alyssa
B
SEMAN
A
Darren
B
Bertilla
D
Romeo
which one is the right answer pls
Bertilla
😂😂😂😂
Niza
Niza
B
Foley
d
Fasae
b
Alicia
a
Mohammed
hi
DINA
d
DINA
d) none. because isoquants meant different combination of inputs give same level of out and higher the isoquants gives higher the level of output
ezhilarasan
okay
Bertilla
answ. d.quantity of labour and capital employed must remain equal
mohamed
d
Ayoka
B
jephter
analyse this table showing how this affect the law of diminishing demand return
What are diminishing marginal returns as they relate to costs?
michael
what are diminishing demand
Bertilla
please can you explain it to me because am new to economics
michael
the law of diminishing state that as more and more variable factor is added to a fixed cost, it will increase first and later its begins to fall until its get to zero. that were ur mc equal to zero
Fasae
thanks dr
Bertilla
The law of diminishing demand states that, if the price of a product is raised, a smaller quantity will be demanded and if the price of a product is lowered, a greater quantity will be demanded.
Were
The law of diminishing returns, also referred to as the law of diminishing marginal returns, states that in a production process, as one input variable is increased, there will be a point at which the marginal per unit output will start to decrease, ceteris puribus
Were
guys I need to know what is meant by basic economic mathematics and explain please
It's also the usage of mathematical tools to express and analyse economic problems.
Rasaq
so basically it's the use of mathematical formulas to solve the problems under demand and supply right...
Lovemore
Yes, though economic analysis majorly has to deal with demand and supply forces in fact the back bone of economics rest on demand and supply but there are other functions like consumption function, implicit ,explicit, monotonic( constant, increasing, decreasing), transcendential, homogeneous, polyn
Rasaq
wat improvement do economic has with our life
it help us how to use our limited resources to satisfy our unlimited wants
Pagnol
Economics assit in understanding the pre-requisite for Growth and developmen and how the workings of the economy operates.
Rasaq
Economic helps us to manager our limited resources, how to expand it, etc over unlimited want
Eagle
Economics is the social Science in which we study how scarce resources are allocated for the betterment of human being.
what is equilibrium point
where price and quantity demanded meet
Pagnol
is the point where price an quantity demanded meet
Aminata
why do consumer demand curve tend to move downward slope
Aminata
Equilibrium point is the point at which quantity demand equals quantity supply.
Rasaq
What is monopoly
Is a strict example of an imperfect market where there is only one seller and many buyer for a particular product.
Rasaq
what is economics
economics us behavior. Of people, nations, markets etc. It has much to do with reactions. watch MSNBC. Bloomberg. everyday they talk about how the markets react to an piece of news, legislation, interest rates etc. Interesting volatile stuff
TOM
but, it also react with science
ezhilarasan
economic is a science with study's the behavior of people,market and price
Bertilla
it's a science which study the behavior of people ,market n price
Bertilla
What is opportunity cost?
Junior
opp. cost~a benefit, profit or value of something that must be given up to acquire or achieve something else
Kim
or something that you foregone
Kim
who is the father of economic
shaikh
Bilal
Nazifi
Researchers demonstrated that the hippocampus functions in memory processing by creating lesions in the hippocampi of rats, which resulted in ________.
The formulation of new memories is sometimes called ________, and the process of bringing up old memories is called ________.
Got questions? Join the online conversation and get instant answers!