Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: DTS decoder 64 bit and S/PDIF support for multichannel output (Read 2903 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

DTS decoder 64 bit and S/PDIF support for multichannel output

Hello everyone, is anyone able to make a 64 bit version of the DTS decoder component for foobar?

Also, is there any (other) way to output a multichannel stream via S/PDIF from foobar?

Using VLC and PotPlayer there are no problems outputting multichannel streams for FLAC, and other audio and movie files, which the speakers correctly detect, decode and play as DTS/multi-channel 5.1. I can't seem to make Foobar do this, possibly because the DTS decoder component is only 32 bit and won't work, and the DSP Upmix to 5.1 just seems to boost the volume slightly but does not change the stream that is output.

Does anyone else know how to get this working?

Thank you for any assistance!

Re: DTS decoder 64 bit and S/PDIF support for multichannel output

Reply #1
DTS decoder is built-in since foobar2000 v2.x. But DTS decoder prevents you from getting multichannel output with S/PDIF. That interface has limited bandwidth and it can losslessly only transmit stereo data. Multichannel audio needs to stay encoded. The DTS decoder decodes the DTS into separate PCM channels so foobar2000 can handle them.

You can play DTS encapsulated in WAV with foobar2000 if you disable the DTS decoder. That can be done at 'Preferences' -> 'Advanced' -> 'Playback' -> disable 'Enable additional decoding'.

Best option would be to let S/PDIF stay where it was meant to be, between DVD player and TV, and use proper multichannel capable interface between PC and your audio equipment. If that is not an option your life would be easier if you had an audio output that encoded all multichannel data to DTS so it could be transferred over the cable. What you depend on now is bitstreaming where source stays as it is and nothing touches it. That is the exact opposite of what foobar2000 is designed to do - everything is decoded to common format and all processing affects everything equally.

Re: DTS decoder 64 bit and S/PDIF support for multichannel output

Reply #2
I made an experimental DTS encoder so you and anyone else using S/PDIF interface can output (hopefully) any multichannel audio with foobar2000. Initial version is a DSP, just place the DSP at the end of the playback chain and configure foobar2000 to use exclusive mode output. Volume needs to be at maximum too for things to work.

You can download the component here: https://foobar.hyv.fi/?view=foo_dsp_dtsenc.

Mono and stereo sources are skipped but higher up-to 5.1 channels gets encoded. If this works and is useful, I could think about making an output component for this so you could freely use foobar2000 volume too.

Re: DTS decoder 64 bit and S/PDIF support for multichannel output

Reply #3
I made an experimental DTS encoder so you and anyone else using S/PDIF interface can output (hopefully) any multichannel audio with foobar2000. Initial version is a DSP, just place the DSP at the end of the playback chain and configure foobar2000 to use exclusive mode output. Volume needs to be at maximum too for things to work.

You can download the component here: https://foobar.hyv.fi/?view=foo_dsp_dtsenc.

Mono and stereo sources are skipped but higher up-to 5.1 channels gets encoded. If this works and is useful, I could think about making an output component for this so you could freely use foobar2000 volume too.

Just need a Dolby Digital encoder.   :D

This component does require a stream be at 48 KHz and DTS CDs are 44.1 KHz.  Not sure what use I'll personally ever have for this but I'll keep it around.

Re: DTS decoder 64 bit and S/PDIF support for multichannel output

Reply #4
This component does require a stream be at 48 KHz and DTS CDs are 44.1 KHz.
Just place resampler before it. But why to encode stereo 16/44.1 to DTS if it can be transmitted by SPDIf as it is.

Re: DTS decoder 64 bit and S/PDIF support for multichannel output

Reply #5
This component does require a stream be at 48 KHz and DTS CDs are 44.1 KHz.
Just place resampler before it. But why to encode stereo 16/44.1 to DTS if it can be transmitted by SPDIf as it is.

I'm saying some 5.1 surround sound material is sampled at 44.1 KHz.  I put a resampler at the end of all my processing chains but the average person might not think of doing so.  A DTS CD is one such example of 5.1 material sampled at 44.1 KHz.  You can get FLACs of stuff in 5.1 with a sample rate of 44.1 KHz.

Re: DTS decoder 64 bit and S/PDIF support for multichannel output

Reply #6
44.1 kHz was supposed to work, unfortunately my testing was very limited. The component currently always wants to encapsulate the audio in a CD-compatible PCM signal and the encoding library wasn't apparently able to use the given bitrate limit wisely and tried to exceed allocated bits. That issue should now be gone with the new release.

Re: DTS decoder 64 bit and S/PDIF support for multichannel output

Reply #7
44.1 KHz is working nicely!

2 bugs remain:

Sample rates 32 KHz and below end up being just noise.  *Not tested on A/V receiver.

More than 7 channels such as 8 channels causes a crash.

Re: DTS decoder 64 bit and S/PDIF support for multichannel output

Reply #8
Thanks for testing, I wish the compiler had warned me of my return value mismatch after function combining. The encoding library doesn't support this high channel count and it was supposed to be rejected, but a bug had slipped in. This is now fixed.

I didn't (yet) do anything about sample rate. I'm currently 100 km away from my development machine and environment and only working with laptop through RDP so I can't test any hardware decoders I may have either, but at least foobar's DTS decoder can play the resulting file when explicitly renamed to .dts. But if this is against specs or doesn't work on any receiver, I will disallow it.

Re: DTS decoder 64 bit and S/PDIF support for multichannel output

Reply #9
@Case
could you explain what does this component actually do to files (signal)?
The description says "Encodes multichannel audio into DTS for S/PDIF use". So does it recode the lossy DTs to another lossy DTS,  that would mean loosing more data? Or does it wrap/envelope the signal in a way DoP (DSD over PCM) works with DSD (without touching the signal)? Or does it do something else?

I tried this componet and it worked like this:
a. 5.1 lossy DTS (44,1 or 48) displayed DTS on AVR (as expected)
b. 5.1 DTS-HDMA - did not work - foobar decoded it to PCM - expected? (meaning lossless was not supposed to work)? Would it be possible to make it work?
c. did not have time to try DTS 96/24 (which is lossy if I'm right) - should it work or not?
d. 5.1 AC3 - did something weird - AVR displayed it as 5.1 DTS - so was AC3 converted to DTS (loosing information from lossy file) or wrapped into DTS (but then why would it be seen as DTS and not AC3)?
e. stereo AC3 file - not worked - AVR displayed stereo PCM - would be nice to have this work with stereo file
f. did not have time to try TrueHD - should it work or not?
g. Should it or will it work with 7.1 files?

Re: DTS decoder 64 bit and S/PDIF support for multichannel output

Reply #10
Thank you for explaining it so clearly.

I do have analog output in multichannel but was sick of the cables and just wanted a single cable, hence S/PDIF. I still find it weird that VLC and Potplayer can make it work automatically but Foobar has neither had the option nor a plugin to enable it.

DTS decoder is built-in since foobar2000 v2.x. But DTS decoder prevents you from getting multichannel output with S/PDIF. That interface has limited bandwidth and it can losslessly only transmit stereo data. Multichannel audio needs to stay encoded. The DTS decoder decodes the DTS into separate PCM channels so foobar2000 can handle them.

You can play DTS encapsulated in WAV with foobar2000 if you disable the DTS decoder. That can be done at 'Preferences' -> 'Advanced' -> 'Playback' -> disable 'Enable additional decoding'.

Best option would be to let S/PDIF stay where it was meant to be, between DVD player and TV, and use proper multichannel capable interface between PC and your audio equipment. If that is not an option your life would be easier if you had an audio output that encoded all multichannel data to DTS so it could be transferred over the cable. What you depend on now is bitstreaming where source stays as it is and nothing touches it. That is the exact opposite of what foobar2000 is designed to do - everything is decoded to common format and all processing affects everything equally.

 

Re: DTS decoder 64 bit and S/PDIF support for multichannel output

Reply #11
Thanks for testing, I wish the compiler had warned me of my return value mismatch after function combining. The encoding library doesn't support this high channel count and it was supposed to be rejected, but a bug had slipped in. This is now fixed.

I didn't (yet) do anything about sample rate. I'm currently 100 km away from my development machine and environment and only working with laptop through RDP so I can't test any hardware decoders I may have either, but at least foobar's DTS decoder can play the resulting file when explicitly renamed to .dts. But if this is against specs or doesn't work on any receiver, I will disallow it.

This sounds really promising!
Please keep us updated on any developments once you get the time.
Cheers.

Re: DTS decoder 64 bit and S/PDIF support for multichannel output

Reply #12
@Case
could you explain what does this component actually do to files (signal)?
The description says "Encodes multichannel audio into DTS for S/PDIF use". So does it recode the lossy DTs to another lossy DTS,  that would mean loosing more data? Or does it wrap/envelope the signal in a way DoP (DSD over PCM) works with DSD (without touching the signal)? Or does it do something else?
It does what is says. It encodes everything with more than two source channels into DTS. If you play a DTS-encoded WAV file and have the postprocessor decoder mentioned in the first reply off then the signal won't be touched, as it is simple stereo data and gets bypassed by this. If normal decoding is on like it should be, it will get re-encoded.

I tried this componet and it worked like this:
a. 5.1 lossy DTS (44,1 or 48) displayed DTS on AVR (as expected)
b. 5.1 DTS-HDMA - did not work - foobar decoded it to PCM - expected? (meaning lossless was not supposed to work)? Would it be possible to make it work?
c. did not have time to try DTS 96/24 (which is lossy if I'm right) - should it work or not?
d. 5.1 AC3 - did something weird - AVR displayed it as 5.1 DTS - so was AC3 converted to DTS (loosing information from lossy file) or wrapped into DTS (but then why would it be seen as DTS and not AC3)?
e. stereo AC3 file - not worked - AVR displayed stereo PCM - would be nice to have this work with stereo file
f. did not have time to try TrueHD - should it work or not?
g. Should it or will it work with 7.1 files?
a) It was re-encoded.
b) If the sample rate isn't supported by the encoder then it passed through untouched. See c).
c) Won't work without resampler because the format only supports 32 kHz, 44.1 kHz and 48 kHz. The encoder also supports half or a quarter of any of these sample rates so the all those would work. This is a temporary limitation in the component, it is super easy to make the encoder take in everything and resample to best supported rate.
d) It was re-encoded to DTS.
e) Source file was decoded like everything in foobar2000 is. And it was not re-encoded into anything as S/PDIF has enough bandwidth to pass mono and stereo as lossless PCM.
f) If the sample rate is one of the currently allowed ones and it has more than 2 channels and at most 6 channels, it would get re-encoded to normal DTS.
g) Does not work at the moment. The encoder doesn't support more than 5.1. Can be made to take in everything by downmixing to best supported format.

