title: It is possible to convert an array of bytes to an AudioClip?
body: <p>I'm making a cross platform application, with the game engine <strong>Unity</strong>,  that simply takes images and audio files (<strong>.ogg</strong>) from a bucket made with the <strong>Amazon Simple Storage Service</strong> (<strong>Amazon S3</strong>). I'm having a problem converting audio files, represented in bytes, to AudioClips.</p>
  
  <p>I have already tried the solutions from both links:</p>
  
  <p><a href="https://stackoverflow.com/questions/16078254/create-audioclip-from-byte">create AudioClip from byte</a></p>
  
  <p><a href="https://stackoverflow.com/questions/35228767/noisy-audio-clip-after-decoding-from-base64?noredirect=1&amp;lq=1">Noisy audio clip after decoding from base64</a></p>
  
  <p>But both solutions doesn't resolve my problem, there is still the static sound after the conversion process from bytes to array.</p>
  
  <p>Another solution I tried is to use the <strong>UnityWebRequestMultimedia</strong> and taking the audio from the url that every single object has in the bucket. This solution works only on the standalone version of the application (PC,Linux,Mac OS). When I try my application on an smartphone, with Android as OS, the UnityWebRequestMultimedia doesn't send the request and that's why I'm trying again to convert the bytes of the object taken from <strong>S3</strong> to audioclip.</p>
  
  <p>Every Audio file on S3 is an <strong>.ogg</strong> file with the following properties:</p>
  
  <p><a href="https://i.stack.imgur.com/suQ3X.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/suQ3X.jpg" alt="Properties of every file audio file"></a></p>
  
  <pre><code>//Method that takes the bytes of the audioclip
      private AudioClip GetMediaBytesFromS3 (Amazon.Runtime.AmazonServiceResult&lt;GetObjectRequest,GetObjectResponse&gt; ServiceResult,string nameOfAudio)
          {
              //Take the bytes of the audio
              byte[] mediaBytes = GetBytesFromMultimediaObject(ServiceResult);
  
              //Make a float array
              float[] floatMediaBytes = new float[mediaBytes.Length / 4];
  
  
  
              for(int i=0;i&lt;floatMediaBytes.Length; i++)
              {
                  //Check if the architecture use the LittleEndian ordering of Bytes
                  if(BitConverter.IsLittleEndian)
                  {
                      Array.Reverse(mediaBytes,i*4,4);
                  }
  
                  floatMediaBytes[i] = ((float) BitConverter.ToInt16(mediaBytes,i*4)) / 0x80000000;
              }
  
              //Make a new audioclip
              AudioClip clipAudio = AudioClip.Create(nameOfAudio,floatMediaBytes.Length,1,16000,false);
              //See if the data are set
              if(clipAudio.SetData(floatMediaBytes,28))
              {
  
                  return clipAudio;
              }
  
              return null;
          }
  </code></pre>
  
  <p>I simply want the audio be played correctly without the static noise.</p>