[Not GZDoom] [4.5.0] - Looping causes audio pop

Bugs that have been investigated and resolved somehow.

Moderator: GZDoom Developers

[4.5.0] - Looping causes audio pop

Postby SanyaWaffles » Mon Dec 28, 2020 5:38 am

while we we're working on SHDX, we noticed something in testing.

The music looping seems to cause an audible 'pop' on both me and my friend/musician's machines.

We tried both the sample and the timestamp method of looping and it didn't seem to help.

We tried lowering the quality of the audio from OGG q10 to OGG q8, it didn't help much.

There's something weird going on.

Even if this isn't a specific GZDoom problem, there's something with my friend's music files that GZDoom doesn't like. It happens with all of his files.

https://www.dropbox.com/s/c0f3zpeqis3tk ... x.ogg?dl=1 here's one file in question. I didn't bother trying to make it a 'runnable' example because from what I understand one could just put this in a loose directory with a folder called music in it and load that and use changemus.

I dunno what's going on. I will do additional testing and report with any findings.
User avatar
SanyaWaffles
Certified Heretic and Grill Champion
 
Joined: 25 Apr 2013
Location: Eastern Ohio
Discord: SanyaWaffles#5095
Twitch ID: sanyawaffles
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Re: [4.5.0] - Looping causes audio pop

Postby Rachael » Mon Dec 28, 2020 8:41 am

What happens if the audio is exported and played as FLAC? Yes, I do realize that might bloat the final archive size a bit.

At any rate, looking at it through Audacity, I do see that the track does not have a quiet termination at either its start or end points:


So what's likely going on here is that at the end, the speaker is left in a state where when the track starts again, it is further from the track's starting point than when it is otherwise silent. Even fading for a centisecond at both ends might be enough to mitigate this, and might not sound too badly like it is being interrupted.
User avatar
Rachael
Admin
 
Joined: 13 Jan 2004
Discord: Rachael#3767
Twitch ID: madamerachelle
Github ID: madame-rachelle
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Re: [4.5.0] - Looping causes audio pop

Postby SanyaWaffles » Mon Dec 28, 2020 9:12 pm

We tried it as a FLAC, same issue.

We tried changing the loop points, same issue.

It doesn't matter if it's a quieter or a louder part, we still get a pop. We get it with other music tracks too, even the more ambient, lo-fi ones.

The musician is familiar with modding music into SSBB, which uses a format that loops with a similar method, and it had no popping with the exact same sample-based timestamps.

We also tried this with earlier builds of the game to be sure it wasn't.

We spent a good 4 hours this morning trying anything to mitigate this, and nothing worked.
User avatar
SanyaWaffles
Certified Heretic and Grill Champion
 
Joined: 25 Apr 2013
Location: Eastern Ohio
Discord: SanyaWaffles#5095
Twitch ID: sanyawaffles
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Re: [4.5.0] - Looping causes audio pop

Postby Metal Neon » Mon Dec 28, 2020 10:20 pm

Hello there, I'm the person in question who is doing the music for Sanya's project.

To further elaborate on the issue, the problem seems to be specifically with GZDoom's loop functionality.

I figured this out by getting the original audio file, and cutting out all parts of the track that aren't between the start and end of the loop, the file is right here.

It's not 100% seamless, but it doesn't experience the pop or what feels like a change in tempo (or the beat) which is the problem we're having with the loop system right now. https://www.dropbox.com/s/l56qr5zunig7l ... 2.ogg?dl=1

I'm wondering if there's a way to crossfade between the starting and ending loop points in order to make the loop feel more seamless. Thank you for your time and getting back to us.
User avatar
Metal Neon
 
Joined: 28 Dec 2020
Location: Oregon
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Re: [4.5.0] - Looping causes audio pop

Postby Graf Zahl » Tue Dec 29, 2020 1:15 am

We can't alter the loop functionality to handle some isolated songs that do not work well due to how they are constructed - it'd affect everything else. Your track starts at a non-zero value and ends at a different non-zero value. That guarantees that there will be an audible pop at the transition point.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: [4.5.0] - Looping causes audio pop

Postby Metal Neon » Tue Dec 29, 2020 2:25 am

I wasn't actually aware of that. I'm going to be going through the tracks to find good loop points with this info. Thank you for the advice
User avatar
Metal Neon
 
Joined: 28 Dec 2020
Location: Oregon
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Re: [4.5.0] - Looping causes audio pop

Postby Metal Neon » Tue Dec 29, 2020 3:14 am

Hello there. After working on the tracks some more we're still experiencing some audio pop in tracks where the start of the loop and end of the loop are at zero values. The track here is an example https://www.dropbox.com/s/zil9jiga5t2hv ... T.ogg?dl=1

