共用方式為


使用 Azure Speech 和 Foundry 工具中的快速轉錄 API

快速謄寫 API 用來轉譯音訊檔案,其傳回結果會同步且比即時快。 在需要盡可能快速獲取音頻錄音轉錄結果並且對延遲時間有可預測要求的情境下,適合使用快速轉錄,例如:

  • 快速音訊或視訊轉錄、字幕和編輯。
  • 會議記錄
  • 語音留言

不同於批次轉譯 API,快速轉譯 API 只會以顯示(而非語匯)形式產生轉譯。 顯示表單是一種更容易閱讀的文字記錄形式,包括標點符號和大寫。

秘訣

您也可以搭配 LLM 語音使用最新的 LLM 驅動的語音轉錄和語音翻譯。

必要條件

  • Azure Speech 資源位於快速轉錄 API 可用區域之一。 如需目前支援的區域清單,請參閱語音 服務區域資料表

  • 音訊檔案(長度少於 2 小時且大小小於 300 MB),其格式和編解碼器由批次轉譯 API 支援:WAV、MP3、OPUS/OGG、FLAC、WMA、AAC、WAV 容器中的 ALAW、WAV 容器中的 MULAW、AMR、WebM 和 SPEEX。 如需支援音訊格式的詳細資訊,請參閱支援的音訊格式

上傳音訊

您可以透過下列方式提供音訊資料以進行快速轉錄:

  • 內嵌音訊上傳
--form 'audio=@"YourAudioFile"'
  • 來自公用 URL 的音訊
--form 'definition="{"audioUrl": "https://crbn.us/hello.wav"}"'

在以下各節中,使用內嵌音訊上傳作為範例。

使用快速轉錄 API

秘訣

試試 Microsoft Foundry 入口網站的快速轉錄功能。

我們了解如何使用快速轉錄 API (透過 轉錄 - 謄寫) 搭配下列案例:

  • 指定的已知地區設定:使用指定的地區設定來轉譯音訊檔案。 如果您知道音訊檔案的地區設定,您可以指定它以改善轉譯精確度,並將延遲降到最低。
  • 語言識別開啟:轉錄一個開啟語言識別的音訊檔案。 如果您不確定音訊檔案的地區設定,您可以開啟語言識別,讓語音服務識別地區設定(每個音訊有一個地區設定)。
  • 多語種轉譯(預覽):使用最新的多語系語音轉譯模型來轉譯音訊檔案。 如果您的音訊包含您想要持續且準確地轉譯的多語系內容,則可以使用最新的多語系語音轉譯模型,而不指定地區設定代碼。
  • 自動分段開啟:謄寫自動分段開啟的音訊檔案。 自動分段可區分交談中的不同說話者。 語音服務提供關於哪個說話者在轉錄語音中特定部分發言的相關資訊。
  • 多頻道功能開啟:轉錄一或兩個聲道的聲音檔案。 多通道轉譯對於具有多個通道的音訊檔案很有用,例如具有多個喇叭的音訊檔案,或具有背景雜訊的音訊檔案。 根據預設,快速轉譯 API 會將所有輸入通道合併成單一通道,然後執行轉譯。 如果不想要這樣做,則可以獨立謄寫頻道而不合併。

使用音訊檔案和要求本文屬性向 transcriptions 端點發出多通道/表單資料 POST 要求。

下列範例示範如何使用指定的地區設定來轉譯音訊檔案。 如果您知道音訊檔案的地區設定,您可以指定它以改善轉譯精確度,並將延遲降到最低。

  • 以您的語音資源金鑰取代 YourSpeechResoureKey
  • YourServiceRegion 替換成您的語音資源區域。
  • 請以您的音訊檔案路徑取代 YourAudioFile

這很重要

針對 Microsoft Entra ID 的建議無金鑰認證,請將 --header 'Ocp-Apim-Subscription-Key: YourSpeechResoureKey' 替換為 --header "Authorization: Bearer YourAccessToken"。 如需無密鑰驗證的詳細資訊,請參閱 角色型訪問控制 作指南。

curl --location 'https://YourServiceRegion.api.cognitive.microsoft.com/speechtotext/transcriptions:transcribe?api-version=2025-10-15' \
--header 'Content-Type: multipart/form-data' \
--header 'Ocp-Apim-Subscription-Key: YourSpeechResoureKey' \
--form 'audio=@"YourAudioFile"' \
--form 'definition="{
    "locales":["en-US"]}"'

根據下列指示建構表單定義:

  • 設定選擇性的 (但建議的) locales 屬性,該屬性應符合要轉譯之音訊數據的預期地區設定。 在這裡範例中,地區設定會設定為 en-US。 如需與支援的地區設定有關的詳細資訊,請參閱語音轉換文字支援的語言

如需快速轉譯 API 和其他屬性的詳細資訊 locales ,請參閱 本指南稍後的要求組態選項 一節。

回應包括 durationMillisecondsoffsetMilliseconds等等。 屬性 combinedPhrases 包含所有說話者的完整轉譯。

