| Crates.io | baton-studio |
| lib.rs | baton-studio |
| version | 0.1.0 |
| created_at | 2025-11-01 18:15:52.591469+00 |
| updated_at | 2025-11-01 18:15:52.591469+00 |
| description | Rust library for controlling the PreSonus STUDIO1824c audio interface via USB. |
| homepage | |
| repository | https://github.com/royvegard/baton_studio.git |
| max_upload_size | |
| id | 1912266 |
| size | 41,931 |
A Rust library for controlling the Presonus STUDIO1824c USB audio interface.
The Presonus STUDIO1824c is a professional USB audio interface that features:
18 input channels:
18 DAW channels (output channels from the computer's perspective)
24 output channels:
Physical controls:
The 1824c contains 9 separate internal mixes, each with stereo fader controls for all 36 input channels (18 physical inputs + 18 DAW channels):
This library allows you to control:
Add this to your Cargo.toml:
[dependencies]
baton-studio = "0.1.0"
use baton_studio::*;
use nusb::MaybeFuture;
use std::error::Error;
fn main() -> Result<(), Box<dyn Error>> {
// Find and open the device
let device = nusb::list_devices()
.wait()?
.find(|dev| dev.vendor_id() == 0x194f && dev.product_id() == 0x010d)
.ok_or(std::io::Error::new(
std::io::ErrorKind::NotFound,
"STUDIO1824c not found",
))?
.open()
.wait()?;
let mut command = Command::new();
let mut state = State::new();
// Enable phantom power
command.set_button(Button::Phantom, true).send(&device)?;
// Set input fader for channel 1 to -3dB
command
.set_input_fader(0, 0, Channel::Left, Value::DB(-3.0))
.send(&device)?;
// Set main output fader to -2.4dB
command.set_output_fader(0, Value::DB(-2.4)).send(&device)?;
// Poll current state and read meter values
state.poll(&device)?;
let mic_level = gain_to_db(state.mic[0]);
println!("Mic 1 level: {:.1} dBFS", mic_level);
Ok(())
}
The Command struct allows you to control the device:
let mut command = Command::new();
// Control input faders (channel, mix, left/right, value)
command.set_input_fader(0, 0, Channel::Left, Value::DB(-6.0)).send(&device)?;
command.set_input_fader(0, 0, Channel::Right, Value::Unity).send(&device)?;
// Control output faders (mix, value)
command.set_output_fader(0, Value::DB(-3.0)).send(&device)?;
command.set_output_fader(1, Value::Muted).send(&device)?;
// Control buttons
command.set_button(Button::Phantom, true).send(&device)?;
command.set_button(Button::Mute, false).send(&device)?;
The State struct provides access to meter readings and button states:
let mut state = State::new();
state.poll(&device)?;
// Read input meters (dBFS values)
println!("Mic 1: {:.1} dBFS", gain_to_db(state.mic[0]));
println!("Line 1: {:.1} dBFS", gain_to_db(state.line[0]));
println!("DAW 1: {:.1} dBFS", gain_to_db(state.daw[0]));
// Read output meters
println!("Main L: {:.1} dBFS", gain_to_db(state.bus[0]));
// Read button states
println!("Phantom power: {}", state.phantom);
println!("Mute: {}", state.mute);
The signal routing works as follows:
+-->Fader left--->\ /-->Line Output 1
Input 1-->| |Stereo fader 1|
+-->Fader right-->/ \-->Line Output 2
|
...
|
+-->Fader left--->\ /-->ADAT Output 7
| |Stereo fader 9|
+-->Fader right-->/ \-->ADAT Output 8
Each of the 36 input channels can be routed to all 9 output mixes with independent left/right fader control.
See the examples/ directory for more complete usage examples:
The library includes comprehensive tests:
# Run all tests (requires connected STUDIO1824c)
cargo test
This library should work on any platform supported by the nusb crate:
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.
nusb USB library