Skip to main content

Topic: foo_dsp_downmix (Read 38929 times) previous topic - next topic

0 Members and 1 Guest are viewing this topic.
foo_dsp_downmix
Hi, here is once again a new DSP for your pleasure.

The purpose of this plugin is to downmix your 5.1 files to matrix-encoded stereo so you can send them to an external PL1/PL2/etc. capable receiver or just if you have to save quite a deal of harddisk space (you know, the compression ratio between dts and downmixed mp3 is nearly 1:10!). In the latter case I would use foo_dsp_fsurround for decoding (trust me ).

What is the difference to the available downmixers?
- Optional phase shifting. Necessary to handle both AC3 and DTS.
- Very good frequency response for the surround channels (55-24000 Hz @ +/- 0.005db, -3db @ 22Hz)
- Full control over the mixing matrix. Just know what coefficients are used, if it's standards conformant, PL1/PL2 or CS compatible. Customize it if necessary.

Get the plugin here.
You also need libfftw for this.
  • Last Edit: 11 August, 2008, 10:36:35 PM by pro_optimizer

  • Matyas
  • [*][*][*]
foo_dsp_downmix
Reply #1
Now this is awesome.
But to understand it right: This DSP downmixes my 5.1 channel AC3 48kHz, into 2 channel MP3 so that I won't loose _almost_ any channel information, and I will be able to "upmix" it into 5.1 channel with fsurround?

What's the level of lost information (not considering the lost info during lossy-lossy recoding?)

So in this case it is much better than foo_dsp_channelmixer, because it allows you to go back to 5.1?

  • tebasuna51
  • [*][*]
foo_dsp_downmix
Reply #2
1) Propossed controls for left panel 'Mixing coeficients' of 'Downmix AC3/DTS to PL2'

- ProLogic compatibility [CheckBox] (default checked)
If checked Front, Center, LFE, Surround B values not accesibles (grayed)

- LFE Enabled [CheckBox] (default unchecked)
If checked default value 0.7071
If unchecked value 0.0000

- Mix SL + SR ( )  (Option between)  Mix SL - SR (x)

2) The generic matrix is:

Code: [Select]
Lt = FL + 0.7071*FC + A * SL + B * SR
Rt = FR + 0.7071*FC - B * SL - A * SR


When ProLogic compatibility checked:

B = sign(MIX_SL_SR) * sign(A) * sqr(1 - A * A)

3) Values required to recover the exact channels test with Free Surround (Center Image = 1.0, Simple and Non-Linear)

Code: [Select]
- Downmix: A =  0.8165, Mix SL-SR    FS: A = 0.8165, Music Mode (0,0) (Default FS)
- Downmix: A =  0.8660, Mix SL+SR    FS: A = 0.8660, PowerDVD comp. (0,180)
- Downmix: A = -0.8660, Mix SL+SR    FS: A = 0.8660, BeSweet comp. (180,0)

With A = 0.7071, B = 0.7071 and we have dpl I.


@Matyas
Is better than other foo_mixers if we listen through an audio equipment with dpl decoder (attached to PC or standalone player). To listen through headphones or stereo speakers maybe other mixers can be similar or better.

With channel test (each channel separated in time) we can recover the 5 channels with error less than 0.0002. Of course with real sound is not true and is dependent of the relations between the source channels.
For instance, if left and right channel have a common sound is recovered at center channel

foo_dsp_downmix
Reply #3
Now this is awesome.
But to understand it right: This DSP downmixes my 5.1 channel AC3 48kHz, into 2 channel MP3 so that I won't loose _almost_ any channel information, and I will be able to "upmix" it into 5.1 channel with fsurround?

What's the level of lost information (not considering the lost info during lossy-lossy recoding?)

So in this case it is much better than foo_dsp_channelmixer, because it allows you to go back to 5.1?


Its hard to explain what information you may exactly lose, so I'll try to be as precise as possible.

