We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now

x

# CD Player: Graphic Equalisers

on
Medium Priority
480 Views
Is it possible to produce VB code to produce a "graphic
equaliser" for a CD Player application? I don't want a lame
two frequency (i.e. left and right channel) equaliser, I was
thinking more along the lines of 8, 10 or even a 12
frequency equaliser.
Comment
Watch Question

## View Solution Only

Commented:
Probably, but I would suggest that you use C++, and look at the source for some FFT program. Then you'll be able to create a real "graphic equalizer".

Commented:
In reply to the comment made by "y96andha": I'm not a C++
programmer! I can only program in basic (and other high-level
languages). Does anyone have any other suggestions - 500 points
are up for grabs!?!
Commented:
There are many reason why what you are trying to acheive is impossible.

To modify individual frenquency ranges of a sound you need to decompose the wav sample into their frenquency. Once you have them, you can scale up or down frequencies as you like and then convert back into wav data for the sound card.
The mathematical tools to do that is call Fourier transform. Since computer works on interger, the computer variation of the mathematical tool is called DFT (Discreete Frourier Transform , it works on integers) The best algorithms to do that is called the FFT (Fast Fourier Transform).
Since this analist is used in many scientific and medical fields,  to commercial implementations of FFT are extremely optimized.
They where optimized because FFT require a lot of processing power. The more precise the analist has to be, the longer it takes.

1-Vb mathematics are too slow to do anything descend. You will hardly be able to show a spectrum analyser with maybe 4 to 5 bands without eating all processing power of a P133, and that is if your are using V5, don't even think about V4.

2- But you don't want to do a spectrum analyser, you want to modify the sound. That means that your analyst must been precise enough to be converted back without noticable lost of quality. That means a FFT of level 1024 or more, not 4 or 5!!. If anyone want to digitally equalise sound, for now they have to buy DSPs, digital signal processing devices. External specialysed processor dedicated to the task. As I remember, they sells for about 300\$.
Download any sound editing software like GoldWave and time how much time it take to equalize 1 minute of sound. My P100 is about 3 times too slow.

3-
To work on a sound, you need to have to samples, to have the samples you need to record them. Cool, sound cards can record as the cd play. This is why I have seen a cd player with a spectrum analizer. It was cool. But now you what to play back the modified sound. Now tell me a sound card that can play and record at the same time. I don't know any. Maybe there are some, in the most specialized (and expensive) cards. Surely not the card of card that your end user will have. The other option would be to require your use to have to card in their computer, one for recording and the other for playback.

Don't ask why you haven't seen any computer program with an equalizer.

Not the solution you were looking for? Getting a personalized solution is easy.

Commented:
If you still want to do FFT, try those url.

An good comercial dll that does FFT and some other thing. They gives examples code for Visual basic and online help.
http://www.greymatter.co.uk/gmWEB/Nodes/NODE00A6.HTM

An home page with lots of good (free!) FFT stuff and code example. They are mostly in C though.
http://jjj.spektracom.de/fxt/fxtpage.html
Be sure to get those two files :
http://jjj.spektracom.de/fxt/fxt970326.tgz
http://jjj.spektracom.de/fxt/int_fft.c

Good luck!

Commented:
Here is a page I can recommend for FFT:
http://www.relisoft.com/freq.html

Source code in C++ is supplied. I modified it to do 4096 points FFT. On my computer it does 100 16-bits 4096 points FFT per second. This is really more than enough to handle the maximum 44 kHz sampling frequency that a CD can provide.

Also, there are drivers for simultaneous sampling and playback out for Creative cards, which should be the most commonly used.

I have been thinking about making an equalizer, but I'm not sure how to connect the different FFT's I receive. If I simply FFT 4096 samples at a time, alter the frequencies and then play them back, there will probably be discontinuities between the FFTs.

Another interesting application would be to make a music to MIDI translator, capable of interpreting the output from a single instrument and translating it into notes. Now you need to be able to play a keyboard in order to input notes easily. It would be nice to be able to play a guitar, flute, or maybe even whistle and get a paper printout.

