All Projects → MoAlyousef → Soloud Rs

MoAlyousef / Soloud Rs

Licence: mit
Rust bindings for the soloud audio engine library

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to Soloud Rs

Vst2
Bindings for vst2 sdk
Stars: ✭ 39 (+85.71%)
Mutual labels:  bindings, audio
Libvlc Go
Go bindings for libVLC and high-level media player interface
Stars: ✭ 188 (+795.24%)
Mutual labels:  bindings, audio
Python Mpv
Python interface to the awesome mpv media player
Stars: ✭ 245 (+1066.67%)
Mutual labels:  bindings, audio
Blipkit
C library for creating the beautiful sound of old sound chips
Stars: ✭ 23 (+9.52%)
Mutual labels:  audio
Sharpmik
SharpMik, pure C# mod player
Stars: ✭ 25 (+19.05%)
Mutual labels:  audio
Libav
Libav github mirror, clone of git://git.libav.org/libav
Stars: ✭ 847 (+3933.33%)
Mutual labels:  audio
Iplug2
C++ Audio Plug-in Framework for desktop, mobile and web [PRE-RELEASE]
Stars: ✭ 875 (+4066.67%)
Mutual labels:  audio
Waveform Playlist
Multitrack Web Audio editor and player with canvas waveform preview. Set cues, fades and shift multiple tracks in time. Record audio tracks or provide audio annotations. Export your mix to AudioBuffer or WAV! Project inspired by Audacity.
Stars: ✭ 919 (+4276.19%)
Mutual labels:  audio
Play
Play audio files from terminal.
Stars: ✭ 12 (-42.86%)
Mutual labels:  audio
Cs.2click
🔊 A Better Audio Router for a Modular System.
Stars: ✭ 7 (-66.67%)
Mutual labels:  audio
Gopherjs Electron
Gopherjs bindings for Electron with an API translator.
Stars: ✭ 26 (+23.81%)
Mutual labels:  bindings
Flavy
Simple API for convert audio/video files, get thumbnails from video, information of files
Stars: ✭ 25 (+19.05%)
Mutual labels:  audio
Webrtc
Pure Go implementation of the WebRTC API
Stars: ✭ 8,399 (+39895.24%)
Mutual labels:  audio
Awesome Music
Awesome Music Projects
Stars: ✭ 925 (+4304.76%)
Mutual labels:  audio
Awesome Musicdsp
A curated list of my favourite music DSP and audio programming resources
Stars: ✭ 871 (+4047.62%)
Mutual labels:  audio
Pipewire
Mirror of the PipeWire repository (see https://gitlab.freedesktop.org/pipewire/pipewire/)
Stars: ✭ 922 (+4290.48%)
Mutual labels:  audio
Mems mic breakout Admp401
SparkFun MEMS Microphone Breakout - INMP401 (ADMP401)
Stars: ✭ 10 (-52.38%)
Mutual labels:  audio
Chipkizi
a recording app for up and coming artists
Stars: ✭ 26 (+23.81%)
Mutual labels:  audio
Openaudible
Open Source Audible Manager
Stars: ✭ 932 (+4338.1%)
Mutual labels:  audio
Tablebinding
Swift NSTableView bound to an NSArrayController
Stars: ✭ 8 (-61.9%)
Mutual labels:  bindings

soloud-rs

Documentation Crates.io License Build

A crossplatform Rust bindings for the soloud audio engine library.

Supported formats: wav, mp3, ogg, flac. The library also comes with a speech synthesizer.

Usage

[dependencies]
soloud = "0.3"

Or to use the git repo:

[dependencies]
soloud = { git = "https://github.com/moalyousef/soloud-rs" }

To play audio:

use soloud::*;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let mut sl = Soloud::default()?;

    let mut wav = audio::Wav::default();

    wav.load(&std::path::Path::new("sample.wav"))?;

    sl.play(&wav); // calls to play are non-blocking, so we put the thread to sleep
    while sl.voice_count() > 0 {
        std::thread::sleep(std::time::Duration::from_millis(100));
    }

    wav.load(&std::path::Path::new("Recording.mp3"))?;
    
    sl.play(&wav);
    while sl.voice_count() > 0 {
        std::thread::sleep(std::time::Duration::from_millis(100));
    }

    Ok(())
}

To play speech:

use soloud::*;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let mut sl = Soloud::default()?;

    let mut speech = audio::Speech::default();

    speech.set_text("Hello World")?;

    sl.play(&speech);
    while sl.active_voice_count() > 0 {
        std::thread::sleep(std::time::Duration::from_millis(100));
    }

    speech.set_text("1 2 3")?;

    sl.play(&speech);
    while sl.active_voice_count() > 0 {
        std::thread::sleep(std::time::Duration::from_millis(100));
    }

    speech.set_text("Can you hear me?")?;

    sl.play(&speech);
    while sl.active_voice_count() > 0 {
        std::thread::sleep(std::time::Duration::from_millis(100));
    }
    
    Ok(())
}

To add a filter:

use soloud::*;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let mut sl = Soloud::default()?;

    let mut wav = audio::Wav::default();
    let mut filt = filter::EchoFilter::default();
    filt.set_params(0.2)?; // sets the delay

    wav.load(&std::path::Path::new("sample.wav"))?;
    wav.set_filter(0, Some(&filt));

    sl.play(&wav);
    while sl.voice_count() > 0 {
        std::thread::sleep(std::time::Duration::from_millis(100));
    }

    Ok(())
}

The examples can be found in the soloud/examples directory. They can be run using:

$ cargo run --example simple
$ cargo run --example speech
$ cargo run --example filter
$ cargo run --example load_mem

You will need to have valid "sample.wav" and "Recording.mp3" audio files in the project root. Or you can change the paths to point to any supported audio file.

There is also a demo gui application (using fltk) here.

Dependencies

A Rust compiler, C++ compiler, Cargo, CMake and git (all these need to be in your PATH). This crate uses the miniaudio backend by default which assumes default sound drivers are functional.

Backends

The default backend is miniaudio, however Soloud supports several backends to varying degrees. To enable support of a certain backend, alsa for example:

[dependencies]
soloud = { version = "0.3", default-features = false, features = ["alsa"] }

This also assumes that those libraries headers are in your include path where CMake can find them, otherwise you can set it via the command line (posix):

$ export CXXFLAGS="-I /path/to/include"

or for Windows:

$ set CXXFLAGS="-I C:\\path\\to\\include"

The same can be done for CFLAGS if needed.

Supported backends:

  • miniaudio
  • oss
  • alsa
  • sdl2
  • sdl2-static
  • portaudio
  • openal
  • xaudio2
  • winmm
  • wasapi
  • opensles
  • coreaudio
  • jack
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].