Frequency domain

Post Reply
AtomicClock
Posts: 132
Joined: Thu Oct 19, 2023 8:01 pm
Location: USA

Frequency domain

Post by AtomicClock »

What software (free is good) can I use to split a recorded note into its frequency-domain counterparts? I tried audacity, but the output was hard to view.

Something like this:
http://hyperphysics.phy-astr.gsu.edu/hb ... mw.html#c1
User avatar
harrisonreed
Posts: 4606
Joined: Fri Aug 17, 2018 12:18 pm
Location: Fort Riley, Kansas
Contact:

Re: Frequency domain

Post by harrisonreed »

Reaper DAW is free and has these tools built in. I don't know about outputting only the various frequency as audio, but it might be about to do that too. You can always use the EQ tools to do it as well.
User avatar
sacfxdx
Posts: 326
Joined: Wed Apr 11, 2018 4:25 pm
Location: North Georgia, US

Re: Frequency domain

Post by sacfxdx »

Reaper is not free. That’s the wrong attitude. If you are going to use it more than once you should pay for it. Someone should be compensated for their work.

It is free to download to evaluate but you should not consider it FREE.

Of course that’s just my opinion.
Steve
andym
Posts: 103
Joined: Sun Dec 23, 2018 3:03 am

Re: Frequency domain

Post by andym »

That’s a slightly unusual form of the plot because they have taken the output of the Fourier Transform and then converted to a simplified view where the power in the spectrum has been assigned to ranges of frequencies for each harmonic. I think that is not necessary and hides from you whether each harmonic is very clear and isolated or has power into the frequencies around it.

You may not like this suggestion but the free tool I use is the statistical package R. It is more of a programming toolkit than a simple app and so using it depends on your programming skills. I’m a seismologist who does a lot of statistical analysis and so it works for me. You can generally find tips on doing things in R by google searching.

There are audio file reading and writing tools and FFT (fast Fourier transform) tools and many plotting tools. In addition to plotting spectra of a segment of a waveform, you can also find ways to plot spectrograms that show how the frequency content is varying over time.

Sometime over the next few weeks I may be setting up some scripts to look at spectral content of some sounds. But it is also possible that I will use Matlab and that isn’t free.
The user formerly known as amichael on TTF.
andym
Posts: 103
Joined: Sun Dec 23, 2018 3:03 am

Re: Frequency domain

Post by andym »

I looked at the audacity spectrum plots on this page:
https://support.audacityteam.org/audio- ... l-analysis

If you are having trouble reading the spectrum in the form shown at the bottom, try two things. First, see if you can plot the X axis (frequency) on a linear scale. That will spread out the overtones more. Then, if necessary, try switching the y-axis from decibels to a linear scale of amplitude. Hopefully, audacity allows for some flexibility in these plots.
The user formerly known as amichael on TTF.
User avatar
harrisonreed
Posts: 4606
Joined: Fri Aug 17, 2018 12:18 pm
Location: Fort Riley, Kansas
Contact:

Re: Frequency domain

Post by harrisonreed »

sacfxdx wrote: Tue Dec 12, 2023 10:59 am Reaper is not free. That’s the wrong attitude. If you are going to use it more than once you should pay for it. Someone should be compensated for their work.

It is free to download to evaluate but you should not consider it FREE.

Of course that’s just my opinion.
Sure, I evaluated it for over 60 days and then chose to get a license because I think it's a great product. But, in terms of you being able to legally download it and evaluate it forever, yes, someone worried about money can absolutely do that. I think their policy works really well. I probably would not have bought a license if it had deactivated after the 60 day period, rather than just letting me know that I was continuing to use it after I was supposed to pay for it.

The developer would rather have people using the product than not.
AtomicClock
Posts: 132
Joined: Thu Oct 19, 2023 8:01 pm
Location: USA

Re: Frequency domain

Post by AtomicClock »