The following things may get lost during the encoding step:
- the directions of a few sound sources that "clash". I will later explain what clashing means.
- sounds that accidentally cancel each other out. This is not very likely or noticeable.
- the information whether a center sound should be played by the center speaker or by left+right.
  This may be a problem if one has a weak center speaker but you can still turn down the center image in the decoder
  (and thus have left and right play the center sounds instead).
 
So let's talk about clashing.
Clashing means that in a short period of time (e.g. 0.2 seconds) multiple sound sources at different locations occupy the same freqencies.
There are 2048 frequency bands so this is not as likely as it may seem.
But it usually happens when identical instruments at different locations play the same melody in parallel.
In this case most decoders will place the offending instruments further behind (in the surrounds) than they were in the original sound.
It happens because the phase angles between the offenders (and thus between the stereo left/right channels, if the offenders where placed one left and the other right) are pretty random and this is what the decoders use for front-back positioning.

To make a wild guess, I would say that in an average song, you won't lose 90% of the channel information.
There may be songs where clashes happen relatively frequently which means you get a more diffuse surround image and there may be
songs where the upmix is not distinguishable from the original. That's why you may want to compare the original and the upmix.

There are still some possible improvements in the decoder (e.g. the output channel volumes may be slightly too low,
the positioning could more precise by a few degrees and maybe there are still bugs in it) but these things are only a matter of time.
In fact it should be possible to have the decoder identify the clashes and trace back to which sources those frequencies belong by cross-correlation but
it's not yet clear how one can do this on an average CPU. Once again, time will tell.


Btw: I use the following DSP chains for comparing 5.1 (in my case mostly dts) to the upmix:
1. no dsp
2. downmix ac3/dts (phase shift) -> free surround (center image=0.8, linear steering, exact reconstruction) -> equalizer (+2db, seems necessary)
3. downmix ac3/dts (phase shift) -> pl2 wrapper
4. downmix ac3/dts (phase shift) -> ATSurround-AS2
5. downmix ac3/dts (phase shift) -> ATSurround-ASr
When I do the comparisons via headphones, each of the chains is followed by Dolby Headphone -> SRC Resampler(96000) -> Convolver(Eq)


Just that it's possible doesn't mean that one should do it, though.
I wouldn't replace my 5.1 files by mp3 unless I were _really_ short on disk space.

1) Propossed controls for left panel 'Mixing coeficients' of 'Downmix AC3/DTS to PL2'

- ProLogic compatibility [CheckBox] (default checked)
If checked Front, Center, LFE, Surround B values not accesibles (grayed)

- LFE Enabled [CheckBox] (default unchecked)
If checked default value 0.7071
If unchecked value 0.0000

- Mix SL + SR ( )  (Option between)  Mix SL - SR (x)

2) The generic matrix is:

Code: [Select]
Lt = FL + 0.7071*FC + A * SL + B * SR
Rt = FR + 0.7071*FC - B * SL - A * SR


When ProLogic compatibility checked:

B = sign(MIX_SL_SR) * sign(A) * sqr(1 - A * A)

3) Values required to recover the exact channels test with Free Surround (Center Image = 1.0, Simple and Non-Linear)

Code: [Select]
- Downmix: A =  0.8165, Mix SL-SR    FS: A = 0.8165, Music Mode (0,0) (Default FS)
- Downmix: A =  0.8660, Mix SL+SR    FS: A = 0.8660, PowerDVD comp. (0,180)
- Downmix: A = -0.8660, Mix SL+SR    FS: A = 0.8660, BeSweet comp. (180,0)

With A = 0.7071, B = 0.7071 and we have dpl I.


@Matyas
Is better than other foo_mixers if we listen through an audio equipment with dpl decoder (attached to PC or standalone player). To listen through headphones or stereo speakers maybe other mixers can be similar or better.

With channel test (each channel separated in time) we can recover the 5 channels with error less than 0.0002. Of course with real sound is not true and is dependent of the relations between the source channels.
For instance, if left and right channel have a common sound is recovered at center channel


Thanks for the details.

