Identifying piano frequencies via color coding in the frequency domain

1 view (last 30 days)
Hello again MATLAB community,
I am attempting to identify the frequency range of a singer by isolating certain time intervales of the song, where it is only him singing and a piano playing in the background. I have a frequency domain plot from 100 Hz to 1000 Hz and I would like to further isolate this by color coding all the fundemental frequencies (pure tones) of a standard piano. Below is an example of my plot, if I could color code all the piano frequencies blue and leave everything else black, that would be ideal. For example, keys 47, 48, 49 correlate to frequencies 391.9954 Hz, 415.3047 Hz, and 440 Hz respectively. There are 39 keys between 100 and 1000 Hz and I effectively want my code to color any lines that have one of these 39 piano key frequencies. Additionally, once I have somewhat Identified this singers freqencies, I would like to color code those frequencies across the entire song. So, any suggestions on color coding frequency ranges vs. frequency values, would be much appreciated.
I understand I could likely just use a for loop, but I still don't fully understand how to interplay for loops with plots. Although I would't be surprised if I didn't need a for loop at all. Thank you all for the assistance.

Answers (1)

Image Analyst
Image Analyst on 5 Dec 2022
Have you tried spectrogram?
Have you looked into Blind Source Separation or INdependent Components Analysis?
This is essentially the Cocktail Party Problem
You can do a decent job solving it with Blind Source Separation or Independent Components Analysis.
See the links below:


Find more on Audio I/O and Waveform Generation in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by