FreeSurroundis meant to be the foobar2000 equivalent of your hi-fi receiver's Dolby ProLogic II button (except that it uses a different algorithm).Its purpose is to decode surround information from your stereo music (including mp3, of course), and to produce 5.1 output from it. It works with any stereo music containing surround info in a coding scheme compatible with any the following decoders:- Dolby Surround- Dolby ProLogic- Dolby ProLogic II- SRS CircleSurround- SRS CircleSurround II- DTS Neo:6- Lexicon Logic7- Stereo Quadrophonic (SQ) *- Quadrophonic Stereo (QS) **

It will also faithfully play back your 'plain old' stereo music, with the exception that echoes are usually played over the surround speakers, and some sound sources, usually strongly distorted guitars, choirs etc., tend to surround the listener instead of being played over the front speakers alone.

DownloadThe plugin is attached at the bottom of this post.

Operation notesIn contrast to the other foobar2000 surround processors (Channel Mixer, Matrix Mixer and ATSurround Processor, as of Aug. 2008), FreeSurround provides independently steered surround channels, and very low crosstalk between channels. If your want to check the state of your surround decoders, you find a test mp3 file at the bottom of the post. It will play a voice on your left front, left rear, right rear, right front and center speaker (one speaker at a time) -- if your decoder is good; otherwise there will be some mishmash on the other channels. Also, FS, being a surround decoder, should not be confused with DSP effects which merely give you an enriched stereo experience, such as Creative CMSS 3D and foobar's Convert Stereo to 4 Channels, or common DSPs like Stadium, Hall etc. Nevertheless there are some options to upmix plain stereo content meaningfully.

Configuration notesHere is a screen shot of the default settings in the config dialog (these happen to be also the settings that I use at home).

The default settings are good for many surround setups, but there are some tweakable options (see screen shot).

The sound field right after the decoding stage can be pictured as a 2-dimensional square with the listener at its center; this sound field can be further transformed spatially in several ways. The default setting is to leave the decoded field as it is, i.e., if a stereo track was downmixed from a discrete 5.1 track (e.g., from AC3 format) and is upmixed again with FreeSurround, it comes closest to the original source material when using the default settings. However, music that was not originally meant for surround playback can be spiced up quite a bit using these controls. The first option (Panorama) is to wrap the sound field around the listener in a circular manner. The slider allows to change the angle that the front soundstage takes up (i.e., the line between the front left and the front right corner of the sound field). Originally it is 90 degrees, but if it is set to, say, 270 degrees the front stage will be wrapped from behind the left ear along the front to behind the right ear of the listener. While the front stage is expanded, the side and rear sound field must correspondingly be compressed into the remaining space behind the listener. The second option (Dimension) allows to shift the sound field forward or backward without changing the shape. The third option (Depth) essentially scales the sound field to the back, i.e. the original square is resized along one axis (while the front stage stays where it is). These transforms are applied in the order in which they are listed here (the order matters). The last slider (Focus) is a bit experimental -- it allows to change the angular spread of the individual sound sources, either by making them more focal or less (i.e., more ambient). This is only really noticable with lots of speakers, but I would not overdo it.

The second group of controls is how the sound field is mapped onto the speakers. The first setting here is the channel setup; this allows you to select how many speakers you have and where they are placed (front left and right, center, rear left and right, side speakers, etc.). From the point of view of the decoder there at 16 possible positions along the edges of the square sound field (see this picture for an example), namely the 4 corners, the 4 midpoints (front center, back center, left side, and right side), and two positions on each edge half-way between the corners and the midpoint (e.g., front left center, front right center). Most people have only a subset of all these channels (e.g., 7.1) in some common locations, but you can have some fairly arbitrary setups (***). But note that the placement of the speakers in the room is actually not in a rectangle but instead follows the corresponding home theater rules. If you have a subwoofer you might want to do the bass management right here, but it is usually a better idea to let the sound card or amplifier do it if they offer the option (e.g. for active sub-satellite systems). The last option in this box is the stereo separation; this allows to effectively stretch the sound field horizontally in the front and/or back areas.