Checkboxes: ok.
Mix SL - SR (x): Why do we need this? To be able to model SQ encoding, too?
I'll change the defaults from 0.707 to 0.7071.
  • Last Edit: 23 February, 2007, 05:00:11 PM by pro_optimizer

  • tebasuna51
  • [*][*]
foo_dsp_downmix
Reply #4
Mix SL - SR (x): Why do we need this? To be able to model SQ encoding, too?

The default FS mode: Music Mode (0,0) need a initial downmix with Mix SL-SR.

And other people also experiment with this kind of mixes, this is a old discussion.

Really for me is not necessary but maybe you need change the default FS.

foo_dsp_downmix
Reply #5

Mix SL - SR (x): Why do we need this? To be able to model SQ encoding, too?

The default FS mode: Music Mode (0,0) need a initial downmix with Mix SL-SR.

And other people also experiment with this kind of mixes, this is a old discussion.

Really for me is not necessary but maybe you need change the default FS.


Ah, I see.
I would not use the music mode to play music for which I know that it's properly encoded.
Music Mode is more useful if you don't really know if the music you send through it is encoded or not because
it will at least not invert (potentially arbitrary) parts of it.
One cannot really encode with SL-SR because centered surround sources would be mostly cancelled out by this.
e.g. Lt = 0.8165x-0.5774x = 0.2391x is already quite low and its even worse for the DPL1 matrix:
Lt = Rt = 0.7071x-0.7071x = 0 (in words: zero)

  • Matyas
  • [*][*][*]
foo_dsp_downmix
Reply #6
Quote
When I do the comparisons via headphones, each of the chains is followed by Dolby Headphone -> SRC Resampler(96000) -> Convolver(Eq)


Why do you use the SSRC resampler to go up to 96kHz? And what's the point behind using Convolver instead of the built-in EQ?

foo_dsp_downmix
Reply #7
Why do you use the SSRC resampler to go up to 96kHz? And what's the point behind using Convolver instead of the built-in EQ?


The reason why I don't use the built-in EQ is this one.

The reason for using SRC is much more subjective, probably I cannot ABX it against the PPHS resampler.
I know how SRC works and that it does, in principle, the Right Thing whereas I don't know how a polyphase resampler works and what the quality tradeoffs involved are. So SRC gives me a better gut feeling at the moment

  • Matyas
  • [*][*][*]
foo_dsp_downmix
Reply #8
@EQ: Thanks for the link.
@SSRC: the question is not why SSRC, but why do you need 96Khz before the EQ which anyway goes directly to your headphones. Isn't 44kHz enough in this case?

foo_dsp_downmix
Reply #9
@EQ: Thanks for the link.
@SSRC: the question is not why SSRC, but why do you need 96Khz before the EQ which anyway goes directly to your headphones. Isn't 44kHz enough in this case?

Well I resample the music because
a) I have an Audigy soundcard which supports only 48/96/... KHz natively.
Therefore it resamples 44.1 KHz music internally and its resampler is said to be quite crappy.
b) the convolver does not match the sampling rates of the filter kernel and the incoming music.
Therefore one has to resample the music to the rate of the kernel.

