Skip to content

jsundqvist/goertzel-processor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

goertzel-processor

Usage:

let context = new (window.AudioContext || window.webkitAudioContext)();

await context.audioWorklet.addModule('goertzel-processor.js');
let goertzelNode = new AudioWorkletNode(context, 'goertzel-processor', {
    processorOptions: { // explicit defaults, can be omitted
        frequencies: [697, 770, 852, 941, 1209, 1336, 1477, 1633],
        blockSize: 512
    }
});
goertzelNode.port.onmessage = (e) => this.handleData(e.data); // <--
goertzelNode.connect(context.destination);

navigator.getUserMedia({audio: true}, (stream) => {
    let microphone = context.createMediaStreamSource(stream);
    microphone.connect(goertzelNode);
}, (e) => {
    console.error('Error getting microphone', e);
});

It's up to you to decide when you think a signal is detected :)

Inspired by https://github.com/sveljko/goertzel

About

Goertzel Filter, DTMF Decoder, AudioWorkletProcessor

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published