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.


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”


MUS177/267 – table lookup oscillators STM32F746

I am aware that most of my examples have been for the STM32F4Discovery board. This time I have coded it up for the STM32F746Discovery, and there is a little touchscreen meantone scale organ built in.

Use the blue button to switch between sine-saw-square-triangle. All formulas in the code, and most all of my code is in main.c for convenient browsing.

Details discussed next Tuesday.

Download link: f746disco-audio

MUS174A – Assignment 2

assignment #2 – music 174a

record a solo acoustic instrument that is not piano 1:30 to 3 minutes

1. choose 2 of the following techniques, choose techniques which compliment the style of music.

  • -use 2 close microphones
  • -use a close microphone and distant microphone
  • -use a stereo pair
  • -use a stereo pair and close microphone

2. record on separate labelled tracks in protools

3. document your project, describe why you used each microphone, why you chose the positions you choose, describe the sound of each microphone. note the position and type of microphones used for each track

4. mix down to a stereo track in protools

5. save everything to a folder named with your last names and “a2”. put this folder in the 174a folder on the class drive

6. present in class, each person will need to talk about what they did

7. quality of recording will be part of the grade

work in the following groups

1) Raymond S Lim – Crystal Jiao – John Anthony D’Agostini

2) Grant Parker Hovander – Camden Robert Greenwood

3) Cory Jonathan Banh – Camille Angela Latzke – Jacob Michael Ugalde

4) Daniela Andrea Chaparro – William Joseph-Glen Carlisle – Chloe Jessica Bari

5) Matthew Harrison Rice – Kostyantyn Chumakov – James Forest Reid

6) Salvador Zamora – Christopher Patrick Loree – Caleb Michael Hess

7) Francis Kyle Galang – Kenroe Ervin Ang

8) Gregory Tazmond Farley – Yidai Li – Joyce Hwayoung Park

9) Aldo Marcel Mojica – Tracy Nicole Levick – Cordane Omari Richardson

10) Chi Zhang – Jorge Alberto Jiron Villarreal – Lizbeth Rios

Due Tuesday Week 7 – November 14th

MUS174A – First Assignment

174 A – First Assignment – The most basic studio tasks

Due 10/24/17 (Tuesday 4th week)

  • Each item is worth 2 points (20 points total)
  • Partially correct is worth 1 point
  • Step omitted – 0 points
  • Room 269/203
  1. Make a folder with your name in the Class drive
  2. Create a ProTools Session at 44.1k, 24 bits, WAV files
  3. Create 2 mono tracks
  4. Name the tracks
  5. Place a comment in one of the tracks with your mic type
  6. Check a microphone, mic stand and cable from Brady
  7. Record spoken audio into each mono track
  8. Use close miking for one track, distant for the other
  9. Mix and bounce/export the audio from the mono tracks
  10. Save the session in your named Folder as Assignment 1

Email Jordan and I when you are finished.

MUS177-267 OpenOCD (update)

Installing OpenOCD

I have edited this document to put preferred methods of installation on the top. Also note that openocd 0.10 is required to program STM32F7 family chips.

macOS – Preferred method – homebrew

  • install Xcode and Xcode command line tools
  • install homebrew using  this command in the Terminal:
    /usr/bin/ruby -e "$(curl -fsSL"
  • install openocd using this in the Terminal:
    brew install --HEAD openocd
  • run openocd -f board/stm32f4discovery.cfg from the Terminal

Windows – Preferred method – Freddie Chopin

  • Download from
  • You will need a .7z unpacker to open the archive.
  • Place in your STMToolchain folder (not strictly necessary)
  • run openocd with options -f “board\stm32f4discovery.cfg” from Eclipse. You can do this from the Command Line, but you will need to set the MSDOS search path.

Common Bug – If you are “bounced” by openocd and have an STM32F4Discovery board

  • You probably have version MB997E of the board
  • Edit the file board/stm32f4discovery.cfg (in the openocd scripts folder) with Eclipse. If on macOS, you will have to first type Command-Shift-G in the file open box and enter /usr/local/share/openocd/scripts
  • Change the line that reads
    source [find interface/stlink-v2.cfg]


    source [find interface/stlink-v2-1.cfg]
  • Save the file and try openocd again

Common Bug – If you are “bounced” by openocd and you are running Windows

Testing – Check Telnet Connection to OpenOCD

You will be able to connect to openocd with “telnet localhost 4444″. Windows users may need to enable the Telnet Client

Other methods to install OpenOCD (not all will work on all hosts)

 Windows & macOS (precompiled OpenOCD – latest for STM32F7)

  • Download from
  • To run from command line – add bin directory to search path. macOS example – edit .bashrc:
     export PATH=$PATH:/Applications/GNU\ MCU\ Eclipse/OpenOCD/0.10.0-3-20170826-1813-dev/bin
  • Windows example – edit Control Panel:System:Advanced:Environment:Path. Append to end of path text:
    ;C:\Program Files\GNU MCU Eclipse\OpenOCD\0.10.0-3-20170826-1813-dev/bin
  • Run from Terminal (macOS) or Command Prompt (Windows)

    openocd -s "C:\Program Files\GNU MCU Eclipse\OpenOCD\0.10.0-3-20170826-1813-dev\scripts" -f "board\stm32f4discovery.cfg"


    openocd -s /Applications/GNU\ MCU\ Eclipse/OpenOCD/0.10.0-3-20170826-1813-dev/scripts -f stm32f4discovery.cfg

Windows(MSYS2 precompiled method)

  • Install MSYS2 from
  • Install OpenOCD binary for 64: pacman S mingww64x86_64openocdgit
  • -or- for 32 bit: pacman S mingww64i686openocdgit
  • Restart MSYS2
  • Enter openocd -s “/mingw64/share/openocd/scripts” -f “board/stm32f4discovery.cfg”
  • You can now connect via “telnet localhost 4444″ from another MSYS2 window
  • Connection from Eclipse uses port 3333 rather than 4444