Skip to content

andrew-r-thomas/doghouse

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

doghouse

doghouse is a pitch detection library written in the zig language. It's still in very early stages, and for now it just implements the Yin pitch detection algorithm.

the name is inspired by this wonderful article.

usage

const doghouse = @import("doghouse");

const sec_per_samp: f32 = 1.0 / 44100.0;
var note: [1024]f32 = undefined;

for (0..1024) |i| {
    const float_idx: f32 = @floatFromInt(i);
    const val: f32 = @sin(float_idx * sec_per_samp * std.math.pi * 2 * 100);
    note[i] = val;
}

const yin = Yin(1024, 0.1);
const pitch = yin.detect_pitch(note, 44100);

std.debug.assert(std.math.approxEqAbs(f32, pitch, 100, 10));

example

A simple example for realtime usage can be found in the examples folder. To run the example, simply run zig build run.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages