Custom Filter - Bleep Censor Tone Filter

I just created a “Bleep Censor Tone” custom filter for Shotcut - with a lot of help from Claude AI!

I got the idea from this thread:

It seems to be working. First, here’s a short demo. No commentary - just me applying the filter to a clip. Apologies for anyone who might be offended by some mildly profane language:

Claude also helped me to write full instructions for it, too. Here’s the intro, from the full instructions:

This is a custom Shotcut filter that replaces audio with a censor tone (“bleep” sound). Instead of splitting a clip and swapping in a tone clip for every single bad word, you apply the Bleep Censor Tone filter once to a track and flip a checkbox on/off at each spot that needs censoring.

Requirement: Requires Shotcut 26.6 or newer — that’s the version that added support for custom filter UIs.

Devised by Shotcut user and Forum member JonRay, with help (and a long chat)… with Claude AI.

Full instructions (PDF file):

Bleep Censor Tone filter - instructions (final).zip (112.0 KB)

Note: I had to compile a DLL file for Windows named “beep.dll”. I had no idea how to do this; Claude did all the work.. but I had to think of all the right questions to ask, and correct him when things didn’t work…

Linux and macOS users will have to compile their own files for it to work. It is above my skill level to do this, and I have zero time available to ask Claude, but I can provide the files that Claude sent me if requested… but can’t help further than that.

I’m happy to share this ZIP with 3 files in it:

Bleep censor filter for Shotcut (JR) - all 3 files - Copy.zip (36.2 KB)

@shotcut or @brian - feel free to use or adapt these files as you like (if you are interested in them) - maybe with a view to including it in future Shotcut versions? However, I am aware that they may need a lot of work to get them up to the high standard of all other filters, so I don’t mind at all if you don’t use it.

For me this was mostly an experiment to see if making a custom filter could be done, and it’s my first attempt at creating a custom filter.

2 Likes

Ehm :slight_smile: I’m using GNU/Linux so… what must I do? :slight_smile:

1 Like

Oh no, I hoped you were on Windows… what a shame. OK, I will post a folder of files which Claude sent me from which I was able to compile a DLL file which worked in Windows.

Then, if you are an expert coder, you will know what to do, but otherwise you might have to ask AI (Claude, gemini etc). I recommend Claude for this one - Although Gemini is good with coding, in this case I found Claude to be much more much more thorough than Gemini . Gemini did try to solve it first, but we ran into a dead end.

If I can find some time I can ask a few questions myself but I’m pretty busy. And actually on vacation… :wink:

Anyway here is the folder of files which Claude sent me:

Bleep censor files from Claude 01.zip (25.2 KB)

This is counter to the spirit of scripts for Shotcut. They should be independent. BAD ARCHITECTURE! If you want to add a capability to the engine, you should do it now as an external plugin (VST2 or LV2) and distribute .qml files for it. Please ask Claude to change this to use that approach.

1 Like

No, it’s OK. I will leave any coding whatsoever I did in good faith and stop trying to contribute.

1 Like

I never used Claude, maybe I have to ask Gemini but generally I don’t like AI. Will try somehow…

1 Like

I’m sorry I misunderstood this as script instead of a filter with its UI. The issue is that this is a new LADSPA plugin, and the MLT in Shotcut does not read LADSPA plugins installed to locations other than the Shotcut install. OTOH, it does read VST2 and LV2 from the system and user-supplied paths:

It you put things into the Shotcut install dir, it has a good change of being removed on an update or reinstall. And some installs do not allow modifying the Shotcut program folder (Microsoft Store app, macOS, Linux AppImage/Snap/Flatpak).

2 Likes

Ok, I’m beginning to understand what you were saying now. I just didn’t understand why you thought I was showing bad behaviour and said it so curtly… and why you didn’t approve. OK, I have calmed down a little. I get it. I can try to change the approach and go down the VST2 or LV2. I’ll see what Claude says, and explain that what he did was poor form.

1 Like

Dan, I’m calmer now. I ran your concerns past Gemini (I’m timed-out with Claude for 5 hours…) and this is his reply, in a series of screen captures (minus the code he sent after each step). Can you just say whether this is an approved approach or not? I don’t want to tread on any toes or unknowingly do anything wrong..:grinning_face: If it’s a good approach I will pursue it further, if that’s OK with you…or take your advice if it’s not a good idea.

