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 *
|
from PyQt4.QtCore import *
|
||||||
|
|
||||||
import time
|
import time
|
||||||
from anki.sound import Recorder, play
|
from anki.sound import Recorder, play, generateNoiseProfile
|
||||||
from ankiqt.ui.utils import saveGeom, restoreGeom
|
from ankiqt.ui.utils import saveGeom, restoreGeom
|
||||||
|
|
||||||
def getAudio(parent, string=""):
|
def getAudio(parent, string=""):
|
||||||
|
@ -40,10 +40,17 @@ def getAudio(parent, string=""):
|
||||||
def recordNoiseProfile(parent):
|
def recordNoiseProfile(parent):
|
||||||
r = Recorder()
|
r = Recorder()
|
||||||
mb = QMessageBox(parent)
|
mb = QMessageBox(parent)
|
||||||
|
mb.setStandardButtons(QMessageBox.NoButton)
|
||||||
|
mb.setIconPixmap(QPixmap(":/icons/media-record.png"))
|
||||||
mb.show()
|
mb.show()
|
||||||
f = time.time() + 8
|
QApplication.instance().processEvents()
|
||||||
|
f = time.time() + 10
|
||||||
r.start()
|
r.start()
|
||||||
while f > time.time():
|
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()
|
QApplication.instance().processEvents()
|
||||||
|
time.sleep(0.1)
|
||||||
r.stop()
|
r.stop()
|
||||||
|
generateNoiseProfile(r.wavFile())
|
||||||
|
mb.deleteLater()
|
||||||
|
|
Loading…
Reference in a new issue