Change log0.9.0- fixed a steering bug in the 0.8.1 beta (sound field was shifted by a few degrees to the left due to an oversight; also steering was less accurate than it should have been)- removed a library dependency (boost serialization) that could cause conflicts with other plugins using the same library but different version (to be confirmed as fixed)

0.8.1 (beta)- basically a rewrite & cleanup; see this post for more details on the original beta announcement.- supports more speaker arrangements (up to 16.1)- supports more controls for sound field transformations (shift, stretch, wrap, ...)- probably a bit faster, too

0.3.5- now much faster when switching tracks

0.3.4- new front and rear stereo separation controls- 4 phase shifting modes are supported now- new linear steering mode (better than the old one)- fixed the dimension slider (negative values were mapped to 0)- the gain is back at 100% due to request (you can still put the equalizer before FS to control the gain)

0.3.3- added the option to invert the rear phase (like pl2 movie mode)- added the option to specify the (surround) mixing coefficients which are assumed for decoding

pre-0.3.3- changed "center width" into "center image", which controls how present the center speaker is (0.3-0.7 are good values for music).- expanded the range of "dimension" to [-0.5 .. 1.0] where 0 is a normal surround soundfield, -0.5 moves the sound towards the front, 1.0 moves it backwards.- changed the gain to ~85% to avoid clipping in practically all cases.- fixed center/surround level (both were too loud it appears).

* SQ is decoded with mono surrounds (i.e. like ProLogic I), due to a defective coding specification.** QS requires the front stereo separation to be set to 1.5, or else the sound field will be too narrow.*** There is one little catch with the more exotic channels: foobar2000 (or Windows) do not expose some of the rarely used positions but instead allow to connect "top" speakers (meant for the ceiling). Therefore there is a bit of remapping going on for these positions: If you have 'side front left'/'side front right' speakers, connect them to the 'top front left'/'top front right' channels, if you have 'side back left/right' connect them to 'top back left/right', and if you have 'back center left/right' speakers you need to connect them to the 'top front center' and 'top back center' channels, respectively.

What does it exactly do? I mean, I've got 5.1-headphones and for example I can hear my subwoofer when listening to stereo-files without any plugin :?And does it improve the sound of 5.1-encoded files aswell?(sorry I'm a newbie )

I was actually thinking a few hours ago that I'd like some more surround processors, despite not having a surround system. As such, there's not much I can say about this, although I notice that it seems to be quadraphonic for now?

Immediately I notice that when switching tracks, it proceeds to play the next snippet of what it was on (I suppose this qualifies as one of those buffer glitches).

does this plugin offers any definite improvement in confront of my favourite 5.1 foobar plugin, i.e, Foo_channelmixer from Skypirich? For me, channelmixer is the best 5.1 plugin around, even better that dolby systems, Creative Labs Neo and Cmss and even better than SSR labs AudioSandbox, so you'll have a difficult time trying to get anything better than Channelmixer

What does it exactly do? I mean, I've got 5.1-headphones and for example I can hear my subwoofer when listening to stereo-files without any plugin :?And does it improve the sound of 5.1-encoded files aswell?(sorry I'm a newbie )

It takes stereo music and decodes it according to the Dolby Surround scheme, which results in 6 channels output, although I do not redirect bass to the subwoofer (which you can do by chaining foo_channel_mixer afterwards IIRC).This means that plain Stereo Music which was not encoded this way sounds very similar to normal Stereo, except that echoes or very distorted sounds usually come over the surround speakers, too. Encoded music sounds much better, of course. Theoretically, sound sources can be placed freely in the soundfield as long as they do not interfere with other sources in the same frequency range. Unfortunately, there is close to zero info about what music "works" on a 5.1 system, so you need to find that out yourself.Recently I stumbled across albums from Lamb (e.g. What Sound/Between Darkness And Wonder), Blank & Jones (Monument), Cog (any), Tool (10.000 Days), Wumpscut (Music For a Slaughtering Tribe), RMB (Widescreen/Mussion Horizon) which are quite "surroundish".It doesn't affect 6-channel sound (e.g. DTS/AC3 music).

