Kirika/README.md

147 lines
20 KiB
Markdown
Raw Normal View History

2022-02-22 09:24:49 +00:00
# [![](resources/kirikas.png)](resources/kirika.png) Kirika
Collection of audio utilities for decoding/encoding files and streams.
2022-03-01 17:10:01 +00:00
* Not based on ffmpeg/libav/libavcodec/libavformat and alike
* Channel-based audio consumption/filter chain
* Raw sample analyzer channels
* AnalyzerChannel channels / mergers / splitters / trimmers
2022-02-22 09:24:49 +00:00
* Audio resampler
* Audio downmixing to stereo/mono
2022-03-01 17:10:01 +00:00
* Multi-codec decoder and encoder
* Multi-format packetizers
* ReplayGain 2.0 track/album calculator
2022-02-28 14:47:50 +00:00
2022-03-01 17:10:01 +00:00
## Codecs supported
2022-02-28 14:47:50 +00:00
| Codec | Containers | Decoder | Analyzer | Encoder | Notes |
|:----------:|:----------------------------------------------------------------------------------------:|:-------:|:--------:|:-------:|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| **FLAC** | [FLAC](https://xiph.org/flac/format.html), [Ogg](https://xiph.org/flac/ogg_mapping.html) | ✅ | ✅ | ✅ | Adjustable encoding compression level and block size.<br/>Decoding/encoding by [libFLAC](https://github.com/xiph/flac) via [goflac](https://git.gammaspectra.live/S.O.N.G/goflac). |
| **TTA** | [TTA](https://www.tausoft.org/en/true_audio_codec_format/) | ✅ | ✅ | ✅ | Decoding/encoding via [go-tta](https://git.gammaspectra.live/S.O.N.G/go-tta). |
| **MP3** | [MP3](http://mpgedit.org/mpgedit/mpeg_format/MP3Format.html) | ✅ | - | ✅ | Adjustable encoding bitrate and mode.<br/>Decoding via [minimp3](https://github.com/kvark128/minimp3), encoding by [LAME](https://lame.sourceforge.io/) via [go-lame](https://github.com/viert/go-lame). |
| **Opus** | [Ogg](https://www.xiph.org/ogg/doc/framing.html) | ✅ | - | ✅ | Adjustable encoding bitrate.<br/>Decoding/encoding by [libopus](https://github.com/xiph/opus) via [go-pus](https://git.gammaspectra.live/S.O.N.G/go-pus). |
| **Vorbis** | [Ogg](https://www.xiph.org/ogg/doc/framing.html) | ✅ | - | ❌ | Decoding by [jfreymuth/vorbis](https://github.com/jfreymuth/vorbis) via [jfreymuth/oggvorbis](https://github.com/jfreymuth/oggvorbis). |
| **AAC** | [ADTS](https://wiki.multimedia.cx/index.php/ADTS) | ✅ | - | ✅ | Adjustable encoding bitrate and mode (LC, HEv2).<br/>Decoding/encoding by [FDK-AAC](https://github.com/mstorsjo/fdk-aac) via [go-fdkaac](https://git.gammaspectra.live/S.O.N.G/go-fdkaac). |
| **ALAC** | MP4* | ✅ | ✅ | ✅ | Decoding/encoding by [libalac](https://git.gammaspectra.live/S.O.N.G/alac) via [go-alac](https://git.gammaspectra.live/S.O.N.G/go-alac).<br/>*MP4 Decoding/encoding only supported on fragmented MP4 currently. |
2022-02-22 09:24:49 +00:00
2022-03-01 17:10:01 +00:00
## Container packetizers supported
2022-04-17 18:27:29 +00:00
| Container | Packetizer | Keep Mode | Sample Numbers | Notes |
|:---------:|:----------:|:---------:|:--------------:|:---------------------------------------------------------------------------------------------------------------------------------------|
| **FLAC** | ✅ | ✅ | ✅ | Uses [mewkiz/flac](https://github.com/mewkiz/flac) for parsing streams. |
| **TTA** | ❌ | - | - | |
| **MP3** | ✅ | ✅ | ✅ | Uses [sssgun/mp3](https://github.com/sssgun/mp3) as a frame parser. |
| **Ogg** | ✅ | ✅ | ✅* | *Sample numbers (absolute granule position in Ogg) depend on underlying codec implementing it.<br/>Has been tested as working for Opus |
| **ADTS** | ✅ | ✅ | ✅ | Uses [edgeware/mp4ff](https://github.com/edgeware/mp4ff) for its ADTS frame parser. |
| **MP4** | ❌ | - | - | |
2022-03-01 17:10:01 +00:00
2022-02-22 09:24:49 +00:00
## Dependencies
### Go >= 1.18
### [libFLAC](https://github.com/xiph/flac) (required by [goflac](https://git.gammaspectra.live/S.O.N.G/goflac))
2022-02-22 09:24:49 +00:00
```shell
sudo apt install libflac-dev
```
### [libopus](https://github.com/xiph/opus) and [libopusfile](https://github.com/xiph/opusfile) (required by [go-pus](https://git.gammaspectra.live/S.O.N.G/go-pus))
```shell
sudo apt install libopus-dev libopusfile-dev
```
2022-02-27 18:44:04 +00:00
### [libopusenc](https://github.com/xiph/libopusenc) (required by [go-pus](https://git.gammaspectra.live/S.O.N.G/go-pus))
```shell
2022-02-28 12:54:17 +00:00
git clone --depth 1 https://github.com/xiph/libopusenc.git
2022-02-27 18:44:04 +00:00
cd libopusenc
./autogen.sh
./configure --prefix /usr
make
sudo make install
```
2022-02-28 13:38:23 +00:00
### [FDK AAC Codec Library](https://github.com/mstorsjo/fdk-aac) (required by [go-fdkaac](https://git.gammaspectra.live/S.O.N.G/go-fdkaac))
2022-02-28 12:54:17 +00:00
```shell
git clone --depth 1 https://github.com/mstorsjo/fdk-aac.git
cd fdk-aac
./autogen.sh
./configure --prefix /usr
make -j$(nproc)
sudo make install
```
### [libalac](https://git.gammaspectra.live/S.O.N.G/alac) (required by [go-alac](https://git.gammaspectra.live/S.O.N.G/go-alac))
```shell
git clone --depth 1 https://github.com/mikebrady/alac.git
cd alac
autoreconf -fi
./configure --prefix /usr
make -j$(nproc)
sudo make install
```
2022-02-28 13:38:23 +00:00
### [LAME](https://lame.sourceforge.io/) (required by [go-lame](https://github.com/viert/go-lame))
2022-02-27 15:43:50 +00:00
```shell
sudo apt install libmp3lame-dev
```
2022-02-22 09:24:49 +00:00
### [libsamplerate](https://github.com/libsndfile/libsamplerate) (required by [gosamplerate](https://github.com/dh1tw/gosamplerate))
```shell
sudo apt install libsamplerate0-dev
```
### [libebur128](https://github.com/jiixyj/libebur128) (required by [go-ebur128](https://git.gammaspectra.live/S.O.N.G/go-ebur128))
```shell
sudo apt install libebur128-dev
2022-04-17 22:22:59 +00:00
```
## Licenses
### Kirika
```
Copyright (c) 2022 Kirika Contributors All rights reserved.
Redistribution and use in source and binary forms, with or without modification,are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
```
### Dependencies
Subdependencies that are not cgo-based are denoted in cursive.
| Dependency | License | Notes |
|:-----------------------------------------------------------------------:|:--------------------------------------------------------------------------------------------------------------------------------------------------:|:-------------------------------------------------------------------------------------------------------------------------------------|
| [S.O.N.G/go-alac](https://git.gammaspectra.live/S.O.N.G/go-alac) | [BSD 2-Clause](https://git.gammaspectra.live/S.O.N.G/go-alac/src/branch/master/LICENSE) | |
| [S.O.N.G/alac](https://git.gammaspectra.live/S.O.N.G/alac) | [Apache 2.0](https://git.gammaspectra.live/S.O.N.G/alac/src/branch/master/LICENSE) | Can be linked by cgo as a shared library. |
| [S.O.N.G/go-ebur128](https://git.gammaspectra.live/S.O.N.G/go-ebur128) | [BSD 2-Clause](https://git.gammaspectra.live/S.O.N.G/go-ebur128/src/branch/master/LICENSE) | |
| [jiixyj/libebur128](https://github.com/jiixyj/libebur128) | [MIT](https://github.com/jiixyj/libebur128/blob/master/COPYING) | Can be linked by cgo as a shared library. |
| [S.O.N.G/go-fdkaac](https://git.gammaspectra.live/S.O.N.G/go-fdkaac) | [MIT](https://git.gammaspectra.live/S.O.N.G/go-fdkaac/src/branch/master/LICENSE) | |
| [mstorsjo/fdk-aac](https://github.com/mstorsjo/fdk-aac) | [FDK License, BSD-like](https://github.com/mstorsjo/fdk-aac/blob/master/NOTICE) | Does not include patent grants.<br/>Can be linked by cgo as a shared library. |
| [S.O.N.G/go-pus](https://git.gammaspectra.live/S.O.N.G/go-pus) | [MIT](https://git.gammaspectra.live/S.O.N.G/go-pus/src/branch/v2/LICENSE) | |
| [xiph/opus](https://github.com/xiph/opus) | [BSD 3-Clause](https://github.com/xiph/opus/blob/master/COPYING) | Read extra license details on the [official site](https://opus-codec.org/license/).<br/>Can be linked by cgo as a shared library. |
| [xiph/opusfile](https://github.com/xiph/opusfile) | [BSD 3-Clause](https://github.com/xiph/opusfile/blob/master/COPYING) | Can be linked by cgo as a shared library. |
| [xiph/ogg](https://github.com/xiph/ogg) | [BSD 3-Clause](https://github.com/xiph/ogg/blob/master/COPYING) | Can be linked by cgo as a shared library. |
| [xiph/libopusenc](https://github.com/xiph/libopusenc) | [BSD 3-Clause](https://github.com/xiph/libopusenc/blob/master/COPYING) | Can be linked by cgo as a shared library. |
| [S.O.N.G/go-tta](https://git.gammaspectra.live/S.O.N.G/go-tta) | [LGPL v3](https://git.gammaspectra.live/S.O.N.G/go-tta/src/branch/master/LICENSE) | |
| [S.O.N.G/goflac](https://git.gammaspectra.live/S.O.N.G/goflac) | [BSD 3-Clause](https://git.gammaspectra.live/S.O.N.G/goflac/src/branch/master/LICENSE) | |
| [xiph/flac](https://github.com/xiph/flac) | [BSD 3-Clause](https://github.com/xiph/flac/blob/master/COPYING.Xiph) | Read extra license details on the [official site](https://xiph.org/flac/license.html).<br/>Can be linked by cgo as a shared library. |
| [dh1tw/gosamplerate](https://github.com/dh1tw/gosamplerate) | [BSD 2-Clause](https://github.com/dh1tw/gosamplerate/blob/master/LICENSE) | |
| [libsndfile/libsamplerate](https://github.com/libsndfile/libsamplerate) | [BSD 2-Clause](https://github.com/libsndfile/libsamplerate/blob/master/COPYING) | Can be linked by cgo as a shared library. |
| [edgeware/mp4ff](https://github.com/edgeware/mp4ff) | [MIT](https://github.com/edgeware/mp4ff/blob/master/LICENSE.md) | |
| [jfreymuth/oggvorbis](https://github.com/jfreymuth/oggvorbis) | [MIT](https://github.com/jfreymuth/oggvorbis/blob/master/LICENSE) | | |
| _[jfreymuth/vorbis](https://github.com/jfreymuth/vorbis)_ | [MIT](https://github.com/jfreymuth/vorbis/blob/master/LICENSE) | Subdependency of _jfreymuth/oggvorbis_. | |
| [kvark128/minimp3](https://github.com/kvark128/minimp3) | [MIT](https://github.com/kvark128/minimp3/blob/master/LICENSE.txt) | | |
| [lieff/minimp3](https://github.com/lieff/minimp3) | [CC0 1.0](https://github.com/lieff/minimp3/blob/master/LICENSE) | |
| [mewkiz/flac](https://github.com/mewkiz/flac) | [The Unlicense](https://github.com/mewkiz/flac/blob/master/LICENSE) | |
| _[go-audio/audio](https://github.com/go-audio/audio)_ | [Apache 2.0](https://github.com/go-audio/audio/blob/master/LICENSE) | Subdependency of _mewkiz/flac_. Only used on tests there. |
| _[go-audio/wav](https://github.com/go-audio/wav)_ | [Apache 2.0](https://github.com/go-audio/wav/blob/master/LICENSE) | Subdependency of _mewkiz/flac_. Only used on tests there. |
| _[go-audio/riff](https://github.com/go-audio/riff)_ | [Apache 2.0](https://github.com/go-audio/riff/blob/master/LICENSE) | Subdependency of _go-audio/wav_. Only used on tests there. |
| _[icza/bitio](https://github.com/icza/bitio)_ | [Apache 2.0](https://github.com/icza/bitio/blob/master/LICENSE-APACHE) or [LGPL v2.1](https://github.com/icza/bitio/blob/master/LICENSE-LGPL-v2.1) | Subdependency of _mewkiz/flac_. |
| [sssgun/mp3](https://github.com/sssgun/mp3) | [MIT](https://github.com/sssgun/mp3/blob/master/LICENSE) | |
| [viert/go-lame](https://github.com/viert/go-lame) | [MIT](https://github.com/viert/go-lame/blob/master/LICENSE) | |
| [LAME](https://lame.sourceforge.io/) | [LGPL v2](https://sourceforge.net/p/lame/svn/HEAD/tree/trunk/lame/COPYING) | Can be linked by cgo as a shared library. |