So the question remains: why 96 KHz and not 48.
Probably it doesn't matter. But at least I don't have to downsample 96KHz music this way.
(And, even if my soundcard's DACs were really bad their lowpass filter would still not reach down into the audible range. )
  • Last Edit: 24 February, 2007, 04:30:31 AM by pro_optimizer

  • Hancoque
  • [*][*][*][*]
foo_dsp_downmix
Reply #10
I have found a strange behaviour when downmixing some DTS material with this plugin. With the "Channel Mixer" plugin the sound seems centered for the listener. But if I use the "Downmix AC3/DTS" plugin instead, some elements seem to be shifted more to the right (DTS mode) or to the left (AC3 mode).

  • klez
  • [*]
foo_dsp_downmix
Reply #11
For any Reason, this Plugin doesnt Work here...
Its loadable, but every File which leaves the Converter (Wav Output) is still a 5 Channel WAV.
Even if i Change the "Master Gain" in the Configuration Dialog , nothing Happens.

Can someone help me?
  • Last Edit: 18 March, 2008, 05:52:40 AM by klez

foo_dsp_downmix
Reply #12
For any Reason, this Plugin doesnt Work here...
Its loadable, but every File which leaves the Converter (Wav Output) is still a 5 Channel WAV.
Even if i Change the "Master Gain" in the Configuration Dialog , nothing Happens.

Can someone help me?


This is because the plugin currently downmixes only 5.1 input (i.e. no 5.0 as it seems to be the case with your source file). A temporary workaround before I pull myself together and add that damn special case would be that you put channel mixer before the downmix plugin and tell it to produce and additional dummy subwoofer channel.

Btw: Sorry for the immense posting delay! Somehow I didn't receive a reply notification for you.
  • Last Edit: 11 August, 2008, 10:43:32 PM by pro_optimizer

  • -Tiziano-
  • [*]
foo_dsp_downmix
Reply #13
Dear Friends

Tod S indicated me in this topic:
http://www.hydrogenaudio.org/forums/index....mp;#entry676408
the presence of your interesting topic.

I'm interested to experiment Foobar2000 as Dolby Prologic II encoder. So I ask:

the library:libfftw3f-3.dll for windows .. where do I have to install it ? In what directory please ?
What file of foo_dsp_downmix I need please ? because in your link there are several files. Anyway I have not clue were to install it/them ...

And I have aother qeustions as:
Is it possible to encode in Pro logic IIx and IIz ? Or is it too soon ?


About LFE Channel: I start from 6 files and or an interleaved 6 channel .WAV file that has discrete tracks for each channel LFE included. In what manner can I treat it please ?
Because till now, the LFE's separate tracks gave me some issue.

I thank you very much for your help and: happy new year 2010 to everybody
  • Last Edit: 31 December, 2009, 04:43:41 AM by -Tiziano-

  • 2E7AH
  • [*][*][*][*][*]
foo_dsp_downmix
Reply #14
the library:libfftw3f-3.dll for windows .. where do I have to install it ? In what directory please ?

In foobar's installation folder

Is it possible to encode in Pro logic IIx and IIz ? Or is it too soon ?

I posted you link in your own thread: http://www.hydrogenaudio.org/forums/index....showtopic=50713

  • -Tiziano-
  • [*]
foo_dsp_downmix
Reply #15
the library:libfftw3f-3.dll for windows .. where do I have to install it ? In what directory please ?

In foobar's installation folder

Is it possible to encode in Pro logic IIx and IIz ? Or is it too soon ?

I posted you link in your own thread: http://www.hydrogenaudio.org/forums/index....showtopic=50713


Hi 2E7AH.

ok perfect but in the main directory or in the "component" directory please ?

And: yes I saw your message in my thread but it's not clear to me .. so I have of course questions here below:

Do I have to put foo_dsp_pl2.dll in window/system ? because you are talking about: PL2XDLL.dll and I have not clue if it's the same. ( there are also: foo_dsp_fsurround.dll and foo_dsp_downmix.dll .. I don't know if I need them or not ... )
And also: How can I start conversion with Foobar ? ( I'm looking for some command on it just now without being successful ) ...

EDIT: Sorry i think to have found ho to convert, just now. Please confirm it: right-click and "convert" selecting the plug in .. correct ? Because I find "command line" also and sincerely I would prefer do not have any "command line" .. who remembers about commands to give ?  END-EDIT


Thank you very much
  • Last Edit: 31 December, 2009, 06:07:00 AM by -Tiziano-

  • 2E7AH
  • [*][*][*][*][*]
foo_dsp_downmix
Reply #16
PL2XDLL.dll and libfftw3f-3.dll in main foobar folder, other .dlls in components folder

[edit] about converting, you have DSP window in processing tab of converter dialog
  • Last Edit: 31 December, 2009, 06:20:25 AM by 2E7AH

  • -Tiziano-
  • [*]
foo_dsp_downmix
Reply #17
PL2XDLL.dll and libfftw3f-3.dll in main foobar folder, other .dlls in components folder

[edit] about converting, you have DSP window in processing tab of converter dialog


ok perfect ... but I don't find: PL2XDLL.dll 

  • lvqcl
  • [*][*][*][*][*]
  • Developer
foo_dsp_downmix
Reply #18
You need PL2XDLL.dll for foo_dsp_pl2, not for foo_dsp_downmix. But if you use foo_dsp_pl2, look here.

  • -Tiziano-
  • [*]
foo_dsp_downmix
Reply #19
Yep, thank you really very much

2E7AH has helped me to solve some little issue I had and now with Foobar2000 I'm able to get an interleaved 6 channels ( 5.1 ) .WAV ( AC3/DTS is the Foobar2000's library I use ) file, produced with Nuendo, and create a .WAV or .MP3 Pro Logic II encoded ! great !! It works really fine

