- Home /
 
               Question by 
               revan7 · Feb 19, 2017 at 11:07 PM · 
                memoryaudioclipconvertingexceptions  
              
 
              NAudio WMA to WAV Conversion Error
Hello, I am trying to convert a .wma byte array to a .wav stream ( I am using the NAudio plug-in ) , for the purpose of creating an AudioClip, here is the code I use ( pretty sure it's wrong but the best I can do ) :
     public static AudioClip FromWMAData(byte[] data)
     {
         System.IO.File.WriteAllBytes("wmatemp.wma", data);
         WMAFileReader wmareader = new WMAFileReader("wmatemp.wma");
         WaveStream waveStream = WaveFormatConversionStream.CreatePcmStream(wmareader);
         WAV wav = new WAV(AudioMemStream(waveStream).ToArray());
         AudioClip audioClip = AudioClip.Create("wma", wav.SampleCount, wav.ChannelCount, wav.Frequency, false);
         if (wav.ChannelCount == 2)
         {
             float[] sampleData = RemixChannels(wav.LeftChannel, wav.RightChannel);
             audioClip.SetData(sampleData, 0);
         }
         else
         {
             audioClip.SetData(wav.LeftChannel, 0);
         }
         // Return the clip
         return audioClip;
     }
However, the program exits, and I am not able to catch an exception of the error, studying the crash dumps I found out that the exception was: "The thread tried to read from or write to a virtual address for which it does not have the appropriate access." Can someone please enlighten me as to what this means ? Or offer a different alternative to converting .wma to .wav, thank you !
               Comment
              
 
               
              @revan7 Did you ever find a solution to this? I am having the same problem.
Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                