Does SoundEffect.FromStream work on wp8?

Hi,

I am trying to load wav files with SoundEffect.FromStream (I dont want to use xnb and content pipeline). The loading process does not throw exception, seemingly it creates a new SoundEffect, but when I am trying to play it, or create an instance from it, everything inside the variable is null.
This is how I load a file:

using (FileStream fs = new FileStream(fileName, System.IO.FileMode.Open))
{
    _SoundEffect = SoundEffect.FromStream(fs);
}

And this is how I am trying to play the sound:

SoundEffectInstance instance = _SoundEffect.CreateInstance();
instance.Play();

Should this FromStream work and I am missing something, or it does not work on wp8?

Sorry for bumping, but yesterday I downloaded the latest developer installer (v3.3 I think) and created two new test projects.

Project1 was targeted Windows phone 8. It threw an exception when I created the graphic device, so I stopped testing this and created another project.

Project2 targeted Windows phone 8.1 and the base template already contained a colorful 3D cube animation.
So, in this project I have added the necessary SoundEffect and SoundEffectInstance variables, initialization, etc… for testing, and seemingly I was able to load the wav file (I converted the original wav to 16bit wav in Audacity), however tried as I might have the duration was always 0:00.00, however there were no exceptions or any errors during loading or playing the sound… (there was no sound because the zero length duration, but also there were no exceptions thrown).

For me it seems that SoundEffect is still not fully developed by the monogame team, but at least I know that the original 3.2 that I am using for my game simply does not support this feature and I am doing everything properly. Kind of…

Any suggestions how could I proceed with my game? I still do not want to use the content pipeline, so should I wait for a new release that supports SoundEffect FromStream or is there any other option for me? Thanks!

Ok, so here is the correct answer:

In 3.3 the SoundEffect.FromStream works like a charm, though you should not forget NOT TO MUTE your phone. :smiley:
So, now I am using the dlls from 3.3 installer, and even multiple sounds can now be played at the same time. I did not test if FromStream works on mp3 and wma file types, but I loaded a 16mb big 16bit wav and there was no problem playing it. Hopefully, it works with mp3 as well! :slight_smile:

I had to remove 3.2 that I used through NuGet, because VS2013 Express was not able to build the game because “the same assembly exist with the same name” error happens, if you have both versions installed. The dlls are not strongly named. :frowning:

SoundEffect.FromStream is for PCM and ADPCM WAV files only. Streaming compressed formats such as MP3 or WMA are not supported in SoundEffect.

I will play around with an mp3’s streamed content, maybe I can do something funny with the byte array and load its data into a wav object, or something. :slight_smile: But anyway, the wav is ok for me…