Fourier Analysis on musical chords in different instruments

  • #1
dobbygenius
30
9
TL;DR 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?
 

Answers and Replies

  • #2
14,194
8,184
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.
 
  • #3
FactChecker
Science Advisor
Homework Helper
Gold Member
7,592
3,314
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.
 
  • #4
hutchphd
Science Advisor
Homework Helper
2022 Award
5,363
4,529
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 olivermsun and FactChecker
  • #5
dobbygenius
30
9
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!
 
  • #6
dobbygenius
30
9
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 FactChecker and hutchphd
  • #7
dobbygenius
30
9
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..?
 
  • #8
14,194
8,184
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:
  • #9
dobbygenius
30
9
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!
 
  • #10
14,194
8,184
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
dobbygenius
30
9
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!
 
  • #12
hutchphd
Science Advisor
Homework Helper
2022 Award
5,363
4,529
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 jedishrfu and FactChecker
  • #13
dobbygenius
30
9
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
 

Suggested for: Fourier Analysis on musical chords in different instruments

Replies
12
Views
539
  • Last Post
Replies
26
Views
1K
Replies
12
Views
1K
Replies
9
Views
1K
  • Last Post
Replies
2
Views
689
Replies
5
Views
2K
Replies
2
Views
979
  • Last Post
Replies
3
Views
776
Replies
1
Views
604
Replies
1
Views
653
Top