0

I'm currently streaming to a Chromecast audio device using stream2chromecast on a lubuntu 16.04 mini pc. The issue am having is that I cannot preserve the audio fidelity while streaming alsa output via audacious media player. What I hear is far from what is being playbacked, and have not been able to figure out why. Below is the ALSA configuration which I am using to stream to the chromecast device.

pcm.!default { 
    type plug 
    slave.pcm writeFile 
}

pcm.writeFile {
    type file
    slave.pcm "hw:0,0"
    format "wav"
    file "| ffmpeg -f wav -i pipe: -af aresample=resampler=soxr -acodec pcm_s24le -hide_banner -f wav pipe: | stream2chromecast.py -"

}

The sound I am experiencing is like something choked. Midrange is weak, the vocals sound somewhat unreal, like the signal is not full.

I have also tried to stream a single file using the tool alone i.e without involving alsa or a sound card, and played with different buffer sizes (1024, 8192, 16384 and 262144) and it did not improve. There was only a subtle improvement with buffer size 262144.

Some thoughts about why..

The sender side is sending the audio data too fast that the network is 'overwhelmed' and can't keep up with the reliable data transfer, hence, some packets are dropped. However, ffmpeg does help maintain a constant bitrate and a data rate of 576kB or 768kB (32 bit) shouldn't be an issue for my 10/100Mbps throughput to handle. Moreover, both the chromecast device and my laptop are wired and not on Wi-Fi.

Any inputs or expert help on how to solve this problem will be highly appreciated. Thanks in advance!

Note: stream2chromecast has been modified to work with stdin, as it currently does not support it.

  • Guess: It's either the resampling and/or a low-fidelity input and/or transfer format (you didn't specify the former in the ~/.asoundrc). Does it have to be ALSA and stream2chromecast? Googling shows that pulseaudio-dlna also works for chromecast. If this gives the same "choked" sound, you'll have to look closer at the formats involved etc. pulseaudio-dlna will also help diagnosing this. – dirkt Jun 29 '17 at 9:28
  • 1
    Thanks @dirkt. Poor system performance and frequent swapping was the cause. I have now removed swap completely and also replaced stream2chromecast with netcat server. Additionally, I blocked internet access for other background programs. The improvement is huge. – mdlfdbck Jul 30 '17 at 23:27
  • Maybe turn that into an answer, and describe in more detail what you've done, for the next person with a similar problem? – dirkt Aug 8 '17 at 6:56

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.