No worries, I am glad it’s working! Can’t wait for the windows support.
Can anyone explain why one of this file (menu_text_types_out_02.wav) is played by this extension much more quietly then other (gem.wav)?
Standard Defold API play those files equally loud.
Archive.zip (20.2 KB)
p.s. macOS, happens only on desktop build. On iPhone sounds played equally.
I’ve just tried your files on macOS and the menu*.wav file actually sounds a bit louder than the gem.wav.
Not sure what it could be in your case.
gem is 44100Hz and menu_text_ is 22050Hz
Test this version of gem and see if that difference matters?
gem.zip (11.0 KB)
The point is to play menu_text… as loud as gem.wav (and the rest of files), not other way around. Or just to know why it is so quiet. I try to resample it, normalize it, etc… No effect.
I guess make sure that the position of the source is correct. The further the sound source from the listener, the quieter the sound will be.
Yes, but if lowering the rate makes them sound the same then you know the Hz difference may be the cause. I looked at the files and didn’t see anything else which may cause it.
I was able to compile the extension for HTML5, but it’s not producing any sound yet. However, it does the initialization. Further work is needed.
Still working on the HTML5 version. There is sound output, but it’s not positioned or pitched for some reason. Trying to figure this one out.
In the meantime, I’ve updated the extension source code on github and you can try HTML5 support for yourself.
Open in Firefox or Safari. https://lerg.github.io/extension-openal/
Save shelter (old school fps) #CoronaDefoldJam
Can anybody please try the extension on Windows? And see if it just works?
I’ve made some minor modifications to make it compile and run on windows.
Pull request on github.
Play url-loaded sound
Just merged your pull request.
Awesome, now this extension runs on all platforms. But HTML5 version needs work.
Awesome extension, thanks for it.
I add it to my game and have some questions:
1)When i add my wav files, i get ERROR:openal: Invalid WAV data header. How can i fixed it?
2)In html looks like, sound volume not decresed when i move away from sound source.
3)You have a lot of distance_model. What is diference of them?
4)What is rolloff_factor?
function on_message(self, message_id, message, sender) if(message_id==hashes.CONTROLLER_SPAWN_3D_SOUNDS)then local sounds=world.map.data.sounds_3d pprint(sounds) for i,sound in ipairs(sounds) do local sound_source = openal.new_source(SOUNDS[sound.sound]) sound_source.reference_distance=2 sound_source.rolloff_factor=50 --sound_source.max_distance=4 sound_source.x, sound_source.y = sound.x +0.5 , sound.y +0.5 sound_source.is_looping = true sound_source:play() sources[i]=sound_source end end end
HTML has issues, haven’t finished it yet. Distance models calculate how exactly sound becomes quieter with distance. There are formulas in OpenAL reference, but you can pick one that just sounds better for you. “_clamped” means at max_distance the sound is muted.
Rolloff controls how far the sound goes, can’t tell exactly how.
Resave WAV files with Audacity, should help.
What about support of OGG or stream playing for big files (1 minute and longer)?
Streaming requires a bit more complex coding to manage buffers and OGG support need a decoder library integration. Not something that can be implemented easily.
Regarding stereo sound, is there any possibility to create a ‘dead space’ around an object, where both left and right speakers will be playing a looped sound and only will have 3D effects far (for example right speaker is working while far away from the center of the object to the right)? Now, in an example there is a ‘line’ (pos.x) on which I can’t stand with a listener to ‘feel’ like really near to the campfire, but instead, the listener is always on the right or left side of the campfire and the sound is always on the right or left side.
If you play with various settings, should be possible. Can’t tell for sure which ones.
Any plan to integrate the OpenAl extension into the core of Defold? The audio department still feels a bit too basic and could use some love.