Fun-ASR/Paraformer的錄音檔案識別模型能將錄製好的音頻轉換為文本,支援單個檔案識別和批量檔案識別,適用於處理不需要即時返回結果的情境。
核心功能
多語種識別:支援識別中文(含多種方言)、英、日、韓、德、法、俄等多種語言。
廣泛格式相容:支援任意採樣率,併兼容aac、wav、mp3等多種主流音視頻格式。
長音頻檔案處理:支援對單個時間長度不超過12小時、體積不超過2GB的音頻檔案進行非同步轉寫。
歌唱識別:即使在伴隨背景音樂(BGM)的情況下,也能實現整首歌曲的轉寫(僅fun-asr和fun-asr-2025-11-07模型支援該功能)。
豐富識別功能:提供說話人分離、敏感詞過濾、句子/詞語級時間戳記、熱詞增強等可配置功能,滿足個人化需求。
適用範圍
支援的模型:
國際
在國際部署模式下,存取點與資料存放區均位於新加坡地區,模型推理計算資源在全球範圍內動態調度(不含中國內地)。
調用以下模型時,請選擇新加坡地區的API Key:
Fun-ASR:fun-asr(穩定版,當前等同fun-asr-2025-11-07)、fun-asr-2025-11-07(快照版)、fun-asr-2025-08-25(快照版)、fun-asr-mtl(穩定版,當前等同fun-asr-mtl-2025-08-25)、fun-asr-mtl-2025-08-25(快照版)
中國內地
在中國內地部署模式下,存取點與資料存放區均位於北京地區,模型推理計算資源僅限於中國內地。
調用以下模型時,請選擇北京地區的API Key:
Fun-ASR:fun-asr(穩定版,當前等同fun-asr-2025-11-07)、fun-asr-2025-11-07(快照版)、fun-asr-2025-08-25(快照版)、fun-asr-mtl(穩定版,當前等同fun-asr-mtl-2025-08-25)、fun-asr-mtl-2025-08-25(快照版)
Paraformer:paraformer-v2、paraformer-8k-v2
更多資訊請參見模型列表
模型選型
情境 | 推薦模型 | 理由 |
中文識別(會議/直播) | fun-asr | 針對中文深度最佳化,覆蓋多種方言;遠場VAD和雜訊魯棒性強,適合嘈雜或多人遠距離發言的真實情境,準確率更高 |
多語種識別(國際會議) | fun-asr-mtl、paraformer-v2 | 一個模型即可應對多語言需求,簡化開發和部署 |
文娛內容分析與字幕產生 | fun-asr | 具備獨特的歌唱識別能力,能有效轉寫歌曲、直播中的演唱片段;結合其雜訊魯棒性,非常適合處理複雜的媒體音頻 |
新聞/訪談節目字幕產生 | fun-asr、paraformer-v2 | 長音頻+標點預測+時間戳記,直接產生結構化字幕 |
智能硬體遠場語音互動 | fun-asr | 遠場VAD(語音活動檢測)經過專門最佳化,能在家庭、車載等嘈雜環境下,更準確地捕捉和識別使用者的遠距離指令 |
更多說明請參見模型功能特性對比
快速開始
下面是調用API的範例程式碼。
您需要已擷取API Key與API Host並配置API Key到環境變數(準備下線,併入配置 API Key)。如果通過SDK調用,還需要安裝DashScope SDK。請將範例程式碼中的 DASHSCOPE_API_HOST 替換為擷取的 API Host。
Fun-ASR
由於音視頻檔案的尺寸通常較大,檔案傳輸和語音辨識處理均需要時間,檔案轉寫API通過非同步呼叫方式來提交任務。開發人員需要通過查詢介面,在檔案轉寫完成後獲得語音辨識結果。
Python
from http import HTTPStatus
from dashscope.audio.asr import Transcription
from urllib import request
import dashscope
import os
import json
# 以下為新加坡地區url,若使用北京地區的模型,需將url替換為:https://dashscope.aliyuncs.com/api/v1
dashscope.base_http_api_url = 'https://dashscope-intl.aliyuncs.com/api/v1'
# 新加坡地區和北京地區的API Key不同。擷取API Key:https://www.alibabacloud.com/help/zh/model-studio/get-api-key
# 若沒有配置環境變數,請用百鍊API Key將下行替換為:dashscope.api_key = "sk-xxx"
dashscope.api_key = os.getenv("DASHSCOPE_API_KEY")
task_response = Transcription.async_call(
model='fun-asr',
file_urls=['https://dashscope.oss-cn-beijing.aliyuncs.com/samples/audio/paraformer/hello_world_female2.wav',
'https://dashscope.oss-cn-beijing.aliyuncs.com/samples/audio/paraformer/hello_world_male2.wav'],
language_hints=['zh', 'en'] # language_hints為選擇性參數,用於指定待識別音訊語言代碼。取值範圍請參見API參考文檔。
)
transcription_response = Transcription.wait(task=task_response.output.task_id)
if transcription_response.status_code == HTTPStatus.OK:
for transcription in transcription_response.output['results']:
if transcription['subtask_status'] == 'SUCCEEDED':
url = transcription['transcription_url']
result = json.loads(request.urlopen(url).read().decode('utf8'))
print(json.dumps(result, indent=4,
ensure_ascii=False))
else:
print('transcription failed!')
print(transcription)
else:
print('Error: ', transcription_response.output.message)Java
import com.alibaba.dashscope.audio.asr.transcription.*;
import com.alibaba.dashscope.utils.Constants;
import com.google.gson.*;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Arrays;
import java.util.List;
public class Main {
public static void main(String[] args) {
// 以下為新加坡地區url,若使用北京地區的模型,需將url替換為:https://dashscope.aliyuncs.com/api/v1
Constants.baseHttpApiUrl = "https://dashscope-intl.aliyuncs.com/api/v1";
// 建立轉寫請求參數。
TranscriptionParam param =
TranscriptionParam.builder()
// 新加坡和北京地區的API Key不同。擷取API Key:https://www.alibabacloud.com/help/zh/model-studio/get-api-key
// 若沒有配置環境變數,請用百鍊API Key將下行替換為:.apiKey("sk-xxx")
.apiKey(System.getenv("DASHSCOPE_API_KEY"))
.model("fun-asr")
// language_hints為選擇性參數,用於指定待識別音訊語言代碼。取值範圍請參見API參考文檔。
.parameter("language_hints", new String[]{"zh", "en"})
.fileUrls(
Arrays.asList(
"https://dashscope.oss-cn-beijing.aliyuncs.com/samples/audio/paraformer/hello_world_female2.wav",
"https://dashscope.oss-cn-beijing.aliyuncs.com/samples/audio/paraformer/hello_world_male2.wav"))
.build();
try {
Transcription transcription = new Transcription();
// 提交轉寫請求
TranscriptionResult result = transcription.asyncCall(param);
System.out.println("RequestId: " + result.getRequestId());
// 阻塞等待任務完成並擷取結果
result = transcription.wait(
TranscriptionQueryParam.FromTranscriptionParam(param, result.getTaskId()));
// 擷取轉寫結果
List<TranscriptionTaskResult> taskResultList = result.getResults();
if (taskResultList != null && taskResultList.size() > 0) {
for (TranscriptionTaskResult taskResult : taskResultList) {
String transcriptionUrl = taskResult.getTranscriptionUrl();
HttpURLConnection connection =
(HttpURLConnection) new URL(transcriptionUrl).openConnection();
connection.setRequestMethod("GET");
connection.connect();
BufferedReader reader =
new BufferedReader(new InputStreamReader(connection.getInputStream()));
Gson gson = new GsonBuilder().setPrettyPrinting().create();
JsonElement jsonResult = gson.fromJson(reader, JsonObject.class);
System.out.println(gson.toJson(jsonResult));
}
}
} catch (Exception e) {
System.out.println("error: " + e);
}
System.exit(0);
}
}Paraformer
由於音視頻檔案的尺寸通常較大,檔案傳輸和語音辨識處理均需要時間,檔案轉寫API通過非同步呼叫方式來提交任務。開發人員需要通過查詢介面,在檔案轉寫完成後獲得語音辨識結果。
Python
from http import HTTPStatus
from dashscope.audio.asr import Transcription
from urllib import request
import dashscope
import os
import json
# 擷取API Key:https://www.alibabacloud.com/help/zh/model-studio/get-api-key
# 若沒有配置環境變數,請用百鍊API Key將下行替換為:dashscope.api_key = "sk-xxx"
dashscope.api_key = os.getenv("DASHSCOPE_API_KEY")
task_response = Transcription.async_call(
model='paraformer-v2',
file_urls=['https://dashscope.oss-cn-beijing.aliyuncs.com/samples/audio/paraformer/hello_world_female2.wav',
'https://dashscope.oss-cn-beijing.aliyuncs.com/samples/audio/paraformer/hello_world_male2.wav'],
language_hints=['zh', 'en'] # language_hints為選擇性參數,用於指定待識別音訊語言代碼。僅Paraformer系列的paraformer-v2模型支援該參數,取值範圍請參見API參考文檔。
)
transcription_response = Transcription.wait(task=task_response.output.task_id)
if transcription_response.status_code == HTTPStatus.OK:
for transcription in transcription_response.output['results']:
if transcription['subtask_status'] == 'SUCCEEDED':
url = transcription['transcription_url']
result = json.loads(request.urlopen(url).read().decode('utf8'))
print(json.dumps(result, indent=4,
ensure_ascii=False))
else:
print('transcription failed!')
print(transcription)
else:
print('Error: ', transcription_response.output.message)Java
import com.alibaba.dashscope.audio.asr.transcription.*;
import com.google.gson.*;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Arrays;
import java.util.List;
public class Main {
public static void main(String[] args) {
// 建立轉寫請求參數
TranscriptionParam param =
TranscriptionParam.builder()
// 擷取API Key:https://www.alibabacloud.com/help/zh/model-studio/get-api-key
// 若沒有配置環境變數,請用百鍊API Key將下行替換為:.apiKey("sk-xxx")
.apiKey(System.getenv("DASHSCOPE_API_KEY"))
.model("paraformer-v2")
// language_hints為選擇性參數,用於指定待識別音訊語言代碼。僅Paraformer系列的paraformer-v2模型支援該參數,取值範圍請參見API參考文檔。
.parameter("language_hints", new String[]{"zh", "en"})
.fileUrls(
Arrays.asList(
"https://dashscope.oss-cn-beijing.aliyuncs.com/samples/audio/paraformer/hello_world_female2.wav",
"https://dashscope.oss-cn-beijing.aliyuncs.com/samples/audio/paraformer/hello_world_male2.wav"))
.build();
try {
Transcription transcription = new Transcription();
// 提交轉寫請求
TranscriptionResult result = transcription.asyncCall(param);
System.out.println("RequestId: " + result.getRequestId());
// 阻塞等待任務完成並擷取結果
result = transcription.wait(
TranscriptionQueryParam.FromTranscriptionParam(param, result.getTaskId()));
// 擷取轉寫結果
List<TranscriptionTaskResult> taskResultList = result.getResults();
if (taskResultList != null && taskResultList.size() > 0) {
for (TranscriptionTaskResult taskResult : taskResultList) {
String transcriptionUrl = taskResult.getTranscriptionUrl();
HttpURLConnection connection =
(HttpURLConnection) new URL(transcriptionUrl).openConnection();
connection.setRequestMethod("GET");
connection.connect();
BufferedReader reader =
new BufferedReader(new InputStreamReader(connection.getInputStream()));
Gson gson = new GsonBuilder().setPrettyPrinting().create();
JsonElement jsonResult = gson.fromJson(reader, JsonObject.class);
System.out.println(gson.toJson(jsonResult));
}
}
} catch (Exception e) {
System.out.println("error: " + e);
}
System.exit(0);
}
}API參考
模型功能特性對比
功能/特性 | Fun-ASR | Paraformer |
支援語言 | 因模型而異:
| 因模型而異:
|
支援的音頻格式 | aac、amr、avi、flac、flv、m4a、mkv、mov、mp3、mp4、mpeg、ogg、opus、wav、webm、wma、wmv | aac、amr、avi、flac、flv、m4a、mkv、mov、mp3、mp4、mpeg、ogg、opus、wav、webm、wma、wmv |
採樣率 | 任意 | 因模型而異:
|
聲道 | 任意 | |
輸入形式 | 公網可訪問的待識別檔案URL,最多支援輸入100個音頻 | |
音頻大小/時間長度 | 每個音頻檔案大小不超過2GB,且時間長度不超過12小時 | |
情感識別 | ||
時間戳記 | 固定開啟 | 預設關閉,可開啟 |
標點符號預測 | 固定開啟 | |
熱詞 | 可配置 | |
ITN | 固定開啟 | |
歌唱識別 | 僅fun-asr和fun-asr-2025-11-07支援該功能 | |
雜訊拒識 | 固定開啟 | |
敏感詞過濾 | 預設過濾阿里雲百鍊敏感詞表中的內容,更多內容過濾需自訂 | |
說話人分離 | 預設關閉,可開啟 | |
語氣詞過濾 | 預設關閉,可開啟 | |
VAD | 固定開啟 | |
限流(RPS) | 提交作業介面:10 任務查詢介面:20 | 提交作業介面:20 任務查詢介面:20 |
接入方式 | DashScope:Java/Python SDK、RESTful API | |
價格 | 國際:$0.000035/秒 中國內地:$0.000032/秒 | 中國內地:$0.000012/秒 |
常見問題
Q:如何提升識別準確率?
需綜合考慮影響因素並採取相應措施。
主要影響因素:
聲音品質:錄音裝置、採樣率及環境雜訊影響清晰度(高品質音頻是基礎)
說話人特徵:音調、語速、口音和方言差異(尤其少見方言或重口音)增加識別難度
語言和詞彙:多語言混合、專業術語或俚語提升識別難度(熱詞配置可最佳化)
上下文理解:缺乏上下文易導致語義歧義(尤其在依賴前後文才能正確識別的語境中)
最佳化方法:
最佳化音頻品質:使用高效能麥克風及推薦採樣率裝置;減少環境雜訊與回聲
適配說話人:針對顯著口音/方言情境,選用支援方言的模型
配置熱詞:為專業術語、專有名詞等設定熱詞(參見定製熱詞)
保留上下文:避免過短音頻分段