VoiceSamplePlayer WAV Assertion fail

I’m running into some odd assertion fails when playing an audio file through a VoiceSamplePlayerRef. It seems to happen with around 50% of the .wavs i have tried. In release mode it behaves well and sounds fine but im suspicious of the crash in debug so wanted to raise awareness of it. It is the same assertion failure as this post but seems to be triggered by something else. It was always at the end of the sample regardless of if it was looping or not.

|fatal | cinder::audio::BufferT<float>::copyOffset[156] *** Assertion Failed *** | expression: ( otherFrameOffset + numFrames <= other.getNumFrames() )

I noticed the code block on line 143 in FileMediaFoundation.cpp (“Whoops etc” shown below) was getting called just before the assertion which may or may not be related.

I couldnt understand why some wavs worked and others didnt, it seemed arbitrary, any thoughts ( @rich.e )?

Windows 64x
Latest cinder master branch

		mReadBufferPos = 0;
		bool endOfFile;
		size_t outNumFrames = processNextReadSample( &endOfFile );
		if( ! outNumFrames ) {
			if( endOfFile ) {
				// Whoops, IMFSourceReader::ReadSample() must of reported EOF before we reached the expected number of frames. I've seen this happen with mp3s.
				// - so we'll just zero out the remaining frames, so the SourceFile receives the expected number of frames as reported when parsing the header.
				outNumFrames = numFramesNeeded - readCount;
			else {
				CI_LOG_W( "Could not read the expected number of samples: " << numFramesNeeded << ", readCount: " << readCount );

Not sure, can you reproduce with just using an audio::SourceFile, or BufferPlayerNode / FilePlayerNode? I usually track down things like this using the SampleTest (via .sln file in test/_audio/Audiotest.msw/ folder), it’s got alot going on in there but gives you many different ways to test audio file stuff.

If you can repro there with a test file I can use, I’ll try to look at it, although I’ll be out of the country for the next two weeks so might not get to it until after that…



Sorry to resurrect this, was on another project for the last month but now back to this one. I’ve pm’d you a link to a short ‘test.wav’ that causes the AudioTest program to fail. Conditions are:

  • Dragged test.wav onto testing app.
  • Plays through fine on ‘BufferPlayerNode’.
  • Switch to ‘FilePlayerNode’
  • When file reaches end assertion fails as described above.

The test app is only in Win32 but i get the same thing in x64 in my app. Can also reproduce with the following 3 lines of code in a new app.

// App member
audio::VoiceRef mVoice

// Setup
mVoice = audio::Voice::create(audio::load(loadAsset("test.wav")));

My app happily ignores this assertion in release mode and i havent noticed any crashes in endurance testing. But as this is going towards a permanent installation I wanted to make sure everything was happy under the hood.