bliplab 0.0.1

Tool to combine several BLIP channels in a song
Documentation
//! See [BLIPlab](https://docs.rs/bliplab)

use anyhow::Context;
use bliplab::{Channel, PathOrString, Song, VariableChange};

fn main() -> anyhow::Result<()> {
    let stringified = serde_json::to_string_pretty(&Song::new(
        Default::default(),
        [(
            "Piano".into(),
            Channel::new(
                PathOrString::String("hi".into()),
                vec!["do", "ré", "mi"].into_iter().map(Into::into),
                "sin(2*pi()*(442*2^((n+1)/N))*t)"
                    .parse()
                    .context("failed to parse instrument expression")?,
                [
                    ('l', 4f64),
                    ('L', 0.0),
                    ('t', 0.0),
                    ('T', 60.0),
                    ('N', 12.0),
                ],
                [],
                [(
                    "L".into(),
                    VariableChange::new(
                        'L',
                        "2^(2-log(2, l))*(60/T)"
                            .parse()
                            .context("failed to parse length expression")?,
                    ),
                )],
            ),
        )],
    ))
    .context("failed to serialize the song")?;

    println!("{}", stringified);

    Ok(())
}