MCPcopy Index your code
hub / github.com/dylagit/audio-limiter

github.com/dylagit/audio-limiter @v0.1

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.1 ↗ · + Follow
17 symbols 29 edges 4 files 0 documented · 0% updated 4y agov0.1 · 2022-05-23★ 362 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Motivation

Sometimes when watching videos or streams on my computer there is a sudden noise which is very loud and painful.

In addition, sometimes I am on a voice call with friends and we are loud.

I wanted a way to be able to lower these loud sounds a bit. That is, I wished for a way to either lower my own microphone's peaks, or to lower all peaks that I hear through my earbuds.

I searched online and didn't find much. Voicemeeter Banana was probably the best one, but it's a very large and complex program with an overwhelming user interface. I also had trouble getting it working and was experiencing issues with static. I just wanted something simpler.

Description

This program can hopefully be that. The intention is for the interface to be extremely boring. Simply select your input device, output device, and threshold, and hit start. That's it. Then all sound piped through the input device will be limited (according to the threshold) and sent to the output device.

Compiling From Source

Install Rust if you don't have it already and then clone the repository and run cargo run in the root folder.

Setup

If you don't have a virtual audio cable to pipe audio through already, then you'll probably need to download one.

This one works fine for me and is the one I'm currently using. So I'd recommend downloading that.

Then, you want to make sure all your sample rates match (otherwise they'll become out of sync and start dropping audio). For example, if you plan to use the program with your microphone and computer sound, then go to your Sound Settings on your computer, select all the relevant sound devices, and go to their properties, and make sure all the sample rates match up.

I personally made all of my devices 16 bit, 48000 Hz like this:

Audio Device Setup

Using The Program

Let's say you wanted to limit all incoming sound on your computer. Here's how you would do that:

First, change your playback device on your computer from your speakers / headphones to Cable Input:

Playback Devices

Then, run audio-limiter.exe. It should look something like this:

Audio Limiter

Next, you'll want to change the Input Device to Cable Output.

Then, you'll want to change the Output Device to your speakers / headphones. Then click Start. If it works, the Start button's text should change to Stop. If it didn't, then something went wrong. It should now look like this:

Audio Limiter Settings

Now start listening to music / videos / whatever, and adjust the Threshold until it all sounds normal. Now, if a loud sound occurs, its magnitude should be blunted.

Disclaimer

I have no idea what I'm doing. The main reason why I made this open-source with a detailed tutorial is that I'm hoping someone who does know what they're doing comes along and either suggestions improvements, or ideally just submits a pull request and improves things.

As it stands, I'm still brand new to Rust, have no education whatsoever with regard to digital audio processing, and only started learning about making user interfaces in Rust yesterday.

That is, this program barely works, if at all. I would love for it to be much better, so I am extremely receptive to any proposed changes.

I would love if there was a way for the program to automatically determine the threshold instead of having to adjust it all the time, but I'm not sure how to do that, or if it's even possible. In addition, it might be nice to have some additional parameters for how blunted the sound should become, and things of that nature. But, as stated, I'm a complete noob, so I'll need a lot of help if you would like those features as well.

Core symbols most depended-on inside this repo

calc_tau
called by 4
src/compressor.rs
ar_avg
called by 2
src/compressor.rs
create_combo_box
called by 2
src/gui.rs
get_devices
called by 1
src/streaming.rs
create_stream
called by 1
src/streaming.rs
limiter
called by 1
src/compressor.rs
compress
called by 1
src/compressor.rs
get_device_name
called by 1
src/gui.rs

Shape

Function 9
Method 6
Class 2

Languages

Rust100%

Modules by API surface

src/gui.rs8 symbols
src/compressor.rs6 symbols
src/streaming.rs2 symbols
src/main.rs1 symbols

For agents

$ claude mcp add audio-limiter \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page