Spectrum Analyser Question - Page 1
Forum section: electronics / beginners

author: mattrix
author_rank: Newbie
timestamp: June 30, 2020, 04:53:23 am
content: Spectrum Analyser QuestionHi. I am new to frequency stuff but I want to know if there is way to input a wav file, have something (spectrum analyser, software, app, etc) analyse that wave, plot all the frequencies in that wave that are MISSING (within a certain frequency band), and then output a NEW wav file that contains ONLY the missing frequencies.A very simplified example would be: within a 1-10 Hz band, inputting a wav file that contains the frequencies 1,3,6,7 hertz, and then the system outputs a new wav file with the frequencies 2,4,5,8,9,10 hertz. Amplitude and duration is not important, only the missing frequencies are important, and accuracy can be plus/minus 0.5hz.It would be great if I could find a way to do this automatically, so I don’t have to export wav data to excel, analyse the missing frequencies, then create a new wav file with the missing frequencies.I have tested a bunch of spectrum apps and software but no luck. They all seem to only export amplitude (Db) and time. I appreciate any help and thanks in advance for your expertise.Cheers,Matt

author: Dave
author_rank: Super Contributor
timestamp: June 30, 2020, 12:54:33 pm
content: Should be easy enough to code in Matlab (or any of its free counterparts).

author: Kasper
author_rank: Frequent Contributor
timestamp: June 30, 2020, 01:17:22 pm
content: Quote from: Dave on June 30, 2020, 12:54:33 pmI was about to say the same thing. Had a project years ago where matlab would find main frequency in an audio file then filter out other frequencies.

author: mattrix
author_rank: Newbie
timestamp: June 30, 2020, 01:27:00 pm
content: Wow thanks guys! I just checked out MATLAB and I'll give it a go. I'm not a programmer but pretty computer savy so I think I can do this. I might be back soon for some advice, or maybe a the help from a MATLAB guru. Do you guys know any?Thanks again.Matt

author: Kasper
author_rank: Frequent Contributor
timestamp: June 30, 2020, 02:23:06 pm
content: Matlab has a bit of a learning curve, specially if you are not a programmer but there is lots of help online. Its graphing features will probably be helpful while learning to code because it provides a nice way to see what you are doing. If you include 'beginners' when you are googling Matlab stuff that might also be helpful.I am very far from guru, only used it years ago in uni.I would try this:1: Use FFT to convert the file from time domain to frequency domain.2: Graph the results to check your work.3: Make an algorithm to change the volume at each frequency.4: Graph the results to check your work.5: Use IFFT to convert from freq domain to time domain.6: Save new audio file

author: mattrix
author_rank: Newbie
timestamp: June 30, 2020, 02:58:58 pm
content: Awesome. That should keep me busy for a while. I understand the concept of the steps you have listed and already watched a couple of videos - just never done it before. I might go to FIVER for some help or find a local coding person.I'm also open to Exporting freq data to Excel and manually creating the missing frequencies for now, just in case there's another option to do that in MatLab (I'm sure there must be), or similar.I also forgot to mention: I'm only working in anarrow band of 60-170hz, so not much data.

author: Kasper
author_rank: Frequent Contributor
timestamp: June 30, 2020, 03:34:30 pm
content: Quote from: mattrix on June 30, 2020, 02:58:58 pmThat'd be step 3 in my previous post. In matlab, your FFT output will tell you the volume at each frequency. Use a loop to go through each frequency, check the volume and adjust as needed. For example lets say your FFT output has 100 frequencies and your max volume is 20, this will check each frequency and for each frequency, if the volume is greater than 10 aka you have signal at that frequency, it will mute it and if the volume is less than 10, aka you don't have signal at that frequency then it will change it to 20.Code:maxVolume = 20;for i = 0:100if(fftOutput > maxVolume/2)invertedFftOutput = 0;elseinvertedFftOuput = maxVolume;endThis is just a quick rough example of one way that might work. I have forgotten most of the little bit I knew about matlab. There are some audio handling examples here that are probably more helpful:https://www.mathworks.com/help/signal/examples/practical-introduction-to-frequency-domain-analysis.html?w.mathworks.com

author: mattrix
author_rank: Newbie
timestamp: July 01, 2020, 01:35:48 am
content: Thanks. I was thinking the same thing last night. All I really have to do is is boost the eq of silent or less freq and lower the freq of the louder more prominent freq. It's like an upside down or mirrored parametric eq. Thanks for the code and that link.

author: EEEnthusiast
author_rank: Frequent Contributor
timestamp: July 01, 2020, 01:57:57 am
content: Octave is another alternative to Matlab. Octave is free and for the purpose you have stated, will do the job just as fine as Matlab.

author: mattrix
author_rank: Newbie
timestamp: July 01, 2020, 02:47:42 am
content: Thanks for that Octave lead. I love FREE stuff. I can at least get started without spending $$$ on something that might just be a little bit out of my league. Plus, I see it's also MatLab compatible, which is nice - again, for later on. I've also contacted a European software company, which may be able to customize their existing FFT software to help me out. I am waiting for a quote (holding my breath). Awesome.

author: gcewing
author_rank: Regular Contributor
timestamp: July 01, 2020, 08:06:48 am
content: Just out of curiosity, can you tell us what the application is for this? It sounds intriguing!

author: mattrix
author_rank: Newbie
timestamp: July 01, 2020, 09:55:25 am
content: Yeah naaah. It's just a theory I am testing. Don't even know if it works yet. It's nothing exciting at this point.