Closed JanClaasen closed 2 years ago
Hi and welcome :)
Unfortunately asset handling is not Kha's and Armory's biggest strength, but I will try to explain it as thoroughly as possible:
Armory automatically exports assets that exist in a Bundled
folder in your project root. However there is a small problem with Armory's approach, and that is that the assets are not directly available as sounds in Kha, and Aura currently requires that for loading them. I plan to improve this in the near future (in both Aura and Armory), but for now you'll have to add the sounds manually to the generated khafile.js.
To do this, create a new text document in Blender's text editor and select that document in the properties panel under Armory Project > Modules > Khafile
. The contents of the selected file will be appended to your khafile and here we can override/extend Armory's problematic asset export. I'm not sure how familiar you are with khafiles, but if all your sounds are in Bundled/sounds
(for example), you can simply use the following line:
// This line tells Kha that every file inside Bundled/sounds should
// be exported as an asset
project.addAssets('Bundled/sounds/**', {notinlist: false, quality: 1.0});
The important thing is the notinlist: false
setting, Armory sets this to true by default and that's why you need the manual workaround.
The quality is a value between 0.0 and 1.0 and apart from the actual quality of the sound this will control whether the sound is compressed or uncompressed. However (and this is a bit unfortunate and not yet documented), Kha will compress the sounds on some targets and don't compress them on others if the quality is below 1. Krom for example only uses uncompressed sounds. So try to play around with the quality if things don't work directly.
Some general tips:
AuraLoadConfig
), you can see the rules for this here. In the above example this shouldn't be the case though.Aura.play()
, if it is compressed Aura.stream()
, but Aura will notify you in case you are using the wrong function.For instance test.wav, would that be uncompressed: ["test"]
Yes :)
Hi and thank you very much for your detailed explanation
after spending the evening trying to get it working i managed to in the end! I had some problems along the way though such as the sound being double speed. The kha page says 44100hz but i had to change it to 48000hz in audacity to get it to sound right.
Then i had trouble with what turned out to be the doppler effect (which was cool), but i had to turn the factor down.
thank you very much again, wonderful library
That's great to hear!
I had some problems along the way though such as the sound being double speed. The kha page says 44100hz but i had to change it to 48000hz in audacity to get it to sound right.
May I ask for which target you compiled? I also experience this on Krom but haven't yet found the issue. It's something Kha/Krom related as it also happens without Aura.
Then i had trouble with what turned out to be the doppler effect (which was cool), but i had to turn the factor down.
Just to get you right, was the effect too strong or didn't you expect the doppler effect to happen at all? I'm asking because currently the doppler effect is active by default and maybe it's better if it would be off by default.
Btw, if you have ideas or find bugs (or the API is unintuitive somewhere), please let me know :)
Hi!
i only tried the Krom one, but yes i experienced the same when using armory without aura too
The doppler effect was nice but at first i thought it was the resample issue still there when moving toward the sound. Would it be possible to have a list of possible effects to add, like a wiki?
Would it be possible to have a list of possible effects to add, like a wiki?
Yes, that's the plan, however I currently haven't much time so this will take some while. The current readme will eventually become too bloated anyway.
Hello, sorry for asking
what would be the easiest way to get this to work with armory engine? I mean with loading the compressed or uncompressed file, do i put my audio file somewhere? For instance test.wav, would that be uncompressed: ["test"] ?