python - QAudioOutput strange peak sound at beginning in PyQt4 -
that's general question: how can rid of peak sound @ beginning of sound? here complete code can try out. comparison: if play same sound qsound, not have peak noise. can't use qsound because not work on ubuntu.
if playing sound in player vlc, there no noise @ beginning. here sound: http://www.file-upload.net/download-7876205/delete_2.wav.html
import struct, sys, time pyqt4.qtcore import qiodevice, qt, qfile pyqt4.qtgui import qapplication, qwidget pyqt4.qtmultimedia import qaudio, qaudiodeviceinfo, qaudioformat, qaudiooutput class window(qwidget): def __init__(self, parent = none): qwidget.__init__(self, parent) format = qaudioformat() format.setchannels(1) format.setfrequency(48000) format.setsamplesize(16) #format.setcodec("audio/pcm") format.setcodec("audio/wav") format.setbyteorder(qaudioformat.littleendian) format.setsampletype(qaudioformat.signedint) self.output = qaudiooutput(format, self) self.file=qfile() self.file.setfilename("c:\\delete_2.wav") self.file.open(qiodevice.readonly) self.output.start(self.file) #self.file.close() if __name__ == "__main__": app = qapplication(sys.argv) window = window() #window.show() sys.exit(app.exec_())
self.file.seek(44)
is skip file header, 44 not fixed size. after audio data
Comments
Post a Comment