Coder Social home page Coder Social logo

Comments (10)

github-actions avatar github-actions commented on May 16, 2024

Thanks for opening your first issue here! Be sure to follow the relevant issue templates, or risk having this issue marked as invalid.

from docker-webtop.

j0nnymoe avatar j0nnymoe commented on May 16, 2024

What browser are you using?

from docker-webtop.

BlueCobbleStone avatar BlueCobbleStone commented on May 16, 2024

What browser are you using?
i'm using brave

from docker-webtop.

thelamer avatar thelamer commented on May 16, 2024

In general Chromium based browsers should just work. A lot depends on the connection quality, host, and client specs.

What we do for audio is different than most implementations of remote audio as we are making the assumption of lower latency and larger beefier hosts that are not in a shared environment.

The default and only audio option is 32 bit float PCM which is sending the raw PCM data from Pulseaudio at about 3 megabit when their is actual data to send. This is lossless crystal clear audio when it works, but there is also no room for extreme latency, dropped packets, or host/client load getting in the way.

Firefox in particular seems to have a problem on the server side when it goes from zero audio to playing where it ships a huge chunk of audio data for the initial second of the playback as it seems to fall behind a bit from silence while it is still playing. This translates to a pop and crackle client side as we are simply processing the data as soon as it comes in. The same thing can happen with other programs like VLC, but again should be limited to the start of playback or when returning from complete silence.
It is a delicate balance that is meant to prevent a series of issues that arise from using transcoded audio streams including:

  • Sync issues- Audio and video will get out of sync after some time when a session is being used as the audio track never stops and can be not processed properly clientside or load from the video rendering can get in the way.
  • No Null Data- When transcoding to a web native audio format like aac/mp3/etc the stream is constant when audio is turned on, there is no way to detect for null packets and the bitrate will be consistent.
  • Browser compatibility- This really boils down to Safari from a support standpoint but playing back an audio track in Safari has been problematic use web native formats. It seems to layer on it's own buffering when it detects that it is needed which in turn translates to out of sync audio for the client.

In general the audio is not going to be perfect for everyone, but if you use a chromium based browser clientside and don't use firefox in the container you will have a much better experience.
The code itself is dead simple:

Pull from pulseaudio socket: https://github.com/linuxserver/kclient/blob/master/index.js#L154-L166
Play PCM audio when we get a chunk from the server: https://github.com/linuxserver/kclient/blob/master/public/js/pcm-player.js

If this does not work for you, using these images in the Kasm Workspaces application (which we have a container for https://github.com/linuxserver/docker-kasm ) Uses the audio system that I described earlier by transcoding the audio into a transport stream with ffmpeg and shipping that to the browser. In general this will be more reliable for extreme remote scenarios but will run into the other points I described above.

In the end the decision to use this lossless high bandwidth audio format was made because these images are geared for self hosting ignoring sane bandwidth and latency limitations you might run into in a "production" deployment.

from docker-webtop.

BlueCobbleStone avatar BlueCobbleStone commented on May 16, 2024

Thanks for all that information.
I forgot to precise that I'm running the container on my local network (same computer).
I tested running chromium in the container with alpine-kde image and I still have worse audio quality than before kasm-base switch.
Sorry but i don't have any other evidence than "I can hear it" when playing youtube videos, music etc ... It seems obvious to me but it's maybe not.

from docker-webtop.

thelamer avatar thelamer commented on May 16, 2024

I am absolutely obsessed with fidelity (thus the 32 bit float audio and lossless desktop compression) This is a 24 bit flac and it sounds exactly like it was playing natively because that is essentially what we are doing with the PCM forwarding we are doing in the browser: (now keep in mind this has been re-encoded to aac for the mp4)

audio.mp4

So if you are not talking about pops and crackles than I am afraid we are not on the same page here. This implementation absolutely mops the floor with the old images.

from docker-webtop.

BlueCobbleStone avatar BlueCobbleStone commented on May 16, 2024

I'm not talking about crackles It feels like the sound has been compressed to a lower quality.
If I Listen the music you'r playing (btw nice song :) on your video and on youtube "https://www.youtube.com/watch?v=To86UdOx0A8" It doesn't feel the same.

from docker-webtop.

thelamer avatar thelamer commented on May 16, 2024

Bits are bits, and I am simply pushing the bits for playback into the web browsers audio processing interface particularly at the absolute maximum quality possible 32 bit float pcm https://www.sounddevices.com/32-bit-float-files-explained/

In any case I hope I have explained the audio subsystem sufficiently, I am afraid there is nothing I can do to make this sound any better as everything is already turned up to 11.

from docker-webtop.

BlueCobbleStone avatar BlueCobbleStone commented on May 16, 2024

I think I have a clear example,
You can install the following packages apk add alsa-utils alsa-plugins-pulse
Then, open the terminal in the container and use this command (Be careful very loud sound) : speaker-test
It sounds completely different

Edit: Idk maybe the pulseaudio configuration is the problem

from docker-webtop.

thelamer avatar thelamer commented on May 16, 2024

@BlueCobbleStone I think I have this nipped in the bud now, it turns out I messed up the bitshift in the PCM player and was pumping the left channel to both left and right, it has been fixed in the base I am building Ubuntu kde now.

from docker-webtop.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.