MUS177/267 – Sample Playback & “Moog” Filter

Here is the project from today’s class. Sample playback simply requires creating a pointer to the samples at the address used in FLASH (0x08080000 in this case), creating an offset for the first sample played, and incrementing this value until reaching the last sample to be played.

f4disco-sample-button-filter

To write samples in the STM32F4 FLASH (we will write in the second half of FLASH from 0x08080000 to 0x080FFFFE)

  1. prepare a sound file by making it a 16 bit mono WAV at 48k sample rate
  2. there are only 524288 bytes, so limit the sample to 262144 samples or 5.4 seconds
  3. save the sample
  4. using Hexfiend, strip off the WAV header (everything up to the word ‘data’ and the 4 bytes after that)
  5. save as a new file with the suffix “.bin”
  6. alternatively open WAV with SoundHack and save as Headerless, 16bit byte swap and “.bin” suffix
  7. make sure OpenOCD is running and connected to your board
  8. use telnet in a terminal window to connect to OpenOCD – “telnet localhost 4444”
  9. make sure STM32F4 is halted with “reset halt”
  10. write into FLASH with command “flash write_image erase filename.bin 0x08080000″
  11. restart your programs with “reset run”