• Stars
    star
    250
  • Rank 162,397 (Top 4 %)
  • Language
    Rust
  • License
    Other
  • Created about 8 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Rust vorbis decoder

lewton

docs crates.io dependency status

Vorbis decoder written in pure Rust.

To give the decoder a try, you can do:

cargo run --example player /path/to/your/audio_file.ogg

It will then play back the audio.

If you want to know how to use this crate, look at the examples folder.

This crate has a low level API for per-packet decoding in the audio and header modules, and a high level API for ogg/vorbis streams in the inside_ogg module.

Some parts were created with help from the public domain stb_vorbis decoder implementation.

The minimum required Rust version is 1.56.

Use of unsafe

The entire library uses not a single line of unsafe code. In fact, lib.rs contains the #![forbid(unsafe_code)] directive.

About the history of this crate

I started to work on this crate in December 2015. The goal was to learn more about Rust and audio processing, while also delivering something useful to the Rust ecosystem.

I've tried not to look into the libvorbis implementation, as then I'd have to first abide the BSD license, and second as I didn't want this crate to become "just" a translation from C to Rust. Instead I wanted this crate to base on the spec only, so that I'd learn more about how vorbis worked.

The only time I did look into the libvorbis implementation was to look up the implementation of a function needed by the ogg crate (the CRC function), which is why that crate is BSD licensed, and attributes the authors. This crate however contains no code, translated or otherwise, from the libvorbis implementation.

After some time I realized that without any help of a working implementation progress would become too slow.

Therefore, I've continued to work with the public domain stb_vorbis implementation and used some of its code (most prominently for the imdct algorithm) to translate it to rust. I've also used it for debugging by comparing its outputs with mine.

Most of this crate however was created by reading the spec only.

Use from C

lewton provides a C-compatible set of library, header and pkg-config file.

To build and install it you can use cargo-c:

cargo install cargo-c
cargo cinstall --release --destdir /tmp/lewton
sudo cp -a /tmp/lewton/* /

License

Licensed under Apache 2 or MIT (at your option). For details, see the LICENSE file.

All examples inside the examples/ folder are licensed under the CC-0 license.

License of your contributions

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed / CC-0 licensed as above, without any additional terms or conditions.

More Repositories

1

cpal

Cross-platform audio I/O library in pure Rust
Rust
2,614
star
2

rodio

Rust audio playback library
Rust
1,690
star
3

vst-rs

VST 2.4 API implementation in rust. Create plugins or hosts. Previously rust-vst on the RustDSP group.
Rust
973
star
4

dasp

The fundamentals for Digital Audio Signal Processing. Formerly `sample`.
Rust
720
star
5

rust-portaudio

PortAudio bindings and wrappers for Rust.
Rust
373
star
6

deepspeech-rs

Rust bindings for the deepspeech library
Rust
295
star
7

dsp-chain

A library for chaining together multiple audio dsp processors/generators, written in Rust!
Rust
287
star
8

vst3-sys

Raw Bindings to the VST3 API
Rust
210
star
9

rust-jack

Decent jack bindings for rust
Rust
204
star
10

baseview

low-level window system interface for audio plugin UIs
Rust
184
star
11

synth

A polyphonic Synth type whose multiple oscillators generate sound via amplitude and frequency envelopes, implemented in Rust. DEPRECATED: This is a very old crate with very old design patterns and is no longer maintained. You might be interested in checking out `dasp` for composing your own synth instead.
Rust
172
star
12

coreaudio-rs

A friendly rust interface to Apple's Core Audio API.
Rust
169
star
13

rust-lv2

A safe, fast, and modular framework to create LV2 plugins, written in Rust
Rust
150
star
14

audrey

A crate to simplify reading, writing and converting between a variety of audio formats.
Rust
114
star
15

ogg

Ogg container decoder and encoder written in pure Rust
Rust
97
star
16

rimd

Library for handling Midi and Standard Midi Files in Rust
Rust
77
star
17

wmidi

Rust midi encoding and decoding library.
Rust
63
star
18

pitch_calc

A library for musical pitch conversions! Provides functions and methods for converting between frequency (hz), midi-step, letter-octave and mels.
Rust
60
star
19

coreaudio-sys

Raw bindings to the OSX CoreAudio framework generated by bindgen (see coreaudio-rs for a more rust-esque wrapper).
Rust
59
star
20

sound_stream

A Rust audio IO stream in the style of an "Event Iterator" driven by PortAudio.
Rust
57
star
21

time_calc

A library for music/DSP time conversions! Provides functions and methods for converting between ticks, ms, samples, bars, beats and measures.
Rust
49
star
22

musical_keyboard

A small lib for converting keyboard input into musical notes.
Rust
26
star
23

mp3

Rust MP3 decoder project
Rust
23
star
24

sampler

A polyphonic sampler instrument that supports unique sample mappings across both frequency and velocity ranges. DEPRECATED: This is a very old crate with very old design patterns and is no longer maintained. You might be interested in checking out `dasp` for composing your own sampler instead.
Rust
23
star
25

areweaudioyet

Are We Audio Yet?
CSS
18
star
26

simplemad

A Rust interface for the MPEG audio (MP1, MP2, MP3) decoding library libmad
Shell
17
star
27

caf

Rust decoder for Apple's Core Audio Format (CAF)
Rust
14
star
28

envelope

An interpolatable Envelope type along with a generic 2D Point, useful for controlling parameters over time.
Rust
13
star
29

website

Website for all things audio in the Rust programming language
HTML
10
star
30

vst2-sys

Bindings for the VST 2.4 API.
Rust
9
star
31

instrument

Converts discrete note events to a continuous signal of amplitude and frequency frames over N number of voices.
Rust
8
star
32

rnnoise-c

Rust bindings to Xiph's rnnoise denoising library
Rust
7
star
33

rms

A simple type for calculating and storing the RMS given some buffer of interleaved audio samples.
Rust
7
star
34

volume

A simple dsp-chain node for multiplying the amplitude of the output buffer by some volume.
Rust
6
star
35

panning

A variety of utilities related to audio panning in Rust.
Rust
5
star
36

lyra

Feature extraction POC
Rust
4
star