Sound Physics: Generating Tones

In summary, To generate the frequency in hertz of a note programmatically, assuming middle A is 440Hz, you need to use the formula f(n)=440 * 2^(n-n_0)/12, where n is the number assigned to each note and n_0 is the number of the note A. The relationships between different notes can vary from consonant to dissonant depending on their prime number ratio. The chromatic scale uses the twelfth root of 2 as a basis for tuning, while the natural scales are optimal for playing music in specific keys but require frequent retuning. The equitempered scale is a compromise that is close enough to the natural scales for most people to not notice the difference.
  • #1
Ciemnl
3
0
Does anyone know how to generate the frequency in hertz of a note(middle C, F# ,G etc.) programatically assuming that middle A is 440Hz? Idealy you type in the note you wish to find the frequency of and it returns the frequency of it.

Thankyou!
 
Physics news on Phys.org
  • #2
The notes are separated by a ratio of [tex]2^{\frac{1}{12}}[/tex]. To get the frequency of any note if we know that A4=440hz, you have to use this formula:

[tex]f(n)=440 \cdot 2^{\frac{n-n_0}{12}}[/tex].

Where you need to assign a number 'n' to each note, n_0 being the number of the note A. To simplify the formula, you can choose n_0 to be 0.

Eg.: ..., n(G3#)=-1, n(A4)=0, n(A4#)=1, etc...
 
  • #3
Thanks, I am guessing the dot after 440 means multiply
 
  • #4
You may (or may not) find it interesting to investigate other tuning systems. The one GPPaille described is called "equal temperament".
 
  • #5
The RELATIONSHIPS between the tones is interesting - consonance versus dissonance.
Go through the prime numbers:
1) 440*1=440. :- closest relation is itself
2) 440*2=880. :- A, same note one octave higher - very consonant
440/2=220. :- A, same note one octave lower - " "
3) 440*3=1320 :- E, 19 steps up - consonant
440*3/2=660 :- E, 7 steps up - "
440/3=146.67 :- D, 19 steps down - consonant
440/3*2=293.333 :- D, 7 steps down - "
5) 440*5=2200 :- Dflat, 28 steps higher
440*5/4=550 :- Dflat , 4 steps higher
there is more
. . . . and so on and so forth - tending towards dissonance as you progress through the primes

The chromatic scale uses the twelvth root of 2 ( 1.059463094) as has been already expressed in the above posts, and it is interesting to see the difference
Natural E, 7 steps up = 660
Chromatic E, 7 steps up = 659.25
 
  • #6
In case anyone is interested, the "natural A scale" described by LeonStanley in post #5 is the optimum set of frequencies for playing music written in the key of A. All of the notes' harmonics line up with each other perfectly and it sounds nice.

However for music written in the key of C, the optimum scale would be the "natural C scale" based in a similar way on multiples of the frequency of C. And so on for all the other keys. The disadvantage of using the natural scales is that you have to retune your instrument every time you play music in a different key. The "equitempered scale" described by GPPaille in post #2 is a compromise that is sufficiently close to all of the natural scales that most people who aren't expert musicians arguably wouldn't notice the difference.
 

1. How is sound produced?

Sound is produced when an object vibrates, creating waves of pressure in the air. These waves travel through the air and can be detected by our ears, which then interpret them as sound.

2. What is the difference between pitch and volume?

Pitch is the perceived highness or lowness of a sound, and is determined by the frequency of the sound waves. Volume, on the other hand, is the perceived loudness or softness of a sound, and is determined by the amplitude of the sound waves.

3. How do different materials affect the production of sound?

Different materials have different densities and elasticity, which can affect the way they vibrate and produce sound. For example, a metal object will produce a different sound than a wooden object due to their different properties.

4. What is the relationship between frequency and wavelength in sound?

Frequency and wavelength are inversely proportional in sound. This means that as the frequency of a sound increases, the wavelength decreases, and vice versa. This relationship is known as the wave speed equation: wave speed = frequency x wavelength.

5. How can sound be manipulated to create different tones?

Sound can be manipulated by altering the frequency and amplitude of the sound waves. By changing the frequency, we can create different pitches, and by changing the amplitude, we can change the volume. Additionally, we can combine different frequencies to create complex tones and manipulate the duration of the sound to create different rhythms.

Similar threads

Replies
9
Views
1K
  • Introductory Physics Homework Help
Replies
3
Views
194
Replies
4
Views
790
  • Introductory Physics Homework Help
Replies
7
Views
748
Replies
14
Views
2K
Replies
1
Views
1K
Replies
58
Views
6K
  • Introductory Physics Homework Help
Replies
5
Views
1K
Replies
11
Views
3K
Replies
8
Views
1K
Back
Top