-
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.
Producing further examples for: * ASREnvelope * Line * AllPassDelay * CombDelay * EQ * SVFilter * StereoBalance * StereoPanner * WhiteNoise
- Loading branch information
Showing
13 changed files
with
269 additions
and
0 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,27 @@ | ||
from signalflow import * | ||
graph = AudioGraph() | ||
|
||
#------------------------------------------------------------------------------- | ||
# Using ASREnvelope to shape the sound of an oscillator over time. | ||
# The Line node generates a continuously-changing value which we use as the | ||
# release time. | ||
#------------------------------------------------------------------------------- | ||
|
||
clock = Impulse(8.0) | ||
CMaj7 = [ 60, 64, 67, 71, 74, 76 ] * 8 | ||
FMaj9 = [ 65, 69, 72, 76, 77, 81 ] * 8 | ||
arpeggios = CMaj7 + FMaj9 | ||
sequence = Sequence(arpeggios, clock) | ||
frequency = MidiNoteToFrequency(sequence) | ||
|
||
oscillator = TriangleOscillator(frequency) | ||
release = Line(0.1, 0.5, 6, True) | ||
envelope= ASREnvelope(0.0, 0.0, release, 1.0, clock) | ||
voice = oscillator * envelope | ||
|
||
pan = SineLFO(0.1667, -1.0, 1.0) | ||
|
||
output = StereoPanner(voice, pan) | ||
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,26 @@ | ||
from signalflow import * | ||
graph = AudioGraph() | ||
|
||
#------------------------------------------------------------------------------- | ||
# Using Line to repeatedly alter the release value of an envelope applied to the | ||
# main synth voice, in time with the music. | ||
#------------------------------------------------------------------------------- | ||
|
||
clock = Impulse(8.0) | ||
CMaj7 = [ 60, 64, 67, 71, 74, 76 ] * 8 | ||
FMaj9 = [ 65, 69, 72, 76, 77, 81 ] * 8 | ||
arpeggios = CMaj7 + FMaj9 | ||
sequence = Sequence(arpeggios, clock) | ||
frequency = MidiNoteToFrequency(sequence) | ||
|
||
oscillator = TriangleOscillator(frequency) | ||
release = Line(0.1, 0.5, 6, True) | ||
envelope= ASREnvelope(0.0, 0.0, release, 1.0, clock) | ||
voice = oscillator * envelope | ||
|
||
pan = SineLFO(0.1667, -1.0, 1.0) | ||
|
||
output = StereoPanner(voice, pan) | ||
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,20 @@ | ||
from signalflow import * | ||
graph = AudioGraph() | ||
|
||
#------------------------------------------------------------------------------- | ||
# Using AllpassDelay to add a delay effect to a simple melodic sequence. | ||
# The original oscillator can be heard in the left channel. | ||
# The delay effect can be heard in the right channel. | ||
#------------------------------------------------------------------------------- | ||
clock = Impulse(1.0) | ||
sequence = Sequence([ 60, 62, 64, 65, 67, 69, 71, 72 ], clock) | ||
frequency = MidiNoteToFrequency(sequence) | ||
oscillator = TriangleOscillator(frequency) | ||
envelope= ASREnvelope(0, 0.2, 0.3, 1.0, clock) | ||
voice = oscillator * envelope | ||
|
||
delayed = AllpassDelay(voice, 0.4, 0.8, 0.5) | ||
|
||
output = ChannelArray([ voice, delayed ]) * 0.75 | ||
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,26 @@ | ||
from signalflow import * | ||
graph = AudioGraph() | ||
|
||
#------------------------------------------------------------------------------- | ||
# Using AllpassDelay to add a dreamy atmosphere to synth arpeggios | ||
#------------------------------------------------------------------------------- | ||
clock = Impulse(3.5) | ||
|
||
Am7 = [ 67, 64, 60, 57 ] * 4 | ||
D7 = [ 62, 66, 69, 72] * 4 | ||
arpeggios = Am7 + D7 | ||
sequence = Sequence(arpeggios, clock) | ||
frequency = MidiNoteToFrequency(sequence) | ||
|
||
oscillator = SquareOscillator(frequency) | ||
envelope= ASREnvelope(0.1, 0, 0.2, 1.0, clock) | ||
voice = oscillator * envelope * 0.3 | ||
filtered = SVFilter(voice, SIGNALFLOW_FILTER_TYPE_LOW_PASS, 4000, 0.3) | ||
delayed = AllpassDelay(filtered, 0.15, 0.8, 0.5) | ||
|
||
pan = TriangleLFO(0.1, -1.0, 1.0) | ||
|
||
output = StereoPanner(delayed, pan) | ||
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,21 @@ | ||
from signalflow import * | ||
graph = AudioGraph() | ||
|
||
#------------------------------------------------------------------------------- | ||
# Using CombDelay to change the character of a saw wave oscillator. | ||
#------------------------------------------------------------------------------- | ||
clock = Impulse(4) | ||
arpeggio = [60, 62, 64, 66, 68, 70, | ||
72, 70, 68, 66, 64, 62] | ||
sequence = Sequence(arpeggio, clock) | ||
frequency = MidiNoteToFrequency(sequence) | ||
|
||
oscillator = SawOscillator(frequency) | ||
envelope= ASREnvelope(0.1, 0, 0.2, 1.0, clock) | ||
voice = oscillator * envelope | ||
|
||
comb = CombDelay(voice, 0.09, 0.6, 0.9) | ||
|
||
output = StereoPanner(comb) * 0.5 | ||
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,14 @@ | ||
from signalflow import * | ||
graph = AudioGraph() | ||
|
||
#------------------------------------------------------------------------------- | ||
# Using EQ to shape white noise. The low band (below 500Hz) is reduced. The mid | ||
# band is boosted. The high band (above 2000Hz) is reduced drastically. | ||
#------------------------------------------------------------------------------- | ||
noise = WhiteNoise() | ||
|
||
eq = EQ(noise, 0.6, 1.5, 0.1, 500, 2000) | ||
|
||
output = StereoPanner(eq) * 0.5 | ||
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,11 @@ | ||
from signalflow import * | ||
graph = AudioGraph() | ||
|
||
#------------------------------------------------------------------------------- | ||
# Using SVFilter as a low-pass filter on white noise. | ||
#------------------------------------------------------------------------------- | ||
noise = WhiteNoise() | ||
filtered = SVFilter(noise, SIGNALFLOW_FILTER_TYPE_LOW_PASS, 1000, 0.6) | ||
output = StereoPanner(filtered) | ||
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,27 @@ | ||
from signalflow import * | ||
graph = AudioGraph() | ||
|
||
#------------------------------------------------------------------------------- | ||
# Using SVFilter as a low-pass filter to reduce the harshness of a square wave | ||
# oscillator. | ||
#------------------------------------------------------------------------------- | ||
clock = Impulse(3.5) | ||
|
||
Am7 = [ 67, 64, 60, 57 ] * 4 | ||
D7 = [ 62, 66, 69, 72] * 4 | ||
arpeggios = Am7 + D7 | ||
sequence = Sequence(arpeggios, clock) | ||
frequency = MidiNoteToFrequency(sequence) | ||
|
||
oscillator = SquareOscillator(frequency) | ||
envelope= ASREnvelope(0.1, 0, 0.2, 1.0, clock) | ||
voice = oscillator * envelope | ||
filtered = SVFilter(voice, SIGNALFLOW_FILTER_TYPE_LOW_PASS, 4000, 0.3) | ||
delayed = AllpassDelay(filtered, 0.15, 0.8, 0.5) | ||
|
||
pan = TriangleLFO(0.1, -1.0, 1.0) | ||
|
||
output = StereoPanner(delayed, pan) | ||
output.play() | ||
|
||
graph.wait() |
22 changes: 22 additions & 0 deletions
22
docs/library/processors/panning/stereobalance/example-0.py
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,22 @@ | ||
from signalflow import * | ||
graph = AudioGraph() | ||
|
||
#------------------------------------------------------------------------------- | ||
# Demonstrating the effects of StereoBalance. Two tones are first panned hard | ||
# left and hard right with StereoPanner. | ||
# Setting StereoBalance's balance value to 0.0 will mean both tones are heard | ||
# equally. A value of -1.0 will result in only the left channel being heard. | ||
# A value of 1.0 will result in only the right channel being heard. | ||
#------------------------------------------------------------------------------- | ||
|
||
low = TriangleOscillator(220) | ||
high = TriangleOscillator(660) | ||
|
||
left = StereoPanner(low, -1.0) | ||
right = StereoPanner(high, 1.0) | ||
panned = (left + right) | ||
|
||
balanced = StereoBalance(panned, -1.0) | ||
|
||
balanced.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,18 @@ | ||
from signalflow import * | ||
graph = AudioGraph() | ||
|
||
#------------------------------------------------------------------------------- | ||
# Using StereoPanner to pan a low pitch to the left and a high pitch to the | ||
# right. | ||
#------------------------------------------------------------------------------- | ||
|
||
low = TriangleOscillator(220) | ||
high = TriangleOscillator(660) | ||
|
||
left = StereoPanner(low, -0.8) | ||
right = StereoPanner(high, 0.8) | ||
|
||
output = (left + right) * 0.5 | ||
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,26 @@ | ||
from signalflow import * | ||
graph = AudioGraph() | ||
|
||
#------------------------------------------------------------------------------- | ||
# Using StereoPanner to repeatedly pan an arpeggiating oscillator between the | ||
# left and right channels. | ||
#------------------------------------------------------------------------------- | ||
|
||
clock = Impulse(8.0) | ||
CMaj7 = [ 60, 64, 67, 71, 74, 76 ] * 8 | ||
FMaj9 = [ 65, 69, 72, 76, 77, 81 ] * 8 | ||
arpeggios = CMaj7 + FMaj9 | ||
sequence = Sequence(arpeggios, clock) | ||
frequency = MidiNoteToFrequency(sequence) | ||
|
||
oscillator = TriangleOscillator(frequency) | ||
release = Line(0.1, 0.5, 12, True) | ||
envelope= ASREnvelope(0.0, 0.0, release, 1.0, clock) | ||
voice = oscillator * envelope | ||
|
||
pan = SineLFO(0.1667, -1.0, 1.0) | ||
|
||
output = StereoPanner(voice, pan) | ||
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,14 @@ | ||
from signalflow import * | ||
graph = AudioGraph() | ||
|
||
#------------------------------------------------------------------------------- | ||
# Using white noise to control the pitch of an oscillator. | ||
# A new pitch is determined once every second. Interpolation is turned off so | ||
# that the oscillator jumps to the new pitch instead of smoothly moving to it. | ||
# Random interval is turned off so that pitch changes occur at a regular rate. | ||
#------------------------------------------------------------------------------- | ||
frequency = WhiteNoise(1, 100, 1000, False, False) | ||
oscillator = SineOscillator(frequency) | ||
output = StereoPanner(oscillator) | ||
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,17 @@ | ||
from signalflow import * | ||
graph = AudioGraph() | ||
|
||
#------------------------------------------------------------------------------- | ||
# Using white noise to simulate the sound of wind. | ||
# White noise is generated at audio rate and passed into a band-pass filter. | ||
# The cutoff of the filter is controlled by another white noise generator, which | ||
# generates a new value between 100 and 300 at randomly-spaced intervals every | ||
# second, and smoothly interpolates between these values. | ||
#------------------------------------------------------------------------------- | ||
noise = WhiteNoise() | ||
cutoff = WhiteNoise(1, 100, 300, True, True) | ||
|
||
filtered = SVFilter(noise, SIGNALFLOW_FILTER_TYPE_BAND_PASS, cutoff, 0.8) | ||
output = StereoPanner(filtered) | ||
output.play() | ||
graph.wait() |