Fourier Analysis on musical chords in different instruments

Click For Summary
SUMMARY

This discussion focuses on the investigation of how the same musical chord, such as C major, can sound different across various instruments due to differences in timbre and harmonic content. Participants recommend using Fourier analysis to visualize the frequency spectrum and harmonics of the chords played on different instruments. Tools like the Minim library for Processing and spectrum analyzers are suggested for analyzing audio frequency content. The conversation also highlights the importance of understanding musical theory concepts such as the circle of fifths and even tempering in relation to chord tuning.

PREREQUISITES
  • Understanding of Fourier analysis and its application in audio processing
  • Familiarity with the Minim library in Processing for audio analysis
  • Knowledge of musical theory concepts, including the circle of fifths and even tempering
  • Basic understanding of timbre and overtone structures in musical instruments
NEXT STEPS
  • Learn how to use the Minim library for audio frequency analysis in Processing
  • Explore the concept of timbre and its impact on sound perception across different instruments
  • Research the circle of fifths and its implications for tuning and harmony in music
  • Investigate the differences in attack-sustain-decay envelopes among various musical instruments
USEFUL FOR

Musicians, audio engineers, music theorists, and anyone interested in the acoustic properties of musical instruments and sound analysis.

dobbygenius
Messages
30
Reaction score
10
TL;DR
What approach should I use to analyze chords on different musical instruments using the Fourier analysis?
I wanted to do an investigation about how the same musical chord can have the same pitch but sound different on different musical instruments. Like how chord C major would sound higher played in the electric guitar than a C major played on piano. How should I approach this investigation?
 
Mathematics news on Phys.org
When you say higher do you mean in a different octave or that chords sound richer on one instrument over another?

On a piano for example, you can play a C-major chord in 7 different octaves or so. They will all sound different from one another as should be expected.

If the chords are based in the middle octave range then they should largely sound the same except for the richness of harmonics provided by the particular musical instrument.

Computing a Fourier spectrum will show the harmonics too.
 
A spectrum analyser would let you look at the frequency content of the input audio. You might be able to see different harmonics or other frequencies that make the same note sound different on different instruments. I have no experience with this myself. You might start with a free Windows PC program and see if that works. Here is a reference.
 
  • Like
Likes   Reactions: hutchphd
dobbygenius said:
Summary:: What approach should I use to analyze chords on different musical instruments using the Fourier analysis?

I wanted to do an investigation about how the same musical chord can have the same pitch but sound different on different musical instruments. Like how chord C major would sound higher played in the electric guitar than a C major played on piano. How should I approach this investigation?
This is a very interesting subject and you will learn a lot . It is much broader and more complicated than you may know and I recommend that you first need to focus your inquiry. There are really two aspects to your question and you will need to choose one or the other (both are fascinating).
One has to do with western diatonic scale musical theory, the "circle of fifths" and the idea of "even tempering" the scale. It turns out that one can produce perfect thirds and fifths (i.e. a major chord) for only one Key at a time. If the key of C Major is in "perfect tune", F# Major will not be.
The other has to do with the tambre (timbre) of a note produced by various instruments i.e why do instruments sound different even for the same note. This is linked to the overtone structure. Here is a good starting question: why do an oboe,English horn and clarinet sound different?
Your choice. Have fun
 
  • Like
Likes   Reactions: olivermsun and FactChecker
jedishrfu said:
When you say higher do you mean in a different octave or that chords sound richer on one instrument over another?

On a piano for example, you can play a C-major chord in 7 different octaves or so. They will all sound different from one another as should be expected.

If the chords are based in the middle octave range then they should largely sound the same except for the richness of harmonics provided by the particular musical instrument.

Computing a Fourier spectrum will show the harmonics too.
I mean the latter (chords sound richer on one instrument over another). I will start by computing the timbre of different instruments and see if I can compare/find a relationship between them, thank you!
 
FactChecker said:
A spectrum analyser would let you look at the frequency content of the input audio. You might be able to see different harmonics or other frequencies that make the same note sound different on different instruments. I have no experience with this myself. You might start with a free Windows PC program and see if that works. Here is a reference.
I've looked into them and I think I can work with it, thankyou for the suggestion!
 
  • Like
Likes   Reactions: FactChecker and hutchphd
hutchphd said:
This is a very interesting subject and you will learn a lot . It is much broader and more complicated than you may know and I recommend that you first need to focus your inquiry. There are really two aspects to your question and you will need to choose one or the other (both are fascinating).
One has to do with western diatonic scale musical theory, the "circle of fifths" and the idea of "even tempering" the scale. It turns out that one can produce perfect thirds and fifths (i.e. a major chord) for only one Key at a time. If the key of C Major is in "perfect tune", F# Major will not be.
The other has to do with the tambre (timbre) of a note produced by various instruments i.e why do instruments sound different even for the same note. This is linked to the overtone structure. Here is a good starting question: why do an oboe,English horn and clarinet sound different?
Your choice. Have fun
I will go with tambre (timbre), to answer your question, is it because oboe, English horn, and clarinet have different/unique overtone structures..?
 
  • Like
Likes   Reactions: hutchphd
Some years ago, my summer students did a project detecting gunshots from sound clips. They used Processing and the Minim library. There was an application in Minim that performed FFT and displayed the audio frequency spectrum.

https://code.compartmental.net/minim/index.html

https://processing.org/

Here's an example from Minim that computes and displays a dynamic frequency spectrum:

Java:
/**
  * This sketch demonstrates how to use an FFT to analyze
  * the audio being generated by an AudioPlayer.
  * <p>
  * FFT stands for Fast Fourier Transform, which is a 
  * method of analyzing audio that allows you to visualize 
  * the frequency content of a signal. You've seen 
  * visualizations like this before in music players 
  * and car stereos.
  * <p>
  * For more information about Minim and additional features, 
  * visit http://code.compartmental.net/minim/
  */

import ddf.minim.analysis.*;
import ddf.minim.*;

Minim       minim;
AudioPlayer jingle;
FFT         fft;

void setup()
{
  size(512, 200, P3D);
  
  minim = new Minim(this);
  
  // specify that we want the audio buffers of the AudioPlayer
  // to be 1024 samples long because our FFT needs to have 
  // a power-of-two buffer size and this is a good size.
  jingle = minim.loadFile("jingle.mp3", 1024);
  
  // loop the file indefinitely
  jingle.loop();
  
  // create an FFT object that has a time-domain buffer 
  // the same size as jingle's sample buffer
  // note that this needs to be a power of two 
  // and that it means the size of the spectrum will be half as large.
  fft = new FFT( jingle.bufferSize(), jingle.sampleRate() );
  
}

void draw()
{
  background(0);
  stroke(255);
  
  // perform a forward FFT on the samples in jingle's mix buffer,
  // which contains the mix of both the left and right channels of the file
  fft.forward( jingle.mix );
  
  for(int i = 0; i < fft.specSize(); i++)
  {
    // draw the line for frequency band i, scaling it up a bit so we can see it
    line( i, height, i, height - fft.getBand(i)*8 );
  }
}

You can find this sample in the Minim library of examples when running the Processing IDE, using the IDE to download Minim, and checking out the examples menuitem from the File menu. Under Minim FFT, look for AnalyzeSound.

I know there is a more sophisticated app written by David Sanz Kirbis for plotting an FFT spectrum for Android showing the spectrum in a graph with properly labeled axes but I'm at a loss to locate it.

POST SCRIPT -- However, I think this is it:

http://www.therandomlab.com/2013/05/fft-audio-frequency-analysis-with.html
 
Last edited:
jedishrfu said:
Some years ago, my summer students did a project detecting gunshots from sound clips. They used Processing and the Minim library. There was an application in Minim that performed FFT and displayed the audio frequency spectrum.

https://code.compartmental.net/minim/index.html

https://processing.org/

Here's an example from Minim that computes and displays a dynamic frequency spectrum:

Java:
/**
  * This sketch demonstrates how to use an FFT to analyze
  * the audio being generated by an AudioPlayer.
  * <p>
  * FFT stands for Fast Fourier Transform, which is a
  * method of analyzing audio that allows you to visualize
  * the frequency content of a signal. You've seen
  * visualizations like this before in music players
  * and car stereos.
  * <p>
  * For more information about Minim and additional features,
  * visit http://code.compartmental.net/minim/
  */

