Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/library
diff options
context:
space:
mode:
authorC. Scott Ananian <cscott@laptop.org>2007-12-12 18:34:37 (GMT)
committer C. Scott Ananian <cscott@laptop.org>2007-12-12 18:36:22 (GMT)
commit28b9e3f98c07d72b2208a385e347fcbb117a7926 (patch)
tree80ca3420766ca181acc475a4224ab3230aa31553 /library
parent9d9f49283b9f8437746692feb4512999ee08ec07 (diff)
Improve speed of 'import pippy' by removing the 'from sugar import env'.
We only do this step for 'audioOut' now.
Diffstat (limited to 'library')
-rwxr-xr-xlibrary/pippy/sound.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/library/pippy/sound.py b/library/pippy/sound.py
index 03e3d1f..570c10c 100755
--- a/library/pippy/sound.py
+++ b/library/pippy/sound.py
@@ -3,17 +3,12 @@
# added frequency modulation genertor
# audioOut write a wave file if a string is given as argument
import os
-from sugar import env
orchlines = []
scorelines = []
instrlist = []
fnum = [100]
-temp_path = env.get_profile_path() + '/pippy'
-if not os.path.isdir(temp_path):
- os.mkdir(temp_path)
-
def quit(self):
perf.Stop()
perf.Join()
@@ -175,6 +170,12 @@ def getSoundList():
def audioOut(file=None):
"""Compile a .csd file and start csound to run it. If a string is given as argument, it write a wave file on disk instead of sending sound to hp. (file = [None])"""
+ global temp_path
+ if temp_path is None:
+ from sugar import env
+ temp_path = env.get_profile_path() + '/pippy'
+ if not os.path.isdir(temp_path):
+ os.mkdir(temp_path)
path = temp_path
csd = open(path + "/temp.csd", "w")
csd.write("<CsoundSynthesizer>\n\n")