Problems with ofxSoundPlayerObject VS2015

Hi there,
I am trying to use ofxSoundPlayerObject in order to have access to the sound buffer of a sound file.
I am using of9.8, VS2015, Win32 Debug for compilation. Changing to x64 or Release doesn’t seem to make a difference.

I am constaltly having this weird error when executing the basic player example on the addon

SSMF: failed to get buffer sizeSSMF: Duration: 938.184
[verbose] ofxSoundPlayerObject: Loading file : C:\Developer\of_v0.9.8_vs_release\apps\myApps\testSound\bin\data\C.mp3
[verbose] ofxSoundPlayerObject: Duration : 938184
[verbose] ofxSoundPlayerObject: Channels : 2
[verbose] ofxSoundPlayerObject: SampleRate : 48000
[verbose] ofxSoundPlayerObject: Num Samples : 90065664
Assertion failed: size < sizeof(m_destBufferShort), file …\addons\ofxSoundObjects\libs\libaudiodecoder\src\audiodecodermediafoundation.cpp, line 221

In that case I was using a .mp3 file, but the same happens with .wav files provided as examples in ofSoundPlayer

I have added the property sheet as stated in the add on but it is weird. I am not sure if I should define how the file should be read or where.

The problem happens when calling to .load(path), precisly in line 51 of ofxSoundPlayerObject.cpp, more precisly when gets into OF_USING_LAD (ladReadFile(buffer), line 338). I can’t find where is that define and maybe used MPG123 for example.

Any help would be higly appreciated!
Best,
Diego

Hi Diego,
which version of the addon are you using? I haven’t thoroughly tested it on windows, and has been a while since I last did. I recommend you to use the latest nightly build instead of 0.9.8. I’ll take a look and see if I can replicate your error.
best

Hi Roy!
Thanks for asking.
I understand you are talking about the OF nightly build. I have just downloaded it. The version of ofxSoundPLayerObject that I am using is the master branch.

Using the nightly build of OF (of_latest_vs_nightly.zip, Jan 21st, http://openframeworks.cc/versions/nightly/of_latest_vs_nightly.zip)
I couldn’t even compile the examples… Is that what you were talking about?

Editing: I downloaded the wrong version. Downloading http://ci.openframeworks.cc/versions/nightly/of_v20180302_vs2015_nightly.zip
I am always using Win32 Debug
Compiling 0.9.2 have the same problem
Nightly Build has not ofBaseSoundPlayer. I am going to check the class in the addon to ofSoundPlayer
Nightly Build: I am having a ton of errors realted with indentifiers not found and functions not being part of std
I am trying astana branch. Needs VS2017. Downloading VS2017 and vs2017 nightly build…
Again, a lot of problems with the compiler… If any body has a working template in VS2015 of ofxGist loading/analyzing an audio file, I would highly appreciate it…
Best,
Diego

hey @dmelladom!
(use the @ with my name so I get notified.)
I’ll have to take a look.
If you want to playback the file and access its buffer use https://github.com/arturoc/ofxBasicSoundPlayer
if you just want to load it and analyse it try
https://github.com/kylemcdonald/ofxAudioDecoder
I think that the latter is a dependency of the former
I’ll let you know if I push a fix for it.

Thanks @roymacdonald!
I have been trying tomget along with those, but unsuccesfully… I will try again and let you know how it works!
Thanks for taking care :slight_smile:

Hi @roymacdonald,

any update on getting ofxSoundPlayerObject working on windows 10?

I was able to get it working in OSX with few issues, but ultimately I would need to use it on windows.

Hi @epicjefferson, it should work with windows.
I’ll take a look and let you know.
best

I was just looking at this and there are several issues with OF’s master branch (and soon to be release 0.10).
I need to take a deeper look at this.
I hope to be able to work on this during the weekend.
best

Thanks @roymacdonald.

I’d really appreciate that.

To be sure, I think it would be easier to get it working with VS2015, rather than VS2017.
And the issue I’m seeing is the same as originally mentioned in this post:

Hi, I think that it makes no difference to compile on VS2015 or VS2017.
That problem you’re having has to do with the libraries being used. Can you please post what you’re getting on the console and/or errors.

@roymacdonald I’m not the windows computer at the moment, but I can check a bit later. It’s something that looks like this:

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

Pretty sure the duration is different depending on the file I try to load

@roymacdonald here is a screenshot of the error.

Hi, that’s the media fundation layer complaining. the error is being generated by libaudiodecoder, which is an external library. I’ll take a look and try to fix it.
I’ll let you know.
best.

Hi @roymacdonald,
Did you find a fix for this? Currently using ofxBasicSoundPlayer and getting the same issue. I tried researching libaudiodecoder, but can’t find a solution. I am not very well versed in Windows development. I have checked out the links you mentioned previously, but haven’t been able to figure it out.
Any help would be greatly appreciated!
This is the output:

WMFail

The issue seems to be when loading the entire audio file into memory. If the audio is streamed, then there is no issue. The buffer array is not big enough to hold the entire file. See audiodecodermediafoundation.h: SHORT_SAMPLE m_destBufferShort[32768]; Making this bigger solved the issue, but doesn’t seem very robust.

I changed the buffer to a vector that dynamically allocates to fit the size of the incoming buffer and it appears to work correctly.
See attached. libaudiodecoder.zip (26.0 KB)

Hi @NickHardeman,
I ended up removing libaudiodecoder and reimplemented it making use of ofxAudioFile.

Which version of ofxSoundObjects are you using? do you have the latest from github?

@roymacdonald Ahh, ok. Thank you for the prompt response. ofxAudioFile looks like it would solve the issue as well. I have been using ofxBasicSoundPlayer since I just need simple playback and buffers. Sorry to bump the thread, I posted here since I thought the fix for libaudiodecoder was relevant to ofxSoundObjects.

@NickHardeman it is fine. dont worry.
I am doing an update now so to include libsndfile for windows, and the correct configuration so everything is properly added to the project when using the project generator.
I’ll let you know once it is ready.

Hey @NickHardeman I’ve just pushed an update to the ofxSoundObjects repo. There is no longer a dependency on libaudiodecoder but you now need ofxAudioFile. I’ve tested it on windows 10 using visual studio 2017.
You can simply add it using the project generator, but it is important that you add the ofxSoundObjects.props file. Read here on how to do it.