QUOTE (Eclipsed Moon @ Jan 28 2007, 13:12)

I was actually thinking a few hours ago that I'd like some more surround processors, despite not having a surround system. As such, there's not much I can say about this, although I notice that it seems to be quadraphonic for now?

Immediately I notice that when switching tracks, it proceeds to play the next snippet of what it was on (I suppose this qualifies as one of those buffer glitches).

Yeah, you're right. I have yet to find the buffer which I forget to clear in this situation :/

Here is a short sound sample from Mike Oldfield's Tubular Bells.I would use the latest plugin version for testing this because it can steer more sources simultaneously (~1000). Tell me if your jaws hit the ground (just joking ;-)

Note: The sample is from the DTS version of that album, converted to stereo with the ATSurround-Encode2 plugin.

Edit: Sorry, didn't see your post, rozzo!

QUOTE (Rozzo @ Jan 28 2007, 17:58)

Hi,

does this plugin offers any definite improvement in confront of my favourite 5.1 foobar plugin, i.e, Foo_channelmixer from Skypirich? For me, channelmixer is the best 5.1 plugin around, even better that dolby systems, Creative Labs Neo and Cmss and even better than SSR labs AudioSandbox, so you'll have a difficult time trying to get anything better than Channelmixer

Ys,rozzo

