Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
keichan34 committed Jan 5, 2025
1 parent b7a3114 commit 13399ae
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
21 changes: 20 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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).
Expand Down
5 changes: 5 additions & 0 deletions tsconfig.dist.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"declaration": true,
"declarationMap": true,
"sourceMap": true
},
"include": ["ts/**/*.ts"],
"exclude": ["node_modules", "dist", "ts/**/*.test.ts"]
}

0 comments on commit 13399ae

Please sign in to comment.