Old 09-15-2019, 03:24 PM   #1
DrTT
Human being with feelings
 
Join Date: Jan 2019
Posts: 68
Default JSFX-SOX: EEL2 Reimplementation of some SOX effects

Dear all,

I am almost a bit embarrassed to present my JSFX-SOX tool package here in this forum, because most other FX presented have very well implemented user interfaces, while mine only allows some parametrization via sliders and just processes audio. (For my rehabilitation at least some debug views are built-in (like e.g. a memory viewer), but all in all they cannot compete UI-wise with other offerings here.)

Nevertheless the package may be worthwhile, because JSFX-SOX implements some of the audio processing effects from SOX like filters, compander, reverb etc. SOX (http://sox.sourceforge.net/) is a command line audio processing tool for Unix, Windows and Mac OS that transforms source audio files in several formats into other audio files. Although SOX does not always provide the "best" effects, it still is a reliable and well-defined audio tool.

Several of the sox effects have been rewritten by me in JSFX-SOX. I also restructured the original C code for easier maintenance during the transformation into EEL, because in the original sources there are some redundancies and unnecessary complexity due to its several contributors. The effects provided aim at producing bit-exact identical renderings in the DAW, i.e. one can be sure that the DAW will produce exactly the same results as the external rendering by sox.

Note that a spiffy user interface is not at all a priority in this project, but only the correct reproduction of the sox algorithms with adequate (slider) parametrisation.

By the way: the correctness of implementation can easily be tested by rendering some audio externally with SOX and internally with the plugins and subtracting the results. Apart from roundoff errors (SOX often uses 32bit integer processing, while EEL always uses double floating point processing) the results cancel out with typically a residual noise of -140dBFS (with 24 bit FLAC files) or even less for higher external bit depths (see figure 1).




Figure 1: Checking the Residual Noise of JSFX-SOX Effects in a Reaper Test Project

Why is this helpful? I am using a command-line based toolchain for generating band notation videos from a text file score in the lilypond notation language plus some configuration file telling about instruments and audio postprocessing etc. The main idea in that tool-chain is that generation of those notation videos with audio tracks can be done with command-line open-source tools from text files without any human intervention.

Part of this tool-chain is sox, because the raw audio generation from MIDI via fluidsynth needs some beefing up by an audio processor.

If you're interested, you can find details on this tool-chain at (https://www.tensi.eu/thomas/iPod/notation-video.html with its source at GitHub https://github.com/prof-spock/Lilypo...VideoConverter).

Of course, since a configuration-driven generation is not very interactive, you sometimes just have to tweak effect settings or instruments directly. Hence I am using Reaper on intermediate audio files of the tool-chain and fiddle with the audio postprocessing there to get the necessary parameters for the command line tool-chain.

Note, however, because sox has rich command line options for its effects, not every effect configuration from sox can be transported into the slider oriented GUI for JSFX. E.g. the compander of sox allows the definition of a transfer function having multiple segments. Although the internal engine of the JSFX compander implements exactly the same internal segment logic, the user interface only allows the typical definition of a threshold and a compression ratio (with three segments).

This is okay for my purposes, but might be problematic for expert sox users. All those deviations from sox are documented in the manual. As an example figure 2 shows the UI of a two-band MCompander with this logic.




Figure 2: Two-Band MCompander in JSFX-SOX

All in all, the following effects are available in this package:
  • allpass: a biquad allpass filter two-poled with filter frequency and the filter bandwith (in several units),
  • band: a biquad bandpass filter with center filter frequency and the filter bandwith (in several units) and an option for unpitched audio,
  • bandpass/bandreject: a biquad filter for bandpass or bandreject with center filter frequency and the filter bandwith (in several units),
  • bass/treble: a biquad filter for boosting or cutting bass or treble with a shelving characteristics with settings for filter frequency and the filter bandwith (in several units),
  • biquad: a generic biquad (iir) filter with 6 coefficients b0, b1, b2, a0, a1 and a2,
  • compand: a compander with attack, release, input gain shift, threshold and compression and soft knee; this is a reduced version of SOX compand with only a simple transfer function,
  • equalizer: a biquad filter for equalizing with settings for the pole count, the filter frequency and the filter bandwith (in several units),
  • gain: a volume changer by exact decibels...,
  • lowpass/highpass: a biquad filter for either lowpass or highpass with settings for the pole count, the filter frequency and the filter bandwith (in several units),
  • mcompand: a multiband compander with a Linkwitz-Riley crossover filter and for each band a compander with attack, release, input gain shift, threshold and compression and soft knee; again the companders only allow a simple transfer function,
  • overdrive: a simple tanh distortion with gain and colour specification,
  • phaser: a phaser effect with sine or triangle modulation,
  • reverb: a reverb effect (based on Freeverb) with several parameters for the room (like size and HF damping) as well as a possible predelay, and
  • tremolo: a tremolo effect with sine modulation using a double-sideband suppressed carrier modulation
The time-variant effects phaser and tremolo are time-locked (see post https://forum.cockos.com/showthread.php?p=2164884 and the documentation); hence the rendering can be exactly synchronized to externally rendered audio snippets.

Documentation is available here, the package itself is at https://github.com/prof-spock/JSFX-SOX-Plugins.

I am also currently looking into providing a ReaPack index file, but I am still working on it.

Hope this is helpful for you.

Best regards
DrTT
DrTT is offline   Reply With Quote
Old 11-16-2019, 10:00 AM   #2
DrTT
Human being with feelings
 
Join Date: Jan 2019
Posts: 68
Default

Dear all,

for easier installation of the JSFXSOX plugins (for bit-exact reproduction of SOX command-line effects) I have now provided an index.xml file for ReaPack.

You can find it at https://github.com/prof-spock/JSFX-S...ster/index.xml.

To import this package, select "Import Repositories..." in ReaPack and write the above URL into the appropriate edit field.

Best regards,
DrTT

Last edited by DrTT; 11-16-2019 at 10:16 AM.
DrTT is offline   Reply With Quote
Old 11-16-2019, 11:02 AM   #3
beingmf
Human being with feelings
 
beingmf's Avatar
 
Join Date: Jul 2007
Location: Jazz City
Posts: 5,073
Default

I'd love to try those, but how to add the repo to ReaPack? I know there's the index file, but I'm too dumb ...
__________________
Windows 10x64 | AMD Ryzen 3700X | ATI FirePro 2100 | Marian Seraph AD2, 4.3.8 | Yamaha Steinberg MR816x
"If I can hear well, then everything I do is right" (Allen Sides)
beingmf is offline   Reply With Quote
Old 11-17-2019, 06:15 AM   #4
DrTT
Human being with feelings
 
Join Date: Jan 2019
Posts: 68
Default

Hello beingmf,

when you have ReaPack available in Reaper, just select Extensions::ReaPack::Import repositories... and paste the index file location
https://github.com/prof-spock/JSFX-SOX-Plugins/raw/master/index.xml into the dialog window.

In principle ReaPack should scan that file and provide a new repository "Dr_TT" in your list. Enable this repository by checkmarking it.



Now you have to install the package via Extensions::ReaPack::Browse packages....

Right-click on the JSFXSOX package and you should see an "Install v0.9" entry in the context menu (here it is "Reinstall" because I have already installed this package). Select this entry and ReaPack should install the files into the "Effects" directory of Reaper.



Now you're ready to go. The JSFXSOX effects should appear in the list of effects within Reaper.
Hope this helps!

Best regards,
DrTT
DrTT is offline   Reply With Quote
Old 11-17-2019, 02:11 PM   #5
Eliseat
Human being with feelings
 
Eliseat's Avatar
 
Join Date: Mar 2018
Location: Cologne
Posts: 1,362
Default

Hi DrTT,

thanks for your effects. I tested some of them quickly and it seems that most of the parameter ranges are really extreme or not optimized for proper handling. Maybe I will take a closer look at them tomorrow and give you a more detailed feedback.

As already mentioned. Thanks for supporting the community with your efforts.

Greetings
Eli
__________________
☆.。.:*・°☆.。.:*・°☆.。.:*・°☆REAPER//✿◔‿◔)°☆.。.:*・°☆.。.:*・°☆
Eliseat is offline   Reply With Quote
Old 11-18-2019, 11:20 AM   #6
DrTT
Human being with feelings
 
Join Date: Jan 2019
Posts: 68
Default

Hello Eliseat,


thanks for your comments and also for looking deeper into the effects!

Quote:
Originally Posted by Eliseat View Post
I tested some of them quickly and it seems that most of the parameter ranges are really extreme or not optimized for proper handling. Maybe I will take a closer look at them tomorrow and give you a more detailed feedback.
You are quite right that some ranges are quite extreme, but be aware that the parameter ranges are not solely for musical purposes, but should mimic the ranges of the corresponding effects in SOX as far as possible.

When looking at the sox sources in https://github.com/chirlu/sox/tree/master/src you'll find e.g. the parameter settings in "phaser.c" (where "NUMERIC_PARAMETER" defines the range and the "p->" parts the default value) as
Code:
NUMERIC_PARAMETER(in_gain  , .0, 1)
NUMERIC_PARAMETER(out_gain , .0, 1e9)
NUMERIC_PARAMETER(delay_ms , .0, 5)
NUMERIC_PARAMETER(decay    , .0, .99)
NUMERIC_PARAMETER(mod_speed, .1, 2)
...
/* Set non-zero defaults: */
p->in_gain   = .4;
p->out_gain  = .74;
p->delay_ms  = 3.;
p->decay     = .4;
p->mod_speed = .5;
The corresponding implementation in JSFXSOX/SOX_Phaser.jsfx is
Code:
slider1:inGain=0.4<0,1,0.001>In Gain [dB]
slider2:outGain=0.74<0,1000,0.001>Out Gain [dB]
slider3:delayInMilliseconds=3.0<0,5,0.001>Delay [ms]
slider4:decay=0.4<0,0.99,0.001>Decay
slider5:frequency=0.5<0.1,2.0,0.001>Modulation [Hz]
So the outGain is even limited here to 1000 instead of the 1E9 in sox (because I thought that a gain of 10⁹dB might be a bit over the top...). The same logic applies to the other effects, where I tried to faithfully deduce the allowed ranges from the original code as far as possible.

So do not spend too much time on the range exploration; the ranges are typically not defined by me, but by sox.
But nevertheless, I am looking forward to hearing your analysis!

Best regards,
DrTT
DrTT is offline   Reply With Quote
Old 11-18-2019, 12:24 PM   #7
beingmf
Human being with feelings
 
beingmf's Avatar
 
Join Date: Jul 2007
Location: Jazz City
Posts: 5,073
Default

Quote:
Originally Posted by DrTT View Post
Hello beingmf,
[...]
Hope this helps!

Best regards,
DrTT
Thanks a lot - I've done this before, I just didn't know, that it's the "master/index.xml" URL that is recognized by ReaPack. So all good now, testing
__________________
Windows 10x64 | AMD Ryzen 3700X | ATI FirePro 2100 | Marian Seraph AD2, 4.3.8 | Yamaha Steinberg MR816x
"If I can hear well, then everything I do is right" (Allen Sides)
beingmf is offline   Reply With Quote
Old 01-05-2021, 04:20 PM   #8
ktm
Human being with feelings
 
Join Date: Jul 2020
Posts: 61
Default

Hi
just discovered this.
Did you also try implementing (if that is the right word) the SRC and the RIAA as JSFX?
Thanks
Ktm
ktm is offline   Reply With Quote
Old 01-05-2021, 04:40 PM   #9
vitalker
Human being with feelings
 
vitalker's Avatar
 
Join Date: Dec 2012
Posts: 13,333
Default

Quote:
Originally Posted by ktm View Post
Hi
just discovered this.
Did you also try implementing (if that is the right word) the SRC and the RIAA as JSFX?
The autor haven't visited forum since August.
vitalker is offline   Reply With Quote
Old 04-29-2021, 12:22 PM   #10
DrTT
Human being with feelings
 
Join Date: Jan 2019
Posts: 68
Default

Hello Ktm,

sorry, I did not expect any reactions 14 months after the publication ;-)

You wrote:
Quote:
just discovered this.
Did you also try implementing (if that is the right word) the SRC and the RIAA as JSFX?
No, I did not.

RIAA should not be too complicated (it is just a filter); but it has a limited utility for me, because I use all the effects during mixing or mastering and not for preparing input material.

And I do not know the SRC effect; what is it?

Best regards
DrTT
DrTT is offline   Reply With Quote
Old 04-29-2021, 05:18 PM   #11
clepsydrae
Human being with feelings
 
clepsydrae's Avatar
 
Join Date: Nov 2011
Posts: 3,409
Default

Quote:
Originally Posted by DrTT View Post
And I do not know the SRC effect; what is it?
(Presumably they are talking about sample rate conversion.)
clepsydrae is offline   Reply With Quote
Old 04-30-2021, 06:20 AM   #12
DrTT
Human being with feelings
 
Join Date: Jan 2019
Posts: 68
Default

Hello clepsydrae,

thanks for your clarification!
Quote:
Quote:
And I do not know the SRC effect; what is it?
(Presumably they are talking about sample rate conversion.)
Okay, that sounds plausible. But again this is a SoX functionality typically applied before writing the audio stream to some audio file.

And to be honest I have no idea how you could write a VST effect to do that, because the sample rate is defined by the VST host - the Reaper program - itself (very often as the project setting). I could imagine some usage of such an effect for increasing the sample rate for oversampling and then later do a downsampling, but I highly doubt whether this works in a typical DAW. At least in Reaper JSFX this is in my opinion impossible: for each sample read there is exactly one sample going out, hence you cannot change the sample rate by an effect in the chain.

Best regards
DrTT
DrTT 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 11:49 PM.


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