Gemini’s answer (minus the code he sent for each step, which I will download):

Also, if I do this, will it work for users on Linux and/or macOS?

Please be aware I’m not a coder.

Yes, that is correct including the install path. I need to update my docs for the LV2 path. I can help you adapt the .qml files if needed after this change.

1 Like

OK, thanks Dan. I can see more and more now why you weren’t too keen on my earlier effort.

Thank you.

Dan, I tried to get this working with the help of Gemini and Claude, but I can’t get it to work and I have given up with it. I put the lv2 folder in the %APPDATA%\LV2 path, and the meta and ui qml files in Shotcut’s App data folder (extensions>filters).

I ran Shocut with --experimental.

The Bleep Censor Tone filter shows up in Shotcut and the keyframes are created as expected when I press “Bleep here”, but the sound doesn’t change to a bleep.

In SC’s Application Log it says

[Info   ]  No LV2 plugins were found! Check your LV2_PATH environment variable.

I tried some other existing lv2 effects folders which I downloaded from the internet, but they are not being found by Shotcut either.

Feel free to free to take a look at these files if you have time or if you are interested in this.

Beep Censor Tone files (jonray).zip (9.2 KB)

There is a bug on Windows in a library Shotcut uses to support LV2. I have to code a workaround for it for the next version of Shotcut. To workaround this, you need to set the LV2_PATH manually to the expanded form of %APPDATA%\LV2

Next, the mlt_service value in your meta.qml is incorrect. It should be
“lv2.http^//yourdomain.org/plugins/bleep_censor_tone”. The AI tried to create & set a resource: to somewhat do that, but it got it wrong. You need to remove that line:

import QtQuick
import org.shotcut.qml

Metadata {
    type: Metadata.Filter
    isAudio: true
    name: qsTr("Bleep Censor Tone")
    mlt_service: "lv2.http^//yourdomain.org/plugins/bleep_censor_tone"
    objectName: "bleepCensorTone"
    keywords: qsTr('beep bleep censor tone sine mute curse profanity swear bleeper')
    qml: "ui.qml"

Now, I get the UI but I do not hear any bleep when I use it. That is because ui.qml is wrong. It is using incorrect property names like frequency when it should be 0 (meta.qml is correct).

meta.qml (1.1 KB)
ui.qml (5.4 KB)

P.S. You do not need to use --experimental for this; that is only to use the UI generator.

1 Like

Thanks Dan for your information, code and files. Much appreciated.

Do you mean C:\Users\\AppData\Roaming\LV2? I tried putting the LV2 there but I still get no beep, and app log still says

Line 138: [Info   ] <MLT> No LV2 plugins were found! Check your LV2_PATH environment variable.

PS I also put another LV2 in there and SC isn’t picking it up. Never mind, I will wait for the next release. I appreciate all the work you are doing.

That path is correct if your username is included. You need to put the plugin’s .lv2 folder in there and not just the DLL.

Can you please upload a zip of your LV2 plugin’s source code?

1 Like

I used the correct appdata folder, with my username in the path. I put the .lv2 folder in it, plus two other .lv2 folders I found online. SC’s app log says No LV2s found.

Sure. Also in the zip file are the two LV2 folders I found online, rnnoise_stereo and rnnoise_mono. Note, there is a filter showing up in SC called “RNNoise” but I don’t think that is being picked up as a LV2. Not 100% sure, though.

bleep_censor_tone.lv2.zip (12.4 MB)

1 Like

In the meantime, here is another possible workaround for @Asbesto and others:

Steps:

Put your video track on a track in Shotcut.

Generate an audio tone from the generate menu. Place it on a track.
Make it the length of your audio track.

MUTE it.
(I detached the audio and moved the video track up a couple of tracks)
Next:
Start Shotcut playing.
Press SHIFT + S where you want the beeps to begin and end. This splits ALL TRACKS.

Go through and press Z (lift) (or delete) on every split section you want to remove (Audio track) AND every split section you want to KEEP (tone track).

In practice, this means lifting or deleting each section in a zig-zag pattern.

Then UNMUTE the Tone track, and play. You could then tweak the position of the sections by dragging the edges of the audio track and the tone track. Best to deselect snapping!

Quick demo, after using a lot of Undos and pressing Redo to show the steps for splitting all tracks:

1 Like

How are you setting the environment variable LV2_PATH?