Hi,
I have created a plugin using Plug'n Script to process audio from variable density optical soundtrack negatives. When attempting to playback from negatives, these tracks have severe distortion resulting from the logarithmic gamma curve of the film. Normally, the reversal printing to a positive track would have corrected this, but these days, no one is going to make a print, so we have been tasked with processing the audio from the negatives. This script is working pretty well, but I need to add one more process. I need a high-pass filter to remove the DC offset in my audio, as well as attenuate some low frequency noise in the original track.
I'm hoping someone may be able to give me an idea why the Biquad highpass filter is behaving strangely when I add it to my script, but works fine when it is in another plugin following my script.
Here's my script code (I have commented out the filter):
/** \file "Gamma v2.cxx 071023 B.Weitz"
* Gamma Correction with Gain, Phase Invert, and High Pass Filter.
*/
/* include your dsp files.
*
*/
#include "library/BiquadFilter.hxx"
#include "library/Constants.hxx"
// Create a biquad filter instance
//KittyDSP::Biquad::Filter filter(audioInputsCount);
//double freqFactor=2*PI*20/sampleRate;
array<string> inputParametersNames = {"INVERT", "GAIN", "PROCESS", "OFFSET", "GAMMA"/*, "HIGH PASS"*/};
array<string> inputParametersUnits = {"", "dB", "", "", "", ""};
array<string> inputParametersEnums = {"OFF;ON", "", "OFF;ON", "", ""/*, "OFF;ON"*/};
array<double> inputParameters(inputParametersNames.length);
array<int> inputParametersSteps = {2, 41, 2, 0, 201/*, 2*/};
array<double> inputParametersMin = {0, -14, 0, 20, 0/*, 0*/};
array<double> inputParametersMax = {1, 6, 1, 40, 100/*, 1*/};
array<double> inputParametersDefault = {1, 0, 0, 31, 45.5/*, 0*/};
bool phaseInvert = false;
double gain = 0;
bool gammaEnable = false;
double offset = 0;
double gamma = 1;
//bool highPassEnable = false;
void processSample(array<double>& ioSample)
{
// Apply reverse logarithmic taper to offset control
double offsetScaled = pow(10, offset / 100) - 1;
for (uint channel = 0; channel < ioSample.length; ++channel)
{
// Apply input Gain
ioSample[channel] *= gain;
// Apply phase invert if enabled
if (phaseInvert)
{
ioSample[channel] = -ioSample[channel];
}
// Apply gamma processing if enabled
if (gammaEnable)
{
// Apply offset
ioSample[channel] += offsetScaled;
// Apply gamma correction
ioSample[channel] = pow(ioSample[channel], gamma / 5);
}
// Apply high-pass filter if enabled
//if (highPassEnable)
//{
// filter.processSample(ioSample);
//}
}
}
void updateInputParameters()
{
phaseInvert = (inputParameters[0] > 0.50);
gain = pow(10, inputParameters[1] / 20);
gammaEnable = (inputParameters[2] > 0.50);
offset = inputParameters[3];
gamma =inputParameters[4];
//highPassEnable = (inputParameters[5] > 0.50);
// filter.setResonantHighPass(freqFactor*pow(1000, .078), 0.707);
}
PnS: Need help with adding high-pass filter to my script
Official support for: bluecataudio.com
Moderator: Blue Cat Audio
PnS: Need help with adding high-pass filter to my script
2023-07-14T01:20:32+00:00
Hi,
I have created a plugin using Plug'n Script to process audio from variable density optical soundtrack negatives. When attempting to playback from negatives, these tracks have severe distortion resulting from the logarithmic gamma curve of the film. Normally, the reversal printing to a positive track would have corrected this, but these days, no one is going to make a print, so we have been tasked with processing the audio from the negatives. This script is working pretty well, but I need to add one more process. I need a high-pass filter to remove the DC offset in my audio, as well as attenuate some low frequency noise in the original track.
I'm hoping someone may be able to give me an idea why the Biquad highpass filter is behaving strangely when I add it to my script, but works fine when it is in another plugin following my script.
Here's my script code (I have commented out the filter):
/** \file "Gamma v2.cxx 071023 B.Weitz"
* Gamma Correction with Gain, Phase Invert, and High Pass Filter.
*/
/* include your dsp files.
*
*/
#include "library/BiquadFilter.hxx"
#include "library/Constants.hxx"
// Create a biquad filter instance
//KittyDSP::Biquad::Filter filter(audioInputsCount);
//double freqFactor=2*PI*20/sampleRate;
array<string> inputParametersNames = {"INVERT", "GAIN", "PROCESS", "OFFSET", "GAMMA"/*, "HIGH PASS"*/};
array<string> inputParametersUnits = {"", "dB", "", "", "", ""};
array<string> inputParametersEnums = {"OFF;ON", "", "OFF;ON", "", ""/*, "OFF;ON"*/};
array<double> inputParameters(inputParametersNames.length);
array<int> inputParametersSteps = {2, 41, 2, 0, 201/*, 2*/};
array<double> inputParametersMin = {0, -14, 0, 20, 0/*, 0*/};
array<double> inputParametersMax = {1, 6, 1, 40, 100/*, 1*/};
array<double> inputParametersDefault = {1, 0, 0, 31, 45.5/*, 0*/};
bool phaseInvert = false;
double gain = 0;
bool gammaEnable = false;
double offset = 0;
double gamma = 1;
//bool highPassEnable = false;
void processSample(array<double>& ioSample)
{
// Apply reverse logarithmic taper to offset control
double offsetScaled = pow(10, offset / 100) - 1;
for (uint channel = 0; channel < ioSample.length; ++channel)
{
// Apply input Gain
ioSample[channel] *= gain;
// Apply phase invert if enabled
if (phaseInvert)
{
ioSample[channel] = -ioSample[channel];
}
// Apply gamma processing if enabled
if (gammaEnable)
{
// Apply offset
ioSample[channel] += offsetScaled;
// Apply gamma correction
ioSample[channel] = pow(ioSample[channel], gamma / 5);
}
// Apply high-pass filter if enabled
//if (highPassEnable)
//{
// filter.processSample(ioSample);
//}
}
}
void updateInputParameters()
{
phaseInvert = (inputParameters[0] > 0.50);
gain = pow(10, inputParameters[1] / 20);
gammaEnable = (inputParameters[2] > 0.50);
offset = inputParameters[3];
gamma =inputParameters[4];
//highPassEnable = (inputParameters[5] > 0.50);
// filter.setResonantHighPass(freqFactor*pow(1000, .078), 0.707);
}
Bob_W
https://www.kvraudio.com/forum/memberlist.php?mode=viewprofile&u=617653
-
Blue Cat Audio Blue Cat Audio https://www.kvraudio.com/forum/memberlist.php?mode=viewprofile&u=39981
- KVRAF
- 5843 posts since 8 Sep, 2004 from Paris (France)
- Contact:
Post by Blue Cat Audio » Tue Jul 18, 2023 1:52 pm
Just looking at the code, it seems that you are doing the filtering inside the for loop, so it is actually processing the frame as many times as you have channels. If you just close the for loop bracket before the filter (instead of after), it should probably work fine.
Post Reply
2 posts
• Page 1 of 1
Jump to
- The Main Forums
- ↳ KVR Studio Manager
- ↳ KVR Experts
- ↳ Getting Started (AKA What is the best...?)
- ↳ Instruments
- ↳ Effects
- ↳ Hosts & Applications (Sequencers, DAWs, Audio Editors, etc.)
- ↳ Guitars
- ↳ Mobile Apps and Hardware
- ↳ Soundware
- ↳ Samplers, Sampling & Sample Libraries
- ↳ Hardware (Instruments and Effects)
- ↳ Modular Synthesis
- ↳ Sound Design
- ↳ Production Techniques
- ↳ Music Theory
- ↳ Computer Setup and System Configuration
- ↳ DSP and Plugin Development
- ↳ DIY: Build it and they will come
- ↳ Music Cafe
- ↳ Sell & Buy (+Special Offers, Deals & Promos)
- ↳ KVR Developer Challenge 2023
- ↳ Everything Else (Music related)
- ↳ Off Topic
- ↳ Off Topic Classics
- Official Company Forums
- ↳ 2getheraudio
- ↳ accSone
- ↳ Acon Digital
- ↳ AcousticsampleS
- ↳ AcousModules
- ↳ Agitated State
- ↳ AIR Music Technology
- ↳ AMG
- ↳ Ample Sound
- ↳ Antares Audio Technologies
- ↳ Apisonic Labs
- ↳ apulSoft
- ↳ AriesCode
- ↳ Arts Acoustic
- ↳ Arturia
- ↳ Audjoo
- ↳ AudioSpillage
- ↳ Audiority
- ↳ Best Service
- ↳ Big Tick
- ↳ Bitwig
- ↳ Controller Scripting
- ↳ Blue Cat Audio
- ↳ Cherry Audio
- ↳ CWITEC
- ↳ Embertone
- ↳ energyXT
- ↳ Eventide
- ↳ Expert Sleepers
- ↳ forward audio
- ↳ Future Audio Workshop
- ↳ FXpansion
- ↳ g200kg
- ↳ Harrison Mixbus
- ↳ HG Fortune
- ↳ Homegrown Sounds
- ↳ HoRNet Plugins
- ↳ Ilya Efimov Production
- ↳ Image Line
- ↳ Impact Soundworks
- ↳ Indiginus
- ↳ Insert Piz Here
- ↳ Ju-X
- ↳ Kirk Hunter Studios
- ↳ Kirnu
- ↳ Kong Audio
- ↳ Krotos
- ↳ Kuassa
- ↳ KV331 Audio
- ↳ LennarDigital
- ↳ Les Productions Zvon
- ↳ Liqube Audio
- ↳ Loomer
- ↳ LVC-Audio
- ↳ Maizesoft
- ↳ Manytone Music
- ↳ MeldaProduction
- ↳ Mellowmuse
- ↳ MIDIMood
- ↳ moForte
- ↳ Mozaic Beats
- ↳ mucoder
- ↳ MusicDevelopments
- ↳ Tips & Tricks
- ↳ MusicLab
- ↳ MUTOOLS
- ↳ New Sonic Arts
- ↳ NUSofting
- ↳ Oli Larkin Plugins
- ↳ Orange Tree Samples
- ↳ patchpool
- ↳ Photosounder
- ↳ PlugInGuru
- ↳ Polyverse Music
- ↳ Precisionsound
- ↳ Premier Sound Factory
- ↳ Psychic Modulation
- ↳ Realitone
- ↳ Resonance-Sound
- ↳ Reveal Sound
- ↳ Roger Linn Design
- ↳ rs-met
- ↳ S3A: Spatial Audio
- ↳ SaschArt
- ↳ Smart Electronix
- ↳ sonible
- ↳ SonicBirth
- ↳ Sonic Reality / eSoundz.com
- ↳ Soundiron
- ↳ SPC Plugins
- ↳ Sugar Bytes
- ↳ TAL Software
- ↳ Tokyo Dawn Labs
- ↳ Tracktion
- ↳ u-he
- ↳ u-he Linux support
- ↳ United Plugins
- ↳ VAZ Synths
- ↳ Virharmonic
- ↳ Wolfgang Palm
- ↳ xoxos
- ↳ XSRDO - SynthCraft
- ↳ ZynAddSubFX
- Site Stuff
- ↳ Site Stuff
- Archived Forums
- ↳ AlgoMusic
- ↳ easytoolz
- ↳ Elevayta
- ↳ Hollow Sun
- ↳ Kazrog
- ↳ LinPlug
- ↳ Muse Research and Development
- ↳ Shuriken
- ↳ SoHa Sound Design
- ↳ Soniccouture
- ↳ Topten Software
- ↳ Tweakbench
- ↳ Valhalla DSP
- ↳ CK Modules & VST
- ↳ Sennheiser AMBEO
- ↳ Muon Software
- ↳ Westgatesounds.net
- ↳ Squaredheads
- ↳ Sonigen
- ↳ CFA-Sound
- ↳ Back In Time Records
- ↳ Livelab.dk
- ↳ Skytopia
- ↳ audioD3CK
- ↳ Inspire Audio
- ↳ Krakli
- ↳ Drumdrops
- ↳ Futucraft
- ↳ OverTone DSP
- ↳ RaXnTraX
- ↳ solar3d-software
- ↳ Signaldust
- ↳ Soundemote
- KVR Forum index
- All times are UTC
- Delete cookies