sound triggers

hi,

just wanted to share something ive been working on which might come in handy for others working with audio visualisations in OF.

i wanted to have a way of triggering different visuals (or events) at different points in a song.
so i created a way of loading in a wav files and displaying it graphically using the libsndfile library (http://www.mega-nerd.com/libsndfile/). a lot of the ideas came from the “sound toy” post (http://forum.openframeworks.cc/t/audio-toy/7309/1) and Jack Schaedeler blog which describes how to get libsndfile building on a mac (http://ofdsp.blogspot.com/2011/07/loading-wav-file-with-sndfilehandle.html)

once i had the wave file loading and displaying, i then created a simple keyboard interface for zooming in/out of the wave file and for placing triggers at different points inside the wave. when the wave file is played back, the triggers go off and cause different visual effects to happen. in this case, its only very simple circles popping when a trigger gets hit but you can hook it up to anything.

for managing the triggers i used,
https://github.com/julapy/ofxTrigger

here is the sound triggers example for OF 007.
http://julapy.com/source/sound-triggers.zip

it only works on osx at the moment as i was only able to build libsndfile for mac. but if you get it working on windows or linux then please let me know and i’ll add it to the ofxSndFile addon, https://github.com/julapy/ofxSndFile. the addon is very bare, only containing the library atm, but i’ll be sure to sort that our soon.

enjoy,
L.

in linux libsndfile is already there since it’s used by the default sound player, ofOpenALSoundPlayer, to read audio files so it should work without problem

ah cool, did not know that.
guess its just the windows lib that needs building now.

As you know I have some troubles to compile your example.

First I had

  
  
dyld: Library not loaded: /usr/local/lib/libsndfile.1.dylib  
  Referenced from: /Users/hugues/Dev/openframeworks/git-openFrameworks/apps/resources/sound_triggers/bin/emptyExampleDebug.app/Contents/MacOS/emptyExampleDebug  
  Reason: image not found  
  

That I fixed by adding the following to the ‘run script’ of the project

  
  
cp -f addons/ofxSndFile/lib/lib/libsndfile.1.dylib "$TARGET_BUILD_DIR/$PRODUCT_NAME.app/Contents/MacOS/libsndfile.1.dylib"; install_name_tool -change /usr/local/lib/libsndfile.1.dylib @executable_path/libsndfile.1.dylib "$TARGET_BUILD_DIR/$PRODUCT_NAME.app/Contents/MacOS/$PRODUCT_NAME";  
  

Now I have the same problem but with an other lib and I do not seem to be able to solve it. Even If if I have the the actual lib file - libFLAC.8.dylib.

  
  
dyld: Library not loaded: /opt/local/lib/libFLAC.8.dylib  
  Referenced from: /Users/hugues/Dev/openframeworks/git-openFrameworks/apps/resources/sound_triggers/bin/emptyExampleDebug.app/Contents/MacOS/libsndfile.1.dylib  
  Reason: image not found  
  

Any help would be appreciated.

Thanks

just wanted to let you know that i totally dig the lo-fi patterns you’re using to label your audio snippets.

hi, apologies for the issues.
as it turns out, i had the library installed to my user root (/urs/local/lib) and so it was working on my machine but would not work on others unless they had libsndfile installed in the same location.

the solution was to grab an existing build of the library from a project that grimus had worked on,
http://forum.openframeworks.cc/t/linking-a-new-library-in-x-code/2925/15

i assume this is an older version of libsndfile but still works great with the example provided.
would be great to build the latest version of libsndfile and make it a universal for mac.
anyone? its way beyond me as ive discovered… but happy to put some time into it if someone can point me in the right direction.

same link as before,
http://julapy.com/source/sound-triggers.zip

L.