Re: DTS decoder 64 bit and S/PDIF support for multichannel output

Reply #13
Please keep us updated on any developments once you get the time.
I'm afraid I'll need your input for further development. I have a HDMI receiver that supports 32 kHz, 44.1 kHz and 48 kHz signals, but only Dolby formats. My DTS encoded data actually actually causes the output to go completely mute.

Re: DTS decoder 64 bit and S/PDIF support for multichannel output

Reply #14
Please keep us updated on any developments once you get the time.
I'm afraid I'll need your input for further development. I have a HDMI receiver that supports 32 kHz, 44.1 kHz and 48 kHz signals, but only Dolby formats. My DTS encoded data actually actually causes the output to go completely mute.
Sure thing. I'll DM you the results so far.

Re: DTS decoder 64 bit and S/PDIF support for multichannel output

Reply #15
The experimental DTS encoder DSP proved that this method works, so I turned it into a little bit more polished version. You can try Digital Output component.

This component queries the actual supported formats of the output. If lossless PCM can be used, that method is preferred. If device reports DTS support, multichannel data is encoded into DTS format. All resampling and downsampling should be handled automatically. Mono and stereo signals are always kept intact.

DTS part untested.

Re: DTS decoder 64 bit and S/PDIF support for multichannel output

Reply #16
Hi @Case
I know that this is not the purpose of this plugin (and a bit offtopic) but would it be possible to write a plugin that does quite opposite to this one?
What I mean is bitstream passthrough. Or would it need the foobar itself to be rewritten?
My use-case is:
1. All stereo files (flac (including HDCD), mp3, DSD) go through ASIO and USB to external DAC and amplifier - that would stay unchanged. (There are very few stereo AC3 or DTSHDMA files but really very few).
2. All multichannel files (AC3, TRUEHD, DTS, DTS96/24, DTSHDMA, flac, DSD) go through WASAPI exclusive and HDMI to AVR - since HDMI can't output DSD from PC (it can from standalone SACD players) we have 2 kinds of signals: bitstream (all Dolby and DTS signals) and PCM. Would be possible to make foobar play those bitstream signals but without decoding them (but not using any reencoding - just bitstreaming)?
Since we can configure many different output devices in foobar and all of them can have different modes (ASIO/WASAPI) and DSPs - it would be great to have an option to use bitstream on the HDMI one.

