ofxSoundObjects audio addon


#1

Hey lovely OF community,
I recently made an addon for working with sound


It is based on what we worked at the ´13 YCAM oF devcon with @arturo, @admsyn and marek bareza. It was intended to be part of the oF core but never made it, hopefully it will be part of it in the future.

It is a super simple yet powerful way for working with audio in whichever way you want to. Get audio from any source, file or audio input stream, process it and send to whichever output you desire.
Check the documentation in guithub for a deeper explanation.
With this addon you can integrate a lot of other audio addons, giving you a lot of power.
It works over the existing oF sound implementations so it also wont break any stuff.
It is multiplatform and works on all the oF supported platforms (theoretically, I haven´t tested it in all).
So far there are some basic examples about how to use this in different way and I’ll soon push some others about integration with other addons and sound processing libraries.
Hope you like it and it becomes useful.

Best!


#2

Thanks for this addon. I tried some of the provided examples and I would like to integrate this in an existing project. It looks very promising.
The XCode projects worked fine for me. But projects generated by the project generator or the qt wizzard didn’t compile. Also make fails.
How would i get this working?


#3

Hi @thomasgeissl , I haven’t added the correct config files to the addon, that’s why PG doesnt work.
I’m fixing it now.
Check again the github repo in half an hour more.
Thanks for bringing up this issue.
best


#4

Thanks @roymacdonald for adding the config file.
The files in src/SoundObjects are not found. I get the following error message.

/Users/thomasgeissl/programming/of/openFrameworks/addons/ofxSoundObjects/example-soundPlayerObject/src/ofApp.h:5:10: fatal error: 'waveformDraw.h' file not found
#include "waveformDraw.h"

Should not they be added automatically to the header search paths?


#5

I just reported some issues in the repo. I will look at them later.


#6

Hi.

Looks really awsome and exactly what I might need in a current project, but compile failed:

addons\ofxSoundObjects\libs\libaudiodecoder\include\audiodecodercoreaudio.h(51): fatal error C1083: Cannot open include file: 'AudioToolbox/AudioToolbox.h': No such file or directory

PS: I included the addon to an existing project through the openframeworks plugin in visual studio

Any suggestions, what may be wrong ?

Thanks!
Jaan

Windows 7
OF 9.3 Visual Studio


#7

Hi, just remove that file
addons\ofxSoundObjects\libs\libaudiodecoder\include\audiodecodercoreaudio.h
it is an osx implementation file.
you’ll also need to remove
addons\ofxSoundObjects\libs\libaudiodecoder\src\audiodecodercoreaudio.cpp
addons\ofxSoundObjects\libs\libaudiodecoder\include\apple/
that should be all.
I think that the addon_config.mk file is not working correctly. :confused:

best


#8

Very excited about having an addon where it is easy to load sound and direct it to a specified output device. I’m going to integrate it into a few projects in the next couple weeks. THANK YOU!! :smile:


#9

Thanks for the reply.

I removed these files from the project, but now I get a bunch of unresolved external symbol errors:

(error LNK2019 & error LNK2001)

_MFStartup@8
_MFShutdown@0
_MFCreateMediaType@4
_MFCreateSourceReaderFromURL@12
_MFAudioFormat_PCM
_MF_MT_MAJOR_TYPE
_MF_MT_SUBTYPE
_MF_MT_ALL_SAMPLES_INDEPENDENT
_MF_MT_FIXED_SIZE_SAMPLES
_MF_MT_SAMPLE_SIZE
_MF_MT_AUDIO_NUM_CHANNELS
_MF_MT_AUDIO_SAMPLES_PER_SECOND
_MF_MT_AUDIO_BLOCK_ALIGNMENT
_MF_MT_AUDIO_BITS_PER_SAMPLE
_MFMediaType_Audio

I looked for a solution and they say, that I have to add the .lib files to Linker -> Input -> Additional Dependencies

Tried to clean and rebuild, but not working.

Then I looked inside the addon_config.mk file and the line:

ADDON_LDFLAGS += -lMfreadwrite.lib -lMFPlat.lib -lmfuuid.lib

When I added these manually inside Linker -> Input -> Additional Dependencies

as:

Mfreadwrite.lib
MFPlat.lib
mfuuid.lib

then it finally compiled.


#10

However,

I tried the soundPlayerObject example and it returned an error while loading a sound file:

SSMF: failed to get buffer sizeSSMF: Duration: 200.568
Assertion failed: size(sizeof(m_destBufferShort), file ..\libs\libaudiodecoder\src\audiodecodermediafoundation.cpp, line 221

#11

Hi Jaan,
the problem is with libaudiodecoder.
this might help:
https://github.com/kylemcdonald/ofxAudioDecoder/pull/3

If you remove the complete libaudiodecoder from project and then you import the ofxAudioDecoder addon it might work.

Sorry I cant be of more help but I’m really busy.
Best


#12

Hello,

I have the same link errors. But I think I didn’t undersatnd well how you solved them.

I tried to copy paste those names in Linker -> Input -> Additional Dependencies. I can now build the solution but when I run the project, it says that Mfreadwrite.DLL, MFPlat.DLL and mfuuid.DLL are missing.
What does it mean ? I don’t have Media Foundation installed or something like that ?

Thanks a lot,
Drreno

I’m on Windows 10 with oF 0.9.3 on Visual Studio 2015


#13

Hi,

I added them like this:


#14

Hi, can you make a pull request with this modifications to the VS project? I don´t use VS.
best!


#15

Hello, can anybody help with using ofxSoundObjects to load multiple wav files at once.
I’m getting a segfault:

(gdb) backtrace
#0  0x00007ffff49e7f41 in free () at /usr/lib/libc.so.6
#1  0x00005555556dd67a in ofxAudioFile::ofxAudioFile(ofxAudioFile const&) ()
#2  0x0000555555604936 in ofxSoundPlayerObject::ofxSoundPlayerObject(ofxSoundPlayerObject const&) ()
#3  0x00005555555fffc7 in ofApp::setup() ()
#4  0x000055555575f8f3 in std::_Function_handler<bool (void const*, ofEventArgs&), std::shared_ptr<of::priv::Function<ofEventArgs, std::recursive_mutex> > ofEvent<ofEventArgs, std::recursive_mutex>::make_function<ofBaseApp>(ofBaseApp*, void (ofBaseApp::*)(ofEventArgs&), int)::{lambda(void const*, ofEventArgs&)#1}>::_M_invoke(std::_Any_data const&, void const*&&, ofEventArgs&) ()
#5  0x0000555555770a8d in ofCoreEvents::notifySetup() ()
#6  0x000055555575f846 in ofMainLoop::run(std::shared_ptr<ofBaseApp>&&) ()
#7  0x0000555555759224 in ofRunApp(ofBaseApp*) ()
#8  0x00005555555d6023 in main ()

my code looks like this:

 for (int i = 0; i < 9; i++){
        std::string j = to_string(i+1);

        sounds[i].load("wav/"+packlist[selPack]+"/000"+j+".wav");
        // load sample data

        sounds[i].setLoop(true);
        sounds[i].setMultiPlay(true);
       }

I am trying to replace ofSoundPlayer with soundobjects.
Thanks
Jason


#16

first try and load fewer sounds. does it work?
I am really busy right now. I can help in a few more days. sorry.


#17

No problems, once I started to get the segfault, even after removing the load wave file part it, would still crash. I’ll try again tomorrow, with a new project and experiment.
The main thing, I’m looking for is to load and play multiple wavs and add some basic effects.
I’ll update here tomorrow with some new findings.


#18

I tried to load one sound from the example - and managed to get it to work…however when I try to load multiple sounds I get segfault - I think this is something to do with ofxAudioFile addon. Did you have another version which doesn’t use that? Or could you please suggest how to go about setting this up properly?

Cheers!


#19

Hi @Jason_Jellyfish
sorry for the belated reply. I was super extra busy.
I just switched to use ofxAudioFile, before I was using a combination of libaudiodecoder and other stuff more, but it was a bit of a hassle to get it working correctly on all platforms. I just checked and there are some problems in the implementation, although I never got a SEGFAULT. Can you try the mixer example? You’ll need to change ofxBasicSoundPlayer for ofxSoundPlayerObject. I will update this soon.