How I can playing byte array of WAVE file using createSound()?

I need to play byte array data like sound using FMOD. How can I do it? I was searching for a long time, but I didn’t understand nothing and I didn’t find examples.

I tried like that, but I failed:

            FMOD.System mainSystem;
            FMOD.Factory.System_Create(out mainSystem);
            mainSystem.init(512, INITFLAGS.NORMAL, (IntPtr)0);
            FMOD.Sound sound = new FMOD.Sound();

            var newArr = wp.getBytesOfAssetsArray()[4];
            var info = new FMOD.CREATESOUNDEXINFO();
            info.cbsize = MarshalHelper.SizeOf(typeof(FMOD.CREATESOUNDEXINFO));
            info.format = SOUND_FORMAT.PCM16;
            info.defaultfrequency = 51000;
            info.length = (uint)newArr.Length;

            mainSystem.createSound(newArr, FMOD.MODE.OPENMEMORY | FMOD.MODE.OPENRAW | FMOD.MODE.CREATESAMPLE, ref info, out sound);
            var channelGroup = new FMOD.ChannelGroup();
            var mainChannel = new FMOD.Channel();
            var mainDSP = new FMOD.DSP();

            mainSystem.playSound(sound, channelGroup, false, out mainChannel);
            mainSystem.createDSPByType(Helper.FMODHelper.generateRandomDsp(3), out mainDSP);
            mainChannel.addDSP(0, mainDSP);
            System.Threading.Thread.Sleep(new Random().Next(5000, 8000));

            sound.release();
            mainChannel.removeDSP(mainDSP);

Sorry that you’ve had so much trouble getting this working - I’ve flagged some documentation improvements in our feature/improvement tracker.

The different modes that you are able to use with System.createSound() have specific requirements for extended information. OPENRAW needs the audio format, default frequency, and the number of audio channels, and OPENMEMORY needs the length. Since you’re using OPENRAW, you just need to specify the number of audio channels in the sound you’re loading with info.numchannels = yourNumberOfChannels; before calling mainSystem.createSound(), and your code should work.