is there any real oscillator , or whatever they call it , that can read a mp3 and graphically present the frequencies with bars preferably .
l have been looking for ages to replace the fake one l have in my mp3 players .
Thank you
Hi dilettante . Here as always .
Yes l am looking for something like that. Is there anything around , beause if it is , l haven't been able to find it ?
I would look for the examples from The trick, I have been using his directsound8 tlb and theres lots of options.
I think its possible to look into the raw-data to extract the sinus curves, but nothing I have done.
theres also the acmStream apis that should unlock a lot of information about the mp3
I'm not sure most things you might find are going to accept "audio" in arbitrary formats. There are a few DirectShow Filters out there, but they only provide data for you to build a display from. Of course they assume you are using DirectShow and a filter chain to play your MP3s.
Thank you for . Rather complicated . My mp3's are played with WMP and plain VB6 code . So think l'll forget about it . Thanks again .
That's what I thought 30 years ago when I first decided to implement the "oscillator" to display frequencies from current playback like in WinAmp (though back then first version of WinAmp wasn't released yet).
It turned out it is *very* easy to do this based on (Fast) Fourier Transform -- it is only the name of this "transformation" that sounds intimidating.
Basicaly what you need to do is to prepare N arrays with the frequencies you want to display on your "oscillator". Say you want 1Khz, 2Khz, 4Khz, 8Khz and 16Khz, so you need 5 buffers of say 128K elements each.
The number of elements depend on the playback frequency you use for your output device and each array is initialized with corresponding frequency sine wave samples which a simple FOR loop and a SIN/COS function call.
Next step is to decode your MP3 to plain (WAV) sound buffers with 128K samples per second and then multiply each of the buffers with current output buffer i.e. SUM(MyOutput(i) * MyFreq1(i)) for each array MyFreq1, MyFreq2, etc. so this way you get each frequency amplitude in the output signal which then you can visualize in LOG scale for instance to get a WinAmp style spectrum visualizer.
It's that simple once you precalculate your frequency arrays: just multiuply and sum (and probably normalize and visualize in LOG scale).
I remember how stunned I was this was working so well back in the days when everything was still DOS and CGA graphics :-))
It's better to use several IIR-filters with an envelope detector for few frequency bands. It allows to overlap the frequency bands. Alternatvely you could use the Goertzel algorithm to exclude only few bands.
Next step is to decode your MP3 to plain (WAV) sound buffers with 128K samples per second and then multiply each of the buffers with current output buffer i.e. SUM(MyOutput(i) * MyFreq1(i)) for each array MyFreq1, MyFreq2, etc. so this way you get each frequency amplitude in the output signal which then you can visualize in LOG scale for instance to get a WinAmp style spectrum visualizer.
It's just a convolution. To get frequency amount you need to multiply to conjugated complex sinusoid (not just sin or cos) and take a sum. The polar notation of resulting complex vector is frequency spectrum. The magnitude - amount, the phase - phase.
To use only cosine wave you need to make the input signal symmetrical (the imaginary part is zeroed then) - you get DCT.
To use only cosine wave you need to make the input signal symmetrical (the imaginary part is zeroed then) - you get DCT.
Can't remember details but sure FFT for real numbers in input still produces complex numbers in the output but is computationaly cheaper (than input with complex numbers).
Isn't a sound buffer (WAV) exactly input of real numbers?
Can't remember details but sure FFT for real numbers in input still produces complex numbers in the output but is computationaly cheaper (than input with complex numbers).
Isn't a sound buffer (WAV) exactly input of real numbers?
cheers,
</wqw>
FFT works only with complex signals. You can either zero one part or mix parts - the result always complex as well as the input. FFT decompose a signal to complex sinusoids.
A real signal is a special case of complex signal (with zeroed imaginary part) so you can put such signal to FFT and get symmetrical spectrum. Because of duality of FFT you can also put a real signal with symmetry to complex and get the result with zeroed imaginary part - it's called Discrete Cosine Transform (but you can use sine as well only change symmetry). You told about multiplication of cosine (or sine) wave to get the spectrum density i just correct you to use only one (cosine or sine) wave you need to make the signal symmetrical.
BTW because duality you can shuffle signal betweet real and imaginary part and calculate spectrum of two signals at once, then just decompose the result using even/odd decomposition. You can check this approach in the project. It calculates 2x FFT real signal using decomposition and spectral transformation.
Just the demonstration how does Fourier Transform works:
Last edited by The trick; Sep 19th, 2021 at 04:02 PM.
It sounds like y'all have this one covered. We're definitely talking about some Fourier Transformation that produces amplitude bars for pre-defined ranges of frequencies.
This makes me remember that, many moons ago, I was business partners with the guy who wrote the Autotune software, before he even envisioned it.
What I remember most about him was that he was crazy fascinated with high-level integer math (and doing it very quickly). At the time, he was mostly working on processing of seismic signals.
For him, Fourier Transformation (basically of digital sound data, represented as a stream of integers) was just the beginning. He worked on how to manipulate the frequencies and recognize patterns within them.
You can see how that progressed into the Autotune software.
But anyway, I'm just reminiscing. But yeah, just taking a WAV signal, and then figuring out a fast way to do a Fourier Transform with your frequency brackets pre-defined, is what's being asked.
Sounds like The Trick is already well on top of it.
Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.
Thank you all
It is very interesting to read the views of experts on the subject l started . However what l was expecting find some
visualization code to adapt to my project . It seems no one has realy bothered to make something and sharing it
with people like me .
Then l remembered looking for the same thing years ago , when good old 'PlanerSourceCode" still alive , recalled
dowloading some samples . All l had to do was ,find them . Searched through my external disks and found some .
l get an error by running them , and not knowing the structure and terminology of the code l could do nothing .
What l noticed though , is that they all consisted of code , ten times or more of the code of my project , only one
seemed to be something close to what l was looking for . l will attach the zip file if anyone wants to bother .
Now the funny part of the whole matter is , that WindowsMediaPlayer which l use , has a built in visualization. All
one has to do is adapt/size it accordingly . An image is attched , with both the actuall visualization of WMP and my
fake one (2 lines of code) . l 'll stick to the real thning until sometning more intersting comes around .