annotate pyspark/decode_to_wav.py @ 0:e34cf1b6fe09 tip

commit
author Daniel Wolff
date Sat, 20 Feb 2016 18:14:24 +0100
parents
children
rev   line source
Daniel@0 1 # Part of DML (Digital Music Laboratory)
Daniel@0 2 #
Daniel@0 3 # This program is free software; you can redistribute it and/or
Daniel@0 4 # modify it under the terms of the GNU General Public License
Daniel@0 5 # as published by the Free Software Foundation; either version 2
Daniel@0 6 # of the License, or (at your option) any later version.
Daniel@0 7 #
Daniel@0 8 # This program is distributed in the hope that it will be useful,
Daniel@0 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
Daniel@0 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
Daniel@0 11 # GNU General Public License for more details.
Daniel@0 12 #
Daniel@0 13 # You should have received a copy of the GNU General Public
Daniel@0 14 # License along with this library; if not, write to the Free Software
Daniel@0 15 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Daniel@0 16
Daniel@0 17 #!/usr/bin/python
Daniel@0 18 # -*- coding: utf-8 -*-
Daniel@0 19
Daniel@0 20 __author__="wolffd"
Daniel@0 21 __date__ ="$21-Jul-2014 15:36:41$"
Daniel@0 22
Daniel@0 23 # -*- coding: utf-8 -*-
Daniel@0 24 #from timeside.decoder import *
Daniel@0 25 #from timeside.encoder import *
Daniel@0 26 #import os.path
Daniel@0 27 #import sys
Daniel@0 28 # now use a regular timeside installation, e.g. installed by
Daniel@0 29 #sys.path.append(os.getcwd() + '/../TimeSide/')
Daniel@0 30
Daniel@0 31 from timeside.decoder.file import *
Daniel@0 32 from timeside.encoder.wav import *
Daniel@0 33
Daniel@0 34 def decode_to_wav(source = 'sweep.flac'):
Daniel@0 35 if source[-4:] == ".wav" :
Daniel@0 36 dest = source
Daniel@0 37 print "already converted: " + dest
Daniel@0 38
Daniel@0 39 else:
Daniel@0 40 dest = source + '.wav'
Daniel@0 41 decoder = FileDecoder(source)
Daniel@0 42 encoder = WavEncoder(dest, overwrite=True)
Daniel@0 43 (decoder | encoder).run()
Daniel@0 44 print "decoded: " + dest
Daniel@0 45 return dest