#ios #audio-processing #audio #rust #avaudiosession

aloe-ios-audio

Aloe iOS Audio is a Rust crate that provides abstractions over iOS audio functionalities, via Apple's AVAudioSession, allowing efficient audio device management and processing for iOS apps. This crate is a translation of the c++ juce module serving the same function.

1 unstable release

Uses new Rust 2024

new 0.1.1 Apr 3, 2025

#73 in #audio-processing

GPL-3.0 license

2MB
17K SLoC

Aloe iOS Audio Crate

Aloe iOS Audio provides a sophisticated audio interface for iOS applications using Rust. Leveraging Apple's AVAudioSession and Core Audio frameworks, it encapsulates comprehensive functionalities to manage audio input/output devices, facilitating robust audio processing in iOS applications.

Features

  • Audio Session Management: Seamlessly handle AVAudioSession configurations, route changes, and error logging to optimize audio performance.
  • Audio Device Handling: Support for multiple audio devices with configurable input/output channels.
  • Flexible Sample Rate and Buffer Size: Optimize audio quality by dynamically adjusting sample rates and buffer sizes.
  • Inter-App Audio: Includes features for managing inter-app audio connections, supporting both audio streaming and MIDI message handling.
  • Error Handling: Provides diagnostic logging capabilities, enhancing debugging and live monitoring of audio status changes.

Structs and Types

  • iOSAudioIODevice: Main audio device abstraction, encapsulating device operations and configuration.
  • IOChannelData: Manages audio channel data for input/output operations, ensuring data integrity and transfer.
  • AudioSessionHolder: Captures session-level information and facilitates the lifecycle of audio device connections.

Usage

To use this crate, add the following to your Cargo.toml:

[dependencies]
aloe-ios-audio = "0.1.0"
use aloe_ios_audio::{iOSAudioIODevice, IOChannelData};

// Initialize and configure an audio device
let mut audio_device = iOSAudioIODevice::default();

// Open the audio device with desired configurations
let result = audio_device.open(&input_channels, &output_channels, sample_rate, buffer_size);

if result.is_empty() {
    // Start processing audio
    audio_device.start(callback);
    // Get available sample rates and buffer sizes
    let sample_rates = audio_device.get_available_sample_rates();
    let buffer_sizes = audio_device.get_available_buffer_sizes();

    // Perform audio operations...

    // Stop and close the device when done
    audio_device.stop();
    audio_device.close();
} else {
    eprintln!("Failed to open audio device: {}", result);
}

License

This crate is licensed under the GPL-3.0 license. See LICENSE for details.

Contributing

Contributions are welcome! Please see our contributing guide for more details.


This README file was generated by an AI model and may not be 100% accurate; however, it should be pretty good.

This crate is a translation of the JUCE module.

JUCE is a c++ software framework for developing high performance audio applications.

Usage falls under the GPLv3 as well as the JUCE commercial license.

See github.com/juce-framework/JUCE and the JUCE license page for details.

This crate is in the process of being translated from c++ to rust. For progress updates, please see the workspacer rust project. designed specifically for rust projects.

Dependencies

~28–42MB
~684K SLoC