From 913147a9b99e5615bc0e67725f01642df63d9398 Mon Sep 17 00:00:00 2001
From: Gregory White <gcwhitemail@gmail.com>
Date: Fri, 9 Feb 2024 15:46:23 +0000
Subject: [PATCH] Documentation: More examples

Adding examples for ChannelArray, OneTapDelay, Resample, StereoWidth.
Updating documentation for Line.
---
 .../operators/channelarray/example-0.py       | 11 ++++++++
 .../delays/onetapdelay/example-0.py           | 16 ++++++++++++
 .../delays/onetapdelay/example-1.py           | 26 +++++++++++++++++++
 .../distortion/resample/example-0.py          | 11 ++++++++
 .../panning/stereowidth/example-0.py          | 12 +++++++++
 .../include/signalflow/node/envelope/line.h   |  2 +-
 6 files changed, 77 insertions(+), 1 deletion(-)
 create mode 100644 docs/library/operators/channelarray/example-0.py
 create mode 100644 docs/library/processors/delays/onetapdelay/example-0.py
 create mode 100644 docs/library/processors/delays/onetapdelay/example-1.py
 create mode 100644 docs/library/processors/distortion/resample/example-0.py
 create mode 100644 docs/library/processors/panning/stereowidth/example-0.py

diff --git a/docs/library/operators/channelarray/example-0.py b/docs/library/operators/channelarray/example-0.py
new file mode 100644
index 00000000..bf311435
--- /dev/null
+++ b/docs/library/operators/channelarray/example-0.py
@@ -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()
\ No newline at end of file
diff --git a/docs/library/processors/delays/onetapdelay/example-0.py b/docs/library/processors/delays/onetapdelay/example-0.py
new file mode 100644
index 00000000..ee67527f
--- /dev/null
+++ b/docs/library/processors/delays/onetapdelay/example-0.py
@@ -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()
\ No newline at end of file
diff --git a/docs/library/processors/delays/onetapdelay/example-1.py b/docs/library/processors/delays/onetapdelay/example-1.py
new file mode 100644
index 00000000..14ae4c74
--- /dev/null
+++ b/docs/library/processors/delays/onetapdelay/example-1.py
@@ -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()
\ No newline at end of file
diff --git a/docs/library/processors/distortion/resample/example-0.py b/docs/library/processors/distortion/resample/example-0.py
new file mode 100644
index 00000000..6c527db1
--- /dev/null
+++ b/docs/library/processors/distortion/resample/example-0.py
@@ -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()
\ No newline at end of file
diff --git a/docs/library/processors/panning/stereowidth/example-0.py b/docs/library/processors/panning/stereowidth/example-0.py
new file mode 100644
index 00000000..57cd21b1
--- /dev/null
+++ b/docs/library/processors/panning/stereowidth/example-0.py
@@ -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()
\ No newline at end of file
diff --git a/source/include/signalflow/node/envelope/line.h b/source/include/signalflow/node/envelope/line.h
index 5cde9b07..a4bf57a4 100644
--- a/source/include/signalflow/node/envelope/line.h
+++ b/source/include/signalflow/node/envelope/line.h
@@ -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.
  *---------------------------------------------------------------------------------*/