From 0a8b168a8a28f560df6a32a41dc353fd322b3152 Mon Sep 17 00:00:00 2001 From: Walter Bender Date: Tue, 15 May 2012 13:29:26 +0000 Subject: add audio record/playback --- (limited to 'utils.py') diff --git a/utils.py b/utils.py index ffab831..230ab45 100644 --- a/utils.py +++ b/utils.py @@ -9,7 +9,7 @@ # along with this library; if not, write to the Free Software # Foundation, 51 Franklin Street, Suite 500 Boston, MA 02110-1335 USA - +import subprocess from StringIO import StringIO try: OLD_SUGAR_SYSTEM = False @@ -51,3 +51,11 @@ def json_dump(data): _io = StringIO() jdump(data, _io) return _io.getvalue() + + +def play_audio_from_file(file_path): + """ Audio media """ + command_line = ['gst-launch', 'filesrc', 'location=' + file_path, + '! oggdemux', '! vorbisdec', '! audioconvert', + '! alsasink'] + subprocess.call(command_line) -- cgit v0.9.1