需求規格設計
- 19/06/27 完成需求規格書初稿
- 19/07/05 重繪系統結構圖
Socket TCP/IP通信
- 19/07/01 #Java實現,可在客戶端與服務端間傳輸文件
訊飛語音轉寫
- 19/07/02 #Java實現,可多音頻文件一次性轉寫爲Json格式的結果
- 19/07/05 #語音服務系統結構圖重繪,詳細描述訊飛語音轉寫原理
- 訊飛語音轉寫Java SDK文檔
可配置參數:
參數 | 類型 | 必須 | 說明 | 示例 |
---|---|---|---|---|
lfasr_type | string | 否 | 轉寫類型,可選值: 0(標準版-已錄製音頻,格式包括 wav,flac,opus,mp3,m4a), 2(電話專用版,已取消電話專用版套餐),默認0 | 0 |
has_participle | string | 否 | 轉寫結果是否包含分詞信息 | false或true, 默認false |
has_seperate | string | 否 | 轉寫結果中是否包含發音人分離信息 | false或true, 標準版默認:false,電話版默認:true |
max_alternatives | string | 否 | 轉寫結果中最大的候選詞個數 | 默認:0,最大不超過5 |
speaker_number | string | 否 | 發音人個數,可選值:0-10,0表示盲分 | 默認:2(適用通話時兩個人對話的場景) |
has_sensitive | string | 否 | 是否需要對轉寫結果進行敏感詞檢測 | false或true, 默認:false |
sensitive_type | string | 否 | 敏感詞檢測類型 | 需要進行敏感詞檢測(has_sensitive爲true)時必傳,0(默認詞庫)或1(自定義敏感詞) |
keywords | string | 否 | 自定義的敏感詞 | 敏感詞檢測類型爲1時必傳,格式:科大訊飛,語音轉寫(每個詞用英文逗號分割,整個字符串長度不超過 |
- [語音轉寫原理] (https://www.zhihu.com/question/20398418)
Json解析
- 19/07/03 #Java實現,將訊飛傳回結果提取文本內容返回txt文件
音頻文件解析
- 19/07/03 資料蒐集
需要從.wav文件中獲取如下信息
類型 | 定義 | 說明 |
---|---|---|
UINT | m_nFramePerSecond | 每秒幀數 |
UINT | m_nBytesPerSecond | 每秒字節數 |
String | m_csCreateTime | |
String | m_csFileName | 保存文件名 |
ULONG | m_nTotalSeconds | 總時間 |
ULONG | m_nDataStartPos | 數據區偏移位置 |
ULONG | m_nDataLength | 數據區字節數 |
HMMIO | m_hMMIO | 多媒體文件句柄 |
MMCKINFO | m_mmckInfoParent | parent chunk information |
MMCKINFO | m_mmckInfoChild | Format chunk information structure |
INT | m_nPlayEndMsg | 播放結束時發送的消息 |
HWND | m_hPlayWnd | 接收消息的窗口句柄 |
GSM610WAVEFORMAT | m_Format | 波形格式 |
UINT | m_nRecIndex | 當前位置 |
CCriticalSection | m_CriticalSection |
//播放時使用的打開函數
bool ReadOpen(LPCTSTR lpszFileName,HWND hWnd,UINT nMsg)
bool IsOpened()
==bool IsOpenedin()
//錄音時使用
bool WriteOpen(LPCTSTR lpszFileName,GSM610WAVEFORMAT pWfmt,HWND hWnd,UINT nMsg)==
void Close()
bool Read(char pBuff,UINT nSize,UINT& nCount)
bool Write(char pBuff,UINT nCount)
//絕對移動到第n秒處
void GoPos(ULONG nSeconds)
//相對移動n秒,負表示向後移動,正表示向前
void Move( long nSeconds )
//取得總的時間
UINT GetTotalSeconds()
//獲取當前位置
ULONG GetCurPos()
bool GetWaveFormat(GSM610WAVEFORMAT& fmt)
bool GetFileName(CString &csFileName)
CString GetCreateTime()
long GetDataLength()
說話人識別
- 19/07/04 資料蒐集,找到LIUM toolkit預計可解決人聲分割和沉默偵測
訊飛語音轉寫Java SDK文檔有提到:
當對多個發音人同時採集音頻時,建議對音頻進行預先切分,每次請求識別的音頻只含有一位發音人的語音。因爲當多人同時發音或多人發音音量有區別時,部分語音有可能會被視爲背景噪音而剔除。
因此,解決發音人識別十分必要。
首先考慮的是當做聲紋識別(Speaker Recognition, SR; Voiceprint Recognition)來做。
如果是多人不同時說話,則考慮人聲分割(Speaker diarization);
- 聲紋識別技術介紹
- 聲紋識別開源工具
- MSR Identity Toolbox Speaker Recognition Research < Matlab >
- LIOM(僅支持英文)
- Alize < Android Java >
- Fully Supervised Speaker diarization in Google < python >
- 人聲分割(Google AI Speaker Diarization 翻譯版)
- LIUM SpkDiarization tookit, 以實現人聲分割,貌似可以實現沉默檢測。< Java, Script >
- LIUM SpkDiarization GitHub代碼
- 人聲提取開源資源合集
暫定使用LIUM 解決問題,使用LIUM面臨的子問題/問題分解如下:
jar包的使用
F:\下載\lium_spkdiarization-8.4.1.jar>java -jar LIUM_SpkDiarization-8.4.1.jar
09:50.990 CONFIG| cmdLine:
09:50.991 CONFIG| ==============================================
========
09:50.992 CONFIG| name = Diarization
09:50.992 CONFIG| ----------------------------------------------
--------
09:50.992 CONFIG| [options] show:
09:50.993 CONFIG| --fInputMask Input featureSet: mask = %s.mfc
c [fr.lium.spkDiarization.parameter.ParameterAudioInputFeature]
09:50.993 CONFIG| --fInputDesc Input featureSet: description (
type[:deltatype][,s:e:ds:de:dds:dde,dim,c:r:wSize:method]) = audio16kHz2sphinx:s
phinx,1:1:0:0:0:0,13,0:0:0:0 [fr.lium.spkDiarization.parameter.ParameterAudioInp
utFeature]
09:50.994 CONFIG| type [spro4,htk,sphinx,gztxt,fe
atureSetTransformation,audio8kHz2sphinx,audio16kHz2sphinx,audio22kHz2sphinx,audi
o44kHz2sphinx,audio48kHz2sphinx] = audio16kHz2sphinx (6)
09:50.994 CONFIG| deltaType [spro4,htk,sphinx] =
sphinx (2)
09:50.995 CONFIG| static [0=not present,1=present
,3=to be removed] = 1
09:50.996 CONFIG| energy [0,1,3] = 1
09:50.997 CONFIG| delta [0,1,2=computed on the fl
y,3] = 0
09:50.998 CONFIG| delta energy [0,1,2=computed on
the fly,3] = 0
09:50.998 CONFIG| delta delta [0,1,2,3] = 0
09:50.999 CONFIG| delta delta energy [0,1,2,3] =
0
09:50.000 CONFIG| file dim = 13
09:50.001 CONFIG| normalization, center [0,1] = 0
09:50.001 CONFIG| normalization, reduce [0,1] = 0
09:50.002 CONFIG| normalization, window size = 0
09:50.003 CONFIG| normalization, method [0 (segme
nt), 1 (cluster), 2 (sliding), 3 (warping)] =0
09:50.003 CONFIG| --fInputMemoryOccupationRate Input featureSe
t: memory occupation rate of the feature in the java virtual machine = %s.mfcc [
fr.lium.spkDiarization.parameter.ParameterAudioInputFeature]
09:50.004 CONFIG| --fInputSpeechThr Input featureSet: silen
ce segmentation method [E,BIGAUSSIAN,None] = None(2) [fr.lium.spkDiarization.par
ameter.ParameterAudioInputFeature]
09:50.004 CONFIG| --fInputSpeechMethod Input featureSet: silen
ce segmentation method [E,BIGAUSSIAN,None] = None(2) [fr.lium.spkDiarization.par
ameter.ParameterAudioInputFeature]
09:50.005 CONFIG| ----------------------------------------------
--------
09:50.006 CONFIG| --sInputMask Input segmentation file mask =
[fr.lium.spkDiarization.parameter.ParameterSegmentationInputFile]
09:50.007 CONFIG| --sInputFormat Input segmentation file
format = seg,ISO-8859-1 ([seg,bck,ctl,saus.seg,seg.xml,media.xml,repere.xml,ege
r.hyp], [ISO-8859-1,UTF8]) [fr.lium.spkDiarization.parameter.ParameterSegmentati
onInputFile]
09:50.008 CONFIG| --sInputRate Input segmentation file rate =
100 [fr.lium.spkDiarization.parameter.ParameterSegmentationInputFile]
09:50.010 CONFIG| --sInput2Mask Input2 segmentation file mask =
[fr.lium.spkDiarization.parameter.ParameterSegmentationInputFile2]
09:50.011 CONFIG| --sInput2Format Input2 segmentation fil
e format = seg,ISO-8859-1 ([seg,bck,ctl,saus.seg,seg.xml,media.xml,repere.xml,eg
er.hyp], [ISO-8859-1,UTF8]) [fr.lium.spkDiarization.parameter.ParameterSegmentat
ionInputFile2]
09:50.012 CONFIG| --sInput2Rate Input2 segmentation file rate =
100 [fr.lium.spkDiarization.parameter.ParameterSegmentationInputFile2]
09:50.013 CONFIG| --sOutputMask Output segmentation file mask =
%s.out.seg [fr.lium.spkDiarization.parameter.ParameterSegmentationOutputFile]
09:50.014 CONFIG| --sOutputFormat Output segmentation fil
e format = seg,ISO-8859-1 ([seg,bck,ctl,saus.seg,seg.xml,media.xml,repere.xml,eg
er.hyp], [ISO-8859-1,UTF8]) [fr.lium.spkDiarization.parameter.ParameterSegmentat
ionOutputFile]
09:50.016 CONFIG| --sOutputRate Output segmentation file rate =
100 [fr.lium.spkDiarization.parameter.ParameterSegmentationOutputFile]
09:50.017 CONFIG| ----------------------------------------------
--------
09:50.018 CONFIG| --system selection the diarization modul
e = baseline [.ParameterBNDiarization]
09:50.021 CONFIG| --thresholds l=2.0, h=3.0, d=250.0, c=1.7 [f
r.lium.spkDiarization.parameter.ParameterBNDiarization]
09:50.022 CONFIG| --doCEClustering make the CLR/NCLR clust
ering = false [.ParameterBNDiarization]
09:50.023 CONFIG| --nbThread number of shows process in para
llele = 1 [.ParameterBNDiarization]
09:50.024 CONFIG| --saveAllStep save all intermediate diarizati
on = false [.ParameterBNDiarization]
09:50.025 CONFIG| --lastStepOnly need an input diarizati
on = false [.ParameterBNDiarization]
09:50.028 CONFIG| --loadInputSegmentation load an input d
iarization = false [.ParameterBNDiarization]
09:50.029 CONFIG| ----------------------------------------------
--------
沉默截斷
見LIUM解析
客戶端界面設計
待補充