Go Back   Cockos Incorporated Forums > REAPER Forums > REAPER Q&A, Tips, Tricks and Howto

Reply
 
Thread Tools Display Modes
Old 01-29-2020, 10:22 AM   #1
TBProAudio
Human being with feelings
 
TBProAudio's Avatar
 
Join Date: May 2014
Location: Germany
Posts: 643
Default Dialog editing: Automatic Dialog-Roomtone-Mixer, free JSFX plugin

Some time ago I stumbled across the Maat MTG plugin: it "automatically" fills the gaps with room information when cutting dialog.
Whoever works with voice or dialog recordings often knows the problem: after cutting, you can hear an unnatural silence in the gaps.
A plugin that automatically fills these gaps can be very helpful and saves a lot of time. And gives the dialog its naturalness back.

After reading the description of MTG, I thought that such a function should be very easy to implement in Reaper with a JSFX plugin.
Said and done. Here it is: the free Dialog-RoomTone-Mix Plugin.

The multi-channel plug-in directs the dialog or room signal to the plug-in output depending on the level of the dialog signal.
The cross-fading is done smoothly and without any delay. The length of the room-audio does not matter as long it overlaps well with the gaps of the dialog signal.
The plugin expects the sliced dialog signal on channel 1 + 2, the room signal on channel 3 + 4.

The plugin has two controls:
Mono mode: off / on, in mono mode only channels 1 and 3 are used.
Output Monitor: Mix (dialog + room signal, standard), Dialog (dialog signal only) and Room (room signal only).

Furthermore, the plugin shows whether dialog or room signal is being delivered.

Here is a short video on how to use the plugin. The effect of (missing) room-signal is best heard with quality headphones.


>>Video<<

Reaper is a great and very flexible DAW. Challenges as described above can be solved quickly and easily without having to pick external plugins.
Just do it yourself! I hope you find the plugin useful. Questions and comments at any time.

Thomas
TBProAudio


JSFX Plugin Code:


Code:
// Copyright 2020, tb-software.com
// All rights reserved.
//
//Redistribution and use in source and binary forms, with or without modification, are permitted 
//provided that the following conditions are met:
//
//Redistributions of source code must retain the above copyright notice, this list of conditions 
//and the following disclaimer. 
//
//Redistributions in binary form must reproduce the above copyright notice, this list of conditions 
//and the following disclaimer in the documentation and/or other materials provided with the distribution. 
//
//The name of tb-software.com may not be used to endorse or 
//promote products derived from this software without specific prior written permission. 
//
//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 
//IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 
//FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
//BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 
//(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
//PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 
//STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 
//THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

// DialogRoomMixer
// by TBProAudio 2020 (www.tb-software.com)

/*
The challenge:
Mixing dialog audio can be a lengthy task because you often have to clean up the recordings. 
Usually this is done by slicing the audio and muting the unwanted parts.
Sometimes the dialog recoding has room content. In this case, it sounds unnatural if you listen to the sliced audio because the room content is missing in the dialog gaps.

The solution:
A plugin which mixes automatically sliced dialog audio and room content.

Usage:
Dialog track 1 (1-2 channels)
Room content track 2 (1-2 channels)
JSFX on mix track (4 channels), voice track on 1 + 2, room track on 3 + 4

Track 1: Slice the dialog audio and mute parts to remove breath and other unwanted noise.
Track 2: Fill the dialog gaps with room audio content (audio without dialog).

The plugin fades in either dialog or room content depending on dialog presence.
This fills the sliced dialog audio nicely with room audio.
*/


// Changelog
// 1.0: Initial release


desc:Dialog-Roomtone-Mixer 1.0 (TBProAudio 2020)

in_pin:Dialog 1
in_pin:Dialog 2
in_pin:Room 1
in_pin:Room 2
out_pin:Mix 1
out_pin:Mix 2

// off=stereo, on=mono
slider1:0<0,1,{Off,On}>Process Mono
// Level Detection Speed                           
slider2:10<10,1000,1>-Env. Follower (ms)
// Fade Time between signals             
slider3:1<10,1000,1>-Mixing Response (ms)
// Dialog Gate Level
slider4:-70<-144,0,1>-Dialog Detection Level (dbFS)
// Monitor
slider5:0<0,2,{Mix,Dialog,Room}>Output Monitor   

// Current Output Level
slider20:0<-144,0,0.1>-*Peak AVG (dbFS)
// Current signal type
slider21:0<0,1,{Room,Dialog}>*Content

@init
function dround(x, n)
local (scale)
(
  scale = pow(10.0, n);
  floor(x * scale + 0.5) / scale;
); 

////////////////////////////////////////////////////////
// Envelope follower
function EF_Reset()
(
  this.runave   = 0.0;
);

function EF_Init()
(
  this.Amp2DBFS  = 6.0/log(2.0);
  this.EF_Reset();
);

function EF_Set(_time_s, _srate)
(
  this.coef = pow(10.0,-1.0/(_time_s * _srate));
);

function EF_Process(_in0)
(
  this.maxspl = abs(_in0);
  
  this.runave = this.maxspl + this.coef * (this.runave - this.maxspl);
  
  this.runave;
);

function EF_Get()
(
  this.runave;
);

function EF_Get_db()
local(ret)
(
  ret = log(this.EF_Get())*this.Amp2DBFS;
    
  ret;
);

PeakFollow.EF_init();
PeakFollow.EF_set(slider2/1000,srate);

MixDialog.EF_init();
MixDialog.EF_set(slider3/1000,srate);

// EO@init

@slider

PeakFollow.EF_set(slider2/1000,srate);
MixDialog.EF_set(slider3/1000,srate);
// EO@slider 

@block

slider20 = dround(max(PeakFollow.EF_Get_db(), -144),1);
slider21 =  (MixDialog.EF_get() > 0.5);
// EO@block
 
@sample

  // Fill envelope follower
  det = 0.0;
  (slider1) ?
  (
    det = spl0;
  ):
  (
    det = (spl0+spl1)/2.0;
  ); 

  PeakFollow.EF_Process(det);
 
  // Dialog/Room detection
  (PeakFollow.EF_Get_db() > slider4) ?
  (
    MixDialog.EF_Process(1.0);
  ):
  (
    MixDialog.EF_Process(0.0);
  );
  
  // Fade between dialog 1+2 and room (3+4) depending on dialog detection
  _out0 = 0.0;
  _out1 = 0.0;
  
  (slider5 == 0) ?
  (
    _out0 = spl0 * MixDialog.EF_get() + spl2 * (1 - MixDialog.EF_get());
    (slider1 == 0) ? _out1 = spl1 * MixDialog.EF_get() + spl3 * (1 - MixDialog.EF_get());
  ):
  (slider5 == 1) ?
  (
    _out0 = spl0 * MixDialog.EF_get();
    (slider1 == 0) ? _out1 = spl1 * MixDialog.EF_get();
  ):
  (slider5 == 2) ?
  (
    _out0 = spl2 * (1 - MixDialog.EF_get());
    (slider1 == 0) ? _out1 = spl3 * (1 - MixDialog.EF_get());
  );

  // output
  spl0 = _out0;
  spl1 = _out1;
  spl2 = 0.0;
  spl3 = 0.0;
/*
  // Debug only  
  spl4 = PeakFollow.EF_Get();
  spl5 =  MixDialog.EF_get();
  spl6 =  (1 - MixDialog.EF_get());
*/

// EO@sample

//@gfx 400 200
// EOL@GFX
__________________
www.tbproaudio.de

Last edited by TBProAudio; 01-29-2020 at 11:39 PM.
TBProAudio is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 06:35 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.