---
# System prepended metadata

title: 語音轉文字
tags: [嘴型、聲音]

---

## 臺灣言語服務
https://github.com/i3thuan5/tai5-uan5_gian5-gi2_hok8-bu7
>訓練好的語音合成、訓練語音合成模型、訓練翻譯模型

## 臺灣言語資料庫
https://github.com/i3thuan5/tai5-uan5_gian5-gi2_tsu1-liau7-khoo3

## 臺灣言語工具
https://github.com/i3thuan5/tai5-uan5_gian5-gi2_kang1-ku7
https://i3thuan5.github.io/tai5-uan5_gian5-gi2_kang1-ku7/

* **使用前開啟環境**
>. venv/bin/activate # 載入環境

* **Linux位置**
>\\wsl.localhost\Ubuntu\root\kaldi

### 語音辨識
https://hackmd.io/@fjEdiTfyT82_NItLHomSLw/rynyewdXG/https%3A%2F%2Fhackmd.io%2Fs%2FHymLWuuQG%23?type=book

* **安裝Kaldi**
https://kaldi-asr.org/doc/tutorial_setup.html
https://github.com/sih4sing5hong5/kaldi/tree/taiwanese/egs/taiwanese/s5c

* **HTK**
https://htk.eng.cam.ac.uk/

---
whisper
## openai_whisper
https://github.com/openai/whisper

### 安裝過程
1. 開啟Anaconda PowerShell Prompt
2. 輸入指令
* Get-ExecutionPolicy(顯示「Bypass」就沒問題)
3. 安裝 Chocolatey
* Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
4. 安裝ffmpeg
* choco install ffmpeg
5. 重開Anaconda PowerShell Prompt並輸入指令
* pip install -U openai-whisper
6. 如果要使用NVIDIA GPU，安裝 PyTorch
* pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121
(CUDA 12.1版本)
7. 安裝完成

---

### 實作
1. 打開Anaconda Powershell Prompt用系統管理員執行
2. cd D:\openai_whisper(檔案位置)
``` bash
whisper 0823.mp3 --language Chinese --model large-v2 --initial_prompt="我是李登輝"
```
>(音檔可使用.mp3 , .wav 或 .mp4)
(中文會自動判斷繁體或簡體，-initial_prompt可決定使用繁體或簡體進行整篇翻譯)
* **model類型**
![螢幕擷取畫面 2024-08-23 093611](https://hackmd.io/_uploads/HkrKdvriR.png)
4. 結果
![螢幕擷取畫面 2024-08-23 094145](https://hackmd.io/_uploads/ByFlFvBs0.png)
![螢幕擷取畫面 2024-08-23 094304](https://hackmd.io/_uploads/S16EFDBsC.png)

### Whisper Python
https://blog.csdn.net/wozuishuai_/article/details/136854118
``` bash=
pip install openai-whisper
pip install setuptools-rust
pip install tk
pip install pyaudio
pip install wave
pip install time
```

* 第一次執行時會先下載模型large-v2於電腦上