mirror of
https://github.com/ankitects/anki.git
synced 2025-09-21 07:22:23 -04:00
fix silence sampling
This commit is contained in:
parent
afb334c89f
commit
23c2b6617d
1 changed files with 10 additions and 3 deletions
|
@ -5,7 +5,7 @@ from PyQt4.QtGui import *
|
|||
from PyQt4.QtCore import *
|
||||
|
||||
import time
|
||||
from anki.sound import Recorder, play
|
||||
from anki.sound import Recorder, play, generateNoiseProfile
|
||||
from ankiqt.ui.utils import saveGeom, restoreGeom
|
||||
|
||||
def getAudio(parent, string=""):
|
||||
|
@ -40,10 +40,17 @@ def getAudio(parent, string=""):
|
|||
def recordNoiseProfile(parent):
|
||||
r = Recorder()
|
||||
mb = QMessageBox(parent)
|
||||
mb.setStandardButtons(QMessageBox.NoButton)
|
||||
mb.setIconPixmap(QPixmap(":/icons/media-record.png"))
|
||||
mb.show()
|
||||
f = time.time() + 8
|
||||
QApplication.instance().processEvents()
|
||||
f = time.time() + 10
|
||||
r.start()
|
||||
while f > time.time():
|
||||
mb.setText("Sampling silence...%0.1f" % f - time.time())
|
||||
txt =_("Sampling silence...<br>Time: %0.1f")
|
||||
mb.setText(txt % (f - time.time()))
|
||||
QApplication.instance().processEvents()
|
||||
time.sleep(0.1)
|
||||
r.stop()
|
||||
generateNoiseProfile(r.wavFile())
|
||||
mb.deleteLater()
|
||||
|
|
Loading…
Reference in a new issue