Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

We’re showing branches in this repository, but you can also compare across forks.

base fork: hecanjog/fabric
...
head fork: hecanjog/fabric
  • 2 commits
  • 1 file changed
  • 0 commit comments
  • 1 contributor
Commits on Mar 14, 2012
Erik Schoster fake merge core changes from william c05a01c
Erik Schoster fake merge breakpoint from william 490b784
Showing with 23 additions and 2 deletions.
  1. +23 −2 dsp.py
25 dsp.py
View
@@ -584,6 +584,21 @@ def play(out=''):
return out
+def delay(s):
+ """ A wrapper for time.sleep() - input seconds as floats """
+ time.sleep(s)
+
+def stream(outs=['']):
+ shhh = open(os.devnull, 'w')
+
+ for out in outs:
+ filename = cache(out)
+ p = subprocess.Popen(['aplay', '-f', 'cd', filename], shell=False, stdout=shhh, stderr=shhh)
+
+ shhh.close()
+
+ return outs
+
def insert_into(haystack, needle, position):
# split string at position index
hay = cut(haystack, 0, position)
@@ -703,18 +718,24 @@ def pan(slice, pan_pos=0.5, amp=1.0):
slice = audioop.add(lslice, rslice, audio_params[1])
return audioop.mul(slice, audio_params[1], amp)
-def env(audio_string, wavetable_type="sine", fullres=False):
+def env(audio_string, wavetable_type="sine", fullres=False, highval=1.0, lowval=0.0):
# Very short envelopes are possible...
if flen(audio_string) < dsp_grain * 4 or fullres == True:
packets = split(audio_string, 1)
else:
packets = split(audio_string, dsp_grain)
- wtable = wavetable(wavetable_type, len(packets))
+ wtable = wavetable(wavetable_type, len(packets), highval, lowval)
packets = [audioop.mul(packet, audio_params[1], wtable[i]) for i, packet in enumerate(packets)]
return ''.join(packets)
+def benv(sound, points):
+ chunksize = flen(sound) / (len(points) - 1)
+ sounds = split(sound, chunksize, audio_params[0])
+
+ return ''.join([env(s, 'line', points[i + 1], points[i]) for i, s in enumerate(sounds)])
+
def panenv(sound, ptype='line', etype='sine', panlow=0.0, panhigh=1.0, envlow=0.0, envhigh=1.0):
packets = split(sound, dsp_grain)

No commit comments for this range

Something went wrong with that request. Please try again.