Now the following step, not yet solved, is:

How to get 7.1 encoded ( Pro Logic IIx ) instead of 5.1.

This is really the maximum to reach, I think ...




P.S. off-topic: I uploaded my Avatar but it's not appearing here yet ...
  • Last Edit: 01 January, 2010, 02:32:40 PM by -Tiziano-

  • 2E7AH
  • [*][*][*][*][*]
foo_dsp_downmix
Reply #20
Do you want to upmix or downmix?

You can use matrix mixer if you know the matrix for DPL IIx
If you don't know the matrix you can try with DPL II upmix to 5.1 and then use matrix mixer for other 2 channels, like this for example:


or use only matrix mixer with this matrix for example (that's for downmix, you should invert it for upmix)

That would be for fast encoding, and none of that has anything to do with DPL of course. Probably the best would be as you were doing with Nuendo, as here you can't change phase, or add delay, or do bend pass as DPL IIx is doing. And you'll need to have that information, or experiment with DPL IIx encoded file and try to distill something

  • -Tiziano-
  • [*]
foo_dsp_downmix
Reply #21
Do you want to upmix or downmix?

You can use matrix mixer if you know the matrix for DPL IIx
If you don't know the matrix you can try with DPL II upmix to 5.1 and then use matrix mixer for other 2 channels, like this for example:
[a href="http://img685.imageshack.us/img685/5695/sshot6u.png" target="_blank"]

  • 2E7AH
  • [*][*][*][*][*]
foo_dsp_downmix
Reply #22
OK, you can try with ffdshow and use downmix to DPL II. it will produce the wanted stereo effect I think

  • 2E7AH
  • [*][*][*][*][*]
foo_dsp_downmix
Reply #23
I tried downmixing 8ch with ffdshow Dolby Prologic II and this is the matrix


SL and SR aren't downmixed

The stereo effect is similar to what downmixer component from this thread is doing, so try it

CyberLink downmixes very differently: back and side channels are exclusively at corresponding front channels

  • -Tiziano-
  • [*]
foo_dsp_downmix
Reply #24
I tried downmixing 8ch with ffdshow Dolby Prologic II and this is the matrix


SL and SR aren't downmixed

The stereo effect is similar to what downmixer component from this thread is doing, so try it

CyberLink downmixes very differently: back and side channels are exclusively at corresponding front channels


Ok perfect ... in this way the amplitudes' relationships among channels are respected, but what about the phase ? I mean: I have to anticipate 90° some signal and delay 90° etc ... in what manner can I do that with that mixer please ?

P.S. in order to avoid misunderstanding: I have to do the same thing I'm doing now with the plug-in AC3/DTS as we were talking in private message, but coding 8 channels ( 7.1 ) instead of 6 ( 5.1 ) )


( is ffdshow in you website I think ... is it correct ? or is that one please ? ffdshow on Sourceforge.net )
  • Last Edit: 02 January, 2010, 02:44:15 PM by -Tiziano-