Dim atpj As WinForm.TextBox = e.Form.Controls("atpj文件")
Dim mp3 As WinForm.TextBox = e.Form.Controls("mp3文件")
Dim mulu As WinForm.TextBox = e.Form.Controls("目录")
Dim FileName As String = ProjectPath & "\tempfiles\mp3topcm.bat" '生成日志文件
Dim i As Integer=0
Dim tstart As String
Dim tend As String
Dim cha As String
Dim cd As Integer
Dim r As Row
Dim jsontxt As String
If atpj.value IsNot Nothing Then
jsontxt = FileSys.ReadAllText(atpj.value)
Else
MessageBox.show("请准确选择待识别的atpj专用文件")
Return
End If
Dim jo As JObject = Jobject.Parse(jsontxt)
If jo("BLOCKS") IsNot Nothing Then
For Each jt As JToken In jo("BLOCKS")
r= Tables("语音识别临时表").AddNew()
tstart=jt("time_start").ToString
tend=jt("time_end").ToString
cha=tend-tstart
r("编号")=Format(i,"0000")
r("名称")=jt("name")
r("开始时间")=Functions.Execute("时间转换",tstart)
r("结束时间")=Functions.Execute("时间转换",tend)
r("时长")=Functions.Execute("时间转换",cha)
r("识别内容")=jt("text").ToString
r("结束编码")=jt("time_end").ToString
r("pcm路径")=ProjectPath & "tempfiles\" & Format(i,"0000") & ".pcm"
r.save
Dim s As String= "ffmpeg -accurate_seek -i " & mp3.value & " -ss " & r("开始时间") & " -t " & r("时长") & " -acodec copy " & ProjectPath & "tempfiles\" & Format(i,"0000") & ".mp3" & vbcrlf & "ffmpeg -y -i " & ProjectPath & "tempfiles\" & Format(i,"0000") & ".mp3 -acodec pcm_s16le -f s16le -ac 1 -ar 16000 " & ProjectPath & "tempfiles\" & Format(i,"0000") & ".pcm" & vbcrlf
FileSys.WriteAllText(FileName,s, True, Encoding.UTF8)
i=i+1
Next
End If