import ddf.minim.analysis.*;
import ddf.minim.*;

Minim       minim;
AudioPlayer jingle;
FFT         fft;

void setup()
{
  size(512, 200, P3D);
 
  minim = new Minim(this);
 
  // specify that we want the audio buffers of the AudioPlayer
  // to be 1024 samples long because our FFT needs to have
  // a power-of-two buffer size and this is a good size.
  jingle = minim.loadFile("jingle.mp3", 1024);
 
  // loop the file indefinitely
  jingle.loop();
 
  // create an FFT object that has a time-domain buffer
  // the same size as jingle's sample buffer
  // note that this needs to be a power of two
  // and that it means the size of the spectrum will be half as large.
  fft = new FFT( jingle.bufferSize(), jingle.sampleRate() );
 
}

void draw()
{
  background(0);
  stroke(255);
 
  // perform a forward FFT on the samples in jingle's mix buffer,
  // which contains the mix of both the left and right channels of the file
  fft.forward( jingle.mix );
 
  for(int i = 0; i < fft.specSize(); i++)
  {
    // draw the line for frequency band i, scaling it up a bit so we can see it
    line( i, height, i, height - fft.getBand(i)*8 );
  }
}

You can find this sample in the Minim library of examples when running the Processing IDE, using the IDE to download Minim, and checking out the examples menuitem from the File menu. Under Minim FFT, look for AnalyzeSound.

I know there is a more sophisticated app written by David Sanz Kirbis for plotting an FFT spectrum for Android showing the spectrum in a graph with properly labeled axes but I'm at a loss to locate it.

POST SCRIPT -- However, I think this is it:

http://www.therandomlab.com/2013/05/fft-audio-frequency-analysis-with.html
Thank you for letting me know about this!
 
  • Like
Likes   Reactions: jedishrfu
  • #10
My student used the Processing IDE to create an android app that they then sideloaded onto an Android tablet.

It would display a live FFT and the students modded the app to trigger when certain specific high frequency sounds were detected that were correlated with known gunshot frequencies. Sadly though, the app would trigger when the student laughed.
 
  • #11
jedishrfu said:
My student used the Processing IDE to create an android app that they then sideloaded onto an Android tablet.

It would display a live FFT and the students modded the app to trigger when certain specific high frequency sounds were detected that were correlated with known gunshot frequencies. Sadly though, the app would trigger when the student laughed.
I saw the video just now, it's so cool!
 
  • Like
Likes   Reactions: jedishrfu
  • #12
dobbygenius said:
I will go with tambre (timbre), to answer your question, is it because oboe, English horn, and clarinet have different/unique overtone structures..?
Also I believe the Flugelhorn and trumpet provide an interesting pair to contrast (If I remember correctly they are the same range but the Flugelhorn taper misses the odd harmonics? And it sounds great)
 
  • Like
  • Informative
Likes   Reactions: jedishrfu and FactChecker
  • #13
hutchphd said:
Also I believe the Flugelhorn and trumpet provide an interesting pair to contrast (If I remember correctly they are the same range but the Flugelhorn taper misses the odd harmonics? And it sounds great)
I see, that's interesting, I'll look into it! thankyou again
 
  • Like
Likes   Reactions: jedishrfu
  • #14
In addition, the attack - sustain - decay envelope is very different from instrument to instrument. If you take a piano note and replace the envelope with that of a violin, the note will sound very much like a violin note.
 

Similar threads

  • · Replies 37 ·
2
Replies
37
Views
5K
  • · Replies 13 ·
Replies
13
Views
4K
  • · Replies 7 ·
Replies
7
Views
3K
  • · Replies 18 ·
Replies
18
Views
4K
Replies
2
Views
2K
Replies
12
Views
3K
  • · Replies 165 ·
6
Replies
165
Views
10K
  • · Replies 117 ·
4
Replies
117
Views
10K
  • · Replies 41 ·
2
Replies
41
Views
16K
  • · Replies 2 ·
Replies
2
Views
1K