Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Wanting program or app for waveform analysis

  1. Jan 18, 2014 #1


    User Avatar
    Gold Member

    Hi everyone,

    My 14 year old son who is an avid musician and composer, wants to do a science project that involves waveform analysis of tonal harmony in Western music, for example, why certain chords and chord progressions are more pleasing than others and whether the interference patterns would give any information on this.

    Is there a PC program or iPad app that would enable him to capture waveforms as he plays chords on the piano? He has a synthesizer as well, so a PC program that takes input from the MIDI interface would work, or it could be using the microphone on a laptop or the iPAD.

    Thanks for any help!
  2. jcsd
  3. Jan 18, 2014 #2
    I'm guessing you'll want something that does a fourier transform to display the frequency components of the recorded wave. I don't know of any programs off hand, but a simple version is actually pretty easy to make if you know what you're doing. So there's probably a good fourier transform or two floating around that you could find with some google searching. Maybe that gives you a starting place?
  4. Jan 18, 2014 #3


    User Avatar
    Science Advisor
    Homework Helper

    http://audacity.sourceforge.net/ is a good choice for capturing the data, and general audio editing. (Your son will probably find it's useful for other music-making tasks apart from this project).

    It might not have an "accurate" enough frequency analysis display for what you hope to do, straight out of the box, but it hosts audio plugins in several different formats so you can probably find anything you want somewhere on the web - or write it yourself and run it from within Audacity.

    Just a word of warning - this project might not turn out to be as "simple" as you might hope. People have been working on it for several hundreds of years already .... :smile:

    But it if makes an aspiring musician listen to sounds critically, that can only be a good thing, whether or not you actually discover the "magic secret" of western music.
  5. Jan 19, 2014 #4


    User Avatar
    Science Advisor
    Gold Member
    2017 Award

    Thats what I was thinking, too. The subject has been studied since Pythagoras and my Son did his Masters project by writing a computer program to analyse musical pieces and to identify structure. It's a subject that's very hard to nail down, objectively.
    You might find it best to approach it by using the synthesiser with pure tones (as pure as you can get), rather than the piano. There are a lot of small PC programs that will give a frequency spectrum of a sample of sound. I do not use PC software so I can't recommend anything in particular - try a few before you buy - they all do much the same thing and the choice of user controls is up to the individual. Google "Audio Spectrum Analysis program"
    The problem will be in identifying the basic structure of what you see (hence I say, use simple sounds rather than percussive piano notes)

    The main help you can give your son will be to make sure his study has some structure and can end up with a few pages that carry a consistent message. He will, almost certainly, hate the writing up and that's the bit that gets the marks! (Boy what a drag) So, after an initial playing phase, try to gather some pictures of chord spectra and see how they tie in with the harmonic structure of individual notes and see how the numbers (ratios of frequencies) tie in. At 14, the demands won't be high so the emphasis should be more on producing something to show he's put in effort and learned something.
    It could be fun (except for the rush at the end).
  6. Jan 19, 2014 #5


    User Avatar
    Science Advisor
    Homework Helper

    If you look at the history of western music for about the last 1000, years (forget about Pythagoras, because there is too much uncertainty about what ancient Greek music actually sounded like!) one conclusion is that what sounded "pleasing" at any particular time was mostly a matter of either consensus, or diktat from an "authority" such as the Church. Nothing much stayed consistent over time.

    There are a few basic acoustical facts, e.g simple frequency ratios like 2:1, 3:2, 4:3 sound different from arbitrary combinations of frequencies. But the problems start when you try to use that idea as the basis for a western-style musical scale.

    2:1 is an octave, and 3:2 and 4:3 are a fifth and a fourth. So far so good, but beyond that the arithmetic doesn't work out. if you combine two fifths, say C-G and G-D, you get a whole tone C-D = 9:8. But then if you combine two tones, you get a third C-E = 81:64. Oops, you really wanted to make that 5:4 = 80:64, and most 21st century westerners would think 5:4 sounds pretty good and 81:64 sounds horrible.

    But in 1000 AD, the powers that be decided that 81:64 was right, and 5:4 was wrong.....

    ... and people are still inventing new ways to make that basic arithmetical problem go away, even if most people today think "equal temperament" is near enough the right compromise.
    Last edited: Jan 19, 2014
  7. Jan 20, 2014 #6


    User Avatar
    Gold Member
    2017 Award

    A page with free audio software (Wikipedia)

    Audio analysis:

    Recording and editing:

    Digial audio editors:

    Some free VST spectrum analyzers (VST plugins needs a software host, i.e. a recording software):

    Voxengo has a bunch of free VST plugins:

    For spectrum analysis I would try Voxengo SPAN:

    I haven't tried any of these (except a bunch of other Voxengo plugins, which are pretty good). I use Sony Sound Forge (which isn't free) for these kind of things, it has built-in spectrum analysis.

    EDIT: as others have pointed out, these things may not be so quick and easy in practice. And setting up a working audio/software environment can be a little tricky and take time, I should point that out.

    EDIT 2:
    What kind of synthesizer (model)? I'd start with making a clean, pure sound on the synthesizer (pure sine), recording it to the computer with a microphone and analyzing it so I'm sure I know what I'm doing.

    A software that handles MIDI is not enough. The computer needs to be able to handle MIDI too. For this you need e.g. 1) a "www.google.se/search?q=midi+to+usb+interface" [Broken] or 2) a sound card with MIDI input. Furthermore, you will need a software synthesizer (e.g. VSTi plugin) which turns MIDI into sound on the computer. Here's a bunch of free VSTi:s:


    The signal flow will be like this:

    External keyboard (synthesizer) -> (MIDI data) -> Computer MIDI interface -> Software synthesizer plugin (e.g. VSTi) -> (Audio data) -> Recording software -> Spectrum analysis (e.g. VST)

    For this you need a recording software that 1) handles plugins, e.g. a VST spectrum analysis plugin or 2) has built-in spectrum analysis. See above.
    Last edited by a moderator: May 6, 2017
  8. Jan 20, 2014 #7


    User Avatar
    Science Advisor
    Gold Member
    2017 Award

    This is all useful stuff but we need to bear in mind that the persons who will be doing the project is 14 years old. It is essential that it doesn't get out of hand, which will overwhelm him and rapidly get him demotivated. The very first thing is not 'how to do things'- it's to define an actual task that is workable. Even undergraduate students are given tasks for their investigations that are aimed at their ability and course knowledge.
    How many hours will be allocated to this project? At least half the effort must be reserved for the presentation (realistically). Just getting one complicated bit of software to work could be more than enough for a 14 year old, with limited background, to fit into the work..

    It could be very useful and instructive, just to be looking at the spectral content of chords (sinusoidal sources, is possible) and some of the less complex voices of the synthesiser.
    Voice of reason:
    You have gone to the trouble of posting on PF about this so you are clearly prepared to be putting in some time towards it (lucky boy). The project could be helped a lot if you can help him to give it some structure and for a 'reasonable' adult influence to keep it within reasonable bounds.Get him to realise that every hour spent on his presentation will be worth at least as much as than the equivalent time tinkering with the gear and getting it to work. He will only begin, really to learn about the subject when he actually starts to present his results. I know; I have done this with hundreds of A level students.
    Good luck.
    Last edited by a moderator: May 6, 2017
  9. Jan 20, 2014 #8


    User Avatar
    Gold Member
    2017 Award

    I know. But I suppose the OP is an adult, that's why I wrote my post :smile:, but maybe it can be misinterpreted. The OP presented two options in post #1:

    1) Microphone recording. The signal flow is:

    Keyboard -> (Audio data) -> Recording software -> Spectrum analysis.

    Equipment needed:
    Keyboard, microphone, audio and/or recording software, spectrum analysis tool
    Keyboard (plugged into "Line in" on the computer), audio and/or recording software, spectrum analysis tool

    2) MIDI. The signal flow is:

    Keyboard -> (MIDI data) -> Computer MIDI interface -> Software synthesizer plugin (e.g. VSTi) -> (Audio data) -> Recording software -> Spectrum analysis (e.g. VST)

    Equipment needed: Keyboard, midi interface, software instrument, audio and/or recording software, spectrum analysis tool

    Obviously 1) is simpler than 2). A standard computer does not have support for receiving midi input, that's why I wrote:

    Last edited by a moderator: May 6, 2017
  10. Jan 20, 2014 #9


    User Avatar
    Science Advisor
    Gold Member
    2017 Award

    I guess it could depend upon the area of knowledge of the Dad more than of the Boy and the Dad knows the Boy more than we do. I was giving a 'child centred' view and thinking what the School hopes to get out of it. I would imagine that it is quite possible that the Boy and Dad will end up far better informed than the Teacher about this topic.
    It's all to do with the final presentation. But that's life.
  11. Jan 20, 2014 #10
    As many have mentioned, the question of why certain notes sound good together can be kind of difficult to answer scientifically, especially because not everyone can agree on what sounds "good" in the first place.

    Hopefully I'm not too late, but here's a suggestion for a similar project which is maybe a little bit easier to tackle. Answer the question "why do different instruments sound different?" It might sound silly at first, but think about it... a quick google search will tell you that a middle C is just an oscillation of around 262 Hz. So why does a middle C on a piano sound so different from a middle C on an electric guitar if they're both just a 262 Hz oscillation?

    The nice thing about this question is that you can actually give a decent answer: harmonics. When you play a middle C on a piano, you're actually generating more than just a 262 Hz wave. You're also generating waves at 2*262 Hz, 3*262 Hz, 4*262 Hz, etc, which are called harmonics. The behaviour of these harmonics (how loud they are, how quickly they decay, etc) is an important part of what makes one instrument sound different from another.

    This question also lends itself to some nice graphs that are easy to look at and understand. If you play a note into a spectrum analyzer, you can see the different frequency spikes which correspond to different harmonics. You can also see very clearly how the spikes look different for different instruments, even though you're playing the same notes. As a simple example, if you play a note on a piano or guitar, you'll see a big spike at the main frequency, but you'll also see a lot of harmonics at higher frequencies. If you whistle, you'll see one large spike at the frequency you're whistling, but almost no harmonics because whistling is a "purer" sound than a guitar or piano. As another example, singers have to learn to control how "rich" their voice sounds, which basically corresponds to controlling how prominent the harmonics are in the notes they sing. I actually built myself a simple spectrum analyzer on my laptop to help me practise this when I took singing lessons. I could see how "rich" my voice was just by looking at the harmonics.

    Of course, you can make this topic as complex as you want (you could probably write a PhD thesis on it), but if you stick to just basic stuff (how big are the harmonic spikes in instrument x vs. instrument y?) it should be pretty manageable I think.

    Edit: it's for a completely different non-musical application, but just as an example this graph is the type of thing you would see if you played a note into a spectrum analyzer. You can see a big spike at around 50 Hz, which would correspond to the main note, but you can also see smaller harmonics at 150 Hz, 250 Hz, 350 Hz, etc. (The ones at 100 Hz, 200 Hz, 300 Hz are missing because this particular graph isn't from a musical instrument)
    Last edited: Jan 20, 2014
  12. Jan 27, 2014 #11


    User Avatar
    Gold Member
    2017 Award

    Actually I've just tried Audacity which AlephZero mentioned in post #3 (since I was looking for a simple audio editor for a completely different reason).

    I tried the built-in spectrum analyzer (Menu: Analyze -> Plot Spectrum). It seems to do the job well, the spectrum window can be resized and it supports a logarithmic scale on the frequency axis. This is what it looks like (it's a spectrum of a DW bass drum):


    Now, what I do appreciate is that there is an "Export" function (see button in image), which saves the data from the spectrum into a text-file, which looks like this:

    Frequency (Hz) Level (dB)
    1,345825 -45,704632
    2,691650 -46,441174
    4,037476 -54,815742

    This is pretty useful, since this textfile can be analyzed further by other software (like e.g. Excel :tongue2:).

    Further info:
    Audacity - Plot Spectrum: http://manual.audacityteam.org/man/Plot_Spectrum
    Audacity - download: http://audacity.sourceforge.net/
    Last edited: Jan 27, 2014
  13. Jan 28, 2014 #12


    User Avatar
    Gold Member
    2017 Award

    I mentioned a couple of free analyzer plugins before in post #6.

    Since I am about to do some audio processing myself, I actually tried a bunch of spectrum analyzers today, just to see how well they performed. Therefore I will give a very brief review of them (or rather, verdict :biggrin:), for the benefit of the original poster and for others who may read this thread.

    I've tried five analyzers: Audacity's built-in analyzer and four VST plugins (which I installed and used in Audacity). I list them from good (1) to bad (5):

    1. Audacity's built-in spectrum analyzer

    Pros: This is actually the analyzer I prefer in this test. It does the job, and you can set the frequency axis to either logarithmic or linear. And it can export the spectrum data to a text file, which is a huge plus. Cons: No particular cons. The spectrum window could be made better, but you can't always get what you want. Here's how an A4 (440 Hz) piano note looks like (with a linear frequency axis):


    2. Freakoscope

    Pros: Pretty nice and easy to use. Many frequency axis options: linear, logarithmic, semitones, 3rd octave and bark. Cons: The frequency axis is at the top and it does not display enough numbers IMO (see picture below, only 2000 Hz). But you can click with the mouse on a peak to see the frequency and note. An A4 piano note looks like this:


    3. Blue Cat Audio Freq Analyst

    Pros: Pretty nice. Some customization options and a pretty nifty zoom-function, i.e. you can zoom in on different frequencies with the mouse. Cons: The frequency axis is logarithmic only, and I did not find a way to make it linear. An A4 piano note looks like this:


    4. Voxengo SPAN

    Pros: It's a rather nice plugin, you can change scale and scroll rather nicely in the spectrum. Furthermore, there are pretty many options. Cons: I actually expected somewhat more of it. It's not a very intuitive interface, I needed to fiddle with the settings in order to get the spectrum I desired. And it seems it only has got a logarithmic frequency axis - no linear. An A4 piano note looks like this:


    5. rs-met Signal analyzer

    Pros: It has got both linear and logarithmic frequency axis, but that's about the only positive thing about this plugin. Cons: It has got a terrible spectrum window :cry:. It's hard to scale, hard to zoom, hard to get anything useful out of it. It's just small and annoying, just look at this sad A4 piano note spectrum :yuck::



    In my opinion, Audacity's built-in spectrum analyzer is the winner of these five. If you want some more options, you can install Freakoscope too and use it in Audacity.

    Side note: Thanks, AlephZero, for suggesting Audacity! It seems it is a nice program. I've used it today for analyzing a couple of hifi speakers, a process which requires full duplex (playback and recording at the same time), and Audacity handles it just fine - it works like a charm!
    Last edited: Jan 28, 2014
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook