Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/denosaurs/opus
🔊 Deno bindings for libopus
https://github.com/denosaurs/opus
audio deno libopus opus
Last synced: 3 days ago
JSON representation
🔊 Deno bindings for libopus
- Host: GitHub
- URL: https://github.com/denosaurs/opus
- Owner: denosaurs
- License: mit
- Created: 2020-09-08T00:16:05.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-04-03T18:55:30.000Z (almost 4 years ago)
- Last Synced: 2024-10-30T01:22:25.316Z (4 months ago)
- Topics: audio, deno, libopus, opus
- Language: TypeScript
- Homepage: https://deno.land/x/opus
- Size: 507 KB
- Stars: 6
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# opus
[![Tags](https://img.shields.io/github/release/denosaurs/opus)](https://github.com/denosaurs/opus/releases)
[![CI Status](https://img.shields.io/github/workflow/status/denosaurs/opus/check)](https://github.com/denosaurs/opus/actions)
[![License](https://img.shields.io/github/license/denosaurs/opus)](https://github.com/denosaurs/opus/blob/master/LICENSE)```typescript
const SAMPLE_RATE = 48000;
const FRAME = 20;
const CHANNELS = 2;await Opus.load();
// Optimize encoding for audio. Available applications are VOIP, AUDIO, and RESTRICTED_LOWDELAY
let encoder = new Opus(SAMPLE_RATE, CHANNELS, OpusApplication.AUDIO);let frameSize = SAMPLE_RATE * FRAME / 1000;
// Get PCM data from somewhere and encode it into opus
let pcmData = new Uint8Array();
let encodedPacket = encoder.encode(pcmData, frameSize);// Decode the opus packet back into PCM
let decodedPacket = encoder.decode(encodedPacket);
console.log(decodedPacket);// Delete the encoder when finished with it (Emscripten does not automatically call C++ object destructors)
encoder.delete();
```## Maintainers
- Filippo Rossi ([@qu4k](https://github.com/qu4k))
## Other
### Related
- [opusscript](https://github.com/abalabahaha/opusscript) - nodejs bindings for libopus 1.3.1, ported with emscripten
### Contribution
Pull request, issues and feedback are very welcome. Code style is formatted with `deno fmt` and commit messages are done following Conventional Commits spec.
### Licence
This project is using the MIT license and is a port of [abalabahaha/opusscript](https://github.com/abalabahaha/opusscript)
to deno.Copyright (c) 2016-2020 abalabahaha
Copyright (c) 2020-2021 the denosaurs team