andym wrote: Tue Dec 12, 2023 11:38 am That’s a slightly unusual form of the plot
...
the free tool I use is the statistical package R
...
you can also find ways to plot spectrograms that show how the frequency content is varying over time.
...
it is also possible that I will use Matlab
I would prefer continuous frequencies to the integral harmonics. I'm actually interested in out-of-tune overtones. I will give R a look. I'm not interested in how frequency content varies over time. That would just expose my inability to hold a long tone. :shuffle:
Last time I checked, most Matlab scripts could be used by GNU Octave. There was some awkwardness in displaying plots -- had to do so via gnuplot, iirc.

Audacity was very cumbersome to use. And I don't think I could zoom horizontally, so reading a frequency was very approximate.
Kdanielsen
Posts: 473
Joined: Sun Jul 28, 2019 9:35 pm
Location: New England

Re: Frequency domain

Post by Kdanielsen »

Here you go:
https://www.compadre.org/osp/pwa/soundanalyzer/

Nifty, free, browser based.

The ios app Tonal Energy is also good. Not free, but an excellent tuner, metronome, drone, analysis, etc etc etc
Kris Danielsen D.M.A.

Westfield State University and Keene State College
Lecturer of Low Brass

Principal Trombone, New England Repertory Orchestra
2nd Trombone, Glens Falls Symphony
AtomicClock
Posts: 132
Joined: Thu Oct 19, 2023 8:01 pm
Location: USA

Re: Frequency domain

Post by AtomicClock »

Definitely nifty. But only has a resolution of about 50 Hz. Maybe good for pitch identification, but not intonation exploration.
User avatar
sacfxdx
Posts: 326
Joined: Wed Apr 11, 2018 4:25 pm
Location: North Georgia, US

Re: Frequency domain

Post by sacfxdx »

harrisonreed wrote: Tue Dec 12, 2023 11:47 am
The developer would rather have people using the product than not.
not to argue but I’m sure the developer would rather have folks pay for it than use it for free.
Steve
andym
Posts: 103
Joined: Sun Dec 23, 2018 3:03 am

Re: Frequency domain

Post by andym »

If you are aware of Gnu Octave, I’m guessing you will be fine with R.
The user formerly known as amichael on TTF.
boneagain
Posts: 219
Joined: Sat Mar 24, 2018 4:52 pm

Re: Frequency domain

Post by boneagain »

Could you post a picture of the Audacity view that did not work for you?
Audacity gives quite a bit of control over the FFT parameters. I particularly like to be able to try different windowing options and frequency bucket sizes.
Audacity also gives a pretty easy export option, which I have liked for comparing results from different sources in a workbook or simple program.
Speaking of simple programs, in addition to the R option above, if you search on "python3" and "fft" you'll find quite a lot out there. Add to that some searching on graphing and you'll have ability to push the FFT around just the way you want and then zoom your resulting chart in just about any imaginable way. The zooming is all baked into the graphing routines. So you can, for instance, create a chart like the default "Plot Spetrum" from Audacity, THEN zoom to the exact place of an intonation question... and zoom back out to see the full context again, or get a more local context...
For most stuff, though, I get what I need just by exporting the data from "Plot Spectrum" in Audacity.

BTW: none of the Python takes away from what a great system "R" is! I have some financial stuff I've built with R that save me DAYS of poking through essential data!
boneagain
Posts: 219
Joined: Sat Mar 24, 2018 4:52 pm

Re: Frequency domain

Post by boneagain »

Some basic fft handling is included in the Python "numpy" module.
Basic use can be as barebones as the script below (copy it into a ".py" file and make sure you have a full python3 environment with "numpy" and "matplotlib" modules).

It brings up this display:
Screenshot from 2023-12-13 09-30-03.png
The icons are for
- zooming back out to the original display
- going forward and back in a "stack" of different zooms you've tried
- recentering the image (to get different parts of a zoom level in the screen)
- zooming in
- messing with appearance settings
- messing with axis settings
- saving the current image to a graphics file
To the right of the icons are the x,y coordinates of the cursor location on the chart.
Unfortunately, my screenshooter cannot capture the cursor.

