Clipfix mod

This was one of my first attempts at modifying a Nyquist plug-in (so please don’t expect good coding style 🙂

Someone asked me about how to fix some badly clipped audio. Repairing clipped audio is bad enough at any time, but in this case the problem was exacerbated because not only were some of the peaks clipped, but “inverted”

distorted audio with inverted peaks
distorted audio with inverted peaks

The modification to the standard ClipFix effect looks for inverted regions and converts them to “flat tops” by replacing the inverted section with a constant value that is equal to the clipping amplitude:

Inverted audio removed
Inverted audio removed

The plug-in then runs a second pass using the standard ClipFix code to reconstruct the peaks on the clipped regions.

Please note that this is an experimental plug-in and may contain bugs. Hopefully I’ll have time to revisit this effect at some time in the future and complete it.

Right click to save ESP-clipfix.ny
(For Internet Explorer “Save Target As”)

2 thoughts on “Clipfix mod”

  1. I get “Nyquist returned the value: 100000”. Using “debug”, I get this:


    error: bad argument type - #(# #)
    Function: #
    Arguments:
    #(# #)
    100000000
    Function: #
    Arguments:
    S1LENGTH
    (SND-LENGTH S LARGENUMBER)
    1> #(# #)
    1> 0
    1> 0.5
    1> error: unbound variable - S1LENGTH
    if continued: try evaluating symbol again
    ...

    (I’m running Audacity 2.1.0).
    Any idea?
    Thanks in advance.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.