• Stars
    star
    445
  • Rank 98,085 (Top 2 %)
  • Language
    C
  • License
    BSD Zero Clause L...
  • Created about 8 years ago
  • Updated 6 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Algorithms for sound filters, like reverb, dynamic range compression, lowpass, highpass, notch, etc

sndfilter

Algorithms for sound filters, like reverb, dynamic range compression, lowpass, highpass, notch, etc.

It's easy to find countless math equations on sound filters, but a bit harder to find simple source code. This library is my attempt at cleaning up and presenting the math-heavy filter algorithms for the programming community.

Please note that I favored simple code over fast code. Hopefully it's made it more understandable.

(MIT License)

Build Instructions

The ./build script is a simple bash script that compiles the source files using clang. It's dirt simple, I promise.

Simply run ./build and the executable should be ./tgt/sndfilter.

C++ Support

This project is pure C, but I've left PRs open for those who want C++ support. Check them out, they might save you some time:

Filters

Implementation

The reverb.c, compressor.c, and biquad.c are the core algorithms.

I do not understand the biquad math, so please don't ask me any questions :-). The core formulas were extracted from Biquad.cpp (Chromium source), and cleaned up a bit to make easier to read.

The compressor came from DynamicsCompressorKernel.cpp (also from Chromium), and cleaned up a bit more. I swapped out the adaptive release curve and simplified the knee calculations. I feel a little more comfortable with that algorithm because there isn't a whole lot of magical math involved.

The reverb effect is a complete rewrite of Freeverb3's Progenitor2 algorithm. It took quite a lot of effort to tear apart the algorithm and rebuild it, but I'm pretty sure it's right.

More Repositories

1

polybooljs

Boolean operations on polygons (union, intersection, difference, xor)
JavaScript
604
star
2

gvasm

Assembler and disassembler designed specifically for Game Boy Advance homebrew.
TypeScript
51
star
3

sink

Minimal programming language for embedding small scripts in larger programs
JavaScript
50
star
4

adsrnode

Advanced ADSR envelope node for WebAudio
HTML
32
star
5

whisky

A collection of stateless random number generators in C
C
26
star
6

polybool

Boolean operations on polygons (union, intersection, difference, xor)
TypeScript
18
star
7

basicmidi

Reads and writes MIDI files into a reasonable intermediate format
C
11
star
8

nvqm

Numeric, Vector, Quaternion, and Matrix functions, consistent across multiple programming languages
C
9
star
9

gba-sound-demo

GBA sound demos for testing different sample rates and bit depths
HTML
9
star
10

spline

Spline functions in different languages (Catmull-Rom spline)
C
8
star
11

simple-js-synth

Simple JavaScript synthesizer using Web Audio
HTML
7
star
12

gvsong

Music engine for the Game Boy Advance written in gvasm assembly
TypeScript
6
star
13

music-theory

A place to store my music theory notes and experimental scripts
HTML
6
star
14

basicwav

C99 library for saving/loading WAV files
C
4
star
15

midimap

Command line tool for generating and mapping MIDI messages (OSX)
Objective-C
3
star
16

nightmare

Audio engine for games based on synthesizing music and sound effects.
C
3
star
17

auntflora

Port of Aunt Flora's Mansion to Game Boy Advance
C
2
star
18

cnvui

Simple JavaScript UI for Canvas
JavaScript
1
star
19

boxburner

Generates patterns for laser cutting
TypeScript
1
star
20

smb3-physics

Reimplentation of Super Mario Bros 3 phyiscs in JavaScript
HTML
1
star