Neos-Metaverse / NeosPublic

A public issue/wiki only repository for the NeosVR project
194 stars 9 forks source link

Neos audio player skipping issue #803

Closed inzanesonikku closed 3 years ago

inzanesonikku commented 4 years ago

i've only noticed this issue on the 2020.7.24.489 update, it isnt a thing in the previous version. what changed?

Frooxius commented 4 years ago

Nothing has changed in particular. What exactly is going on? Which player do you mean? Is it the native one or the multimedia? Does it happen with all files? Does it happen all the time or under some conditions? What exactly does the "skipping" do?

inzanesonikku commented 4 years ago

i beleive its called the naitive player, the circle waveform thing. and what the skipping is is that every so often and it wont matter what format it is, there are noticeable audio gaps. (i've tried all formats neos supports). when it happens is basicly all the time, no special condition needs to be met to notice this however the "skipping" bit, will just jump ahead a little in the audio file. that i know for sure its never happened before.

RueShejn commented 4 years ago

how many audio sources do you have in the world that you tested this? when working on a few maps with alot of audio outputs i noticed a few sound skipping/ popping issues

inzanesonikku commented 4 years ago

only one sir.

Frooxius commented 4 years ago

Do any other audio sources keep playing fine? E.g. what if you bring in a YouTube video and play that at the same time?

inzanesonikku commented 4 years ago

the video player plays just fine

RueShejn commented 4 years ago

can you send the audio file?

shiftyscales commented 4 years ago

I've confirmed this issue with Zane. I've also found a way to reliably replicate it. It seems to be tied to background processing potentially starving the audio thread.

Example: From a clean launch of Neos, create a new world, spawn an audio file.

This applies to other types of background processing as well, e.g. if Neos has been running for a while/you've joined multiple worlds in the session, etc.

While Neos has first been launched, audio is perfectly smooth- but the instant there's any amount of background processing done, it appears to starve the audio thread, causing crackling.

Attached is a log where I captured the background worker threads during the crackling, and I stopped capturing slightly after the crackling stopped:

SHIFTYWINDOWS - 2020.7.27.3 - 2020-07-26 17_13_32.log

Frooxius commented 4 years ago

Does this happen with any audio files at all? Even WAV file for example? Audio thread should normally be running with really high priority, so it's a bit odd that I'd be getting starved. However if you're playing certain audio types from multiples sources, the double decoding can cause issues.

The Neos background threads are separate from audio, they have a lower priority too.

shiftyscales commented 4 years ago

Yes, it seems to happen even with WAV too. It could potentially be the double-decoding? It does appear that when the audio source is duplicated, it decodes it again instead of reusing the existing instance, and it is shortly after the player visual has finished generating the waveform that the crackling stops.

It seems strange that it happens even when there is only one audio source actively playing though.

The most reliable way I've found to replicate this:

Audio will crackle/stutter while the waveform on the visual is being generated, and will stop crackling shortly after it has finished.

There could be other means/mechanisms to replicate it- but this has proved the most reliable means so far. neosdb:///068c9fe598eb6275e454f7c698e4f9fb49a44e0ec5c093a9dda7d4caf85cf507 This is an OGG file provided by Zane where the issue is very easy to hear when following the steps outlined above. I also tried exporting it as a WAV in Audacity, and the same issue occurred with the freshly exported WAV file.

shiftyscales commented 4 years ago

It also happens when spawning out new copies from the inventory (in place of duplicating.) Strangely, it does seem to only happen on certain audio files, or at least, certain audio files like the one provided above are much easier to hear the issue on. But it does occur across various formats, e.g. OGG, WAV.

shiftyscales commented 4 years ago

According to Zane- in some cases where a volume meter component is present, removal of the volume meter will stop the issue.

I believe this might be because it lowers the amount of processing done.

Frooxius commented 3 years ago

This should now be fixed with the new audio system introduced in 2020.10.25.915!