def qcpfinal(self, start, duration, volume=None): conversions.converttowav(self.file, self.wavfile, samplerate=8000, channels=1, start=start, duration=duration) if volume is not None: conversions.adjustwavfilevolume(self.wavfile, volume) conversions.convertwavtoqcp(self.wavfile, self.qcpfile, self.optimization.GetSelection()) return open(self.qcpfile, "rb").read()
def mp3convert(self): # make mp3 to work with open(self.mp3file, "wb").write(conversions.converttomp3(self.file, int(self.bitrate.GetStringSelection()), int(self.samplerate.GetStringSelection()), int(self.channels.GetStringSelection()))) self.afi=fileinfo.getmp3fileinfo(self.mp3file) print "result is",len(self.afi.frames),"frames" # and corresponding wav to play conversions.converttowav(self.mp3file, self.wavfile)
def _trim_and_adjust_vol_mp3(self, start, duration, volume): conversions.converttowav(self.file, self.wavfile, start=start, duration=duration) conversions.adjustwavfilevolume(self.wavfile, volume) return conversions.converttomp3(self.wavfile, int(self.bitrate.GetStringSelection()), int(self.samplerate.GetStringSelection()), int(self.channels.GetStringSelection()))
def qcpfinal(self, start, duration, volume=None): # use the original to make a new wav, not the one that went through foo -> qcp -> wav conversions.converttowav(self.file, self.wavfile, samplerate=8000, channels=1, start=start, duration=duration) if volume is not None: conversions.adjustwavfilevolume(self.wavfile, volume) conversions.convertwavtoqcp(self.wavfile, self.qcpfile, self.optimization.GetSelection()) return file(self.qcpfile, "rb").read()
def qcpconvert(self): # we verify the pvconv binary exists first conversions.getpvconvbinary() # convert to wav first conversions.converttowav(self.file, self.wavfile, samplerate=8000, channels=1) # then to qcp conversions.convertwavtoqcp(self.wavfile, self.qcpfile, self.optimization.GetSelection()) # and finally the wav from the qcp so we can accurately hear what it sounds like conversions.convertqcptowav(self.qcpfile, self.wavfile)
def _trim_and_adjust_vol_mp3(self, start, duration, volume): # trim, adjust volume, and write mp3 out # use the original to make a new wav, not the one that went through foo -> mp3 -> wav conversions.converttowav(self.file, self.wavfile, start=start, duration=duration) # adjust the volume conversions.adjustwavfilevolume(self.wavfile, volume) # convert to mp3 return conversions.converttomp3(self.wavfile, int(self.bitrate.GetStringSelection()), int(self.samplerate.GetStringSelection()), int(self.channels.GetStringSelection()))
def qcpconvert(self): conversions.getpvconvbinary() conversions.converttowav(self.file, self.wavfile, samplerate=8000, channels=1) conversions.convertwavtoqcp(self.wavfile, self.qcpfile, self.optimization.GetSelection()) conversions.convertqcptowav(self.qcpfile, self.wavfile)
def mp3convert(self): open(self.mp3file, "wb").write(conversions.converttomp3(self.file, int(self.bitrate.GetStringSelection()), int(self.samplerate.GetStringSelection()), int(self.channels.GetStringSelection()))) self.afi=fileinfo.getmp3fileinfo(self.mp3file) print "result is",len(self.afi.frames),"frames" conversions.converttowav(self.mp3file, self.wavfile)