Are 2 1024 FFT too much for the audio sheild?

Status
Not open for further replies.

apuri123

Member
Hi, I have created a small spectrum analyser with the audio board and FastLED3.1 on Teensy 3.1. When I have the following audio initializations the code works fine (with a few glitches on startup):

// GUItool: begin automatically generated code
AudioInputI2S i2s1; //xy=271.20001220703125,212.1999969482422
AudioAnalyzeFFT1024 myFFT; //xy=504.20001220703125,206.1999969482422
AudioConnection patchCord2(i2s1, 0, myFFT, 0);
AudioControlSGTL5000 audioShield;

But when I add another FFT to the right channel:
// GUItool: begin automatically generated code
AudioInputI2S i2s1; //xy=418.20001220703125,441
AudioAnalyzeFFT1024 LeftChannelFFT; //xy=651.2000122070312,414
AudioAnalyzeFFT1024 RightChannelFFT; //xy=655.1999969482422,454.1999969482422
AudioConnection patchCord1(i2s1, 0, LeftChannelFFT, 0);
AudioConnection patchCord2(i2s1, 1, RightChannelFFT, 0);
AudioControlSGTL5000 audioShield; //xy=375.20001220703125,276.00001525878906

The previous code does not work (ie leftChannel stops working). The same LED glitches to start with and then nothing seems to happen. Is there a memory size issue here or lack of processing available on The Audio board?

It should be noted that I am having some power issues (power supply does not like to power my 176leds for some reason o_O). Please say if power issue will cause the above on the Audio Board. I have turned the brightness down to 50 from 200 and still the above issue is seen. (I know I can run the whole strip on brightness 50 with the Example code cylon, fire2012 etc).

some input would be appreciated!!!

Kind Regards,
Arjun
P.s Can provide rest of code if necessary
 
You could add the cpu and memory usage monitoring and print the result periodically. See the MemoryAndCpuUsage example in the Audio library.

Pete
 
You could add the cpu and memory usage monitoring and print the result periodically. See the MemoryAndCpuUsage example in the Audio library.

Pete

Hi,

Memory was set to 12 and with both FFTs, memory usage is at 14-16. One question though. I have set the maxmemory to 20, but in the output it is being set to 18? is this the untimate max for the Memory board?

Kind Regards,
Arjun
 
If you have allocated memory with AudioMemory(20) and the usage is reporting that the maximum is 18 then you are OK. The problem occurs when the reported maximum usage is greater than or equal to what you've allocated. Then it's time to allocate more with AudioMemory.
You should also check the CPU usage too. Try it with one FFT and then with both. As long as usage stays a bit below 100% you're OK.

Pete
 
If you have allocated memory with AudioMemory(20) and the usage is reporting that the maximum is 18 then you are OK. The problem occurs when the reported maximum usage is greater than or equal to what you've allocated. Then it's time to allocate more with AudioMemory.
You should also check the CPU usage too. Try it with one FFT and then with both. As long as usage stays a bit below 100% you're OK.

Pete
Hi Pete,

I didnt explain myself properly. I had allready done what you just suggested before my last post. The code is working now as expected! It was a memory issue with it maxing out at 12 when it needed 14-16. What I dont understand is that before. I was alocating 12 and it was returning the maxmemory allocation as 12. Now I am allocating 20 and it is returning the maxmemory allocation as 18. Hope this makes sense:
Before:
AudioMemory(12)
Usage:12/12

Now:
AudioMemory(20)
Usage: 16/18
 
When you allocate memory, the audio system can't take any more than that.
AudioMemory(12)
Usage:12/12
This indicates that you've allocated 12 buffers. The Usage: says that the system is currently using 12 buffers and, since the usage was last reset, the maximum number of buffers used was 12. When the current and maximum usage are the same as what you have allocated, you're living right on the edge.

With this one:
AudioMemory(20)
Usage: 16/18
You allocated 20 buffers. The usage is currently 16 buffers and the maximum usage was 18 buffers. The 18 buffers is less than you have allocated, so if they are needed there are still 2 buffers available.

Pete
 
Status
Not open for further replies.
Back
Top