Skip to content

Commit

Permalink
Documentation: More examples
Browse files Browse the repository at this point in the history
Adding examples for ChannelArray, OneTapDelay, Resample, StereoWidth.
Updating documentation for Line.
  • Loading branch information
gregwht committed Feb 9, 2024
1 parent e0b61be commit 913147a
Show file tree
Hide file tree
Showing 6 changed files with 77 additions and 1 deletion.
11 changes: 11 additions & 0 deletions docs/library/operators/channelarray/example-0.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from signalflow import *
graph = AudioGraph()

#-------------------------------------------------------------------------------
# Using ChannelArray to pan a low tone to the left and a high tone to the right.
#-------------------------------------------------------------------------------
low = TriangleOscillator(220)
high = TriangleOscillator(660)
panned = ChannelArray([low, high]) * 0.3
panned.play()
graph.wait()
16 changes: 16 additions & 0 deletions docs/library/processors/delays/onetapdelay/example-0.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from signalflow import *
graph = AudioGraph()

#-------------------------------------------------------------------------------
# Using OneTapDelay to create a delay effect with no feedback.
# The original sound is heard in the left channel, and the delayed sound in the
# right channel.
#-------------------------------------------------------------------------------
clock = Impulse(1)
oscillator = TriangleOscillator(440)
envelope = ASREnvelope(0.001, 0, 0.3, 1.0, clock)
voice = oscillator * envelope
delayed = OneTapDelay(voice, 0.25) * 0.5
output = ChannelArray([voice, delayed]) * 0.5
output.play()
graph.wait()
26 changes: 26 additions & 0 deletions docs/library/processors/delays/onetapdelay/example-1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
from signalflow import *
graph = AudioGraph()

#-------------------------------------------------------------------------------
# Using OneTapDelay to bring controlled rhythmic interest to a melodic sequence
#-------------------------------------------------------------------------------
clock = Impulse(3.5)
Dm = [ 62, 65, 69 ] * 2
Bdim = [ 59, 62, 65 ] * 2
Gm = [55, 58, 62 ] * 2
Bb = [77, 74, 70 ]
A = [ 76, 73, 69 ]

arpeggios = Dm + Bdim + Gm + Bb + A
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, "low_pass", 4000, 0.3)
delayed = filtered + OneTapDelay(filtered, 0.4) * 0.5

output = StereoPanner(delayed) * 0.3
output.play()
graph.wait()
11 changes: 11 additions & 0 deletions docs/library/processors/distortion/resample/example-0.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from signalflow import *
graph = AudioGraph()

#-------------------------------------------------------------------------------
# Using Resample to distort a sine wave.
#-------------------------------------------------------------------------------
sine = SineOscillator(440)
crushed = Resample(sine, 11025, 4)
output = StereoPanner(crushed) * 0.3
output.play()
graph.wait()
12 changes: 12 additions & 0 deletions docs/library/processors/panning/stereowidth/example-0.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from signalflow import *
graph = AudioGraph()

#-------------------------------------------------------------------------------
# Using StereoWidth to continuously alter the width of a stereo signal.
#-------------------------------------------------------------------------------
low = TriangleOscillator(220)
high = TriangleOscillator(660)
panned = ChannelArray([low, high])
width = StereoWidth(panned, TriangleLFO(0.5, 0, 1)) * 0.3
width.play()
graph.wait()
2 changes: 1 addition & 1 deletion source/include/signalflow/node/envelope/line.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace signalflow
{

/**--------------------------------------------------------------------------------*
* Line segment with the given start/end values and duration.
* Line segment with the given start/end values, and duration (in seconds).
* If loop is true, repeats indefinitely.
* Retriggers on a clock signal.
*---------------------------------------------------------------------------------*/
Expand Down

0 comments on commit 913147a

Please sign in to comment.