|
|||||||
![]() |
|
|
LinkBack | Thread Tools |
|
|
#1 |
|
DriverHeaven Newbie
Join Date: May 2009
Posts: 9
Rep Power: 0 ![]() |
((X)) Surround System
Hi. I started making a plugin, ((X)) Surround System, last weekend that seems to be upmixing 2ch audio in a fashion reminiscent of Dolby Pro Logic II. I'm not totally sure if it actively matrixes anything, but I'm sure someone else can figure that out.
Here are the sources that I have been using while developing this plugin: http://www.dolby.com/uploadedFiles/z..._Operation.pdf Dolby Pro Logic - Wikipedia, the free encyclopedia I would say that it has been coming along well, but I can't figure out how to correctly apply a matrix. I am also looking for a better way to compare the status of the different channels so that the separation will be better, and I can fully remove voices from the rear channels, whether they are in the center, left, or right channel of the stereo track. For example, if you listen to a song, particularly Basket Case by Danger Doom, where someone is saying something only from the right channel, it will playback in the rear right with a distinguishable level of prominence while playing in the front at the same time. The code is below: ------------------------------------------------------------------------- ; Registers input in_L, in_R; output L, R, Ls; output Rs, C; static C_constant=0x5a827999, SL_phase=0x7fffffff, Sr_phase=0x80000000; temp SL, Sr, offsetrL; temp offsetrR ; Code macs C, in_L, in_R, C_constant; macsn SL, in_R, in_L, 0x7fffffff; macs Ls, offsetrL, SL, SL_phase; macsn Sr, in_L, in_R, 0x7fffffff; macs Rs, offsetrR, Sr, Sr_phase; limit SL, Sr, L, Ls; limit offsetrL, 0x80000000, Rs, offsetrL; limit Sr, SL, R, Rs; limit offsetrR, 0x80000000, Ls, offsetrR; macsn L, C, in_R, 0x20000000; macsn R, C, in_L, 0x20000000; end ------------------------------------------------------------------------- The code is from the sixth edition that I have made; I can post the earlier versions if anyone is interested. I would also prefer to keep it ultralight by removing anything that it doesn't need to be functional that can be taken up by another plugin, like speaker delays. Here are some of my sources for testing its ability to upmix 2ch audio: YouTube - Killzone 2 Gameplay HD 720P Widescreen HD Quality DiRT Video Game, Dusty Trails Gameplay HD | Game Trailers & Videos | GameTrailers.com YouTube - Gran Turismo 5 Prologue: Ferrari F40 replay YouTube - Sonic Unleashed Trailer "High Europe" Spagonia YouTube - Gran Turismo 5 Prologue: Ferrari F40 replay YouTube - Ferrari F40 testdrive by FifthGear YouTube - Soul Calibur IV Hilde And Sophitia Gameplay YouTube - Project Gotham Racing 4 - Corvette HD YouTube - Project Gotham Racing 4 (PGR4) [Tokio] and Computer games like NFSU2, GRID, CoD 4 etc. Footage from movies and television like the Fifth Gear test drive should be usable. For the record, my knowledge and understanding of this kind of stuff is very limited, and I don't fully understand the instructions. I also don't know if this guide covers all of them. kX Project -- A Beginner's Practical Guide to Programming Digital Audio Effects on the E-MU10kx family of DSPs in the kX Project Environment As a result, anything that can help me understand them will be valuable to me. ![]() Thanks! |
|
|
|
|
|
#2 |
|
d/h member-shmember
Join Date: Dec 2002
Location: Evil Empire
Posts: 2,418
Rep Power: 47 ![]() |
Îòâåò: ((X)) Surround System
>As a result, anything that can help me understand them will be valuable to me.
well, there's nothing complicated there really. In fact one should start with understanding the only instruction: macs, as multiplication and addition cover 99.9% of signal processing algorithms. The rest is just a matter of understanding the effect algorithm and the math behind it. And this (the algorithm and the math) is what i would recommend you to dig into first - start with writing the algorithm math on a paper in some pseudocode (whichever "pseudo" you feel better with - for example: "a = b + c + d * e - f * g") and then convert the stuff into dane code. You can always ask us here for the details on a particular instruction and its use in a certain algorithm chunk - but first, the algorithm itself, algorithm, algorithm, algorithm!
__________________
Last edited by Max M.; May 5, 2009 at 01:29 PM. |
|
|
|
|
|
#3 |
|
DriverHeaven Newbie
Join Date: May 2009
Posts: 9
Rep Power: 0 ![]() |
Re: ((X)) Surround System
Hi again. Thanks for the advice; I got the matrixing right this time
. However, in order to keep the sounds from the left and right channels that should be playing in the front, like dialogue on the left or right, from playing in the surround speakers, I need to be to make a voltage-controlled amplifier that will lower one channel and raise the other when sounds like those play. I am assuming that making the volume multipliers for the Ls and Rs channels inversely proportional would work, but I'm not sure how to do it. Is there a way to use the MACS function so that the R operand is constant without using the constant register? I tried using the constant register, but it can't be used as R in the function.Thanks again. ![]() Oh yeah, I need to be able to do something like this in order to set up the L and R channels in stereo. Otherwise, they play sounds that should only be coming from the back. Last edited by Maxon; May 9, 2009 at 08:55 PM. Reason: I forgot an important detail, |
|
|
|
|
|
#4 |
|
d/h member-shmember
Join Date: Dec 2002
Location: Evil Empire
Posts: 2,418
Rep Power: 47 ![]() |
Îòâåò: ((X)) Surround System
>I am assuming that making the volume multipliers for the Ls and Rs channels inversely proportional would work
Nope. Don't miss the important detail - the VCA should be controlled not by the signal waveform (what you're trying to do) but by the signal envelope - which you need to extract first. Or, in other words - the "balancing servo" engine of the active matrix is just a kind of dynamics processing, or yet in another words, simply a form of compressor/expander. To give you more keywords for search (algorithms! ;): "envelope detector + vca". >Is there a way to use the MACS function so that the R operand is constant without using the constant register? No, you cannot "invert" an instruction operation by "swapping" the meaning of its operands. Well, the "inverted" multiplication could be a division or (depending on the goal) inversion of multiplier itself (like a = b * (1 - c)) - but this is not what you really need (at the moment). The sample-per-sample multiplication/division of one waveform by another will give you just a distortion not a "level control". ---- I guess your next turn is to dig into "compression algo" articles/papers ;) (like this for example)
__________________
Last edited by Max M.; May 10, 2009 at 12:16 AM. |
|
|
|
|
|
#5 |
|
DriverHeaven Newbie
Join Date: May 2009
Posts: 9
Rep Power: 0 ![]() |
Re: ((X)) Surround System
I'm trying to get the first envelope detection method mentioned above working. When I play it back as an output signal, it comes out distorted.
http://www.mathworks.com/products/demos/shipping/dspblks/dspenvdet.html#7 Also, how do I get a visual confirmation of the detection? Last edited by Maxon; May 23, 2009 at 01:25 PM. Reason: Posted the wrong link. |
|
|
|
|
|
#6 |
|
d/h member-shmember
Join Date: Dec 2002
Location: Evil Empire
Posts: 2,418
Rep Power: 47 ![]() |
Îòâåò: ((X)) Surround System
well, you can assing the output of the detector to an extra output of the plugin and then analyze it the waty you like (for example record in your favorite editor and check visually)
__________________
|
|
|
|
|
|
#7 |
|
DriverHeaven Newbie
Join Date: May 2009
Posts: 9
Rep Power: 0 ![]() |
Re: ((X)) Surround System
Forget what I said; I've got it now. I'll probably work more on this next week after I've taken all of my finals.
I got the envelope detection working for the left and right totals. If I'm correct, I should have to detect the envelope for the L+R and L-R signals as well, but that should be a later concern. Anyway, I'm still not sure how to go about setting up the VCA in its entirety. Variable-gain amplifier - Wikipedia, the free encyclopedia Voltage Controlled Amplifier SSM2018 | Trimless Voltage Controlled Amplifier | Operational Amplifiers (Op Amps) | Amplifiers and Comparators | Analog Devices 4QD-TEC: Voltage controlled amplifier circuit I did some searching, but all I can find are circuit diagrams. I'm assuming that I am going to have to understand them before I can finish this plug-in. This would also mean that I will have to study electronics up to a level appropriate for this. Would these be good places to start? Electronics: An Online Guide for Beginners - Schematic Diagrams Tutorial - How to Read a Schematic The Physics Classroom Learn Physics Today! Electricity & Magnetism Last edited by Maxon; Jun 3, 2009 at 05:21 PM. Reason: I can solve the aforementioned problem |
|
|
|
|
|
#8 | ||
|
d/h member-shmember
Join Date: Dec 2002
Location: Evil Empire
Posts: 2,418
Rep Power: 47 ![]() |
Îòâåò: ((X)) Surround System
Quote:
The tricky parts are: 1. What timings you will need to apply to your envelope before VCA (e.g. how fast changes in envelope level will affect corresponding output level changes) - assuming the "active matrix" is somewhat similar to "automatic level normalizer" - that would be relatively short attack and pretty long release. 2. How deep (e.g. the "scale") and in what degree the envelope level should affect corresponding output - e.g. you need to convert your initial arrangement (... "to compare the status of the different channels so that the separation will be better, and I can fully remove voices from the rear channels, whether they are in the center, left, or right channel of the stereo track...") into the math. E.g. sorta "which levels of which channel to which 'voltage_control' and how". Etc. Quote:
As for the exact layout and fine-tuning of all those active-matrix modules (envelope detector, timing filters, vca), well, i guess only a complete documentation and/or source code for a "dolby-like" active-matrix can provide precise direction - but i'm not aware of such documentation/code. So it's going to be total trial-and-error. After all, i'd said that the "active surround matrix" is quite complex thing to make it completely from scratch - as there's no common convention for such processing and the algorithms of proprietary processors are completely undocumented. So well, perhaps, first i'd suggested to start with a minimalistic compressor module or a sort-of - just to become less or more familiar with typical dynamics processing building blocks and a variety of options they provide. Otherwise it's going to be a nightmare for you due to infinite number of unknowns. Something like that i guess (maybe not so helpful - sorry).
__________________
Last edited by Max M.; Jun 5, 2009 at 07:16 AM. |
||
|
|
|
|
|
#9 |
|
DriverHeaven Newbie
Join Date: May 2009
Posts: 9
Rep Power: 0 ![]() |
Re: ((X)) Surround System
I've got excellent news: the plugin is almost finished. Unfortunately, it is not entirely true to DPLII thanks to the lack of solid documentation on the VCAs, which had been mentioned previously. I'll update this post with what I have managed to finish as of late in a few days; I want to see if there is anything I can do to bring it closer.
|
|
|
|
|
|
#10 |
|
DriverHeaven Newbie
Join Date: May 2009
Posts: 9
Rep Power: 0 ![]() |
Re: ((X)) Surround System
What I said would take a few days ended up taking longer than a week...Oh well.
Anyway, I have one last question before I put up the code. The compression works, but Dolby Pro Logic II has a feature that allows it to change the response time in real time based on the gain at any given moment. How would I go about implementing this? |
|
|
|
|
|
#11 |
|
kX Project Lead Programmer and Coordinator
Join Date: Dec 2002
Posts: 3,037
Rep Power: 56 ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Îòâåò: ((X)) Surround System
I guess you need a delay line with some variable time pointer, but I suggest you send a message to Max M. concerning this
![]() looking forward to trying your plugin ![]() E. |
|
|
|
|
|
#12 | |
|
DriverHeaven Newbie
Join Date: May 2009
Posts: 9
Rep Power: 0 ![]() |
Re: ((X)) Surround System
Hi. I got everything working, but I went back and rewrote much of the plugin. It sounds many times better than it did in July.
Anyway, I'm finally releasing it, but there are some things that should be mentioned first: It is not done. There are still things that I want to try with it, such as other methods for creating a matrix surround effect that are not included in the plugin. HeadWize - Technical Paper: Pro Logic Surround Decoder Principles of Operation by Roger Dressler Either way, The front and rear L and R channels are in full stereo. However, the source affects the placement of stereo sounds. For example, a sound that is supposed to be dominant in the left speaker may play as though it is closer to the center speaker than it would have been without my plugin, or may even play like it is coming from the center speaker. Luckily, this does not normally happen. Every source I tried, save for one or two exceptions out of the hundreds I have run through, play back as intended. As for the compression, sudden and noticeable changes in volume pretty much don't happen. When I use DScaler 4: DScaler - TV Viewer, I don't notice any sudden changes in volume while playing Xbox 360 or Gamecube unless I play Kirby Air Ride. That game is pretty much the only reason that I'm sure the variable delay probably works. :/ Within the past month or so, I have been able to test this plugin with Dolby Pro Logic II sources. It seemed to work very well, much better than the version that I tested on July 1st. However, my speakers are so bad that I had been using filters like the highshelf and the timbre one while I developed the plugin. Regardless, it seemed to work very well when I tested it today without those filters in place. Based on the previous paragraph, it should be a given that I don't have full-range speakers to work with. As a result, I didn't even bother with bass redirection. I do recommend sending the C signal to both the center and subwoofer outputs though. I also recommend using the EQ Highpass filter for all of the outputs, but I would imagine that it would work pretty well without it from the tests I ran today. If you do use a highpass filter, set the surround one to 300/3.50. Just to make sure this is obvious, I only use the highpass filter because all of the very low frequency sounds I hear end up in my subwoofer. I am learning more about minimum-phase filters, and will eventually rewrite the entire lowpass section that is used in the envelope detection. I have no idea when I will be able to do that though. As I said before, it is unfinished. I am sure that I have made some mistakes, particularly with the surround channels. As mentioned in my previous posts, any help to correct these is greatly appreciated. You might have noticed that I offered no absolutes, except for not being finished, in the previous paragraphs. I have only tried this on one system, and don't believe that I have any idea how it will work on yours. It's possible that I'm being paranoid, I hope I am anyway, but I just wanted to make this as obvious as possible. On the other hand, I believe that it would be fair to say that the version posted above is in no way even remotely as good as this new one. ![]() As for resources (I don't know the units), it uses: 129 Instrs (I'm assuming that stands for instructions) 129 GPRs 0 iTram/iTramSize: 0 (That was kinda obvious...oh well) 16 xTram/xTramSize 2/256 (This is for the response time that I mentioned in my July 1st post. I do recommend speaker delays after the processing.) For anyone who's interested in knowing before they try it, it uses 229 instructions and 174 GPRs when it is used with p16v and epilog. There are enough resources to have 80 GPRs and 483 instructions left over after adding a 10 Band EQ for the front, center, and surround channels as three separate entities when using an SB0244. Quote:
|
|
|
|
|
|
|
#13 |
|
DriverHeaven Newbie
Join Date: May 2009
Posts: 9
Rep Power: 0 ![]() |
Re: ((X)) Surround System
That last post got rather large! I forgot to mention that this plugin is significantly quieter than an unaltered signal. It has to be quieter to avoid distortion.
Here are some more sources to test it with: YouTube - Mario & Sonic at the Olympic Winter Games - Official Dutch Trailer [HD] YouTube - District 9 - Official Trailer 2 [HD] YouTube - [JGTC] Super GT 2008 Round-Final Fuji start YouTube - Xbox 360 - Forza Motorsport® 3 - E3 Trailer YouTube - Forza Motorsport 3 - Aston Martin DBS Gameplay[Alpha Build] [HD] YouTube - Gran Turismo 5 - Official E3 Trailer [HD] YouTube - GC 2008: Killzone 2 Multiplayer Trailer 1 [High Quality] YouTube - Gran Turismo 5 'GamesCom 09 Subaru Gameplay' TRUE-HD QUALITY |
|
|
|
|
|
#14 | |
|
DriverHeaven Newbie
Join Date: May 2009
Posts: 9
Rep Power: 0 ![]() |
Re: ((X)) Surround System
I've set up a new version. It fixes several of the problems in the last one.
Quote:
|
|
|
|
|
|
|
#15 |
|
kX Project Lead Programmer and Coordinator
Join Date: Dec 2002
Posts: 3,037
Rep Power: 56 ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Îòâåò: ((X)) Surround System
Thanks for the effect! I will add it to the next driver release. Unfortunately, I cannot test it myself: I only have stereo speakers at the moment...
E. |
|
|
|
|
|
#16 |
|
DriverHeaven Newbie
Join Date: Nov 2009
Posts: 2
Rep Power: 0 ![]() |
AW: ((X)) Surround System
Hello,
I am new here and found this thread. That´s exactly what I was looking for. Can someone explain me how to implement this Source Code in the Kx Driver. Do I have to copy it into a File an import it. Thanks Pat |
|
|
|
|
|
#17 |
|
DH Senior Member
Join Date: Jan 2003
Location: The Netherlands
Posts: 1,884
Rep Power: 48 ![]() ![]() ![]() ![]() |
Re: ((X)) Surround System
Copy the code,
save to a text file with extension .da, register it by doubleclicking the file, The effect should now be listed in the DSP menu. |
|
|
|
|
|
#18 |
|
DriverHeaven Newbie
Join Date: Nov 2009
Posts: 2
Rep Power: 0 ![]() |
AW: ((X)) Surround System
Thanks for your help, I renamed it an imported it in Kx. The first version of the plugin works fine. The newer versions I can´t import, it says wrong database. Any ideas?
Greets |
|
|
|
|
|
#19 | ||
|
d/h member-shmember
Join Date: Dec 2002
Location: Evil Empire
Posts: 2,418
Rep Power: 47 ![]() |
Îòâåò: ((X)) Surround System
Quote:
Just in case, i guess i have to put a few remarks here (though i tried to avoid this just to not spoil the fun), to prevent a.. uhmm, let's say "misinterpretation": Quote:
I'd suggest you first to try conventional kX's effects (installed with the driver) made for the similiar task ("stereo to surround upmixing") - for example "Surrounder(+)" or "ProLogica" - neither of two follow the "Dolby PL2" algorithms strictly, but at least they do not have major bugs/mistakes (while the code posted here does). --- p.s. For the same reason i already recommended to Eugene to NOT include the plugin to the next driver release. Don't take me wrong but the plugin does need some ... hmm ... let's say "polishing" before.
__________________
Last edited by Max M.; Nov 18, 2009 at 03:53 PM. |
||
|
|
|
![]() |
| Bookmarks |
| Tags |
| matrix, matrix surround, surround sound, surround system |
| Thread Tools | |
|
|