diff pyspark/decode_to_wav.py @ 0:e34cf1b6fe09 tip

commit
author Daniel Wolff
date Sat, 20 Feb 2016 18:14:24 +0100
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/pyspark/decode_to_wav.py	Sat Feb 20 18:14:24 2016 +0100
@@ -0,0 +1,45 @@
+# Part of DML (Digital Music Laboratory)
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+
+__author__="wolffd"
+__date__ ="$21-Jul-2014 15:36:41$"
+
+# -*- coding: utf-8 -*-
+#from timeside.decoder import *
+#from timeside.encoder import *
+#import os.path
+#import sys
+# now use a regular timeside installation, e.g. installed by 
+#sys.path.append(os.getcwd() + '/../TimeSide/')
+
+from timeside.decoder.file import *
+from timeside.encoder.wav import *
+
+def decode_to_wav(source = 'sweep.flac'):
+    if source[-4:] == ".wav" :
+        dest = source
+        print "already converted: " + dest
+        
+    else:
+        dest = source + '.wav'
+        decoder  = FileDecoder(source)
+        encoder  = WavEncoder(dest, overwrite=True)
+        (decoder | encoder).run()
+        print "decoded: " + dest
+    return dest