title: play sound file in PyQt
body: <p>I've developed a software in PyQt which plays sound.I'm using Phonon Library to play the sound but it has some lag.So how can I play a sound file in PyQt without using Phonon Library.</p>
  
  <p>This is how I am currently using Phonon:</p>
  
  <pre><code>def Playnote(self,note_id):
      global note    
      note = note_id
      self.PlayThread = PlayThread()
      self.PlayThread.start()
  
  
  
  
  class PlayThread(QtCore.QThread):
    def __init__(self):
    QtCore.QThread.__init__(self)
  
    def __del__(self):
      self.wait()     
    def run(self):
      global note
      self.m_media = Phonon.MediaObject(self)
      audioOutput = Phonon.AudioOutput(Phonon.MusicCategory, self)
      Phonon.createPath(self.m_media, audioOutput)
      self.m_media.setCurrentSource(Phonon.MediaSource(Phonon.MediaSource(note)))
      self.m_media.play()
  </code></pre>
  
  <p>Now the lag is reduced. But the problem is is I'm pressing two or more keys in short time that's the new note overheads and stops the previous note. I need to play the previous note till it ends.</p>
  
  <pre><code>class PlayThread(QtCore.QThread):
     def __init__(self):
      QtCore.QThread.__init__(self)
      self.m_media = Phonon.MediaObject(self)
      self.audioOutput = Phonon.AudioOutput(Phonon.MusicCategory, self)
      Phonon.createPath(self.m_media, self.audioOutput)    
     def __del__(self):
        self.wait()       
     def play(self, note):
        self.m_media.setCurrentSource(Phonon.MediaSource(Phonon.MediaSource(note)))
        self.m_media.play()
     def run(self):pass
  </code></pre>