sintonia/library/ecasound/examples/ecidoc_example.py
Paul Baranowski 6a39e4f5f5 Removed the Debian directory.
Renamed directory "dev" to "dev_tools".

Replaced the ecasound-2.7.2 with a new download of ecasound.  The reason is
that the previous ecasound directory had all the Makefiles checked in with
hardcoded paths from Naomi's computer.  This prevented anyone else from
being able to build.  I copied over the modified version of ecacontrol.py.
2011-03-09 18:20:34 -05:00

42 lines
1.4 KiB
Python

#!/usr/bin/env python
# -----------------------------------------------------------------------
# Implementation of the following:
#
# 1. Setup ECI to read audio from file, apply a 100Hz lowpass filter, and
# send it to the soundcard (/dev/dsp).
# 2. Every second, check the current position. If the stream has
# been running for over 15 seconds, exit immediately. Also,
# every second, increase the lowpass filter's cutoff frequency
# by 500Hz.
# 3. Stop the stream (if not already finished) and disconnect the
# chainsetup. Print chain operator status info.
# -----------------------------------------------------------------------
import time
from pyeca import *
e = ECA_CONTROL_INTERFACE()
e.command("cs-add play_chainsetup")
e.command("c-add 1st_chain")
e.command("ai-add foo.wav")
e.command("ao-add /dev/dsp")
e.command("cop-add -efl:100")
e.command("cop-select 1")
e.command("copp-select 1")
e.command("cs-connect")
e.command("start")
cutoff_inc = 500.0
while 1:
time.sleep(1)
e.command("engine-status")
if e.last_string() != "running": break
e.command("get-position")
curpos = e.last_float()
if curpos > 15: break
e.command("copp-get")
next_cutoff = cutoff_inc + e.last_float()
e.command_float_arg("copp-set", next_cutoff)
e.command("stop")
e.command("cs-disconnect")
e.command("cop-status")
print "Chain operator status: ", e.last_string()