|
|||||||
![]() |
|
|
LinkBack (2) | Thread Tools |
|
|
#1
|
|
DriverHeaven Newbie
Join Date: Jun 2005
Posts: 18
Rep Power: 0 ![]() |
I have coded a very simple plugin for encoding surround sound into a Dolby Pro-Logic signal. The code works well for some games (try bf 1942) and its function can be seen using rightmark 3d analyser. The best part is the encode can be sent to a single SPDIF output and decoded by an external encoder. The information came from a linux thread and also gives info for encoding Dolby Pro-Logic II. My code is derived directly from this info and no doubt has room for improvement. Any suggestions would be welcome.
dsp code: input L,R,Ls,Rs,C output Lt,Rt temp tL,tr macs tL,L,C,.707 macsn tL,tL,ls,.707 macsn tL,tL,Rs,.707 macs tr,R,C,.707 macs tr,tr,Ls,.707 macs tr,tr,Rs,.707 macs Lt,tL,0,0 macs Rt,tr,0,0 end thread link: http://forum.doom9.org/showthread.ph...721#post145721 |
|
|
|
|
|
#2 |
|
S-3D enthusiast
|
Replace 0.707 by a more exact constant.
1/sqrt(2) = 0.70710678118654752440084436210485 Code:
input L,R,Ls,Rs,C; output Lt,Rt; static theconstant = 0.70710678118654752440084436210485; temp tL, tR; macs tL, L, C, theconstant; tL = L + C * theconstant macsn tL, tL, ls, theconstant; tL = tL - ls * theconstant macsn Lt, tL, Rs, theconstant; tL = tL - Rs * theconstant macs tR, R, C, theconstant; tR = R + C * theconstant macs tR, tR, Ls, theconstant; tR = tR + Ls * theconstant macs Rt, tR, Rs, theconstant; tR = tR + Rs * theconstant end |
|
|
|
|
|
#3 |
|
DriverHeaven Newbie
Join Date: Jun 2005
Posts: 18
Rep Power: 0 ![]() |
Thanks for the help.
I have added wave 0/1 to the F/R input and level controls for front and center via kx plugins in the dsp. This helps games with no sound at all or games using software only sound. |
|
|
|
|
|
#4 |
|
Kx User
Join Date: Sep 2003
Location: Finland
Posts: 31
Rep Power: 0 ![]() |
That's really cool. I wonder if it's a lot more complicated to encode to ac-3 or true surround sound. Any ideas?
__________________
Oswald |
|
|
|
|
|
#5 |
|
DriverHeaven Newbie
Join Date: Jun 2005
Posts: 18
Rep Power: 0 ![]() |
As I understand it ac-3 is much more complicated. I believe there is FFT involved in the compression algorythm. No one has yet done FFT in emu 10kx dsp code. A software solution must be real time -- minimal latency for games otherwise the sound would lag the video in games. Some new sound cards with Dolby Digital Live (DDL) at least claim to do this. Be warned about the Turtle Beach Montego and digital output for games (see my post in another thread).
|
|
|
|
|
|
#6 |
|
Kx User
Join Date: Sep 2003
Location: Finland
Posts: 31
Rep Power: 0 ![]() |
While surfing the net I found this:
http://essej.net/ac3jack/ It claims to be some kind of a soft which can do real-time ac3 encoding. Unfortunately I have no clue what to do with it or how to use it (or compile it). Maybe some one with more knowledge on this kind of stuff could take a look and say if it's of any use. Thanks.
__________________
Oswald |
|
|
|
|
|
#7 |
|
Kx User
Join Date: Sep 2003
Location: Finland
Posts: 31
Rep Power: 0 ![]() |
Some more info on this AC3Jack...
I found this page where the author of the soft i.q. comments on some stuff. Especially he says, that the encoder is supplied by FFMPEG's libavcodec. Ring any bells? This page is at: http://music.columbia.edu/pipermail/...er/005888.html
__________________
Oswald |
|
|
|
|
|
#8 |
|
DriverHeaven Lover
Join Date: Apr 2005
Location: Europe/Slovenia/Ljubljana
Posts: 157
Rep Power: 0 ![]() |
Yeah,FFDShow filter can encode to AC3 in realtime it appears
|
|
|
|
|
|
#9 |
|
Kx User
Join Date: Sep 2003
Location: Finland
Posts: 31
Rep Power: 0 ![]() |
Really?! Cool. Can you tell how exactly? Thanks.
__________________
Oswald |
|
|
|
|
|
#10 |
|
DriverHeaven Lover
Join Date: Apr 2005
Location: Europe/Slovenia/Ljubljana
Posts: 157
Rep Power: 0 ![]() |
Go to Start menu and open ffdShow submenu. Select Audio Decoder configiration shortcut.
Scroll left side panel all way down and select Output. Look under supported output samples and select AC3 and select desired AC3 bitrate. Under Connect to: select if which interface to use for output and if you want to direct it through SPDIF. I assume this is it,but i can't try it on SPDIF because i have only normal analog 4.1 speakers. I guess you have to connect it to external Dolby decoder or something. |
|
|
|
|
|
#11 |
|
Kx User
Join Date: Sep 2003
Location: Finland
Posts: 31
Rep Power: 0 ![]() |
Apparently I have a different version of FFDShow. All the tabs you mentioned weren't the same here. Actually I didn't find any Connect To: tab, but didn't need it anyways.
The main thing: Now my external decoder really does recognise an AC-3 signal coming from the computer. So this really seems to work! Thanks a bunch. Unfortunately I got it to work only with Media Player (and with some files the sound is really distorted and clipping and stuff). Is this supposed to work with all kinds of audio outputs? Especially, is it possible to encode a games 3D-sound to AC-3 with FFDShow or is it somehow Media Player (or generally some media player) specific? I mean, do DirectShow filters have anything to do with in-game audio? Also, perhaps more kX related, as it is meant for musicians, Cubases output doesn't get encoded either. This isn't a big problem though, because I'm woking with plain ol' stereo when it comes to music and use different speakers for that too. In that area kX ofcourse kicks ass. Just want to spice up my gaming adventures...
__________________
Oswald |
|
|
|
|
|
#12 |
|
Tail Razer
Join Date: Jun 2005
Location: Bernyurass, AZ - USA
Posts: 4,027
Rep Power: 36 ![]() ![]() |
Just FYI, three is an AUDIO settings applet and A VIDEO settings applet for FFDShow. - I first thought the same thing, look in your start menu for 'Audio Filter Configuration' - I have it, but I also have the latest version from sourceforge installed.
|
|
|
|
|
|
#13 |
|
Kx User
Join Date: Sep 2003
Location: Finland
Posts: 31
Rep Power: 0 ![]() |
Yes, I found the Audio Configuration. I had to enable the AC3 there and so on... I just can't find the 'Connect to' part there. Don't seem to need it either, because the signal gets passed through just fine as is.
__________________
Oswald |
|
|
|
|
|
#14 | |
|
Tail Razer
Join Date: Jun 2005
Location: Bernyurass, AZ - USA
Posts: 4,027
Rep Power: 36 ![]() ![]() |
Quote:
But, I most certainly could be wrong - I would try playing with that to see how it affects you/this subject. |
|
|
|
|
|
|
#15 |
|
Eternal Sentinel
|
Can anyone give me an explanation as to how I can integrate this into my DSP settings? I have an Audigy 2 and I'd like to add in Dolby and any other encoders that may be. I'd like to know if anyone has any DSP tweaks and plugin addons that I could use.
__________________
|
|
|
|
|
|
#16 |
|
DriverHeaven Newbie
Join Date: Dec 2006
Posts: 3
Rep Power: 0 ![]() |
Ok, first I'll just say that I'm new here.
Anyway, back to the subject, I saw the code on the first couple posts. I understand it, but what does it go to? What program do you put this code into to make a software pro logic encoder? Basically what I'm asking is "what do you do with this code?" Plese help. Thank you! |
|
|
|
|
|
#17 | |
|
Tail Razer
Join Date: Jun 2005
Location: Bernyurass, AZ - USA
Posts: 4,027
Rep Power: 36 ![]() ![]() |
Quote:
Make sure you have a blank line AFTER THE 'END'. Save the file as 'anyfilename.da' - then just double click on it to register it. It then becomes available as a plugin in the KX DSP. |
|
|
|
|
|
|
#18 |
|
d/h member-shmember
Join Date: Dec 2002
Location: Evil Empire
Posts: 2,400
Rep Power: 47 ![]() |
[color=gray]
interesting, i've missed this topic in 2005. My two cents - just in case someone will request it to be included to the main kX package. Actually such module already exists in kX (it was there since 2002) - it's titled "cnv51to20" for a few reasons: 1. You can't use "Pro-Logic" title without a permission form the Dolby. 2. Real Dolby Pro-Logic I has a bit more complex algorithm then such simple "matrix encoding". p.s. actually "Surrounder(+)" (in "2.x, on" mode) uses similar encoding too (even with a bit more magic). [/color] Last edited by Max M.; Dec 29, 2006 at 11:48 AM. |
|
|
|
|
|
#19 |
|
DriverHeaven Newbie
Join Date: Dec 2006
Posts: 3
Rep Power: 0 ![]() |
Thank you!
|
|
|
|
|
|
#20 |
|
DriverHeaven Junior Member
Join Date: Oct 2003
Posts: 21
Rep Power: 0 ![]() |
I did this myself a while back, but I added a 20 ms delay to front-left and front-right to prevent strange addition/subtract effects when the same signal is sent to all speakers.
I also added a 8 kHz lowpass to rear-left and rear-right, otherwise rear signals with a frequency above 8 kHz are sent to the fronts. To prevent equal front-left and front-right signals bleeding into the center speaker, you can add a very small delay to either front-left or front-right, a delay as small as 1 sample should be sufficient. |
|
|
|
|
|
#21 |
|
DriverHeaven Newbie
Join Date: Nov 2004
Posts: 2
Rep Power: 0 ![]() |
I've been using this plugin now and indeed it seems to work! There's one thing i don't understand though.. The wikipedia article about Dolby Pro Logic says that it adds the surround channel with phase shifting, but the only thing this plugin does is add the center channel to both left and right channels, substract the surround channel from the left channel and add it to the right.
Could anyone tell me why substracting the surround channel from the signal is the same as phase-shifting it +90° and adding it is the same as phase-shifting it -90°? Or is this just a dirty hack that will work quite well, but not optimal? -edit- ah, I get it now. In stead of rotating one left 90° and the other right 90°, you just leave one untouched and negate the other one to approximate 180° rotation. Somehow in my setup the abovementioned 8kHz filter wasn't necessary and only (obviously) decreased sound quality from the rear channel. The code I now use in the dolby encoder component: Code:
input L, R, Ls, Rs, C; output Lout, Rout; static theconstant=0.7071; temp tL, tR, tS ; Code macs tL, L, C, theconstant; add center channel to left channel macs tR, R, C, theconstant; add center channel to right channel macs tS, Ls, Rs, 0x7fffffff; combine Ls & Rs to one temporary surround channel macsn Lout, tL, tS, theconstant; add 180° rotated (negated) surround to left channel macs Rout, tR, tS, theconstant; add untouched surround to right channel Front Left: 1.010m Front Right: 0.990m Rear Left: 0.808m Rear Right: 0.808m Center: 1.000m Last edited by Remboooo; Mar 29, 2007 at 11:43 AM. |
|
|
|
|
|
#22 |
|
DriverHeaven Junior Member
Join Date: Oct 2003
Posts: 21
Rep Power: 0 ![]() |
A dolby pro logic decoder has an 8 kHz lowpass for the rear speakers, sounds above 8 kHz in the rear channels will come out of the front speakers.
|
|
|
|
|
|
#23 |
|
DriverHeaven Senior Member
Join Date: Mar 2004
Posts: 1,745
Rep Power: 0 ![]() |
A person was asking for a 5.1 encoder aswell, doesn't Trils redocneKX plug do this exact feature?
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
|
|
LinkBacks (?)
LinkBack to this Thread: http://www.driverheaven.net/3-d-audio/79137-dolby-pro-logic-encoder.html
|
||||
| Posted By | For | Type | Date | |
| surround sound on a stereo sound card. - LinuxQuestions.org | This thread | Refback | Oct 5, 2008 10:12 AM | |
| surround sound on a stereo sound card. - LinuxQuestions.org | This thread | Refback | Jun 1, 2008 02:14 PM | |