SamDel / ChromeCast-Desktop-Audio-Streamer

Stream the sound of your desktop to your Chromecast Audio device
MIT License
411 stars 30 forks source link

Multi-channel audio possible? #103

Closed andersborgabiro closed 3 years ago

andersborgabiro commented 3 years ago

I played a 5.1 FLAC 24-bit (ripped from Blu-ray, and 5.1 when played locally) and it was converted to stereo before being transferred to the Chromecast (at least the amplifier considers it a stereo stream).

Is it technically possible to achieve at least 5.1?

SamDel commented 3 years ago

Not sure, but it might be possible.

This tool always converts to stereo / two channels now (version 3.5, here in code). In Setup 3.5.6.zip the audio isn't converted to stereo, so I think/hope all captured channels are send to the device.

I can't test it myself so I'm not sure what happens. Can you try (with wav as stream format on the options tab) and let it know?

andersborgabiro commented 3 years ago

The amplifier says Multi In, so yes. There's clearly a different sound in each speaker.

I used "Wav (Soundcard's sample rate/24bit)".

When I choose MP3 on a 5.1 track I get no sound, so I guess conversion to stereo needs to be forced in that case.

Maybe you could try with Netflix "Test Patterns".

Also, if you have Realtek audio or similar there's a multichannel speaker test.

SamDel commented 3 years ago

In Setup 3.5.7.zip mp3 is converted to stereo again. I think that should work on all setups then!?

Thanks, I will try to do a multichannel test later...

andersborgabiro commented 3 years ago

This is my quick test result: 5.1 in, WAV out: Multi In Stereo, in WAV out: Multi In (!) Anything in, MP3 out: Stereo

SamDel commented 3 years ago

Thanks!

5.1 in, WAV out: Multi In Stereo, in WAV out: Multi In (!)

I think it works like so: when you play a stereo track the two channels are converted to the number of tracks your soundcard has (a different sound in each speaker?). This tool captures the sound from the soundcard, so it always has the same number of channels your soundcard has.

Anything in, MP3 out: Stereo

as expected.

Do you think there should be an option to always convert to stereo?

andersborgabiro commented 3 years ago

Only if it would otherwise fail I guess.

That said, multichannel simulations from (actually) stereo audio will not be possible to activate on my amp if it receives multichannel audio. I don't know if that's the norm.

When back home I can check this better.

andersborgabiro commented 3 years ago

After some thought, an optional forced conversion to stereo (off by default) would be clever in cases where nothing else works. Not that I've found a "showstopper" case, but the multichannel simulation scenario makes it more convenient. Switching to MP3 output would be an option, but a rather bad one.

andersborgabiro commented 3 years ago

Do you know how audio in Atmos format would be handled? Converted to the nearest equivalent the audio card supports before you get an audio stream? Does the Chromecast support Atmos?

SamDel commented 3 years ago

In Setup 3.5.8.zip I added an option for it. I think in all/most scenarios the conversion is taken care of by the drivers. I was also thinking about the bandwidth. For me, streaming to one device in stereo (wav 24bit) takes ~2.4Mbps, how's the bandwidth for you with multiple channels?

In my understanding with Atmos a lot more channels can be added. It looks like Chromecast supports it, so it could work with version 3.5.8. Maybe someone can do a test!

andersborgabiro commented 3 years ago

I get stable ~7 Mbps upstream for 5.1/WAV/24. This is also the case when no audio is played (player paused). Not sure if that could be optimized.

As I guess you know, Atmos is about placing sounds in "full 3D". The theoretical limit is 128 objects/channels. Interestingly games have for years used something similar internally, but then converted to (at the most) traditional multi-channel.

I don't have Atmos equipment though.

andersborgabiro commented 3 years ago

VLC paused: still 7 Mbps VLC exited: no data transfer

So this might actually be a quirk in VLC (keeping audio active even when not playing).

MPC-HC doesn't do this.

SamDel commented 3 years ago

When the player is paused the application is capturing and streaming silence, for me the bandwidth doesn't change. I don't think it can be optimized, when you stop streaming audio the device disconnects.

andersborgabiro commented 3 years ago

I guess the option then would be to switch to less demanding data output, but that might cause other problems.

SamDel commented 3 years ago

True. You have to restart the stream if you want to change the audio quality, causing delays.

andersborgabiro commented 3 years ago

Thanks for updating the application.

SamDel commented 3 years ago

Thank you for testing! Very nice that this application has multi-channel support now 😃 ! I will create an 'official' release (3.6) in a week or so.

If anyone can do an Atmos test, please leave a comment!

SamDel commented 3 years ago

Version 3.6