You know those 4 LEDs at the bottom of the board? Well, I have got them doing something useful now.
You can now switch between three modes of operation using:
WavePro.led(mode);
where "mode" is one of:
LED_NORMAL
Green LED = disk activity, yellow = recording, yellow = SPI activity, and red is not assigned yet.
LED_VU
Simple 4-bit VU meter of the playing sound.
LED_SPECTRUM
This is the clever one. A spectrum analyser display (4 bit of course) of the playing audio. This uses the dsPIC's DSP to do a full FFT of the current block of audio being loaded into the DMA buffers on the fly, and lights the LEDs depending on various threshold levels.
Caution should be used with the SPECTRUM mode, as it is quite processor intensive (as you can imagine) even with the DSP. It's quite amazing that it can do an entire FFT of the audio block realtime whilst loading up the DMA buffers, and tweaking the volume, etc. Using SPECTRUM mode with high bitrate samples might well take too long to calculate and cause pops, skips, and even strange robotic sounding effects as the calculations overflow the alotted time and the DMA buffers don't get filled up in time.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Incidentally, in the next release, the FFT will be prepared during DMA buffer A fill, and executed during DMA buffer B fill - that way it only actually does the FFT 50% of the time, and it works perfectly with higher bitrates. Also, it means it's calculating and displaying the FFT for the chunk that is actually playing, not the next chunk that will play.
Last edit: Majenko Technologies 2012-11-04
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
A bit of fun today.
You know those 4 LEDs at the bottom of the board? Well, I have got them doing something useful now.
You can now switch between three modes of operation using:
where "mode" is one of:
Green LED = disk activity, yellow = recording, yellow = SPI activity, and red is not assigned yet.
Simple 4-bit VU meter of the playing sound.
This is the clever one. A spectrum analyser display (4 bit of course) of the playing audio. This uses the dsPIC's DSP to do a full FFT of the current block of audio being loaded into the DMA buffers on the fly, and lights the LEDs depending on various threshold levels.
Caution should be used with the SPECTRUM mode, as it is quite processor intensive (as you can imagine) even with the DSP. It's quite amazing that it can do an entire FFT of the audio block realtime whilst loading up the DMA buffers, and tweaking the volume, etc. Using SPECTRUM mode with high bitrate samples might well take too long to calculate and cause pops, skips, and even strange robotic sounding effects as the calculations overflow the alotted time and the DMA buffers don't get filled up in time.
Incidentally, in the next release, the FFT will be prepared during DMA buffer A fill, and executed during DMA buffer B fill - that way it only actually does the FFT 50% of the time, and it works perfectly with higher bitrates. Also, it means it's calculating and displaying the FFT for the chunk that is actually playing, not the next chunk that will play.
Last edit: Majenko Technologies 2012-11-04