|
|
|
01-13-2014, 07:51 AM
|
#1
|
Human being with feelings
Join Date: Feb 2011
Location: Adelaide, South Australia
Posts: 217
|
Reaper Dolby Prologic II Encoder
I recently got my hands on a Kenwood Surround Receiver (KRF-V5560D) which has a licensed Dolby Prologic II decoder, so, I was able to finish and test my DPLII encoder JS effect for Reaper.
This code implements a Dolby Prologic II Matrix Encoder as defined here:
http://en.wikipedia.org/wiki/Dolby_Pro_Logic
I then created a demo MP3 in Reaper:
http://picosong.com/krt4
Obviously, you need to play this on a DPLII system too hear the full effect, but also sounds cool on stereo, DPL and generic surround systems.
The code does not support Center or LFE, since centering can be achieved in ReaSurround, and LFE can be achieved by using a high pass filter on the side channel, which will centralize the low end frequencies, effectively sending it to the sub speaker.
Copy this code to a file in your Reaper JS effects folder.
Code:
/*
** Name: DPLII Quadrophonic Encoder
** Auth: Derek J. Evans (derek.john.evans@hotmail.com)
**
** Desc: Encodes a quadrophonic (4 channel) mix to a DPL/DPLII style stereo signal.
** To use, place this effect after a ReaSurround (set to quadrophonic). This encoder
** will take 4 channels (1-4) and output a stereo DPL/DPLII mix.
** I have tested this encoder on a Kenwood Surround Receiver (KRF-V5560D) which has a licensed
** Dolby Prologic II, DTS.
** Note: The phase adjust was taken from "JS: Utility/phase_adjust". Great Code!
** Date: Monday, 13 January 2014
*/
desc: DPLII Quadrophonic Encoder
@init
fftsize = 8192;
pdc_bot_ch = 0;
pdc_top_ch = 2;
pdc_delay = fftsize;
// Array Pointers
wind = 0;
buf0 = fftsize * 2; // Rear
buf1 = buf0 + buf0;
buf2 = buf1 + buf0; // Front
buf3 = buf2 + buf0;
pos = 0;
w = 2.0 * $pi / fftsize;
i = 0;
loop(fftsize / 2,
wind[i] = 0.42 - 0.50 * cos(i * w) + 0.08 * cos(2.0 * i *w);
i += 1;
);
phaseadj = $pi * 90.0 / 180.0;
cadj = cos(phaseadj);
sadj = sin(phaseadj);
db0 = sqrt( 1 / 2);
db1 = sqrt(19 / 25);
db2 = sqrt( 6 / 25);
@sample
pos >= fftsize ? (
tmp = buf0; buf0 = buf1; buf1 = tmp;
tmp = buf2; buf2 = buf3; buf3 = tmp;
fft(buf0, fftsize);
fft_permute(buf0, fftsize);
i = 0;
loop(fftsize / 2,
a = i;
b = a + 1;
x = buf0[a];
y = buf0[b];
buf0[a] = x * cadj - y * sadj;
buf0[b] = x * sadj + y * cadj;
a = 2 * fftsize - i - 2;
b = a + 1;
x = buf0[a];
y = buf0[b];
buf0[a] = x * cadj + y * sadj;
buf0[b] = -x * sadj + y * cadj;
i += 2;
);
fft_ipermute(buf0, fftsize);
ifft(buf0, fftsize);
pos = 0;
);
w1 = wind[pos / 2];
w2 = wind[(fftsize - pos) / 2 - 1];
sw = (w1 + w2) * fftsize;
FL = buf2[pos + 0]; // Front Left
FR = buf2[pos + 1]; // Front Right
RL = (buf0[pos + 0] + buf1[pos + 0 + fftsize]) / sw; // Rear Left
RR = (buf0[pos + 1] + buf1[pos + 1 + fftsize]) / sw; // Read Right
buf2[pos + 0] = spl0; // Front Left
buf2[pos + 1] = spl1; // Front Right
buf0[pos + 0] = spl2 * w1;
buf0[pos + 1] = spl3 * w1;
buf1[pos + 0 + fftsize] = spl2 * w2;
buf1[pos + 1 + fftsize] = spl3 * w2;
// Dolby Pro Logic II Encoding Matrix
spl0 = FL - RL * db1 - RR * db2; // Left Total
spl1 = FR + RL * db2 + RR * db1; // Right Total
pos += 2;
Cheers
Derek
|
|
|
01-13-2014, 09:57 AM
|
#2
|
Human being with feelings
Join Date: Jun 2012
Location: Spain
Posts: 7,239
|
wow very interesting! Thank you! I'll try this.
It would be nice to upload the test file with the reaper project setup to see how it is used.
Could you explain a bit more how to use it with a 5.1 source instead of 4 channels?
|
|
|
01-13-2014, 02:24 PM
|
#3
|
Human being with feelings
Join Date: Feb 2011
Location: Adelaide, South Australia
Posts: 217
|
For 5.1, use some pin connectors to send the center to the front channels. Convert to dblii and use a high pass filter to remove low end. Apply a low pass filter to the lfe (sub bass) channel and add that back into the stereo output.
But, in practice, it's better to just centeralize the sub bass and move center channels to the center using reasurround.
|
|
|
01-14-2014, 09:48 AM
|
#4
|
Human being with feelings
Join Date: Jun 2012
Location: Spain
Posts: 7,239
|
I think I got it
something like this
|
|
|
01-14-2014, 08:28 PM
|
#5
|
Human being with feelings
Join Date: Feb 2011
Location: Adelaide, South Australia
Posts: 217
|
Yep, that's the one. I had that implemented in the effect but it doesn't really do much, unless you are working in 5.1, and you want a dblii version. I also looked into adding low/high pass filters to the effect, but again, you might prefer using other filters or eq's. I use meldas eq's to adjust the front/back sound. I guess you would know you will need to low pass the lfe channel and high pass the other 5. Also, in the default 5.1 setup, the centers influence needs to be reduced, so you can still pan hard front left and right. Ie: the default influence causes a left signal to bleed into the right.
|
|
|
01-14-2014, 08:31 PM
|
#6
|
Human being with feelings
Join Date: Feb 2011
Location: Adelaide, South Australia
Posts: 217
|
Quote:
Originally Posted by derek.john.evans
Yep, that's the one. I had that implemented in the effect but it doesn't really do much, unless you are working in 5.1, and you want a dblii version. I also looked into adding low/high pass filters to the effect, but again, you might prefer using other filters or eq's. I use meldas eq's to adjust the front/back sound. I guess you would know you will need to low pass the lfe channel and high pass the other 5. Also, in the default 5.1 setup, the centers influence needs to be reduced, so you can still pan hard front left and right. Ie: the default influence causes a left signal to bleed into the right.
|
Oops, ya not using reasurround. Scratch my last comment :-)
|
|
|
01-21-2014, 09:43 PM
|
#7
|
Human being with feelings
Join Date: Feb 2011
Location: Adelaide, South Australia
Posts: 217
|
Just some more Dolby 5.1 ideas for people to play with:
http://forum.cockos.com/showthread.php?t=9608
I'll be trying this tonight.
On another topic. I tried a lot of different ways to add reverb to a quadrophonic mix. ie: Adding after encoding to DPLII, adding to the front, or back, or diagonal speakers, etc.
The method I like the most is, add the reverb to the instruments you require reverb on, and send the output to 2 unused channels.
Then in ReaSurround, pan the reverb as you would an instrument. This gives me the best level of control and simplicity.
|
|
|
01-22-2014, 07:14 AM
|
#8
|
Human being with feelings
Join Date: Jun 2012
Location: Spain
Posts: 7,239
|
Hi Derek... the other day I exported a test mp3 successfully. Stereo sounding good and my DPLII hardware decoder played it nicely in surround too.
But I also had a problem with another track where the sound was distorted like if it were clipping badly but levels didn't indicate any clipping. strange. I'll have to do some more tests.
Normally I don't use LFE or center channel for surround music, so it is good as it is.
|
|
|
02-01-2014, 09:26 PM
|
#9
|
Human being with feelings
Join Date: Feb 2011
Location: Adelaide, South Australia
Posts: 217
|
The Swiss Army Knife of Surround Sound Encoders!
I wrote this encoder this morning. Its a 10-to-2 channel surround sound encoder. It uses delays and not phase adjustments to minimize gain loading. I found this to sound better than phase adjustments which can make the high end harsh, and isn't great for real time mixing.
Basically this is a 10 tap delay, where each delay can be rotated.
Standard panning is -45deg to 45deg.
Dolby defines +/-75deg (approx) as rear left and rear right.
Ive been using +/-65deg (approx) as side left and side right.
Ive uploaded some screen shots of the settings I used for the demo mix.
NOTE: There are no compressors, limiters or reverbs. Just a low pass filter to extract a LFE channel, and a eq for the final output.
I also mixed in stereo, and used plugins to create a 10 channel mix to encode. You can use ReaSurround to create 5.1, 7.1 or 9.1 mixes if you wish.
One last note: If you do want to use a phase adjust, simply use Utility/Phase_adjust or BetaBugs PhaseBug to apply a 90deg shift to the channels you want. Basically, a 90deg phase shift creates a "clone" of your signal. The resulting signal will sound identical to the original, but will have a different wave form, which makes it possible for Dolby to separate the channels. But, I found, you still need a delay to reduce gain riding (read Dolby's doc's), and it also adds a simple reverb (space) effect.
Anyway. See what you think.
Demo track is here:
http://picosong.com/Y4zF
Code:
desc: 10-to-2 Channel Surround Sound Encoder
slider5:65<0,100,1>Output Level (%)
slider10:100<0,100,1>Front Left Level (%)
slider11:100<0,100,1>Front Right Level (%)
slider12:100<0,100,1>Front Center Level (%)
slider13:100<0,100,1>LFE Level (%)
slider14:100<0,100,1>Rear Left Level (%)
slider15:100<0,100,1>Rear Right Level (%)
slider16: 0<0,100,1>Side Left Level (%)
slider17: 0<0,100,1>Side Right Level (%)
slider18: 0<0,100,1>Left Height Level (%)
slider19: 0<0,100,1>Right Height Level (%)
slider20:-45<-90,90,0.1>Front Left Rotate (Deg)
slider21:+45<-90,90,0.1>Front Right Rotate (Deg)
slider22: 0<-90,90,0.1>Front Center Rotate (Deg)
slider23: 0<-90,90,0.1>LFE Rotate (Deg)
slider24:-75<-90,90,0.1>Rear Left Rotate (Deg)
slider25:+75<-90,90,0.1>Rear Right Rotate (Deg)
slider26:-65<-90,90,0.1>Side Left Rotate (Deg)
slider27:+65<-90,90,0.1>Side Right Rotate (Deg)
slider28:-55<-90,90,0.1>Left Height Rotate (Deg)
slider29:+55<-90,90,0.1>Right Height Rotate (Deg)
slider30:0<0,500,1>Front Left Delay (ms)
slider31:0<0,500,1>Front Right Delay (ms)
slider32:0<0,500,1>Front Center Delay (ms)
slider33:0<0,500,1>LFE Delay (ms)
slider34:0<0,500,1>Rear Left Delay (ms)
slider35:0<0,500,1>Rear Right Delay (ms)
slider36:0<0,500,1>Side Left Delay (ms)
slider37:0<0,500,1>Side Right Delay (ms)
slider38:0<0,500,1>Left Height Delay (ms)
slider39:0<0,500,1>Right Height Delay (ms)
@init
_slider30=-1;
_slider31=-1;
_slider32=-1;
_slider33=-1;
_slider34=-1;
_slider35=-1;
_slider36=-1;
_slider37=-1;
_slider38=-1;
_slider39=-1;
@slider
slider30!=_slider30?(_slider30=slider30;d0=in+floor(srate*slider30/1000)*10;);
slider31!=_slider31?(_slider31=slider31;d1=in+floor(srate*slider31/1000)*10;);
slider32!=_slider32?(_slider32=slider32;d2=in+floor(srate*slider32/1000)*10;);
slider33!=_slider33?(_slider33=slider33;d3=in+floor(srate*slider33/1000)*10;);
slider34!=_slider34?(_slider34=slider34;d4=in+floor(srate*slider34/1000)*10;);
slider35!=_slider35?(_slider35=slider35;d5=in+floor(srate*slider35/1000)*10;);
slider36!=_slider36?(_slider36=slider36;d6=in+floor(srate*slider36/1000)*10;);
slider37!=_slider37?(_slider37=slider37;d7=in+floor(srate*slider37/1000)*10;);
slider38!=_slider38?(_slider38=slider38;d8=in+floor(srate*slider38/1000)*10;);
slider39!=_slider39?(_slider39=slider39;d9=in+floor(srate*slider39/1000)*10;);
a=(slider20+45)*$pi/180; c0=cos(a)*slider10/100; s0=sin(a)*slider10/100;
a=(slider21+45)*$pi/180; c1=cos(a)*slider11/100; s1=sin(a)*slider11/100;
a=(slider22+45)*$pi/180; c2=cos(a)*slider12/100; s2=sin(a)*slider12/100;
a=(slider23+45)*$pi/180; c3=cos(a)*slider13/100; s3=sin(a)*slider13/100;
a=(slider24+45)*$pi/180; c4=cos(a)*slider14/100; s4=sin(a)*slider14/100;
a=(slider25+45)*$pi/180; c5=cos(a)*slider15/100; s5=sin(a)*slider15/100;
a=(slider26+45)*$pi/180; c6=cos(a)*slider16/100; s6=sin(a)*slider16/100;
a=(slider27+45)*$pi/180; c7=cos(a)*slider17/100; s7=sin(a)*slider17/100;
a=(slider28+45)*$pi/180; c8=cos(a)*slider18/100; s8=sin(a)*slider18/100;
a=(slider29+45)*$pi/180; c9=cos(a)*slider19/100; s9=sin(a)*slider19/100;
@sample
(in=in-10)<0?in=srate*10;
(d0=d0-10)<0?d0=srate*10;
(d1=d1-10)<0?d1=srate*10;
(d2=d2-10)<0?d2=srate*10;
(d3=d3-10)<0?d3=srate*10;
(d4=d4-10)<0?d4=srate*10;
(d5=d5-10)<0?d5=srate*10;
(d6=d6-10)<0?d6=srate*10;
(d7=d7-10)<0?d7=srate*10;
(d8=d8-10)<0?d8=srate*10;
(d9=d9-10)<0?d9=srate*10;
in[0]=spl0;
in[1]=spl1;
in[2]=spl2;
in[3]=spl3;
in[4]=spl4;
in[5]=spl5;
in[6]=spl6;
in[7]=spl7;
in[8]=spl8;
in[9]=spl9;
spl0=(d0[0]*c0+d1[1]*c1+d2[2]*c2+d3[3]*c3+d4[4]*c4+d5[5]*c5+d6[6]*c6+d7[7]*c7+d8[8]*c8+d9[9]*c9)*slider5/100;
spl1=(d0[0]*s0+d1[1]*s1+d2[2]*s2+d3[3]*s3+d4[4]*s4+d5[5]*s5+d6[6]*s6+d7[7]*s7+d8[8]*s8+d9[9]*s9)*slider5/100;
|
|
|
02-03-2014, 09:11 AM
|
#10
|
Human being with feelings
Join Date: Apr 2008
Posts: 259
|
Post Production mixing in Reaper
It seems I have to do some learnin' up on what's changed in Reaper since I stepped away...ReaSurround and now this, so I can get an LtRt printed simultaneously? holy monday morning brain explosion!!!
__________________
"We're like geeky and shit: I'm hanging out on a message board about a recording program. It's kinda expected to be all up in arms about something as ridiculously abstract as 24->16 bit dithering..." -RPR usr nickm
|
|
|
02-04-2014, 06:44 PM
|
#11
|
Human being with feelings
Join Date: Jun 2012
Location: Spain
Posts: 7,239
|
Thank you Derek
The new 10to2 seems amazing!
So, the stereo file that outputs would sound good on stereo, or 5.1 or 7.1 or 9.1 systems? Or only to Stereo and 9.1 systems?
Last edited by heda; 02-04-2014 at 07:06 PM.
|
|
|
06-05-2014, 01:42 AM
|
#12
|
Human being with feelings
Join Date: Apr 2013
Location: Perth, Australia
Posts: 169
|
Derek this is great! Especially the 10x2
Qu
1. So obviously the use of delay causes it to sound all flammy, Im assuming if you leave all delays at 0 you would then need to have your channel gain setup so that gain riding isnt an issue. Correct?
2. In a full 5.1 film mix for broadcast with say a target of -27 LUFS and -8db TruePeak do you think I would need to adjust gain? What is the gain increase factor from gain riding if delays werent used?
3. Do you know if the commercially available encoders like minn#### surc$$$ and neyr^^^ soun@@@@@@ [wink] use delays? cause their mixes come out relatively unscathed compared to yours with delays. Whats your guess as to how they tackle this? Inherent limiting?
|
|
|
10-26-2020, 10:14 AM
|
#13
|
Human being with feelings
Join Date: Jan 2013
Location: Montreal, Canada
Posts: 258
|
IS this thread still alive?
I've just acquired a good ol Yamaha HTR-6030 5.1 amp with Dolby Pro Logic. I have passed my audio out the SPDIF / COAX channel on my MOTU 1248 AVB - adn I do seem to get surround when I play back a movie file!
I would love to try doing some of my mixes in 5.1 and export the files to view / listen at home.
Is it possible to do it with this system? Where does ReaSurround come in?
Can anyone point a complete n00b to some 5.1 Reaper Mixing From A to Z resources?
Thank you!
|
|
|
10-26-2020, 12:21 PM
|
#14
|
Human being with feelings
Join Date: Feb 2017
Posts: 4,823
|
i'm in the same boat Tim, i've just acquired my first ever surround receiver (denon 3802) & am curious about all this sort of stuff too
|
|
|
10-26-2020, 01:49 PM
|
#15
|
Human being with feelings
Join Date: Jul 2010
Location: Silicon Valley, CA
Posts: 2,779
|
There is no "point-one" LFE in Pro Logic. And it works by "steering" to sound so you can't get 5 different sounds from the 5 speakers at the same time.
It's an older standard from the VHS days before we had DVDs & Blu-Rays with Dolby Digital 5.1 or DTS with 6 (or more) discrete channels. There are some older movies on DVD with the original Dolby Surround (Pro Logic) soundtracks.
If you are making a new surround recording I'd recommend using a true 5.1 (or 7.1) channel format rather than the Pro Logic format with the surround channels "matrix encoded" into the stereo mix.
However, there are various Pro Logic II "soundfield" playback settings that you can use with regular stereo. I use the "hall" setting (or similar) with regular stereo music to get some rear channel reverb.
You're not supposed to use the LFE with music. It's for "effects" (booms & explosions). The regular bass goes to the 5 surround channels, and on a normal home setup (with "small" speakers) the bass from those surround channels gets mixed with the LFE is re-routed to the subwoofer. (The receiver has a setting for "bass management" in case your regular small surround speakers can't reproduce the bass.)
|
|
|
10-26-2020, 04:43 PM
|
#16
|
Human being with feelings
Join Date: Feb 2017
Posts: 4,823
|
cheers for the info.
Quote:
Originally Posted by DVDdoug
If you are making a new surround recording I'd recommend using a true 5.1 (or 7.1) channel format rather than the Pro Logic format with the surround channels "matrix encoded" into the stereo mix.
|
and can this be done in Reaper (with ReaSurround)?
|
|
|
10-26-2020, 08:06 PM
|
#17
|
Human being with feelings
Join Date: Jan 2013
Location: Montreal, Canada
Posts: 258
|
Thanks for that info Doug - but here's what I *really* want for Christmas: to sit down at Reaper with *only* my SPDIF out to Yamaha in, a blank project and a step-by-step list of "Here's what you have to do to go from knowing sweet EFF ALL to mixing my latest Music Release or Home Movie or freakin TikTok in glorious 5.1, taking it home to the living room HTPC, playing the MP4 file and having everyone go WOWWWW OMG COOOL."
Here's what I have so far:
1) Reaper
2) ReaSurround
3) SPDIF out from audio interface
4) Yamaha HTR-6030 with Dolby Pro Logic II
That's all I got, that's all I will have.
Anyone fill in any blanks? Let's make a sticky!
|
|
|
10-27-2020, 10:24 AM
|
#18
|
Human being with feelings
Join Date: Aug 2006
Location: Berlin
Posts: 11,817
|
ProLogic II does not depend on digital transmission like Dolby Digital or Dolby E does. The first time I used ProLogic II was a looooong damn time ago when had a Logitech Z5500 surround setup(inexpensive but good for the price). It could decode ProLogic II to 5.1.
Iirc it was one of the Zelda games that was using the stereo output of the console, so it would play fine on anything, but ProLogic II took to a nice level.
It's just a little better than good old Dolby Surround (4.1 decoded), so you could use the output of a mainboard and have your receiver decode it to get a good experience.
If your receiver cannot decode ProLogic II from a digital input (electrical SPDIF or optical) you need to take a look what the receiver CAN do. Maybe it can decode an analog Prologic II signal to 5.1.
|
|
|
10-27-2020, 06:24 PM
|
#19
|
Human being with feelings
Join Date: Jan 2013
Location: Montreal, Canada
Posts: 258
|
Quote:
Originally Posted by airon
If your receiver cannot decode ProLogic II from a digital input (electrical SPDIF or optical) you need to take a look what the receiver CAN do...
|
As I stated above, that is *exactly* what my receiver can do, and how I have it hooked up.
What's next?
|
|
|
11-27-2020, 02:15 PM
|
#20
|
Human being with feelings
Join Date: Aug 2020
Location: San Francisco
Posts: 298
|
matrix encoding/decoding were Dolby's first attempts at surround sound. it started with VCRs in 1982 (many founders were from Ampex and other core Founders were already out with the Rolling Stones and Grateful Dead SELLING Dolby noise reduction on for tape machines.) Ray Dolby himself was always inventing in his San Francisco home attic or traveling India.
so the VCR guys asked for a HiFi output to go with the new VCRs. they all probably knew each other anyway. matrix encoding is a known concept by DSP professionals. it doesn't take a lot of math to sell the concept*. BUT Dolby added noise reduction and naturally understood DSP from analog circuitry and applied some IP to make it into a new business model. like a new software synth idea that the others still won't quite cut it, but it's 1970s technology, so it's resistors, capacitors and op amps.
then they invented Dolby Digital, got into Dolby Vision and those two IPs are now in the latest silicon release from Intel.
*hint: to decode you compare the phase of two incoming signals, find the difference and steer them accordingly. how do you build the 'transmitter' end?
in hindsight it seems that the releasing a simple matrix encoder/decoder way back then with Ray Dolby designing it is STILL a gateway drug into surround sound. you can get into it by accident and you're hooked. 'by any means necessary it can be done! <kinda>'.
|
|
|
11-27-2020, 06:41 PM
|
#21
|
Human being with feelings
Join Date: Apr 2019
Posts: 379
|
awesome! It would be great to have a decoder as well... I remember I used to have the encoder/decoder in series in Pro Tools to monitor the final result and make the final adjustments
|
|
|
12-22-2020, 05:05 PM
|
#22
|
Human being with feelings
Join Date: Jan 2018
Posts: 19
|
You've seen a plugin doing both, it's called Surcode and costs more than $600.
So I'm more than happy I discovered this thread
|
|
|
06-06-2023, 11:23 AM
|
#23
|
Human being with feelings
Join Date: Feb 2018
Posts: 7
|
Is it compatible with Dolby Surround and Pro Logic 1?
In other words, can ot encode compatible audio that can be used as Dolby Surround track on VHS?
|
|
|
11-06-2023, 07:06 AM
|
#24
|
Human being with feelings
Join Date: Apr 2019
Posts: 379
|
a question: the title says Pro Logic Quadraphonic encoder, but then it says Pro Logic II
which one is it? Pro Logic is 4 speakers (L C R +LFE) while Pro Logic II is 6 speakers (L C R Ls Rs + LFE)
thank you for this awesome code!
|
|
|
11-06-2023, 08:20 AM
|
#25
|
Human being with feelings
Join Date: Jul 2010
Location: Silicon Valley, CA
Posts: 2,779
|
Why do you want to use this obsolete-inferior format?
I don't know anything about the REAPER encoder but with Pro Logic anything that's identical and in-phase in both stereo channels (typically dialog scenes) will be "steered" to the center speaker.
There is no LFE in Pro Logic but if you have an AVR the bass can be routed to a subwoofer.
|
|
|
Thread Tools |
|
Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 02:23 AM.
|