Introduction: FMOD Running on Raspberry Pi

The instructions here seem to be outdated

Here’s what I had to do. Note that steps 4-6 may not be necessary

  1. Make sure audio works on your raspberry pi
    1. http://iwearshorts.com/blog/raspberry-pi-setting-u...

    2. https://jeffskinnerbox.wordpress.com/2012/11/15/ge..

    3. https://www.raspberrypi.org/documentation/configur...

  2. Download Fmod Ex (the Programmer Api) from the FMOD site
    1. You may be asked to sign in. As long as you are not planning to sell the product, you can use FMOD for free. Just create a profile, sign in, then go back to the download page to download your package
  3. Copy FMOD tar.gz file to root on your pi
  4. Untar it using tar -xvzf: tar -xvzf fmodstudioapi10813linux.tar.gz
  5. Navigate to fmodstudioapi10813linux/api/lowlevel. You will need the files in the inc folder. Then you will need to note the shared library that’s right for your distribution (in the next step we’ll do something with it). My Raspberry Pi Model has an armv7 architecture so I’m using the shared library (.so files) in the lib/armhf folder. If you have a Raspberry Pi with armv6 you would use the files in the lib/arm folder
  6. sudo cp fmodstudioapi10813linux/api/lowlevel/lib/armhf/libfmod* /usr/local/lib/
  7. sudo cp fmodstudioapi10813linux/api/lowlevel/inc/*.h* /usr/local/include/
  8. The next thing is to test if everything is in working order. For this example we’ll use play_sound.cpp found in /fmodstudioapi10813linux/api/lowlevel/examples
    1. To build the executable we’ll use the provided makefile. Makefiles are effectively a set of instructions on how to build and link your files to create your executable.
    2. Run“Cd make” // to change directory into the make folder under /fmodstudioapi10813linux/api/lowlevel/examples/make
    3. “make --file play_sound.makefile CONFIG=Debug CPU=armhf”
      1. My raspberry pi uses armv7+ . If your pi is armv6, your CPU flag will be “arm”
      2. NOTE: when I originally did this I got the error: “error while loading shared libraries: libfmod.so.8: cannot open shared object file: No such file or directory” and it was because I originally thought my pi was armv6 so I ran “make --file play_sound.makefile CONFIG=Debug CPU=arm” which was incorrect for me. Once I changed the CPU flag to the correct one this error went away
      3. If this fails with the following error “ /usr/include/arm-linux-gnueabihf/gnu/stubs.h:7:29: fatal error: gnu/stubs-soft.h: No such file or directory # include ”, you may need to change your makefile such that “-mfloat-abi=softfp” becomes “-mfloat-abi=hard”.
      4. Then re-run the instructions provided in 7.a.
  9. If you get an error that says “A fatal error has occurred… ../play_sound.cpp(40): FMOD error 51 - Error initializing output device.” you will probably need to choose a different sound driver. By default, the example files will use your default sound driver which is the one indexed at 0 (see the System::getDriver section of the FMOD api page for what I mean about indexing). When I set my driver to index 1 per the advice here. Things worked
  10. When I printed out the number of drivers, the index of the driver my system was using, and my list of sound drivers, I got:
    1. num Drivers = 10 | mydriver = 0
    2. sound driver 0, driver name pulse
    3. sound driver 1, driver name sysdefault:CARD=ALSA
    4. sound driver 2, driver name dmix:CARD=ALSA,DEV=0
    5. sound driver 3, driver name dmix:CARD=ALSA,DEV=1
    6. sound driver 4, driver name dsnoop:CARD=ALSA,DEV=0
    7. sound driver 5, driver name dsnoop:CARD=ALSA,DEV=1
    8. sound driver 6, driver name hw:CARD=ALSA,DEV=0
    9. sound driver 7, driver name hw:CARD=ALSA,DEV=1
    10. sound driver 8, driver name plughw:CARD=ALSA,DEV=0
    11. sound driver 9, driver name plughw:CARD=ALSA,DEV=1
  11. Hopefully this can help some of you as well!