The upper plot here is a synthesized wave form.
Below that is an FFT of the waveform.

Here's a zoom of the first peak in the 2nd graph above, with the cursor over the peak spot:
Screenshot from 2023-12-13 09-31-52.png
I found it easier to get Audacity to generate the FFT analysis (the code below is really too simple/underparameterized for musical analysis) then use python for something like this:
Screenshot from 2023-12-13 09-51-01.png
This has different aspects of playing one note in different valve combinations. Since volume makes a huge difference in spectrum, I include that in the legend on the chart. I also quantify how accurately I was able to maintain the desired pitch.

Being able to zoom from this too-too-busy overview into very specific parts of the spectrum, AND have the chart rescale itself is why I used Python on it.

One of the flaws in my character is that as soon as I get something from, say Audacity, I think,"Well, if only it ALSO showed me..." and I'm off down the rabit hole.
So I'm not exactly recommending this to you, but if you DO decide to chase down the rabit hole yourself, a thread on what you are after and how you achieve it could be entertaining.

Here's the script for the first examples:

#!/usr/bin/python3
# fft1.py
# play with python fft analysis
# dba 2021/04/02

import numpy as np
import matplotlib.pyplot as plt

# Construct time signal
Fs = 5000 # sample freq
tstep = 1 / Fs # sample time interval
#f0 = 100 # signal freq
f0 = 62 # signal freq
cycles = 10 # number of times to repeat base pattern
N = cycles * int(Fs/ f0) # number of samples
fstep = Fs / N # Frequency steps

h1 = .9
h2 = .02
h3 = .3
h4 = .01
h5 = .5

t = np.linspace(0, (N-1)*tstep, N) # array of time values
f = np.linspace(0, (N-1)*fstep, N) # array of freq values

base_angle = 2 * np.pi * f0 * t
#y = 1 * np.sin(2 * np.pi * f0 * t) # array of y values for wave
y = (h1 * np.sin( 1 * base_angle)
+ h2 * np.sin( 2 * base_angle)
+ h3 * np.sin( 3 * base_angle)
+ h4 * np.sin( 4 * base_angle)
+ h5 * np.sin( 5 * base_angle)
)
# setup fft
X = np.fft.fft(y)
X_mag = np.abs(X) / N

# corrections to ONLY results within Nyquist limit
f_plot = f[0:int(N/2+1)]
X_mag_plot = 2 * X_mag[0:int(N/2+1)] # adjust AC buckets for plus minus
X_mag_plot[0] = X_mag_plot[0] / 2 # adjust 0 Hz (DC) bucket back down

# get rms for waveform and fourier series
rms_wave = np.sqrt(np.mean(np.square(y)))
print("rms_wave=", rms_wave)
rms_fft = np.sqrt(np.mean(np.square(X_mag_plot)))
print("rms_fft=", rms_wave)

# plot it out
fig, [ax1, ax2] = plt.subplots(nrows=2, ncols=1)
ax1.plot(t, y, '.-')
ax2.plot(f_plot, X_mag_plot, '.-',label="Original")

ax1.set_xlabel("time (s)")
ax2.set_xlabel("freq (Hz)")
ax1.grid()
ax2.grid()
ax1.set_xlim(0, t[-1])

tick_step = int(1000*1/f0)/1000
tick_end = int(1000*cycles/f0)/1000
print("step=",tick_step," end=",tick_end)
ax1.set_xticks(np.arange(0,tick_end,tick_step))
#ax1.set_xticks(np.arange(0,0.16,0.016))
#ax2.set_xlim(0, f_plot[-1])
ax2.set_xlim(0, f0 * 21)
ax2.set_xticks(np.arange(0, f0 * 21, f0))
ax2.set_yscale('log')
plt.tight_layout()

plt.show()
You do not have the required permissions to view the files attached to this post.
Post Reply

Return to “Technology”