Mapping a series of numbers to a greater range of numbers?

Hi, i am working on a 3D LED-cube-like spectrum analyzer and have been having problems with the spectrum analyzer part.

I am using the Spark Fun Spectrum Shield, which contains the MSGEQ7 chip for spectrum analysis. This chip splits an audio spectrum into 7 equal bands:

  • 63Hz
  • 160Hz
  • 400Hz
  • 1kHz
  • 2.5kHz
  • 6.25kHz
  • 16kHZ

My spectrum analyzer needs 16 bands, so I need a way to average the seven values outputted by this shield into 16. There is probably an easy mathematical way to do this, but I am relatively new to Arduino and in some cases, application of math.

Can someone show me a way I can do this! Any help is greatly appreciated! Thanks in advance!

That shield has 7 bands x 2 channels = 14 bands so that only leaves you with 2 unused channels on your spectrum analyzer. Maybe you could use those for some sort of cool light effects unrelated to the audio spectrum.

Well, I thought of that but the second chip is for the right audio channel, while the first is for the left. I am trying to make the analyzer mono, only using 1 audio, channel, so I need to stretch 7 numbers to 16.

I know it will not be that accurate but it will still represent the difference audio frequencies somewhat.

Maybe something simple like summing two bands and divide by 2 to simulate a value for a band in between.

Of you want two bands in between, two times lower plus higher divide by three and one time lower plus two times higher divide by three.

It does not reflect real life, but you can never create what was not there in the first place.

Thanks for the response! Do you know if there are any other ICs similar to the MSGEQ7 that produce a higher number of bands? (greater than 7)

The problem is called resampling, which can be done by oversampling followed by decimation using a FIR digital
filter.

But here simple linear or quadratic interpolation might be simpler and adequate.

sterretje:
Of you want two bands in between, two times lower plus higher divide by three and one time lower plus two times higher divide by three.

MarkT:
But here simple linear or quadratic interpolation might be simpler and adequate.

Ok, i am going to modify the 3D LED-Cube-Spectrum analyzer to have 19 channels instead of 16, Since I have not finished building it, this will not take too much work :slight_smile:

I am going to use the 19 channels in this way: (| represents a channel, 1 represents a real number from IC, the gaps between the 1's will be numbers averaged out in a linear way^)
| | | | | | | | | | | | | | | | | | |
1 1 1 1 1 1 1

I will post the finnished project when it is done, thanks to pert, sterretje and MartT for the help!