|
1 | | -# opus |
| 1 | +# opus: Haskell Bindings to libopus |
2 | 2 |
|
| 3 | +> This is an active fork of previous work at |
| 4 | +> [alios/opus](https://github.com/alios/opus) |
| 5 | +> with permission granted from the original author to publish the package/code |
| 6 | +> under the same name. |
3 | 7 |
|
4 | | -## get test files |
| 8 | +Xiph.Org Foundation's Opus Audio codec is a widely used audio codec for VoIP and |
| 9 | +streaming. `libopus` is the reference implementation of an encoder and decoder |
| 10 | +for this codec, and is available to be used via various package managers |
| 11 | +[under the BSD-3 license](https://opus-codec.org/license/). |
| 12 | + |
| 13 | +This Haskell package provides bindings to `libopus`'s encoding and decoding |
| 14 | +functionality. It is continuously tested against the official audio vectors in |
| 15 | +the project CI (on GitHub). |
| 16 | + |
| 17 | +The package also provides Conduit functions for encoding and decoding, for easy |
| 18 | +use in streaming scenarios. |
| 19 | + |
| 20 | +## Usage |
| 21 | + |
| 22 | +1. Add `opus` to your cabal/stack project dependencies |
| 23 | +2. Install `libopus` and `pkg-config` (used for finding where libopus is): |
| 24 | + 1. **On Windows**: Run the following commands in your MSYS2 environment: |
| 25 | + ``` |
| 26 | + pacman -S mingw64/mingw-w64-x86_64-pkg-config |
| 27 | + pacman -S mingw64/mingw-w64-x86_64-opus |
| 28 | + ``` |
| 29 | + If you do not know where your MSYS2 environment is, but you installed |
| 30 | + the Haskell toolchain using GHCup, try: |
| 31 | + ``` |
| 32 | + ghcup run -m -- pacman -S mingw64/mingw-w64-x86_64-pkg-config |
| 33 | + ghcup run -m -- pacman -S mingw64/mingw-w64-x86_64-opus |
| 34 | + ``` |
| 35 | + 2. **On MacOS**: Run the following commands: |
| 36 | + ``` |
| 37 | + brew install opus |
| 38 | + ``` |
| 39 | + 3. **On Ubuntu/Debian**: Run the following commands: |
| 40 | + ``` |
| 41 | + apt-get install pkg-config |
| 42 | + apt-get install libopus-dev |
| 43 | + ``` |
| 44 | +3. Import and get going! For example, import `Codec.Audio.Opus.Encoder` to use |
| 45 | + the `opusEncoderCreate` and `opusEncode` functions. |
| 46 | +
|
| 47 | +## Development |
| 48 | +
|
| 49 | +To develop locally, you will need the `pkg-config` (pre-installed on Mac) and |
| 50 | +`libopus` system packages, as described above. |
| 51 | +
|
| 52 | +To run tests locally, you will also need the Opus test vectors available within |
| 53 | +a directory called `opus_newvectors`. The following command will do just that: |
5 | 54 |
|
6 | 55 | ``` |
7 | | -$ curl -OL https://opus-codec.org/docs/opus_testvectors-rfc8251.tar.gz |
| 56 | +curl -L https://opus-codec.org/static/testvectors/opus_testvectors-rfc8251.tar.gz | tar -xz |
8 | 57 | ``` |
9 | 58 |
|
| 59 | +## License |
| 60 | +
|
| 61 | +`test/opus_compare.c` was taken as-is from Xiph.Org Foundation under the BSD-3 |
| 62 | +license. |
| 63 | +
|
| 64 | +This project as a whole is licensed under the BSD-3 license. Please see the |
| 65 | +LICENSE file for more information. |
| 66 | +
|
| 67 | +Copyright (c) 2018 Markus Barenhoff |
| 68 | +Copyright (c) 2021-2022 Yuto Takano |
| 69 | +Copyright (c) 2025-PRESENT Haskell Opus Library Contributors |
10 | 70 |
|
11 | | -test/opus_compare.c is taken as-is from Xiph.Org Foundation under the BSD-3 license. |
|
0 commit comments