Well, the most definite improvement is that its output channels are fully independent which means that they *can* play completely different things (if the recording engineer wants them to).There is a stereo test file which plays a voice on each of the 5 channels, one channel at a time.When you play this with foo_channel_mixer, you hear the voice always on every channel (only at slightly different volume), even if you turn "front in rear" and "rear in front" down to zero.OTOH, if you have "vanilla stereo" music, you may want to mirror the front sounds in the rears (like e.g. CMSS does) and there foo_channel_mixer gives you more control.It would be cool if Skypirich allowed this kind of blending for 6 channel inputs, too, because then you could chain his plugin after mine (and I, Andrew Tan, Chungalin or the author of foo_dts don't have to implement all those controls).Actually, we really need a plugin where one can control the volume of each channel separately.

In confront with channelmixer, Mike Olfield's sample offers a real difference: sound seems to move around oneself from one speaker to another in a definitively deeper conception of stereo. On the counterpart, I was forced to give some more decibeles to my amplifier to get a clear sound; at the same level fee-surround was not giving a bright sound. I'm getting good results now by applying the Vlevel plugin after your mixer, many things previously muddy or unaudible came to surface.

.. decodes it .. which results in 6 channels output, although I do not redirect bass ..

Here the center channel stays silent. For music this is not so bad, but I got the impression, from the posts here, that it should have some signal too. The plugin works nicely but, as you said, it depends on the (stereo) source.

Here the center channel stays silent. For music this is not so bad, but I got the impression, from the posts here, that it should have some signal too. The plugin works nicely but, as you said, it depends on the (stereo) source.

Your're right, the center signal is equally distributed to front left/right. You'll be able to control this with "center width", once I add a GUI configuration. For now, it should be ok (since, as you said, no center not a big loss for music anyway).

This plugin seems to work great to me except for one problem, which is it seems to be assuming that input is at 44.1 KHz - other sample rates are played back either too quickly or too slowly, so something that's 48 KHz, for example, is played back too slowly by about 10% (and yes the pitch is affected as well). I haven't checked into bit-depth just yet, just 16-bit mono and stereo at different sample rates...

This plugin seems to work great to me except for one problem, which is it seems to be assuming that input is at 44.1 KHz - other sample rates are played back either too quickly or too slowly, so something that's 48 KHz, for example, is played back too slowly by about 10% (and yes the pitch is affected as well). I haven't checked into bit-depth just yet, just 16-bit mono and stereo at different sample rates...

Oops, what a stupid mistake (forgot to set the correct output sample rate). It's fixed now. Btw: It works with 32bit floating point precision internally, so bitrates should be no problem.

Thanks for the quick fix, though I have another bug to report - with a 22 KHz mono mp3 (the htguys.com podcast to be specific), foobar2000 crashes in foo_dsp_fsurround upon seeking. Interestingly I configured foo_gep to output at 22 KHz as a test and tried some nsf files (so its output should also have been 22 KHz mono) and had no problems with seeks...

And here's the contents of failure.txt (and yes this is with fsurround as the only active DSP to try to cut down on potential failure points ):

Thanks for the quick fix, though I have another bug to report - with a 22 KHz mono mp3 (the htguys.com podcast to be specific), foobar2000 crashes in foo_dsp_fsurround upon seeking. Interestingly I configured foo_gep to output at 22 KHz as a test and tried some nsf files (so its output should also have been 22 KHz mono) and had no problems with seeks...

<snipp>

Thanks for the detailed info, it's fixed now.The bug was that the decoder core is not loaded in bypass mode (i.e. non-stereo source), but was flushed upon seeking.

Very promising, really. It may become my substitute of Channel Mixer as feeder of Dolby Headphone plugin, beacuse this one is more deterministic in the volume domain. I mean, I can disable dynamic compression and set "amplification" to 100% with less chances of getting eventual clippings.

To my taste the Front channels are too "separated", I think the Dimension control should have a "negative" side in order to get the Fronts closer. Is that possible? Also the Center control has little effect on the Center presence.

Not very related to that, but I'm missing some kind of visual control over channel contents. I think that would be a good idea to code some kind of passthrough-DSP with integrated VU-meter visualization that could be able to display EACH channel level independently at the same time. You could insert that plugin in any position of the DSP chain to see what's going on at THAT point (number of channels and what's playing on them). I know the fb2k scene is not visualization-friendly (and I don't want this to change) but there're a few visualizations that DO aid in monitoring multichannel audio, specially if you don't have all those speakers! What do you think about this matter?

Very promising, really. It may become my substitute of Channel Mixer as feeder of Dolby Headphone plugin, beacuse this one is more deterministic in the volume domain. I mean, I can disable dynamic compression and set "amplification" to 100% with less chances of getting eventual clippings.

Well, I use 100% amplification in DH myself and did not notice any clipping yet.The reason is that I do not change the volume at all but just redistribute the sound to the different channels.Edit: Okay, of course clipping can happen even when one doesn't change the total volume (in an extreme case by putting everything from left and right just into left).I changed the master gain to 0.7 (which is very safe) for now. I think I'll add a slider for this (b/c many people would probably dislike a DSP which reduces the overall volume). And I added a warning mechanism that writes a line into the console whenever the plugin produces data which is above the maximum volume (1.0), so you can check that it doesn't clip.The absolutely worst case follows from the PL2 encoding matrix: The signal <Lt=0.8165*i, Rt=0.5774*j> (rear left) would be turned into <Lsurr=0.8165+0.5774, Rsurr=0>.So if someone maximized the volume of the <Lt, Rt> signal, the decoded signal would have the volume level <Lsurr=(0.8165+0.5774)/0.8165, Rsurr=0>. In other words, the worst case gain would have to be 0.5858.Under the (reasonable) assumption that there is at least one front source in the file which is at least as loud as the loudest rear source, then the worst case gain would have to be 1/(0.5774+0.8165) = 0.7174, so 0.7 is fully sufficient for any non-pathetic music.

QUOTE (Chungalin @ Feb 9 2007, 21:24)

To my taste the Front channels are too "separated", I think the Dimension control should have a "negative" side in order to get the Fronts closer. Is that possible? Also the Center control has little effect on the Center presence.

Good point, I changed the allowed range of dimension to [-0.5 .. 1.0] (where -0.5 means that nearly everything ends up in the front channels), hope you don't need even more front-ness (this would defeat the original purpose of this plugin a bit). But if you experience strongly increased stereo separation with FS enabled compared to stereo, then it's very likely that the more separated sources are actually behind you (if this is the case I'd like to know to what material you are referring to). The central reason for this effect is that in PL2, the surround channels are encoded very close to the center and thus sound rather "mono" when the stereo file is played back undecoded. So if this is annoying you, you probably need a crossfeed slider for rear and one for front.A simple criterion to find out if what you hear behind you is really surround (instead of crosstalk) is whether there is no other source at the same time which occupies the same frequencies (this is the only situation in which crosstalk can occur).

On the center matter:I changed the meaning of "center width" to "center image" so that it's more clear what this slider does:0.0 means there is no center, so left front an right front have to emulate center sounds.1.0 means that the center just plays its part of the music.If there was a sound source at location X, the volume levels (for X) would be approx. like this:[--------X------------------------]L---------------------------------R "no center (0.0)": L=0.75, C=0.00, R=0.25L---------------C----------------R "center on (1.0)": L=0.45, C=0.55, R=0.00

As you see, the stereo separation remains completely untouched, it just enables a third speaker in the middle.The effect in DH is rather subtle, because all virtual speakers have (theoretically) equal properties so its more about how "virtual" or how "concrete" the center sources sound.Personally, I have it at 0.3 (according to the new meaning).

QUOTE (Chungalin @ Feb 9 2007, 21:24)

Not very related to that, but I'm missing some kind of visual control over channel contents. I think that would be a good idea to code some kind of passthrough-DSP with integrated VU-meter visualization that could be able to display EACH channel level independently at the same time. You could insert that plugin in any position of the DSP chain to see what's going on at THAT point (number of channels and what's playing on them). I know the fb2k scene is not visualization-friendly (and I don't want this to change) but there're a few visualizations that DO aid in monitoring multichannel audio, specially if you don't have all those speakers! What do you think about this matter?

I too think that such a plugin is a very good idea for monitoring purposes (including clipping).Another thing that I thought would be cool & useful is a visualization of the soundfield (where sources are marked as dots in a 2d plane, which works under the assumption that each frequency in a short period of time comes from exactly one source). This way, one could quickly determine if the music is actually surround encoded or not.

The minimal version would just be a DSP plugin which displays the visualization in its config dialog.Another option would be to open an external window when the DSP is loaded.And the king of options would be to have a ColumnsUI-Panel which can use information from a special (passthrough) probe dsp.Once I have time again, I might try options 2 and 3, but therefore I need a least a decent setup of ColumnsUI (for the motivation!).

- Dimension slider (-0.5, 1.0) without effect.- The surround channels must be attenuated by 0.83.- The SR channel is inverted.- With Center Image=1 the center channel must be attenuated by 0.35.If downmix matrix is not normalized or the downmix is after normalized we obtain overflow.- With Center Image=0 the center channel have a good relation with front channels (70%).

The separation is really good, is possible a little adjust to obtain a correct decoded wav with any preset?

You're right with the center thing, changed that.Is it possible that the actual value is 0.5*sqrt(0.5) (=0.3536)?

The fact that surround sources have to be attenuated surprises me a bit but actually its quite practical since this mitigates the clipping issue, changed it.

But there are two things related to the mixing matrix you used:1. Shouldn't the factors for SL and SR be 0.8165 and 0.5774, scaled by some normalization constant? Because 0.8165/0.5774 = 1.4140 and 0.2818/0.1627 = 1.7382 which seems not to match. I think this is the reason why you get the two off-diagonal 1's.

2. Did you apply the +90 degree phase shifts to SL and SR? In case you didn't, I would try to encode it with ATSurround-Encode2, which appies the correct hilbert filter. I'd like to know what correlation coeffs you get with PL2 then. It's no problem for me to un-shift the signal by +90/-90 since I work in the frequency domain anyway but I'm not sure if you can do this with an analog filter (which PL2 mimics AFAIK). I uploaded a version called foo_dsp_fs-phaseshift.dll which does that un-shifting for your testing.

There is another test which should be conducted.This is how PL2/FS reconstructs a source when it is arbitrarily distributed across LF,FR,C,SL,SR.Thing is that it's not a piece of cake to get a linear behaviour over all positions.I think I'd need access to Mathematica to get this 100% right and I think PL2 doesn't do this perfectly either.

Thanks for you quick answer.I agree with "how PL2/FS reconstructs a source when it is arbitrarily distributed across LF,FR,C,SL,SR", because is the real problem.But simplified data can help to adjust some parameters before go to more sophisticated test.

To answer your questions:

1) The dpl II matrix coeficients:

1/0.7071/0.8660/0.5000 (0.3254/0.2301/0.2818/0.1627 normalized)

is used by Midas Azid 1.9 (Dec-2003) and since BeSweet v1.5b20 after this discussion instead the old one:

With better channel separation results for Free Surround (surround channels more amplified) but worse for PowerDVD

2) "Did you apply the +90 degree phase shifts to SL and SR?"Hard question. My opinion is:- The 90 degree phase shifts is out of dpl2 encode/decode phases. Only 180 degree (- sign) is necessary.- The 90 degree phase shifts is necessary when we create a 5.1 signal only if rear channels are generated from front channels to avoid interaction in mixes. And is not necessary when the channels are independents or "if the source was recorded using five discrete microphones placed in the corners of an auditorium", like say Dolby in their docs.- I don't apply 90 degree phase shifts to SL and SR because the precedent reasons. BeSweet-Azid don't aply any phase shifts.- ATSurround don't work for dpl II, only dpl I.