Re: DTS decoder 64 bit and S/PDIF support for multichannel output

Reply #17
Technically what you are asking is possible, but bitstreaming is against the principle ideas of foobar2000. It's like asking a word processor to refuse to view contents of files. Or asking a web browser to not render webpages but instead just show the raw encoded binary data coming from servers.
 
Bitstreaming would require replacing existing decoders with new custom "decoders" that didn't actually decode anything. And they would have to cheat foobar's engine by passing the engine some dummy data to keep scroll bar in sync, and use hacks to pass the undecoded data directly to output. It would be ugly, and I'm not a fan of the idea.

If you prefer bitstreaming over foobar2000's design I'd currently recommend using any video player. Video players are designed for bitstreaming. And all the bitstream formats other than DSD are meant for video use anyway.

Re: DTS decoder 64 bit and S/PDIF support for multichannel output

Reply #18
Technically what you are asking is possible, but bitstreaming is against the principle ideas of foobar2000. It's like asking a word processor to refuse to view contents of files. Or asking a web browser to not render webpages but instead just show the raw encoded binary data coming from servers.
 
Bitstreaming would require replacing existing decoders with new custom "decoders" that didn't actually decode anything. And they would have to cheat foobar's engine by passing the engine some dummy data to keep scroll bar in sync, and use hacks to pass the undecoded data directly to output. It would be ugly, and I'm not a fan of the idea.

