# 3.2 Finding piano note frequencies

 Page 1 / 1
A method to determine the frequencies of the notes that a piano is playing using known times that notes are played.

## Windowing

We now want to find the frequency that each note is played at. To do this, we want to isolate each note using the times provided by the note onset-detection code. Our program uses a simple rectangular window to get the part of the song we want to analyze. Rectangular windows introduce some high-frequency noise to the spectrum because both ends of the sound vector now have steep edges, but it is a quick method and it did not noticeably impact the performance of the code.

## Frequency spectrum

Now that we have a single note isolated, we take its Fourier transform and normalize it so we can analyze it in the frequency domain. The note has strong peaks at frequencies which correspond to frequencies of the note which was played. Harmonics of the note also appear quite strong, depending on the specific piano used to play the note and the note itself.

First, we must determine that a note is being played at all. If a note is being played, there will be peaks in the frequency spectrum that are large compared to the rest of the spectrum. We determined that if peaks exist with a magnitude of 100 or greater, that a note was certainly being played. This algorithm runs into some trouble with very soft parts of songs, but is very reliable for most songs.

In order to determine which notes are being played, we use a simple threshold detector. If the peak is above a certain threshold (our final code uses 0.1), then we mark it as a candidate for being a note that was played. The peak must also be far enough away from other peaks so that we do not register a double-peak. The program then iterates over all the candidates to determine which are actual notes being played and which are harmonics.

Harmonics of a vibrating string occur at integer multiples of the fundamental frequency. Since a piano consists of many vibrating strings, we know that a peak should show up at frequencies corresponding to integer multiples of the note that is being played. Knowing this, we can always determine that the peak with the lowest frequency must be a note being played because it cannot be a multiple of any lower frequencies. Using this lowest frequency, we then remove any harmonics that are integer multiples of it. We then search for harmonics of the next-lowest frequency peak that is still a candidate, and repeat until we have determined that every remaining peak is not a harmonic of any other peak.

Unfortunately, octaves present a unique challenge. The note one octave above any note occurs at twice the frequency of the lower note, which is the same frequency as its second harmonic. There is no sure-fire way to determine when a peak is a harmonic and when it is a second note being played one octave above the first note, so we implemented another threshold system. If the peak in question is more than .3 times the value of the lower-frequency peak, then our program interprets it as a second note being played instead of a harmonic. This value seems to work in most cases. Harmonics above the second tend to be very weak in the frequency domain, but they could potentially cause a problem on certain pianos.

One of the hardest parts of finding the peaks is setting a good threshold value. It should be low enough that all the necessary peaks are set as candidates, but high enough that the noise is never picked up. We square the spectrum to get the power spectrum, which makes the peaks stand out an allows us to easily see where we should set the threshold. Changing threshold values is much easier when looking at this view.

All of the candidates that remain are determined to be notes that were played and the frequencies are returned by the program.

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
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
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
what is backward bend
It's a curve that reverses direction
Good evening friends
Kojo
Evening
evening
Emmanuel
hi
Lawrence
Any Nigerian lady to meet here Well on eco ground
Suleiman
Good morning ooo I hope everyone is fine
Kojo
hello
James
yeah
Kojo
how?
Kojo
how time
James
cool
Kojo
Ok
James
Good morning
Junior
morning all
Emeka
Morning
😶g
Maaz
moaz taha u r egyptian aren't u ?
Marwa
marwa no
Maaz
how economic effect the Market
Abdikarem
what is the difference between statistic and statistics?
Shafiu
One of the Principle of Economics states "Market is the best place to organize economic activies". However, market may fail if it does not perform it's necessary expected functions like Exercising real forces of demand and supply, contact where transactions are made etc. Though government may int
Rasaq
Rasaq
it can can be described as when the demand is insufficient
high Dublin divino through Higginbotham
How does exchange rate affect the demand and supply?
austine
You mean demand and supply of currency ?
Jahangir
Hello
Hann
Hi
Jahangir
Am debby
Hann
am jahangir
Jahangir
how are you
Ogunsola
I am All fine Wbu ?
Jahangir
doing great
Ogunsola
Hw r u all
Mudassar
Am gud
Hann
Gd
Mudassar
Ogunsola
are you help for your country of economy leavel
Mutha
hi
Hammed
Hello
Assan
hi
Pranshi
Hello
Kamal
hi
Pranshi
hi
Abbas
hi
Abdirazak
ki sah botine
Neyshawn
hi
Nasir
Hello Economist
Nasir
hello
Victor
Hie... may anyone give me examples of countries that successfully implemented import substitution industrialisation.
Thabo
Nigeria
Junior
hey I'm emma from Uganda
niwagaba
Hello
Abraham
What is the difference between Demand and Quantity Demanded?
Weedh
Demand refers to how much a product is desired by buyer mean while quantity demanded refers to the amount of product a buyer is willing to buy at a certain price.
Junior
Good evening
Evening
Junior
evening
Ogunsola
someone wat is d textbook to read for banking and finance course
ayomide
Evening
Anjorin
Hw r u doing
Faku
yh
Benj
I'm good, u?
Anjorin
demand is the various quantity of goods or services a consumer is Willing and able to buy at a particular price over s given period of time while quantity demanded is the amount of goods or services being paid for
Florence
Good
Awudu
discuss how international organization affect business
Imeobong
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!