diff --git a/README.md b/README.md index 36b0f59..6c00a79 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,28 @@ # audio-snippet-detector -A Node.js module to detect audio features in an streaming audio source. +A Node.js module to detect audio features in an streaming audio source. The detector is written in Rust, and provides a Writable / Async Iterator interface to NodeJS code. > [!WARNING] > This is very, very alpha code. The interfaces may change at any time. +At this time, the detector code assumes 16-bit 16kHz signed-integer raw audio data. Providing anything else will probably result in garbage output. + +## How to use + +```typescript +import { AudioSnippetDetector } from "audio-snippet-detector"; +const detector = new AudioSnippetDetector(); + +// add the sounds you want to detect +detector.add_database('chime', fs.readFileSync('../audio.raw')); + +// now, you're ready to detect sounds +const streamingInput = fs.createReadStream('../some-large-file.raw'); +streamingInput.pipe(detector); +for await (const item of detector) { + console.log(`I detected ${item.label} (score: ${item.score})`); +} +``` + ## Building Building this package requires a [supported version of Node and Rust](https://github.com/neon-bindings/neon#platform-support). diff --git a/tsconfig.dist.json b/tsconfig.dist.json index 3a45466..d137818 100644 --- a/tsconfig.dist.json +++ b/tsconfig.dist.json @@ -1,5 +1,10 @@ { "extends": "./tsconfig.json", + "compilerOptions": { + "declaration": true, + "declarationMap": true, + "sourceMap": true + }, "include": ["ts/**/*.ts"], "exclude": ["node_modules", "dist", "ts/**/*.test.ts"] }