disunity icon indicating copy to clipboard operation
disunity copied to clipboard

Unity 5 load audio from external binary file

Open ivanpopelyshev opened this issue 10 years ago • 3 comments

In "creativerse" game audio files from "resources.assets" are linked to "resources.resources" binary file through "m_Resource" field. Need to add it as a child binary file.

ivanpopelyshev avatar Oct 20 '15 16:10 ivanpopelyshev

According to quickbms script for unity, $NAME$.assets file can reference $NAME$.resources file.

ivanpopelyshev avatar Oct 27 '15 16:10 ivanpopelyshev

Here's an example from a U5 sharedassets1.assets file (standalone game) :

0 AudioClip Base
 1 string m_Name = "ui_menu_click"
 0 int m_LoadType = 1
 0 int m_Channels = 1
 0 int m_Frequency = 44100
 0 int m_BitsPerSample = 16
 0 float m_Length = 1.500000
 1 bool m_IsTrackerFormat = false
 0 int m_SubsoundIndex = 0
 0 bool m_PreloadAudioData = true
 0 bool m_LoadInBackground = false
 1 bool m_Legacy3D = true
 0 StreamedResource m_Resource
  1 string m_Source = "sharedassets1.resource"
  0 UInt64 m_Offset = 0
  0 UInt64 m_Size = 132416
 1 int m_CompressionFormat = 0

1 stands for 4-byte alignment after a field. m_Offset and m_Size both are in bytes. In case of a U5 web player game, it usually looks like this : "archive:/resources.assets". There are some bundle files for standalone games that have path names that treat the bundle's name like a folder name like this:

archive:/CAB-cd49bb0197cf41d663ae791708cd5b95/CAB-cd49bb0197cf41d663ae791708cd5b95.resource

I use the FMOD lowlevel API to play the sound bank in NRT (non-realtime) and play it to a PCM-16 .wav file. I don't know if there are any Java wrappers. As far as I know, all of these sound banks only contain one sound.

DerPopo avatar Nov 01 '15 13:11 DerPopo

The .resource file used to be called .resS and disunity works fine with it. For now you can just try renaming it.

jack980517 avatar Nov 24 '15 23:11 jack980517