Hi there
I am wondering whether I can somehow set the AudioCompressionFormat when using a UnityWebRequest with a DownloadHandlerAudioClip.
I am downloading AudioClips from a Content Management System where other people can upload their AudioFiles. Therefore AssetBundles are not really an option.
From what I see AudioCompressionFormat is solely available in UnityEditor namespace in conjunction with AudioImporter. It seem nowhere available for RunTime useage.
The following example show my attempt:
downloadHandlerAudioClip.compressed = true;
downloadHandlerAudioClip.streamAudio = true;
uwr.SendWebRequest();
while (uwr.result != UnityWebRequest.Result.ConnectionError && uwr.downloadedBytes < 1024)
{
yield return null;
}
This works fine so far. Since I have the compression flag on my DownloadHandlerAudioClip I would expect to be able to set the AudioCompressionFormat there as well. Am I missing something?
Also what AudioCompressionFormat is used by the DownloadHandler?
I did a quick comparison in an arbitrary scene. I am using different compressions for the AudioClips of my AudioSources, measuring the memory consumption:
- Importing AudioClips as AssetBundles (exported with ImportSettings set to streaming and Vorbis as compression with 100% Quality): 475 MB
- Importing AudioClips with DownloadHandler compressed and with streaming both set to true: 766 MB
- Importing AudioClips with DownloadHandler uncompressed and without streaming: 1100 MB
For me this concludes that the compression of the DownloadHandler uses probably PCM compression. It would be super cool to be able to change this.
Is that possible? Will that be possible in the future?
(Also it would be nice to be able to import Ambisonic Audiofiles from Script)