Skip to content

Audio spectrum analyzer in C/C++ using FFT of audio file read from microSD card through FatFS displayed onto 1.3" OLED screen

License

Notifications You must be signed in to change notification settings

ic-27/stm32f4-spectrum-analyzer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

56 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Licensing

This repository is licensed under GPL-3.0. Third-party libraries used are distributed under their own licenses.

Overview

This is an audio spectrum analyzer written in C/C++ on the STM32F4 discovery kit using FFT of wav audio file read from microSD card through FatFS displayed onto an OLED screen. Credits to anweshct3 for initial project inspiration. This project also stemmed from my wanting to learn/practice C++, DSP, ARM, CppUTest, and integrating different libraries. Project includes the audio spectrum analyzer on the STM32F4 discovery kit, and an audio spectrum analyzer written in python for the host computer.

I first started out writing the audio spectrum analyzer in python to establish a base "truth." It was much easier to code and debug in python first, and then approach programming it on the STM32F4 discovery board. The python program was useful in debugging what was wrong with my implementation on the STM32F4, such as discovering that I needed to skip the first 44 bytes of a wav file since it was metadata.

Another thing helped with development was integrating CppUTest, a C/C++ unit test framework. I much prefer ceedling, but unfortunately it doesn't support C++, but it was a good opportunity to learn about a new tool. CppUTest helped with ensuring that my logic was correct with unit tests before even uploading the code to the microcontroller.

Task List

  • Write audio spectrum analyzer in python
  • Integrate libopencm3 open source HAL
  • Set up programming stm32f4-disc1 through openocd
  • Set up Makefile for stm32f4-disc1
  • Integrate with ARM-CMSIS library (DSP
  • Set up debugging for stm32f4-disc1
  • Integrate CppUTest for unit/integration testing
  • Learn how to use CppUTest to write a mock
  • Write middleware for FatFS to integrate w/ microSD card
  • Write module for OLED driver
  • Test CMSIS-4 DSP functions with audio wav file
  • Display DSP output onto OLED
  • Fix FatFS glue function to read more than 512 bytes at a time
  • Use timers to handle timeouts
  • Speed up using DMA
  • Use I2C to allow audio playback

Structure

build: makefile for building and flashing project
test:  makefile for running unit & integration tests using CppUTest
lib:   external libraries
src:   contains src and header files for building the project split into application, bsp, and driver
misc:  audio spectrum analyzer written in python3 & wav files

How to Build

Coming soon! :-)

Libraries

Helpful Links

About

Audio spectrum analyzer in C/C++ using FFT of audio file read from microSD card through FatFS displayed onto 1.3" OLED screen

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published