Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
xasopheno committed Aug 11, 2023
1 parent bbcd6b3 commit 4ec84fa
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 29 deletions.
2 changes: 1 addition & 1 deletion core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ weresocool_instrument = { path = "../instrument", version = "^1.0.47", default_f
weresocool_shared = { path = "../shared", version = "^1.0.47" }
weresocool_vorbis = { path = "../vorbis", version = "^1.0.47", optional=true, default_features = false }
weresocool_portaudio = { path = "../portaudio", version = "^1.0.47", optional=true }
weresocool_visualizer = { path = "../../weresocool_visualizer/pixel", version = "^1.0.47", default_features=false, optional=true }
weresocool_visualizer = { path = "../../weresocool_visualizer", version = "^1.0.47", default_features=false, optional=true }
rand = { version="0.7.3", features=["wasm-bindgen"]}
hound = "3.4.0"
serde = { version = "1.0.164", features = ["derive"] }
Expand Down
34 changes: 34 additions & 0 deletions instrument/src/renderable/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,40 @@ impl RenderOp {
filters: Vec::new(),
}
}

pub const fn init_fglp_samples(
f: f64,
g: (f64, f64),
l: f64,
p: f64,
total_samples: usize,
settings: &Settings,
) -> Self {
Self {
f,
p,
g,
l,
t: 0.0,
reverb: None,
attack: settings.sample_rate,
decay: settings.sample_rate,
asr: ASR::Long,
samples: total_samples,
total_samples,
index: 0,
voice: 0,
event: 0,
portamento: 1024,
osc_type: OscType::None,
next_l_silent: false,
next_r_silent: false,
next_out: false,
names: Vec::new(),
filters: Vec::new(),
}
}

pub fn init_silent_with_length(l: f64) -> Self {
Self {
f: 0.0,
Expand Down
2 changes: 1 addition & 1 deletion instrument/src/renderable/render_voice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ impl RenderVoice {
}
}

pub fn push_ops(&mut self, ops: &[RenderOp]) {
pub fn push(&mut self, ops: &[RenderOp]) {
self.ops.extend_from_slice(ops);
}

Expand Down
2 changes: 1 addition & 1 deletion shared/src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ pub const fn default_settings() -> Settings {
mic: false,
sample_rate: 48_000.0,
yin_buffer_size: 2048,
buffer_size: 1024,
buffer_size: 1024 * 12,
crossfade_period: 1024 * 4,
probability_threshold: 0.3,
gain_threshold_min: 0.0,
Expand Down
53 changes: 27 additions & 26 deletions test.socool
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{ f: 311.127, l: 1, g: 1/3, p: 0 }

thing1 = {
Overlay [
{5/1, 2, 1, 1},
Expand Down Expand Up @@ -28,24 +29,24 @@ thing1 = {
Fm 4/3, Fm 11/8, Fm 3/2, Fm 7/6,
Fm 7/6, Fm 9/8, Fm 7/6, Fm 9/8, Fm 1,

Seq [
Fm 3/4, Fm 1/2, Fm 5/6, Fm 4/3, Fm 3/4,
Fm 1/3, Fm 9/8, Fm 1/3, Fm 7/6, Fm 3/4,
]
Seq [
Fm 3/4, Fm 1/2, Fm 5/6, Fm 4/3, Fm 3/4,
Fm 1/3, Fm 9/8, Fm 1/3, Fm 7/6, Fm 3/4,
]
-- | BandPass 1/2 2
| Repeat 8,

Fm 5/6, Fm 3/4, Fm 2/3, Fm 5/4, Fm 3/4,
Fm 1, Fm 5/4, Fm 4/3, Fm 3/2, Fm 5/3,
Fm 7/6, Fm 9/8, Fm 4/3, Fm 9/8, Fm 7/8,
Fm 5/6, Fm 3/4, Fm 7/8, Fm 9/8, Fm 5/4,
Fm 3/4, Fm 2/3, Fm 5/4, Fm 3/2,
Fm 5/4, Fm 9/8, Fm 7/6, Fm 1, Fm 1/2,
Fm 5/6, Fm 3/4, Fm 2/3, Fm 5/4, Fm 3/4,
Fm 1, Fm 5/4, Fm 4/3, Fm 3/2, Fm 5/3,
Fm 7/6, Fm 9/8, Fm 4/3, Fm 9/8, Fm 7/8,
Fm 5/6, Fm 3/4, Fm 7/8, Fm 9/8, Fm 5/4,
Fm 3/4, Fm 2/3, Fm 5/4, Fm 3/2,
Fm 5/4, Fm 9/8, Fm 7/6, Fm 1, Fm 1/2,

Seq [
Fm 3/4, Fm 1/2, Fm 3/4, Fm 5/8, Fm 9/8,
Fm 1/3, Fm 5/4, Fm 1/3, Fm 1, Fm 3/4,
]
Seq [
Fm 3/4, Fm 1/2, Fm 3/4, Fm 5/8, Fm 9/8,
Fm 1/3, Fm 5/4, Fm 1/3, Fm 1, Fm 3/4,
]
-- | BandPass 1/2 2
| Repeat 8,
Fm 3/4 | Lm 16,
Expand All @@ -62,17 +63,17 @@ thing1 = {
Overlay [
Fm 1, Fa -8 | ModBy [Lm 9, Fm 0]
],
]
| ModBy [
Pm 4/5 | Lm 1/2,
Pm 1,
]
| Overlay [
Saw | Fm 1/2,
Sine 1/2
]
| LowPass 4 2
| Repeat 8
]
| ModBy [
Pm 4/5 | Lm 1/2,
Pm 1,
]
| Overlay [
Saw | Fm 1/2,
Sine 1/2
]
| LowPass 4 2
| Repeat 8
}

thing2 = {
Expand Down Expand Up @@ -137,7 +138,7 @@ thing2 = {
-- -- Sine 1/2
-- ]
| Seq [
Fm 1
Fm 1
-- Fm 1, Fm 7/8, Fm 3/4, Fm 5/6 | Lm 2
]
-- | LowPass 4 2
Expand Down

0 comments on commit 4ec84fa

Please sign in to comment.