A modular command line digital signal processor built in rust. Ever wanted to pipe raw audio samples around in the terminal to impress your friends at a party? Well then, you've come to the right place. earwig
is a collection of CLI audio processors which harness the power of stdin
and stdout
to send samples down the signal chain.
For example: ./in sample.wav | ./choppy | ./out
Mainly because once I had the idea, I couldn't unthink it... Also I wanted to become more familiar with digital signal processing, especially in rust
. And actually I think it might be a really fun music making tool.
-
cargo build --release
-
./target/release/in | ./target/release/choppy | ./target/release/out
listen
Listens on a default input device and pipes every sample represented as an amplitude between -1 and 1 tostdout
.play [path/to/file.wav] [loop]
Reads an audio file from disk and pipes every sample represented as an amplitude between -1 and 1 tostdout
. Passingloop
argument means the file will be repeated indefinitely.silly [OPTIONS] [F] [WAVE]
Oscillator... Silly... Get it?
out
Audio output module. Slurps up samples fromstdin
and streams them as audible audio to the nearest output device.imaginary [--width] [--height] [path]
PNG output module. Slurps up samples fromstdin
and creates a png in which several amplitudes are represented by their maximum to fit the given width in pixel.
choppy [chunk_size_ms] [max_buffer_len_secs]
Chop up some audio semi-randomly. Fills a fixed length buffer with samples recieved fromstdin
then continually chops it up in a semi-random way, pipes chopped audio samples tostdout
. All args optional.clippy [threshold] [alignment] [alignment]
It looks like you are trying to clip samples to an absolute value below the threshold amplitude. Unless clippy is chaotic, in which case it does the opposite. Oh, and if clippy is evil, it eats samples rather than fixing them.extremely [t]
Linearly interpolate each sample toward +/-1,t
between zero and one determines how much to prioritize the extreme value.hungry [threshold]
Eats up any sample below the threshold amplitude.randomly [t]
Linearly interpolate each sample toward random values,t
between zero and one determines how much to prioritize the random value.reversi [ms]
Reverses the order of samples within the passed time period.smashy
Can't quite explain what this does, it sounds like extreme compression being applied in an unpredictable manner. Takesstdin
sends viasdout
.smoothy [n]
Average each sample with the lastn
samples.smiley [manic|cynic]
Constrains samples to stay positive. Results in very mild distortion.speedy [x]
Changes the speed by factorx
. For example,speedy 0.5
halves the speed.wobbly [x]
Modulates speed against a control signal, which makes everything sound.... wobbly....wobbly 0.5
generates an LFO at frequency 0.5 and modulates the passed samples accordingly.
Yes please!! When doing so, bare in mind:
- one module per file in
src/
- add a
[[bin]]
entry toCargo.toml
for your new module - add a line to https://github.com/sandreae/earwig#modules describing the module a little
- modules should be fun.. This includes: pointless, "really??", plain noisy, "is it working?" and funky
- lots of code comments please
- keep on the simple side of the tracks where possible, fewer dependencies and transparent logic is prefered