{
	"durationMilliseconds": 182439,
	"combinedPhrases": [
		{
			"text": "Good afternoon. This is Sam. Thank you for calling Contoso. How can I help? Hi there. My name is Mary. I'm currently living in Los Angeles, but I'm planning to move to Las Vegas. I would like to apply for a loan. Okay. I see you're currently living in California. Let me make sure I understand you correctly. Uh You'd like to apply for a loan even though you'll be moving soon. Is that right? Yes, exactly. So I'm planning to relocate soon, but I would like to apply for the loan first so that I can purchase a new home once I move there. And are you planning to sell your current home? Yes, I will be listing it on the market soon and hopefully it'll sell quickly. That's why I'm applying for a loan now, so that I can purchase a new house in Nevada and close on it quickly as well once my current home sells. I see. Would you mind holding for a moment while I take your information down? Yeah, no problem. Thank you for your help. Mm-hmm. Just one moment. All right. Thank you for your patience, ma'am. May I have your first and last name, please? Yes, my name is Mary Smith. Thank you, Ms. Smith. May I have your current address, please? Yes. So my address is 123 Main Street in Los Angeles, California, and the zip code is 90923. Sorry, that was a 90 what? 90923. 90923 on Main Street. Got it. Thank you. May I have your phone number as well, please? Uh Yes, my phone number is 504-529-2351 and then yeah. 2351. Got it. And do you have an e-mail address we I can associate with this application? uh Yes, so my e-mail address is mary.a.sm78@gmail.com. Mary.a, was that a S-N as in November or M as in Mike? M as in Mike. Mike78, got it. Thank you. Ms. Smith, do you currently have any other loans? Uh Yes, so I currently have two other loans through Contoso. So my first one is my car loan and then my other is my student loan. They total about 1400 per month combined and my interest rate is 8%. I see. And you're currently paying those loans off monthly, is that right? Yes, of course I do. OK, thank you. Here's what I suggest we do. Let me place you on a brief hold again so that I can talk with one of our loan officers and get this started for you immediately. In the meantime, it would be great if you could take a few minutes and complete the remainder of the secure application online at www.contosoloans.com. Yeah, that sounds good. I can go ahead and get started. Thank you for your help. Thank you."
		}
	],
	"phrases": [
		{
			"offsetMilliseconds": 960,
			"durationMilliseconds": 640,
			"text": "Good afternoon.",
			"words": [
				{
					"text": "Good",
					"offsetMilliseconds": 960,
					"durationMilliseconds": 240
				},
				{
					"text": "afternoon.",
					"offsetMilliseconds": 1200,
					"durationMilliseconds": 400
				}
			],
			"locale": "en-US",
			"confidence": 0.93554276
		},
		{
			"offsetMilliseconds": 1600,
			"durationMilliseconds": 640,
			"text": "This is Sam.",
			"words": [
				{
					"text": "This",
					"offsetMilliseconds": 1600,
					"durationMilliseconds": 240
				},
				{
					"text": "is",
					"offsetMilliseconds": 1840,
					"durationMilliseconds": 120
				},
				{
					"text": "Sam.",
					"offsetMilliseconds": 1960,
					"durationMilliseconds": 280
				}
			],
			"locale": "en-US",
			"confidence": 0.93554276
		},
		{
			"offsetMilliseconds": 2240,
			"durationMilliseconds": 1040,
			"text": "Thank you for calling Contoso.",
			"words": [
				{
					"text": "Thank",
					"offsetMilliseconds": 2240,
					"durationMilliseconds": 200
				},
				{
					"text": "you",
					"offsetMilliseconds": 2440,
					"durationMilliseconds": 80
				},
				{
					"text": "for",
					"offsetMilliseconds": 2520,
					"durationMilliseconds": 120
				},
				{
					"text": "calling",
					"offsetMilliseconds": 2640,
					"durationMilliseconds": 200
				},
				{
					"text": "Contoso.",
					"offsetMilliseconds": 2840,
					"durationMilliseconds": 440
				}
			],
			"locale": "en-US",
			"confidence": 0.93554276
		},
		{
			"offsetMilliseconds": 3280,
			"durationMilliseconds": 640,
			"text": "How can I help?",
			"words": [
				{
					"text": "How",
					"offsetMilliseconds": 3280,
					"durationMilliseconds": 120
				},
				{
					"text": "can",
					"offsetMilliseconds": 3440,
					"durationMilliseconds": 120
				},
				{
					"text": "I",
					"offsetMilliseconds": 3560,
					"durationMilliseconds": 40
				},
				{
					"text": "help?",
					"offsetMilliseconds": 3600,
					"durationMilliseconds": 320
				}
			],
			"locale": "en-US",
			"confidence": 0.93554276
		},
		{
			"offsetMilliseconds": 5040,
			"durationMilliseconds": 400,
			"text": "Hi there.",
			"words": [
				{
					"text": "Hi",
					"offsetMilliseconds": 5040,
					"durationMilliseconds": 240
				},
				{
					"text": "there.",
					"offsetMilliseconds": 5280,
					"durationMilliseconds": 160
				}
			],
			"locale": "en-US",
			"confidence": 0.93554276
		},
		{
			"offsetMilliseconds": 5440,
			"durationMilliseconds": 800,
			"text": "My name is Mary.",
			"words": [
				{
					"text": "My",
					"offsetMilliseconds": 5440,
					"durationMilliseconds": 80
				},
				{
					"text": "name",
					"offsetMilliseconds": 5520,
					"durationMilliseconds": 120
				},
				{
					"text": "is",
					"offsetMilliseconds": 5640,
					"durationMilliseconds": 80
				},
				{
					"text": "Mary.",
					"offsetMilliseconds": 5720,
					"durationMilliseconds": 520
				}
			],
			"locale": "en-US",
			"confidence": 0.93554276
		},
		// More transcription results...
	    // Redacted for brevity
		{
			"offsetMilliseconds": 180320,
			"durationMilliseconds": 680,
			"text": "Thank you for your help.",
			"words": [
				{
					"text": "Thank",
					"offsetMilliseconds": 180320,
					"durationMilliseconds": 160
				},
				{
					"text": "you",
					"offsetMilliseconds": 180480,
					"durationMilliseconds": 80
				},
				{
					"text": "for",
					"offsetMilliseconds": 180560,
					"durationMilliseconds": 120
				},
				{
					"text": "your",
					"offsetMilliseconds": 180680,
					"durationMilliseconds": 120
				},
				{
					"text": "help.",
					"offsetMilliseconds": 180800,
					"durationMilliseconds": 200
				}
			],
			"locale": "en-US",
			"confidence": 0.92022026
		},
		{
			"offsetMilliseconds": 181960,
			"durationMilliseconds": 280,
			"text": "Thank you.",
			"words": [
				{
					"text": "Thank",
					"offsetMilliseconds": 181960,
					"durationMilliseconds": 200
				},
				{
					"text": "you.",
					"offsetMilliseconds": 182160,
					"durationMilliseconds": 80
				}
			],
			"locale": "en-US",
			"confidence": 0.92022026
		}
	]
}