I'm not really sure what's going on in this instance. If it's just the way I'm mixing the tracks then I guess I'll have to deal with it, otherwise I'm hoping that this can be looked into.
User avatar
Metal Neon
 
Joined: 28 Dec 2020
Location: Oregon
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Re: [4.5.0] - Looping causes audio pop

Postby Rachael » Tue Dec 29, 2020 6:11 am

I'm moving this to Audio/Music bugs so that it has the right visibility with the right people.

I'm not 100% in-the-know with what's happening in GZDoom's audio system, and AFAIK Graf is more versed with GZDoom's side of handling the audio than he is with the OpenAL code itself. The two best people I know of to help here are Nash and Chris - Nash because he can analyze the audio and make an audiograph of what is actually happening, and Chris because he's the one who made the OpenAL-soft backend that GZDoom currently uses and linked it all together.
User avatar
Rachael
Admin
 
Joined: 13 Jan 2004
Discord: Rachael#3767
Twitch ID: madamerachelle
Github ID: madame-rachelle
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Re: [4.5.0] - Looping causes audio pop

Postby Nash » Tue Dec 29, 2020 10:46 am

It looks like it's already mentioned in this thread, so what I'm about to say won't be anything new - the loop start and end points would have to be placed at a perfect zero crossing point. In Audacity, there is a function to snap the selection cursor to the closest zero crossing it can find (I think the default hotkey is Z) - other DAWs should have similar functionality to snap to zero crossing.

Note that for it to be 100% seamless, the zero crossing should occur on BOTH the left and right channels. It's not enough to just look at only one channel, see a zero point and go "ah, I'll just place the tag there". I >think< Audacity takes stereo into account with its zero crossing snap function, but I may be wrong. YMMV with other DAWs, of course. Or just zoom in REALLY close and eyeball it. XD

You'd have to use a sample value for the loop start and end, because timestamp isn't accurate enough.

If it still pops when the loop points are placed on perfect zero crossings, then, I'm not sure what else to suggest. Chris would probably know better. I'm not sure how OpenAL handles it. I may be remembering it incorrectly (correct me if I'm wrong, Chris!) but I think OAL already does micro crossfades.
User avatar
Nash
Twitter/Facebook/Youtube: nashmuhandes
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia
Twitch ID: nashmuhandes
Github ID: nashmuhandes

Re: [4.5.0] - Looping causes audio pop

Postby Chris » Tue Dec 29, 2020 11:12 am

This typically happens when there's a large difference in amplitude between the loop end sample and loop start sample. The waveform has to make a sharp correction to fit the sample points, causing a click or pop from the sudden amplitude change. Checking out the waveform in Audacity, it does seem as though there's a notable amplitude difference between the start and end loop points, particularly for the left channel.

Assuming the music was authored to loop properly, then as Nash suggested you'd generally want to loop where the start and end points cross 0 amplitude.

If the music was not authored to loop properly, you may need to add some blending to the start and/or end points so they match up. Sort of like how you'd make a texture tilable that originally wasn't.

Nash wrote:If it still pops when the loop points are placed on perfect zero crossings, then, I'm not sure what else to suggest. Chris would probably know better. I'm not sure how OpenAL handles it. I may be remembering it incorrectly (correct me if I'm wrong, Chris!) but I think OAL already does micro crossfades.

It does microfades when a sound stops, or starts in the middle of the sound (a non-0 starting offset). When looping, it just treats it as a continuous stream of samples, moving the read offset back to the start point when it reaches the end point. For music in particular, that's ZMusic handling the sample reading in a similar fashion, OpenAL just sees a continuous stream of samples being queued in.
User avatar
Chris
 
Joined: 17 Jul 2003

Re: [4.5.0] - Looping causes audio pop

Postby Metal Neon » Tue Dec 29, 2020 7:15 pm

Thank you all for the help. When we first heard zero point we thought it had something to do with milliseconds and not phase. I altered one of the tracks using the method you gave me and it made the pop significantly quieter. It's still present in the track but its quiet and doesn't mess with the expected timing of the track which was the problem we were facing before. I may end up messing about with it some more to see if I can get it more precise but this was extremely helpful.
User avatar
Metal Neon
 
Joined: 28 Dec 2020
Location: Oregon
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Re: [4.5.0] - Looping causes audio pop

Postby Rachael » Tue Dec 29, 2020 7:55 pm

No worries - sound has certain physics that might not be obvious to understand - when you have a moving waveform and transition to another one without a proper transition, it will have that pop because the state of the speaker is completely different at the point prior to the transition to the point after.
User avatar
Rachael
Admin
 
Joined: 13 Jan 2004
Discord: Rachael#3767
Twitch ID: madamerachelle
Github ID: madame-rachelle
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support


Return to Closed Bugs

Who is online

Users browsing this forum: No registered users and 0 guests