Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/library/pippy/sound.py
diff options
context:
space:
mode:
authorChris Ball <cjb@laptop.org>2008-03-14 18:07:48 (GMT)
committer Chris Ball <cjb@laptop.org>2008-03-14 18:07:48 (GMT)
commit3d1cb031e9ef60698c85707e7551f6ee2c9d87da (patch)
tree0ada18daac7292cf7cd5845a9f57cbb595c7a8a8 /library/pippy/sound.py
parent1df80a0226011e4f0f1d7a0ebffd6e7b36be68fd (diff)
Look for the audio library in /home as well as /usr/share.
Diffstat (limited to 'library/pippy/sound.py')
-rwxr-xr-xlibrary/pippy/sound.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/library/pippy/sound.py b/library/pippy/sound.py
index 05540e5..ff4d8e3 100755
--- a/library/pippy/sound.py
+++ b/library/pippy/sound.py
@@ -1,8 +1,8 @@
#! /usr/bin/env python
+import os
-# added frequency modulation genertor
-# audioOut write a wave file if a string is given as argument
-
+dirs = ['/usr/share/activities/TamTamEdit.activity/common/Resources/Sounds/',
+ '/home/olpc/Activities/TamTamEdit.activity/common/Resources/Sounds/']
orchlines = []
scorelines = []
instrlist = []
@@ -16,6 +16,11 @@ def quit(self):
cs = None
"""
+def finddir():
+ for d in dirs:
+ if os.path.isdir(d):
+ return d
+
def defAdsr(attack=0.01, decay=0.1, sustain=0.8, release=0.1):
"""Define an ADSR envelope. fnum = defADSR(attack = [0.01], decay = [0.1], sustain = [0.8], release = [0.1])"""
att = int(2048 * attack)
@@ -144,7 +149,7 @@ def playPluck( pitch=100, amplitude=5000, duration=2, starttime=0, pitch_envelop
def playWave(sound='horse', pitch=1, amplitude=1, loop=False, duration=1, starttime=0, pitch_envelope='default', amplitude_envelope='default'):
"""Play a wave file (sound = ['horse'], pitch = [1], amplitude = [1], loop = [False], duration = [1], starttime = [0], pitch_envelope=['default'], amplitude_envelope=['default'])"""
- fullname = '/usr/share/activities/TamTamEdit.activity/common/Resources/Sounds/' + str(sound)
+ fullname = finddir() + str(sound)
if loop == False: lp = 0
else: lp = 1
@@ -168,7 +173,7 @@ def playWave(sound='horse', pitch=1, amplitude=1, loop=False, duration=1, startt
def getSoundList():
import os
- return sorted(os.listdir('/usr/share/activities/TamTamEdit.activity/common/Resources/Sounds/'))
+ return sorted(os.listdir(finddir()))
temp_path=None
def audioOut(file=None):