-
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.
- Loading branch information
Showing
11 changed files
with
374 additions
and
340 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 |
---|---|---|
@@ -1,29 +1,34 @@ | ||
#!/usr/bin/env python3 | ||
|
||
#-------------------------------------------------------------------------------- | ||
# -------------------------------------------------------------------------------- | ||
# Example: Audio playthrough, from input to output. | ||
# (Be careful to listen through headphones or feedback might occur.) | ||
#-------------------------------------------------------------------------------- | ||
# (Listen through headphones to avoid feedback) | ||
# -------------------------------------------------------------------------------- | ||
|
||
from signalflow import * | ||
|
||
graph = AudioGraph() | ||
|
||
#-------------------------------------------------------------------------------- | ||
# Read single channel input. | ||
# To specify the audio device to use, add to ~/.signalflow/config: | ||
# | ||
# [audio] | ||
# input_device_name = "My Device" | ||
#-------------------------------------------------------------------------------- | ||
audio_in = AudioIn() | ||
|
||
#-------------------------------------------------------------------------------- | ||
# Add some ringmod and delay. | ||
#-------------------------------------------------------------------------------- | ||
audio_out = audio_in * SineOscillator(200) | ||
audio_out = audio_out + CombDelay(audio_out, 0.2, 0.8) * 0.3 | ||
output = ChannelArray([ audio_out, audio_out ]) | ||
|
||
graph.play(output) | ||
graph.wait() | ||
|
||
def main(): | ||
graph = AudioGraph() | ||
|
||
#-------------------------------------------------------------------------------- | ||
# Read mono audio input. | ||
# To specify the audio device to use, add to ~/.signalflow/config: | ||
# | ||
# [audio] | ||
# input_device_name = "My Device" | ||
#-------------------------------------------------------------------------------- | ||
audio_in = AudioIn(1) | ||
|
||
#-------------------------------------------------------------------------------- | ||
# Add some delay, and play | ||
#-------------------------------------------------------------------------------- | ||
output = audio_in + CombDelay(audio_in, 0.2, 0.8) * 0.3 | ||
stereo = StereoPanner(output) | ||
|
||
graph.play(stereo) | ||
graph.wait() | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
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
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 |
---|---|---|
@@ -1,32 +1,38 @@ | ||
#!/usr/bin/env python3 | ||
|
||
#------------------------------------------------------------------------ | ||
# SignalFlow: Modulation example. | ||
# SignalFlow: Granulation example. | ||
#------------------------------------------------------------------------ | ||
from signalflow import * | ||
import os | ||
|
||
#------------------------------------------------------------------------ | ||
# Create the global processing graph. | ||
#------------------------------------------------------------------------ | ||
graph = AudioGraph() | ||
graph.poll(2) | ||
def main(): | ||
#------------------------------------------------------------------------ | ||
# Create the global processing graph. | ||
#------------------------------------------------------------------------ | ||
graph = AudioGraph() | ||
graph.poll(1) | ||
|
||
#------------------------------------------------------------------------ | ||
# Load an audio buffer. | ||
#------------------------------------------------------------------------ | ||
audio_path = os.path.join(os.path.dirname(__file__), "audio", "gliss.aif") | ||
buf = Buffer(audio_path) | ||
clock = RandomImpulse(50) | ||
pos = WhiteNoise(1, min=0, max=buf.duration, interpolate=False) | ||
pan = RandomUniform(-1, 1, clock=clock) | ||
rate = RandomExponential(0.5, 2.0, clock=clock) | ||
granulator = Granulator(buf, clock, pan=pan, pos=pos, rate=rate, duration=0.5) | ||
envelope = EnvelopeBuffer("triangle") | ||
granulator.set_buffer("envelope", envelope) | ||
#------------------------------------------------------------------------ | ||
# Load an audio buffer. | ||
#------------------------------------------------------------------------ | ||
audio_path = os.path.join(os.path.dirname(__file__), "audio", "gliss.aif") | ||
buf = Buffer(audio_path) | ||
clock = RandomImpulse(50) | ||
granulator = Granulator(buffer=buf, | ||
clock=clock, | ||
pan=RandomUniform(-1, 1, clock=clock), | ||
pos=RandomUniform(0, buf.duration, clock=clock), | ||
rate=RandomExponential(0.5, 2.0, clock=clock), | ||
duration=0.5) | ||
envelope = EnvelopeBuffer("triangle") | ||
granulator.set_buffer("envelope", envelope) | ||
|
||
#------------------------------------------------------------------------ | ||
# Play the output. | ||
#------------------------------------------------------------------------ | ||
graph.play(granulator) | ||
graph.wait() | ||
#------------------------------------------------------------------------ | ||
# Play the output. | ||
#------------------------------------------------------------------------ | ||
graph.play(granulator) | ||
graph.wait() | ||
|
||
if __name__ == "__main__": | ||
main() |
Oops, something went wrong.