附註

語音服務是彈性服務。 如果您收到 429 錯誤碼 (要求過多),請遵循最佳做法以減輕自動調整期間中的節流

要求設定選項

以下是在呼叫轉錄 - 轉錄作業時設定轉錄的一些屬性選項。

屬性 說明 必要或選用
channels 要個別謄寫之頻道的以零為起始的索引清單。 除非啟用了自動分段,否則最多支援兩個頻道。 根據預設,快速轉譯 API 會將所有輸入通道合併成單一通道,然後執行轉譯。 如果不想要這樣做,則可以獨立謄寫頻道而不合併。

如果您要個別從立體聲音頻檔案轉譯通道,您需要指定 [0,1][0][1]。 否則,立體聲音訊會合併至單聲道,而且只會謄寫單一頻道。

如果音訊為立體聲且已啟用 diarization,則您無法將 channels 屬性設定為 [0,1]。 語音服務不支援對多個頻道進行自動分段。

對於單聲道音訊,會忽略 channels 屬性,而且音訊一律會轉譯為單一通道。
選擇性
diarization 自動分段組態。 自動分段是在一個音訊通道中辨識和區分多個說話者的流程。 例如,指定 "diarization": {"maxSpeakers": 2, "enabled": true}。 然後,轉錄檔案會包含每個已轉錄片語的條目(例如 speaker"speaker": 0"speaker": 1)。 選擇性
locales 地區設定的清單應該符合要謄寫之音訊資料的預期地區設定。

如果您知道音訊檔案的地區設定,您可以指定它以改善轉譯精確度,並將延遲降到最低。 如果指定單一地區設定,該地區設定會用於轉譯。

但是,如果您不確定地區設定,則可以指定多個地區設定來使用語言識別。 使用更精確的候選地區設定清單,語言識別可能更精確。

如果您未指定任何地區設定,語音服務會使用最新的多語系模型來識別地區設定並持續轉譯。

您可以透過 轉譯 - 列出支援的地區 設定 REST API 取得最新的支援語言(API 版本 2024-11-15 或更新版本)。 如需地區設定的詳細資訊,請參閱 語音服務語言支援 檔。
如果您知道預期的地區設定,則為選用,但建議使用。
phraseList 短語列表是提前提供的單詞或短語列表,以幫助提高他們的識別度。 將片語新增到片語清單會增加其重要性,使其更容易被辨識。 例如,指定 phraseList":{"phrases":["Contoso","Jessie","Rehaan"]}。 片語清單透過 API 版本 2025-10-15 受到支援。 如需詳細資訊,請參閱 使用片語清單提高辨識準確性 選擇性
profanityFilterMode 指定如何處理辨識結果中的不雅內容。 接受的值為 None (會停用粗話過濾)、Masked (會以星號取代粗話)、Removed (會移除結果中的所有粗話) 或 Tags (會新增粗話標籤)。 預設值是 Masked 選擇性