Skip to content

Commit

Permalink
Update examples
Browse files Browse the repository at this point in the history
  • Loading branch information
ideoforms committed Nov 7, 2023
1 parent a4177c1 commit 70a1cfc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
18 changes: 12 additions & 6 deletions examples/buffer-play-example.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,22 @@
# Reads a stereo buffer from an audio file, and plays it through system output.
#--------------------------------------------------------------------------------

import signalflow as sf
from signalflow import *
import os

graph = sf.AudioGraph()
graph = AudioGraph()

audio_path = os.path.join(os.path.dirname(__file__), "../audio/stereo-count.wav")
buf = sf.Buffer(audio_path)
player = sf.BufferPlayer(buf, loop=True)
#--------------------------------------------------------------------------------
# Read samples into a Buffer by passing the filename
#--------------------------------------------------------------------------------
audio_path = os.path.join(os.path.dirname(__file__), "audio", "stereo-count.wav")
buf = Buffer(audio_path)
print("Loaded buffer with %d channel(s), duration: %.1fs" % (buf.num_channels, buf.duration))

print("Loaded buffer: %s" % buf)
#--------------------------------------------------------------------------------
# Begin looping playback
#--------------------------------------------------------------------------------
player = BufferPlayer(buf, loop=True)

graph.play(player)
graph.wait()
2 changes: 1 addition & 1 deletion examples/granulation-example.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#------------------------------------------------------------------------
# Load an audio buffer.
#------------------------------------------------------------------------
audio_path = os.path.join(os.path.dirname(__file__), "../audio/gliss.aif")
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)
Expand Down

0 comments on commit 70a1cfc

Please sign in to comment.