-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Created examples for: MouseDown() MouseX() MouseY() ASREnvelope() Line() Impulse() ClockDivider() Sequence() And fixing a typo in BufferPlayer().
- Loading branch information
Showing
12 changed files
with
135 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from signalflow import * | ||
graph = AudioGraph() | ||
|
||
#------------------------------------------------------------------------------- | ||
# When the left mouse button is clicked, as detected by MouseDown(), an LFO is applied to the oscillator's frequency. | ||
#------------------------------------------------------------------------------- | ||
lfo = SineLFO(5, 100, 600) | ||
frequency = If(MouseDown(), lfo, 100) | ||
osc = TriangleOscillator(frequency) | ||
osc.play() | ||
graph.wait() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from signalflow import * | ||
graph = AudioGraph() | ||
|
||
#------------------------------------------------------------------------------- | ||
# A simple wobbling synthesiser controlled using the mouse. When the mouse is clicked, as detected by MouseDown(), an LFO is activated and affects the oscillator's frequency. MouseX position changes the rate of the LFO. MouseY position changes the upper frequency limit, affecting pitch. | ||
#------------------------------------------------------------------------------- | ||
rate = MouseX() * 10 | ||
upper_limit = MouseY() * 1500 | ||
lfo = SineLFO(rate, 100, upper_limit) | ||
frequency = If(MouseDown(), lfo, 100) | ||
osc = TriangleOscillator(frequency) | ||
osc.play() | ||
graph.wait() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from signalflow import * | ||
graph = AudioGraph() | ||
|
||
#------------------------------------------------------------------------------- | ||
# Using the MouseX position to change the rate of an LFO, which is modulating an oscillator's frequency | ||
#------------------------------------------------------------------------------- | ||
lfo_rate = MouseX() * 10 | ||
frequency = SineLFO(lfo_rate, 100, 600) | ||
osc = TriangleOscillator(frequency) | ||
osc.play() | ||
graph.wait() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from signalflow import * | ||
graph = AudioGraph() | ||
|
||
#------------------------------------------------------------------------------- | ||
# A simple wobbling synthesiser controlled using the mouse. When the mouse is clicked, as detected by MouseDown(), an LFO is activated and affects the oscillator's frequency. MouseX position changes the rate of the LFO. MouseY position changes the upper frequency limit, affecting pitch. | ||
#------------------------------------------------------------------------------- | ||
rate = MouseX() * 10 | ||
upper_limit = MouseY() * 1500 | ||
lfo = SineLFO(rate, 100, upper_limit) | ||
frequency = If(MouseDown(), lfo, 100) | ||
osc = TriangleOscillator(frequency) | ||
osc.play() | ||
graph.wait() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from signalflow import * | ||
graph = AudioGraph() | ||
|
||
#------------------------------------------------------------------------------- | ||
# Using the MouseY position to change the frequency of an oscillator. | ||
#------------------------------------------------------------------------------- | ||
frequency = MouseY() * 1000 | ||
osc = TriangleOscillator(frequency) | ||
osc.play() | ||
graph.wait() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from signalflow import * | ||
graph = AudioGraph() | ||
|
||
#------------------------------------------------------------------------------- | ||
# A simple wobbling synthesiser controlled using the mouse. When the mouse is clicked, as detected by MouseDown(), an LFO is activated and affects the oscillator's frequency. MouseX position changes the rate of the LFO. MouseY position changes the upper frequency limit, affecting pitch. | ||
#------------------------------------------------------------------------------- | ||
rate = MouseX() * 10 | ||
upper_limit = MouseY() * 1500 | ||
lfo = SineLFO(rate, 100, upper_limit) | ||
frequency = If(MouseDown(), lfo, 100) | ||
osc = TriangleOscillator(frequency) | ||
osc.play() | ||
graph.wait() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from signalflow import * | ||
graph = AudioGraph() | ||
|
||
#------------------------------------------------------------------------------- | ||
# Using an ASR Envelope to shape a square wave oscillator | ||
#------------------------------------------------------------------------------- | ||
osc = SquareOscillator(500) | ||
envelope = ASREnvelope(0.1, 0.0, 0.5) | ||
output = osc * envelope | ||
output.play() | ||
graph.wait() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
from signalflow import * | ||
graph = AudioGraph() | ||
|
||
#------------------------------------------------------------------------------- | ||
# Using a line to control the gain of an oscillator, emulating a sidechain ducking effect. | ||
#------------------------------------------------------------------------------- | ||
clock = Impulse(frequency=1.0) | ||
line = Line(0.0, 0.5, 1.0, 0, clock) | ||
osc = SawOscillator(200) | ||
output = osc * line | ||
output.play() | ||
graph.wait() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
from signalflow import * | ||
graph = AudioGraph() | ||
|
||
#------------------------------------------------------------------------------- | ||
# Using a ClockDivider to create rhythms related to the main clock. Here the oscillator in the left channel is heard on every tick of the clock. The oscillator in the right channel is heard every 3 ticks of the clock. | ||
#------------------------------------------------------------------------------- | ||
clock = Impulse(2.0) | ||
divided_clock = ClockDivider(clock, 3) | ||
|
||
oscillator_a = TriangleOscillator(220) | ||
oscillator_b = TriangleOscillator(440) | ||
|
||
envelope_a = ASREnvelope(0.01, 0.0, 0.25, 1.0, clock) | ||
envelope_b = ASREnvelope(0.01, 0.0, 0.5, 1.0, divided_clock) | ||
|
||
voice_a = oscillator_a * envelope_a | ||
voice_b = oscillator_b * envelope_b | ||
|
||
left = StereoPanner(voice_a, -1.0) | ||
right = StereoPanner(voice_b, 1.0) | ||
|
||
left.play() | ||
right.play() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
from signalflow import * | ||
graph = AudioGraph() | ||
|
||
#------------------------------------------------------------------------------- | ||
# Creating a sequence using the MIDI note values of a C Major scale, starting on middle C. | ||
#------------------------------------------------------------------------------- | ||
clock = Impulse(2.0) | ||
sequence = Sequence([ 60, 62, 64, 65, 67, 69, 71, 72 ], clock) | ||
frequency = MidiNoteToFrequency(sequence) | ||
oscillator = TriangleOscillator(frequency) | ||
oscillator.play() | ||
graph.wait() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters