Mar-12-2018, 03:39 AM
Am currently building up 2 sets of files. One set is the audio/WAV and the other set is the transcription. In needing to check the accuracy of the transcription, the following script plays each of the WAV files.
But if the transcription does not equal the spoken word (audio), then I want to add some code to pause the script (e.g. space bar) so that some details can be written down. Ideally, it would be nice to replay just that WAV to confirm the transcription to the spoken word, but for now, just a pause will suffice.
#!/usr/bin/python3
import vlc
import time
import glob
wav_files = glob.glob("*.wav")
instance=vlc.Instance(["--no-sub-autodetect-file"])
# You should not recreate a player for each file, just reuse the same
# player
player=instance.media_player_new()
for wav in wav_files:
player.set_mrl(wav)
player.play()
playing = set([1,2,3,4])
time.sleep(5) #Give time to get going
duration = player.get_length() / 1000
mm, ss = divmod(duration, 60)
print("Playing", wav, "Length:", "%02d:%02d" % (mm,ss))
while True:
state = player.get_state()
if state not in playing:
break
continueI'm using the package python-vlc from https://github.com/oaubert/python-vlc , and thanks to Olivier Aubert for helping me with an error message issue with subtitles. The messages were of the form:Error:[00007f29d4024158] core demux error: option sub-original-fps does not exist [00000000010c1368] core input error: no suitable demux module for `file/subtitle:///....'
[00007f29d00037e8] core demux error: option sub-original-fps does not exist [00000000010d5028] core input error: no suitable demux module for `file/subtitle:///....'and the line of code that suppressed those messages is:instance=vlc.Instance(["--no-sub-autodetect-file"])So, now back to the question. The script is doing what it should and I will add some code to, before each WAV file is played, to print/display the actual transcription for that WAV file.
But if the transcription does not equal the spoken word (audio), then I want to add some code to pause the script (e.g. space bar) so that some details can be written down. Ideally, it would be nice to replay just that WAV to confirm the transcription to the spoken word, but for now, just a pause will suffice.
