Crates.io | sorceress |
lib.rs | sorceress |
version | 0.2.0 |
source | src |
created_at | 2021-02-28 08:08:58.251446 |
updated_at | 2021-03-22 19:18:36.404894 |
description | A Rust environment for making music and sounds with SuperCollider. |
homepage | |
repository | https://github.com/ooesili/sorceress |
max_upload_size | |
id | 361711 |
size | 282,807 |
A Rust environment for sound synthesis and algorithmic composition, powered by SuperCollider.
Sorceress is a Rust crate that provides a creative coding environment for:
Sound synthesis - build audio synthesizers by connecting unit generators together into signal graphs. SuperCollider provides hundreds of unit generators to choose from including things like wave generators, noise generators, filters, envelopes, compressors, resonators, physical simulations, Fourier transforms, and much more.
Algorithmic composition - write code to create music, anywhere from using code as a musical notation system to full-fledged generative composition where large scale structures of a music piece are determined by computational algorithms.
SuperCollider is a powerful and mature platform for audio synthesis with decades of development effort behind it. SuperCollider's Client and Server architecture lets us to leverage all of the features offered by SuperCollider's audio synthesis server, from Rust:
There are projects in many other programming languages for interacting with SuperCollider including Overtone, Tidal, and Sonic Pi. I really like programming in Rust and I could not find any such project using Rust so I started building Sorceress.
This example plays a sine wave at 220 Hz for 1 second:
use sorceress::{
server::{self, Result, Server},
synthdef::{encoder::encode_synth_defs, SynthDef},
ugen,
};
use std::{thread::sleep, time::Duration};
fn main() -> Result<()> {
let server = Server::connect("127.0.0.1:57110")?;
let sine_wave = SynthDef::new("sine_wave", |_| {
ugen::Out::ar().channels(ugen::Pan2::ar().input(ugen::SinOsc::ar().freq(220)))
});
let encoded_synthdef = encode_synth_defs(vec![sine_wave]);
server.send_sync(server::SynthDefRecv::new(&encoded_synthdef))?;
server.send(server::SynthNew::new("sine_wave", 1))?;
sleep(Duration::from_secs(1));
server.reset()?;
Ok(())
}
With cargo-edit installed run:
$ cargo add sorceress
You must install SuperCollider separately from the sorceress
crate.
Note: Sorceress does not run SuperCollider for you at this time, so you must boot a server yourself. The recommended way to do this by starting the server in scide, SuperCollider's built in IDE.
The primary source of documentation for Sorceress is the crate documentation on docs.rs.
See CONTRIBUTING for details on creating issues or making pull requests.
Sorceress is free software available under Version 3 the GNU General Public License. See COPYING for details.