mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 14:02:21 -04:00
mention audio requirements, save recorder location, tweaks
This commit is contained in:
parent
559a896f24
commit
7f8c18ce35
2 changed files with 25 additions and 9 deletions
15
README
15
README
|
@ -1,4 +1,4 @@
|
|||
Anki for Linux
|
||||
Anki
|
||||
-------------------------------------
|
||||
|
||||
Prerequisites:
|
||||
|
@ -14,14 +14,19 @@ For graph generation:
|
|||
- python-numpy (numpy)
|
||||
- python-matplotlib (matplotlib)
|
||||
|
||||
For audio playing support:
|
||||
|
||||
- mplayer on Windows/Linux (Mac uses native libraries)
|
||||
|
||||
For audio recording support:
|
||||
|
||||
- sox
|
||||
- pyaudio
|
||||
|
||||
For furigana generation:
|
||||
|
||||
- kakasi
|
||||
|
||||
For audio support:
|
||||
|
||||
- mplayer
|
||||
|
||||
Running / Installation
|
||||
-------------------------------------
|
||||
|
||||
|
|
|
@ -6,21 +6,32 @@ from PyQt4.QtCore import *
|
|||
|
||||
import time
|
||||
from anki.sound import Recorder, play
|
||||
from ankiqt.ui.utils import saveGeom, restoreGeom
|
||||
|
||||
def getAudio(parent, string=""):
|
||||
"Record and return filename"
|
||||
# record first
|
||||
r = Recorder()
|
||||
mb = QMessageBox(parent)
|
||||
restoreGeom(mb, "audioRecorder")
|
||||
mb.setWindowTitle("Anki")
|
||||
mb.setIconPixmap(QPixmap(":/icons/media-record.png"))
|
||||
but = QPushButton(_(" Stop"))
|
||||
but.setIcon(QIcon(":/icons/media-playback-stop.png"))
|
||||
but.setIconSize(QSize(32, 32))
|
||||
#but.setIconSize(QSize(32, 32))
|
||||
mb.addButton(but, QMessageBox.RejectRole)
|
||||
mb.show()
|
||||
mb.setText("Recording..")
|
||||
QApplication.instance().processEvents()
|
||||
t = time.time()
|
||||
r.start()
|
||||
mb.exec_()
|
||||
QApplication.instance().processEvents()
|
||||
while not mb.clickedButton():
|
||||
txt =_("Recording...<br>Time: %0.1f")
|
||||
mb.setText(txt % (time.time() - t))
|
||||
QApplication.instance().processEvents()
|
||||
# ensure at least a second captured
|
||||
saveGeom(mb, "audioRecorder")
|
||||
while time.time() - t < 1:
|
||||
time.sleep(0.1)
|
||||
r.stop()
|
||||
# process
|
||||
r.postprocess()
|
||||
|
|
Loading…
Reference in a new issue