Skip to content

Commit

Permalink
some book stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffreyrosenbluth committed Jul 24, 2020
1 parent 65e66e6 commit 08d2bd9
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 11 deletions.
12 changes: 12 additions & 0 deletions book/src/getting_started.md
Original file line number Diff line number Diff line change
@@ -1 +1,13 @@
# Getting Started

**Tutorial Info**

- Author: Jeffrey Rosenbluth

---

## Installing Oscen

## Running The Demo App

## Writing Your Own Synth with Nannou
22 changes: 11 additions & 11 deletions oscen-lib/src/instruments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub struct WaveGuide {
cutoff_freq: In,
wet_decay: In,
input: ArcMutex<Link>,
gate: ArcMutex<Adsr>,
envelope: ArcMutex<Adsr>,
lpf: ArcMutex<Lpf>,
delay: ArcMutex<Delay>,
mixer: ArcMutex<Mixer>,
Expand All @@ -30,16 +30,16 @@ impl WaveGuide {
rack.append(input.clone());

// Adsr
let gate = Adsr::new(0.2, 0.2, 0.2)
let envelope = Adsr::new(0.2, 0.2, 0.2)
.attack(0.001)
.decay(0)
.sustain(0)
.release(0.001)
.wrap();
rack.append(gate.clone());
rack.append(envelope.clone());

// Exciter: gated noise
let exciter = Product::new(vec![input.tag(), gate.tag()]).wrap();
let exciter = Product::new(vec![input.tag(), envelope.tag()]).wrap();
rack.append(exciter.clone());

// Feedback loop
Expand All @@ -66,7 +66,7 @@ impl WaveGuide {
cutoff_freq: cutoff_freq.into(),
wet_decay: wet_decay.into(),
input,
gate,
envelope,
lpf,
delay,
mixer,
Expand All @@ -80,30 +80,30 @@ impl WaveGuide {
}

pub fn on(&mut self) {
self.gate.lock().unwrap().on();
self.envelope.lock().unwrap().on();
}

pub fn off(&mut self) {
self.gate.lock().unwrap().off();
self.envelope.lock().unwrap().off();
}

pub fn attack<T: Into<In>>(&mut self, arg: T) -> &mut Self {
self.gate.lock().unwrap().attack(arg);
self.envelope.lock().unwrap().attack(arg);
self
}

pub fn decay<T: Into<In>>(&mut self, arg: T) -> &mut Self {
self.gate.lock().unwrap().decay(arg);
self.envelope.lock().unwrap().decay(arg);
self
}

pub fn sustain<T: Into<In>>(&mut self, arg: T) -> &mut Self {
self.gate.lock().unwrap().sustain(arg);
self.envelope.lock().unwrap().sustain(arg);
self
}

pub fn release<T: Into<In>>(&mut self, arg: T) -> &mut Self {
self.gate.lock().unwrap().release(arg);
self.envelope.lock().unwrap().release(arg);
self
}

Expand Down

0 comments on commit 08d2bd9

Please sign in to comment.