diff options
author | Graham Northup <grissess@nexusg.org> | 2017-09-18 23:12:14 -0400 |
---|---|---|
committer | Graham Northup <grissess@nexusg.org> | 2017-09-18 23:12:14 -0400 |
commit | 85925d69e08455bd91d32a27cd3690c9cb634a6b (patch) | |
tree | 1023c044a3350aadb4eb06bf73e209f81f21f8ae /src/main.rs |
Initial work on modular synthesis
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..6db2bcf --- /dev/null +++ b/src/main.rs @@ -0,0 +1,23 @@ +use std::io; +use std::io::*; + +extern crate synfone; +use synfone::synth::*; + +const FRAMES: usize = 44100 * 2; + +fn main() { + let mut params = Default::default(); + + let mut freq: GenBox = Box::new(Param { name: "freq".to_string(), default: 440.0, buf: SampleBuffer::new(1) }); + let mut sg: GenBox = Box::new(Sine { freq: freq, phase: 0.0, buf: SampleBuffer::new(params.env.default_buffer_size) }); + + let mut counter = 0; + let mut out = io::stderr(); + + while counter < FRAMES { + let buf = sg.eval(¶ms); + out.write_all(buf.bytes()); + counter += buf.len(); + } +} |