I know that my test and requirements are based in premises that can be wrong, but I don't know another reference:- Dpl II soft encoder: Azid 1.9 (with ac3 sources)- Dpl II soft decoder PowerDVD 7And, of course, dpl II is not perfect.

BTW, the Dimension slider don't must affect the relation between the front and rear channels volume?

EDIT: all values and comment without test the new release. I'm testing...

- The center chanel is perfect at 1.Now using the same sample and normalizing 100%, in this case is the same than:Lt = FL + 0.7071*FC + 0.866*SL + 0.500*SRRt = FR + 0.7071*FC - 0.500*SL - 0.866*SRand with 1/1000 instead % for more precision:

Thanks again for the tables (interesting how much crosstalk PL2 has!).But I'd like to know how well PowerDVD's PL2 performs when you used the coefficients from wikipedia for mixing. I expect that it's at least not worse than what you got with BeSweet's coefficients.

Concerning the phase shifts:I think it's quite a strong assumption that front and rear channels are fully independent.If I want to position an instrument to the right side of the listener, I would mix it equally at right surround and right front. This works perfectly if the phases of front and surround are orthogonal and it doesn't work at all if they are collinear. Effectively, you would pan the final output somewhere along the front plane.

Btw: ATSurround may not be able to decode PL2 properly, but at least it can encode it with the (relatively new) Encode2 mode. And I'm quite sure that it follows the wikipedia rules for encoding.

I read that PL2's music mode doesn't flip the signs of any of the surround channels (just like I do in the official version of FS). The reason is that it this treats non-encoded music more carefully, metaphorically speaking.OTOH, sources which are PL2 encoded do most likely have the 90░ phase shift applied (for the aforementioned reasons). It would be ridiculous if Dolby's $4000 encoder doesn't do this.So one needs at least these two decoding modes: 1. +0,+0 / 2. +90,-90.I will expose them in the next version (which will ship, erm... this night).

Note that proper phase shifts are less important for decoding than for encoding because the brain doesn't rely on phases to steer front/back but PL2 does.Actually I have no clue if one can hear a difference between those 2 decoding modes at all.So someone would have to conduct an ABX test through Dolby Headphone I guess.

- About phase shifts:I say is unnecessary:If the channels are independent like this channel test sample.If the channels are from an decoded ac3 because the rear channels are already shifted (if are Dolby compliant).

But is necessary if we are generating the rear channels from the front channels.

Because a high % of dpl II encodes are from ac3 5.1 decoded channels, with rear channels already shifted, the dpl II encoder can't do another shift, must be optional and applied when needed.

- About ATSurround Encoder2.You are right seems like Wikipedia coef. I need make more test.