-
Notifications
You must be signed in to change notification settings - Fork 160
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
3.6.0: Looping sound issue #2244
Comments
After experimenting a bit I found that this is caused by the decoded sound being slightly longer than the original file. To prove that I run an non-looping sound and wrote result of our SDLDecoder class into a file. Here's a raw wave data, which may be imported into a sound software as 32-bit float 44100 hz PCM: It has roughly 0.006 s of trailing silence, that is matching the length of gaps found in a game's audio output recorded by user. (I shall add the ability to write such SDLDecoder or AudioCoreSlot output as an option to the engine, to simplify testing further similar cases.) At this point it looks like the root of the problem is inside SDL_Sound library (or any SDL2 utils used by SDL_Sound). EDIT: right, I forgot to note, that the input sound is 48 kHz, while it's being converted on playing to 44 kHz. |
UPD: looks like this is related how SDL_Sound loads the original 48 kHz file. It adds a small piece of silence in the end, which results in audible "gaps" when looping. For instance, Audacity loads the sound fine without appending anything. |
If you can reproduce this using either SDL_Sound or mojoAL alone, its useful to report upstream. Edit: is this related to #1696? |
I had a misunderstanding, the problem exists before converting from 48 kHz to 44 kHz. This may be seen if you import attached "test.raw" file in Audacity, providing matching specs: 32-bit float 48 kHz 2 channel PCM. This is before passing further into mojoal, so not related to the playback device at all. EDIT: I shall make a test program that writes a result of Sound_Decode to file. |
Opened an issue for SDL Sound: |
I think my PR there will be merged soon, in my tests it fixes the issue. (If you could test building my sdl_sound branch it would help making sure I haven't screwed anything) |
Made a branch for testing (here) with the change that will build here: https://cirrus-ci.com/build/5161767643381760 Web version here: https://ericoporto.github.io/agsjs/sdl_sound_issue_92 Here is the test game: LoopVaccum.ags.zip From listening I can't honestly tell the difference... |
Problem
There have already been a report about looping sound before (#501), but it was closed after considered to be a "false alarm", or not engine's issue.
EDIT: also it seems to be reported long before 3.6.0 was out, so it was not related to the new audio system.
But recently another user reported a problem with the looping sound again. I tested it, and confirm that it's indeed happening in 3.6.0+, while playing nicely in previous versions (3.5.1 and lower).
Here's the sound file in question:
VacuumNoise.zip
Here's a user's recording of playing this sound in 3.5.1.14:
Looping_sound_AGS_3-5-1-14.zip
Here's a user's recording of playing this sound in 3.6.0.53:
Looping_sound_AGS_3-6-0-0-53.zip
To Reproduce
Simply import into AGS, and play repeatedly on start or room enter, e.g.
There's an obvious question of how to diagnose this problem. Theoretically I see few potential places where the mistake may take place:
2.1. Result of our "audio slot" work;
2.2. Result of mojoAL playback.
My thought is to add a "sound debug" mode in the engine that would write decoded sound into a file, separately from the OpenAL playback. This will let see the soundwave of a decoded data itself.
As for playback, the good thing is that SDL supports "Direct-to-disk Audio" device, which will write the engine's audio output to "raw" file (format is 32-bit float PCM), which may then be imported to a sound editing program such as "Audacity". If that would not be enough, perhaps it may be possible to add our own output for data processed in "audio slot" before it's given to MojoAL.
NOTE: I assign this to 3.6.1 Milestone, but if a fix is found soon enough, then it may as well be backported to 3.6.0 batch and another patch released.
May or not be related to #1978.UPDATE:
This is a SDL_Sound issue: icculus/SDL_sound#92
The text was updated successfully, but these errors were encountered: