Gen Code Export iOS

From Cycling '74 Wiki
Jump to: navigation, search


The article below has been moved. This page will no longer be maintained.

This document describes the creation of iOS filters with gen~ and Audiobus.

The referenced material is found here:‎


  • Xcode 4.6 or later
  • Max 6.1 or later


  • Download the AudioBus SDK [1] - take care, this example is not compatible with the new AudioBus 2 SDK
  • Download The Amazing Audio Engine [2]
  • Download the AudioBus app in order to test (cost $4.99 to install on an iOS device) [3]

Building an Audiobus iOS project

  1. Show the iOSGenFilter folder from the above download in Finder
  2. Copy The Amazing Audio Engine to the project folder as follows:
    1. Open TheAmazingAudioEngine.xcodeproj in Xcode
    2. Build the project (Cmd+B)
    3. Find the products group in the Xcode navigator and Ctrl+Click on the libTheAmazingAudioEngine.a to show it in Finder
    4. Copy the file (libTheAmazingAudioEngine.a) to the iosGenFilter folder
    5. Close TheAmazingAudioEngine.xcodeproj Xcode project
    6. From Finder, copy the AmazingAudioEngine with all of the header (.h) and source (.m) files to the iosGenFilter folder
  3. From the Audiobus SDK, copy the Audiobus folder and libAudiobus.a file to the iosGenFilter folder
  4. Open the gen~ patch in the iOSGenFilter folder
  5. In Max, export the gen~ patch as C++ code as follows:
    1. Unlock the patch and select the gen~ object
    2. From the inspector, under the Export header, click on the "choose" button next to the field "Folder to export into"
    3. Choose the GenFilter folder inside project folder, where the code will be exported
    4. Click the "exportcode" message connected to the gen~ object to finally export the code
  6. Open the GenFilter.xcodeproj in the iosGenFilter folder
  7. In xcode, Change the namespace used in to match that of the exported code
    1. This means, find the statement near top of file starting with “using namespace” and make it look like this: using namespace gen_exported;
    2. (if you get a bunch of errors – then you need to find out what your exported code is called. It will be the most recent .cpp file in the GenFilter folder.)
  8. Connect your iOS device to your computer (iPhone or iPad)
  9. Build the Xcode project for the device
  10. Generate and Audiobus API key
    1. In ‘products’ group in Ccode navigator, Ctrl+Click on the product and select ‘open in finder’.
    2. Ctrl+Click on the in Finder and select ‘open package contents’. – leave this finder window open
    3. In a broswer go to [4] - you’ll probably need to login with your user/password set up earlier.
    4. Drag the info.plist file from the Finder window just opened into the dropbox in the browser.
    5. Enable the 'Filter Port' option and click the button on the web page to generate a key
    6. You should get a screen with your temporary API key.
    7. Now copy the API key into the file replacing the existing one – around line 51. – re-build project to make sure you have no errors

To test the filter:

  1. Ensure the iOS device is still connected
  2. Build and Run the Xcode project
  3. You should now see the GenFilter app running on your device
  4. Switch out of the app and launch AudioBus
  5. In AudioBus, select the microphone input for input, the GenFilter for effect, and the speaker or headphone output for output.
  6. Switch back to GenFilter and twiddle some parameters
  7. You should hear audio coming out of your device