1.0.0 - Fixed type errors
This commit is contained in:
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -684,7 +684,7 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "musicgen"
|
name = "musicgen"
|
||||||
version = "0.1.0"
|
version = "1.0.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"clap",
|
"clap",
|
||||||
"cpal 0.16.0",
|
"cpal 0.16.0",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "musicgen"
|
name = "musicgen"
|
||||||
version = "0.1.0"
|
version = "1.0.0"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
authors = ["Atridad Lahiji <me@atri.dad>"]
|
authors = ["Atridad Lahiji <me@atri.dad>"]
|
||||||
description = "Generate electronic music without AI"
|
description = "Generate electronic music without AI"
|
||||||
|
@ -8,6 +8,7 @@ use crate::core::{
|
|||||||
Track,
|
Track,
|
||||||
};
|
};
|
||||||
use crate::scales::{Scale, ScaleType};
|
use crate::scales::{Scale, ScaleType};
|
||||||
|
use crate::synthesis::Waveform;
|
||||||
|
|
||||||
/// Track-based composition
|
/// Track-based composition
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
@ -90,12 +91,22 @@ impl Composition {
|
|||||||
_ => InstrumentType::Lead,
|
_ => InstrumentType::Lead,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let waveform = match instrument_type {
|
||||||
|
InstrumentType::Lead => Waveform::Sawtooth,
|
||||||
|
InstrumentType::Bass => Waveform::Square,
|
||||||
|
InstrumentType::Pad => Waveform::Sine,
|
||||||
|
InstrumentType::Arp => Waveform::Triangle,
|
||||||
|
InstrumentType::Percussion => Waveform::Noise,
|
||||||
|
InstrumentType::Drone => Waveform::Sine,
|
||||||
|
};
|
||||||
|
|
||||||
Ok(Track {
|
Ok(Track {
|
||||||
name: track.name.clone(),
|
name: track.name.clone(),
|
||||||
octave: 4, // Will be overridden by note specifications
|
octave: 4,
|
||||||
notes,
|
notes,
|
||||||
volume: track.volume,
|
volume: track.volume,
|
||||||
instrument_type,
|
instrument_type,
|
||||||
|
waveform,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
//! the musicgen library for representing notes, tracks, and compositions.
|
//! the musicgen library for representing notes, tracks, and compositions.
|
||||||
|
|
||||||
use crate::scales::ScaleType;
|
use crate::scales::ScaleType;
|
||||||
|
use crate::synthesis::Waveform;
|
||||||
|
|
||||||
/// Musical note representation
|
/// Musical note representation
|
||||||
#[derive(Debug, Clone, PartialEq)]
|
#[derive(Debug, Clone, PartialEq)]
|
||||||
@ -50,6 +51,7 @@ pub struct Track {
|
|||||||
pub notes: Vec<Note>,
|
pub notes: Vec<Note>,
|
||||||
pub volume: f32,
|
pub volume: f32,
|
||||||
pub instrument_type: InstrumentType,
|
pub instrument_type: InstrumentType,
|
||||||
|
pub waveform: Waveform,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Composition styles (kept for compatibility)
|
/// Composition styles (kept for compatibility)
|
||||||
@ -296,6 +298,7 @@ mod tests {
|
|||||||
],
|
],
|
||||||
volume: 0.8,
|
volume: 0.8,
|
||||||
instrument_type: InstrumentType::Lead,
|
instrument_type: InstrumentType::Lead,
|
||||||
|
waveform: Waveform::Sawtooth,
|
||||||
};
|
};
|
||||||
|
|
||||||
composition.tracks.push(track);
|
composition.tracks.push(track);
|
||||||
|
Reference in New Issue
Block a user