Commented:
To stich semlessly the different, or more precesly, to do an FFT/inverseFFT accurate enough to not have lost of quality, you must do an FFT centered on each sample you analyze, one at the time. The all the surrounding samples define what frequencies are at the point you are analysing. As far as I know, to be perfectly precise, an FFt shoud be working centered on the sample, with the data of the whole sound and infinite blanks before and after. And that is, for each sample. But of course this is ridiculous, and an bunch of 4096 sample is enough to get an approximation good enough for the 44khz playback rate.
But those bunch of 4096 sample need to overlap, not necessarly on every sample, but they need to overlap alot.
This is a big difference between trying to to a spectrum analyser and an equalizer. And this is also where your computer gets too slow. At 100 FFT per second, you do one FFT every 450 sample which I don't think is enough. I would rather imagine that every 5 or 10 sample would be the maximum allowable altough I don't have any exact numb

Commented:
To stich semlessly the different, or more precesly, to do an FFT/inverseFFT accurate enough to not have lost of quality, you must do an FFT centered on each sample you analyze, one at the time. The all the surrounding samples define what frequencies are at the point you are analysing. As far as I know, to be perfectly precise, an FFt shoud be working centered on the sample, with the data of the whole sound and infinite blanks before and after. And that is, for each sample. But of course this is ridiculous, and an bunch of 4096 sample is enough to get an approximation good enough for the 44khz playback rate.
But those bunch of 4096 sample need to overlap, not necessarly on every sample, but they need to overlap alot.
This is a big difference between trying to to a spectrum analyser and an equalizer. And this is also where your computer gets too slow. At 100 FFT per second, you do one FFT every 450 sample which I don't think is enough. I would rather imagine that every 5 or 10 sample would be the maximum allowable altough I don't have any exact number for you.

I am really surprised of hearing about a driver for sampling and playback. I would have been pretty sure that this was an hardware restriction placed there to lower the price of the card. It seems clear to me that the processors on the card needs to be twice as fast to move both data stream.
Still, I would be really happy if you could point it to me. I would send it to Id software, 3dRealms and to Interplay so that they can code voice chating in their next multiplayer network game, so that we can talk without leaving the joystick (hand free). The problem is not to get the sound through the network or the Internet; they could simply use trick like RealAudio did, send the data 8bits at 7kHz/sec and a good compression sheme. After all, it would only be cool to have that "a little too far" walky-talky sound inside the Descent ship!  :)
No, the real problem is about playing the sound effects at the same time you are recording to check if the player is talking.

One last thing,
I've though too about such .wav to .midi translator. Actully, I was thinking about a .wav to .mod translator, but it is basicly the same thing: cutting out mixed intruments. The task start to be awfully hard when you think about all the coposites that make up one single instrument sound. I first think of vibrato, of complex harmonics, or maybe even complex harmonic that change upon the loundeness of the note (as for trumpets). Then try to jungle around noise and overlapping voices and synthetised sound like in techno mucis Or just try to figure out a pattern to detect out of all drums ans snare beside the bassdrum. It seemt not that easy to me. Surely searchers will come out with something as they did for voice reconnition, maybe I could even be one of such team, but I've decided that I would rather not try this alone!

se yaa,

Commented:
This is the driver you need to install. It is available from Creatives homepage on http://www.cle.creaf.com/wwwnew/tech/ftp/ftp-sb16awe.html

Full duplex means that they can simultaneously sample and playback data.

sbw95up.exe

File Date: 970730
File Size: 308,001 bytes
Description: Full Duplex Sound Blaster 16/SB32/AWE32/AWE64 Driver Updates for Win95
SDR-95UPD-1-US (Revision 10)

Included Drivers:
SB16.VXD v4.36
SB16SND.DRV v4.36
SBAWE32.DRV v4.33
SBAWE.VXD v4.33

Commented:
Fair enough. Thanks for all the information - it'll probably help

P.S. I thought a graphic equaliser was a spectrum analysiser,
because all I was hopeing to achieve was a couple of little bars
which went up and down according to the music being produced from
the CD-Player, thank's for enlightening me ;^)
##### Thanks for using Experts Exchange.

• View three pieces of content (articles, solutions, posts, and videos)
• Ask the experts questions (counted toward content limit)
• Customize your dashboard and profile

OR

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the