If you prefer bitstreaming over foobar2000's design I'd currently recommend using any video player. Video players are designed for bitstreaming. And all the bitstream formats other than DSD are meant for video use anyway.

Thank you for your answer. I am aware that videoplayers do bitstreaming and Dolby/DTS was first meant to be used in video but I really want and like to use foobar as universal player for my music. Nowadays more and more albums get new multichannel versions on Bluray (with TrueHD or DTSHDMA).
Reading your answer I just realized that when bitstreaming I would probably loose all the visualizations (VU meters, spectrograms etc.).
So for now I use ffmpeg to decode Dolby/DTS within foobar and probably will still do that.
But I have one question - do I "loose" some features when decoding with foobar vs. bitstreaming to AVR? I know of Dolby Dialog Normalization (4dB) (as far as I know DTS also has Dialog Norm but default to 0dB). Are there any others (eg. room correction)? And are those of any worth - meaning "is dialog norm" of any value in music (not movies)?

Re: DTS decoder 64 bit and S/PDIF support for multichannel output

Reply #19
The dummy data I mentioned could be decoded data for correct visualisations. For me the most important loss would be all the DSPs and ReplayGain. I don't do Spotify-style streaming for that reason either, losing my DSPs and ReplayGain is intolerable thought. I need to be in control of the audio signal.

Comparing bitstreaming with foobar2000 decoding depends on the capabilities of the particular decoder and what the external receiver does. Something like dialog normalization should be off by default in a foobar2000 decoder as audio people generally prefer full dynamics. Ideally decoder would offer configuration options for settings that make sense to be adjustable. Though I can't think of valid use for dialog normalisation for music. I'd think quality-wise foobar2000 decoding is more accurate. Everything gets decoded to at least 32-bit floating point without quality reducing shortcuts. I wouldn't be surprised if simple chips in AVR just decode everything to 16-bits.

Room correction should work better when not bitstreaming. With bitstreaming only the receiver can do any adjustments. For PCM signal the correction can in addition be done by foobar2000 DSP or for example OS level software.

Something very special like Dolby Atmos would at the moment cause problems for foobar2000 when decoded. It defines too many channels and supports moving 3D objects that have no valid mapping in the outputs or processing pipeline. Passing this through foobar2000 and out through decoded outputs would definitely be lossy.

Re: DTS decoder 64 bit and S/PDIF support for multichannel output

Reply #20
Thank you,
last question: Does ATMOS only carry "3D" information? Meaning when playing 8 channels TrueHD with ATMOS but without ATMOS decoders - I have 8 channels of TrueHD and what do I loose? Only the "proper position" of some 3D objects or some sounds/notes from the actual music? Do I hear all the music but with some objects in different positions (coming from the 8 channels/speakers and not from ATMOS speakers)  or do I hear "not all the music"? Since ATMOS is not a channel but metadata I would imagine that it only contains the coordinates of placing and timing of some objects but maybe it contains some additional audio (which would have same effect as listening to 5.1 mix on stereo speakers - we would loose a portion of actual audio)?

Re: DTS decoder 64 bit and S/PDIF support for multichannel output

Reply #21
Dolby Atmos is "just" an improved surround system, normal surround didn't include height information. If you don't have the ceiling speakers/speakers firing to ceiling, my understanding is that downmix in foobar2000 should be perfect. I read more about the Atmos stuff and apparently the Spatial Output API in Windows is suitable for using Atmos perfectly without bitstreaming. If there is some music where these features are needed, I would definitely bring this up with Peter to see how foobar2000 could support it.