Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Hard Limiting with SOX (Read 2664 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Hard Limiting with SOX

Howdy
Does anyone have any tips on achieving a hard limiter type effect with sox and the compand effect?

I have a recording from vinyl that generally peaks at -6db, but occasionally a click or pop will show up all the way up to 0db. All I want to do is tame these stray clicks so that they don't screw with normalisation later.

In audacity, I do this using the hard limiter effect, set to -6db.

I've come up with compand 0.1,0.1 -6,-6,0,-6 0 -90 0.1 which to me says

put one point of the transfer function at -6,-6 (so everything below this remains unchanged), and put another point at 0 (x-axis) and -6 (y-axis) so that anything above -6 would be limited to -6db.

I'm unclear what to put for 'initial level' so I used the suggested -90, and I set the delay to match the attack exactly 0.1 so it would be a lookahead limiter. I would think however that I would want an attack closer to 0, but wasnt sure if that was supported in sox.

I am attaching a short sample that includes one 'pop' I would like to limit to -6db.

Any tips?

Thanks yall

Re: Hard Limiting with SOX

Reply #1
I've never used SoX but there are specailized applications for "cleaning up" digitized vinyl.    These tools will probably work better if you don't first limit the click.

Wave Corrector (fully automatic) is now FREE!   I've used Wave Repair ($30 USD) for a long time.   It's manual, so it only "touches" the audio where you identify a defect and it offers several repair methods/algorithms, but it's VERY time consuming.     It does an audibly perfect job removing most (but not all) clicks & pops.   It's often easier to remove the really bad clicks & pops, probably because they are easiest to "find".

Or, Audacity has an automatic Click Removal effect, a manual Repair effect, or as a last resort you can zoom-in and re-draw the waveform.   Audacity also has a good limiter.

O, if you simply want to clip the waveform, you can amplify (by +6dB in your case) with SoX, or Audacity, or whatever, and export as a regular (integer) WAV file.   That will normalize your file at the same time.

Re: Hard Limiting with SOX

Reply #2
Thanks for the tips.
I am specifically trying to do this with sox and I'm not really trying to necessarily remove the clicks automatically, I just want to limit them so that I can run normalisation and get a better result.
(side note: I have tried this with an audacity macro and that appears to be broken, 'this operation cannot be done until importation of FILE1.wav completes').

Its not a terrible idea to just boost the signal, but I'm afraid that might make the click worse by clipping it so harshly. Still, its a good idea and I'm going to try just boosting and see how that works.

But really, I'm curious how to set the compand up in sox for hard limiting.

Thanks again

Re: Hard Limiting with SOX

Reply #3
Quote
and I set the delay to match the attack exactly 0.1 so it would be a lookahead limiter. I would think however that I would want an attack closer to 0, but wasnt sure if that was supported in sox.
The documentation is confusing (to me) but I think you've got it right.  (I guess you can't enter a negative attack time so you have to use the delay.) 

"The proof is in the pudding"...   Is it working for you as-expected?  

Quote
side note: I have tried this with an audacity macro and that appears to be broken, 'this operation cannot be done until importation of FILE1.wav completes').
Did you try it without a macro?  

I've done a couple of quick experiments with the Audacity limiter and it seems to look-ahead slightly when set to "hard limit"...  The wave shape didn't seem to change...   I couldn't see any distortion when I zoomed-in.    (There were older versions of Audacity that would simply clip when set to 'hard limit" but the current version is much nicer.)

 

Re: Hard Limiting with SOX

Reply #4
"The proof is in the pudding"...   Is it working for you as-expected?
Ha no, absolutely not - that's why I'm asking for advice on what I'm doing wrong. It appears that nothing is happening.

Did you try it without a macro?
Yes - I can achieve the effect I want in Audacity using the hard limiter set to -6db. However doing it via macro appears to be broken - audacity apparently doesn't want to process a file until the full waveform is drawn, but it tries (and fails) anyway. This looks like a bug to me.

So if anyone knows how I can achieve a hard-limiter effect in sox, I'm all ears!

Thanks!