La API de Transcripción rápida se usa para transcribir archivos de audio con resultados de forma sincrónica y más rápidamente que en tiempo real. Use la transcripción rápida en los escenarios en los que necesite la transcripción de una grabación de audio lo más rápido posible con una latencia predecible, como los siguientes:
A diferencia de la API de transcripción por lotes, la API de transcripción rápida solo genera transcripciones en el formulario de visualización (no léxico). El formulario de presentación es una forma más legible de la transcripción que incluye signos de puntuación y mayúsculas.
Realice una solicitud POST multipart/form-data al punto de conexión transcriptions
con el archivo de audio y las propiedades del cuerpo de la solicitud.
En el ejemplo siguiente se muestra cómo transcribir un archivo de audio con una configuración regional especificada. Si conoce la configuración regional del archivo de audio, puede especificarla para mejorar la precisión de la transcripción y minimizar la latencia.
- Reemplace
YourSubscriptionKey
por su clave de recurso de Voz.
- Reemplace
YourServiceRegion
por la región del recurso de Voz.
- Reemplace
YourAudioFile
por la ruta de acceso al archivo de audio.
curl --location 'https://YourServiceRegion.api.cognitive.microsoft.com/speechtotext/transcriptions:transcribe?api-version=2024-11-15' \
--header 'Content-Type: multipart/form-data' \
--header 'Ocp-Apim-Subscription-Key: YourSubscriptionKey' \
--form 'audio=@"YourAudioFile"' \
--form 'definition="{
"locales":["en-US"]}"'
Construya la definición del formulario según las instrucciones siguientes:
- Establezca la propiedad opcional (pero recomendada)
locales
que debe coincidir con la configuración regional esperada de los datos de audio que se van a transcribir. En este ejemplo, la configuración regional se establece en en-US
. Las configuraciones regionales que pueden especificarse son: de-DE, en-IN, en-US, es-ES, es-MX, fr-FR, hi-IN, it-IT, ja-JP, ko-KR, pt-BR y zh-CN.
Para obtener más información sobre locales
y otras propiedades para la API de transcripción rápida, consulte la sección opciones de configuración de solicitudes más adelante en esta guía.
La respuesta incluye durationMilliseconds
, offsetMilliseconds
, etc. La propiedad combinedPhrases
contiene las transcripciones completas para todos los oradores.
{
"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.93616915
},
{
"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.93616915
},
{
"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.93616915
},
{
"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.93616915
},
{
"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.93616915
},
{
"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.93616915
},
// 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.9314801
},
{
"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.9314801
}
]
}
Realice una solicitud POST multipart/form-data al punto de conexión transcriptions
con el archivo de audio y las propiedades del cuerpo de la solicitud.
En el ejemplo siguiente se muestra cómo transcribir un archivo de audio con identificación de idioma activada. Si no está seguro de la configuración regional, puede especificar varias configuraciones regionales. Si no especifica ninguna configuración regional o si las configuraciones regionales que especifica no están en el archivo de audio, el servicio Voz intenta identificar la configuración regional.
- Reemplace
YourSubscriptionKey
por su clave de recurso de Voz.
- Reemplace
YourServiceRegion
por la región del recurso de Voz.
- Reemplace
YourAudioFile
por la ruta de acceso al archivo de audio.
curl --location 'https://YourServiceRegion.api.cognitive.microsoft.com/speechtotext/transcriptions:transcribe?api-version=2024-11-15' \
--header 'Content-Type: multipart/form-data' \
--header 'Ocp-Apim-Subscription-Key: YourSubscriptionKey' \
--form 'audio=@"YourAudioFile"' \
--form 'definition="{
"locales":["en-US","ja-JP"]}"'
Construya la definición del formulario según las instrucciones siguientes:
- Establezca la propiedad opcional (pero recomendada)
locales
que debe coincidir con la configuración regional esperada de los datos de audio que se van a transcribir. En este ejemplo, las configuraciones regionales se establecen en en-US
y ja-JP
. Las configuraciones regionales que pueden especificarse son: de-DE, en-IN, en-US, es-ES, es-MX, fr-FR, hi-IN, it-IT, ja-JP, ko-KR, pt-BR y zh-CN.
Para obtener más información sobre locales
y otras propiedades para la API de transcripción rápida, consulte la sección opciones de configuración de solicitudes más adelante en esta guía.
La respuesta incluye durationMilliseconds
, offsetMilliseconds
, etc. La propiedad combinedPhrases
contiene las transcripciones completas para todos los oradores.
{
"durationMilliseconds": 185079,
"combinedPhrases": [
{
"text": "Hello, thank you for calling Contoso. Who am I speaking with today? Hi, my name is Mary Rondo. I'm trying to enroll myself with Contoso. Hi, Mary. Are you calling because you need health insurance? Yes. Yeah, I'm calling to sign up for insurance. Great. Uh If you can answer a few questions, we can get you signed up in a Jiffy. Okay. So what's your full name? uh So Mary Beth Rondo, last name is R like Romeo, O like Ocean, N like Nancy D, D like Dog, and O like Ocean again. Rondo. Got it. And what's the best callback number in case we get disconnected? I only have a cell phone, so I can give you that. Yep, that'll be fine. Sure. So it's 234-554 and then 9312. Got it. So to confirm, it's 234-554-9312. Yep, that's right. Excellent. Let's get some additional information for your application. Do you have a job? Uh Yes, I am self-employed. Okay, so then you have a social security number as well? Uh Yes, I do. Okay, and what is your social security number, please? Uh Sure, so it's 412-253-4931. 6789. Sorry, was that a 25 or a 225? You cut out for a bit. It's double two, so 412, then another two, then five. Thank you so much. And could I have your e-mail address, please? Yeah, it's maryrondo@gmail.com. So my first and last name at gmail.com. No periods, no dashes. Great. Uh That is the last question. So let me take your information and I'll be able to get you signed up right away. Thank you for calling Contoso and I'll be able to get you signed up immediately. One of our agents will call you back in about 24 hours or so to confirm your application. That sounds good. Thank you. Absolutely. If you need anything else, please give us a call at 1-800-555-5564, extension 123. Thank you very much for calling Contoso. Actually, so I have one more question. Yes, of course. I'm curious, will I be getting a physical card as proof of coverage? So the default is a digital membership card, but we can send you a physical card if you prefer. Uh Yes. Could you please mail it to me when it's ready? I'd like to have it shipped to, are you ready for my address? Uh Yeah. uh So it's 2660 Unit A on Maple Avenue, Southeast Lansing, and then zip code is 48823. Absolutely. I've made a note on your file. Awesome. Thanks so much. You're very welcome. Thank you for calling Contoso and have a great day."
}
],
"phrases": [
{
"offsetMilliseconds": 720,
"durationMilliseconds": 1600,
"text": "Hello, thank you for calling Contoso.",
"words": [
{
"text": "Hello,",
"offsetMilliseconds": 720,
"durationMilliseconds": 480
},
{
"text": "thank",
"offsetMilliseconds": 1200,
"durationMilliseconds": 200
},
{
"text": "you",
"offsetMilliseconds": 1400,
"durationMilliseconds": 80
},
{
"text": "for",
"offsetMilliseconds": 1480,
"durationMilliseconds": 120
},
{
"text": "calling",
"offsetMilliseconds": 1600,
"durationMilliseconds": 240
},
{
"text": "Contoso.",
"offsetMilliseconds": 1840,
"durationMilliseconds": 480
}
],
"locale": "en-US",
"confidence": 0.93265927
},
{
"offsetMilliseconds": 2320,
"durationMilliseconds": 1120,
"text": "Who am I speaking with today?",
"words": [
{
"text": "Who",
"offsetMilliseconds": 2320,
"durationMilliseconds": 160
},
{
"text": "am",
"offsetMilliseconds": 2480,
"durationMilliseconds": 80
},
{
"text": "I",
"offsetMilliseconds": 2560,
"durationMilliseconds": 80
},
{
"text": "speaking",
"offsetMilliseconds": 2640,
"durationMilliseconds": 320
},
{
"text": "with",
"offsetMilliseconds": 2960,
"durationMilliseconds": 160
},
{
"text": "today?",
"offsetMilliseconds": 3120,
"durationMilliseconds": 320
}
],
"locale": "en-US",
"confidence": 0.93265927
},
{
"offsetMilliseconds": 4480,
"durationMilliseconds": 1600,
"text": "Hi, my name is Mary Rondo.",
"words": [
{
"text": "Hi,",
"offsetMilliseconds": 4480,
"durationMilliseconds": 400
},
{
"text": "my",
"offsetMilliseconds": 4880,
"durationMilliseconds": 120
},
{
"text": "name",
"offsetMilliseconds": 5000,
"durationMilliseconds": 120
},
{
"text": "is",
"offsetMilliseconds": 5120,
"durationMilliseconds": 160
},
{
"text": "Mary",
"offsetMilliseconds": 5280,
"durationMilliseconds": 240
},
{
"text": "Rondo.",
"offsetMilliseconds": 5520,
"durationMilliseconds": 560
}
],
"locale": "en-US",
"confidence": 0.93265927
},
{
"offsetMilliseconds": 6120,
"durationMilliseconds": 1800,
"text": "I'm trying to enroll myself with Contoso.",
"words": [
{
"text": "I'm",
"offsetMilliseconds": 6120,
"durationMilliseconds": 120
},
{
"text": "trying",
"offsetMilliseconds": 6240,
"durationMilliseconds": 200
},
{
"text": "to",
"offsetMilliseconds": 6440,
"durationMilliseconds": 80
},
{
"text": "enroll",
"offsetMilliseconds": 6520,
"durationMilliseconds": 200
},
{
"text": "myself",
"offsetMilliseconds": 6720,
"durationMilliseconds": 360
},
{
"text": "with",
"offsetMilliseconds": 7080,
"durationMilliseconds": 120
},
{
"text": "Contoso.",
"offsetMilliseconds": 7200,
"durationMilliseconds": 720
}
],
"locale": "en-US",
"confidence": 0.93265927
},
// More transcription results...
// Redacted for brevity
{
"offsetMilliseconds": 181520,
"durationMilliseconds": 720,
"text": "You're very welcome.",
"words": [
{
"text": "You're",
"offsetMilliseconds": 181520,
"durationMilliseconds": 160
},
{
"text": "very",
"offsetMilliseconds": 181680,
"durationMilliseconds": 200
},
{
"text": "welcome.",
"offsetMilliseconds": 181880,
"durationMilliseconds": 360
}
],
"locale": "en-US",
"confidence": 0.90571773
},
{
"offsetMilliseconds": 182320,
"durationMilliseconds": 1840,
"text": "Thank you for calling Contoso and have a great day.",
"words": [
{
"text": "Thank",
"offsetMilliseconds": 182320,
"durationMilliseconds": 200
},
{
"text": "you",
"offsetMilliseconds": 182520,
"durationMilliseconds": 80
},
{
"text": "for",
"offsetMilliseconds": 182600,
"durationMilliseconds": 120
},
{
"text": "calling",
"offsetMilliseconds": 182720,
"durationMilliseconds": 280
},
{
"text": "Contoso",
"offsetMilliseconds": 183000,
"durationMilliseconds": 520
},
{
"text": "and",
"offsetMilliseconds": 183520,
"durationMilliseconds": 160
},
{
"text": "have",
"offsetMilliseconds": 183680,
"durationMilliseconds": 120
},
{
"text": "a",
"offsetMilliseconds": 183800,
"durationMilliseconds": 40
},
{
"text": "great",
"offsetMilliseconds": 183840,
"durationMilliseconds": 200
},
{
"text": "day.",
"offsetMilliseconds": 184040,
"durationMilliseconds": 120
}
],
"locale": "en-US",
"confidence": 0.90571773
}
]
}
Realice una solicitud POST multipart/form-data al punto de conexión transcriptions
con el archivo de audio y las propiedades del cuerpo de la solicitud.
En el ejemplo siguiente se muestra cómo transcribir un archivo de audio con la diarización habilitada. La diarización distingue entre diferentes oradores en la conversación. El servicio Voz proporciona información sobre qué hablante hablaba una parte determinada de la voz transcrita.
- Reemplace
YourSubscriptionKey
por su clave de recurso de Voz.
- Reemplace
YourServiceRegion
por la región del recurso de Voz.
- Reemplace
YourAudioFile
por la ruta de acceso al archivo de audio.
curl --location 'https://YourServiceRegion.api.cognitive.microsoft.com/speechtotext/transcriptions:transcribe?api-version=2024-11-15' \
--header 'Content-Type: multipart/form-data' \
--header 'Ocp-Apim-Subscription-Key: YourSubscriptionKey' \
--form 'audio=@"YourAudioFile"' \
--form 'definition="{
"locales":["en-US"],
"diarization": {"maxSpeakers": 2,"enabled": true}}"'
Construya la definición del formulario según las instrucciones siguientes:
Establezca la propiedad opcional (pero recomendada) locales
que debe coincidir con la configuración regional esperada de los datos de audio que se van a transcribir. En este ejemplo, la configuración regional se establece en en-US
. Las configuraciones regionales que pueden especificarse son: de-DE, en-IN, en-US, es-ES, es-MX, fr-FR, hi-IN, it-IT, ja-JP, ko-KR, pt-BR y zh-CN.
Establezca la propiedad diarization
para reconocer y separar varios oradores en un canal de audio. Por ejemplo, especifique "diarization": {"maxSpeakers": 2, "enabled": true}
. A continuación, el archivo de transcripción contiene speaker
entradas para cada frase transcrita.
Para obtener más información sobre locales
, diarization
y otras propiedades para la API de transcripción rápida, consulte la sección opciones de configuración de solicitudes más adelante en esta guía.
La respuesta incluye durationMilliseconds
, offsetMilliseconds
, etc. En este ejemplo, la diarización está habilitada, por lo que la respuesta incluye información de tipo speaker
para cada frase transcrita. La propiedad combinedPhrases
contiene las transcripciones completas de todos los oradores en un único canal.
{
"durationMilliseconds": 182439,
"combinedPhrases": [
{
"channel": 0,
"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": [
{
"channel": 0,
"speaker": 1,
"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.93616915
},
{
"channel": 0,
"speaker": 1,
"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.93616915
},
{
"channel": 0,
"speaker": 1,
"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.93616915
},
{
"channel": 0,
"speaker": 1,
"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.93616915
},
{
"channel": 0,
"speaker": 0,
"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.93616915
},
{
"channel": 0,
"speaker": 0,
"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.93616915
},
// More transcription results...
// Redacted for brevity
{
"channel": 0,
"speaker": 0,
"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.9314801
},
{
"channel": 0,
"speaker": 1,
"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.9314801
}
]
}
Realice una solicitud POST multipart/form-data al punto de conexión transcriptions
con el archivo de audio y las propiedades del cuerpo de la solicitud.
En el ejemplo siguiente se muestra cómo transcribir un archivo de audio que tiene uno o dos canales. Las transcripciones de varios canales son útiles para archivos de audio con varios canales, como archivos de audio con varios altavoces o archivos de audio con ruido de fondo. De forma predeterminada, la API de transcripción rápida combina todos los canales de entrada en un único canal y, a continuación, realiza la transcripción. Si esto no es deseable, los canales se pueden transcribir de forma independiente sin combinarlos.
- Reemplace
YourSubscriptionKey
por su clave de recurso de Voz.
- Reemplace
YourServiceRegion
por la región del recurso de Voz.
- Reemplace
YourAudioFile
por la ruta de acceso al archivo de audio.
curl --location 'https://YourServiceRegion.api.cognitive.microsoft.com/speechtotext/transcriptions:transcribe?api-version=2024-11-15' \
--header 'Content-Type: multipart/form-data' \
--header 'Ocp-Apim-Subscription-Key: YourSubscriptionKey' \
--form 'audio=@"YourAudioFile"' \
--form 'definition="{
"locales":["en-US"],
"channels": [0,1]}"'
Construya la definición del formulario según las instrucciones siguientes:
Establezca la propiedad opcional (pero recomendada) locales
que debe coincidir con la configuración regional esperada de los datos de audio que se van a transcribir. En este ejemplo, la configuración regional se establece en en-US
. Las configuraciones regionales que pueden especificarse son: de-DE, en-IN, en-US, es-ES, es-MX, fr-FR, hi-IN, it-IT, ja-JP, ko-KR, pt-BR y zh-CN.
Establezca la propiedad channels
para especificar los índices de base cero de los canales que se van a transcribir por separado. Se admiten hasta dos canales, a menos que la diarización esté habilitada. En este ejemplo, se especifican los canales 0 y 1.
Para obtener más información sobre locales
, channels
y otras propiedades para la API de transcripción rápida, consulte la sección opciones de configuración de solicitudes más adelante en esta guía.
La respuesta incluye durationMilliseconds
, offsetMilliseconds
, etc. La propiedad channel
identifica el canal si el archivo de audio contiene varios canales. La propiedad combinedPhrases
contiene transcripciones completas independientes por canal de audio. Busque "channel": 0,"text"
y "channel": 1,"text"
para identificar las transcripciones completas de cada canal.
{
"durationMilliseconds": 185079,
"combinedPhrases": [
{
"channel": 0,
"text": "Hello. Thank you for calling Contoso. Who am I speaking with today? Hi, Mary. Are you calling because you need health insurance? Great. If you can answer a few questions, we can get you signed up in the Jiffy. So what's your full name? Got it. And what's the best callback number in case we get disconnected? Yep, that'll be fine. Got it. So to confirm, it's 234-554-9312. Excellent. Let's get some additional information for your application. Do you have a job? OK, so then you have a Social Security number as well. OK, and what is your Social Security number please? Sorry, what was that, a 25 or a 225? You cut out for a bit. Alright, thank you so much. And could I have your e-mail address please? Great. Uh That is the last question. So let me take your information and I'll be able to get you signed up right away. Thank you for calling Contoso and I'll be able to get you signed up immediately. One of our agents will call you back in about 24 hours or so to confirm your application. Absolutely. If you need anything else, please give us a call at 1-800-555-5564, extension 123. Thank you very much for calling Contoso. Uh Yes, of course. So the default is a digital membership card, but we can send you a physical card if you prefer. Uh, yeah. Absolutely. I've made a note on your file. You're very welcome. Thank you for calling Contoso and have a great day."
},
{
"channel": 1,
"text": "Hi, my name is Mary Rondo. I'm trying to enroll myself with Contuso. Yes, yeah, I'm calling to sign up for insurance. Okay. So Mary Beth Rondo, last name is R like Romeo, O like Ocean, N like Nancy D, D like Dog, and O like Ocean again. Rondo. I only have a cell phone so I can give you that. Sure, so it's 234-554 and then 9312. Yep, that's right. Uh Yes, I am self-employed. Yes, I do. Uh Sure, so it's 412256789. It's double two, so 412, then another two, then five. Yeah, it's maryrondo@gmail.com. So my first and last name at gmail.com. No periods, no dashes. That was quick. Thank you. Actually, so I have one more question. I'm curious, will I be getting a physical card as proof of coverage? uh Yes. Could you please mail it to me when it's ready? I'd like to have it shipped to, are you ready for my address? So it's 2660 Unit A on Maple Avenue SE, Lansing, and then zip code is 48823. Awesome. Thanks so much."
}
],
"phrases": [
{
"channel": 0,
"offsetMilliseconds": 720,
"durationMilliseconds": 480,
"text": "Hello.",
"words": [
{
"text": "Hello.",
"offsetMilliseconds": 720,
"durationMilliseconds": 480
}
],
"locale": "en-US",
"confidence": 0.9177142
},
{
"channel": 0,
"offsetMilliseconds": 1200,
"durationMilliseconds": 1120,
"text": "Thank you for calling Contoso.",
"words": [
{
"text": "Thank",
"offsetMilliseconds": 1200,
"durationMilliseconds": 200
},
{
"text": "you",
"offsetMilliseconds": 1400,
"durationMilliseconds": 80
},
{
"text": "for",
"offsetMilliseconds": 1480,
"durationMilliseconds": 120
},
{
"text": "calling",
"offsetMilliseconds": 1600,
"durationMilliseconds": 240
},
{
"text": "Contoso.",
"offsetMilliseconds": 1840,
"durationMilliseconds": 480
}
],
"locale": "en-US",
"confidence": 0.9177142
},
{
"channel": 0,
"offsetMilliseconds": 2320,
"durationMilliseconds": 1120,
"text": "Who am I speaking with today?",
"words": [
{
"text": "Who",
"offsetMilliseconds": 2320,
"durationMilliseconds": 160
},
{
"text": "am",
"offsetMilliseconds": 2480,
"durationMilliseconds": 80
},
{
"text": "I",
"offsetMilliseconds": 2560,
"durationMilliseconds": 80
},
{
"text": "speaking",
"offsetMilliseconds": 2640,
"durationMilliseconds": 320
},
{
"text": "with",
"offsetMilliseconds": 2960,
"durationMilliseconds": 160
},
{
"text": "today?",
"offsetMilliseconds": 3120,
"durationMilliseconds": 320
}
],
"locale": "en-US",
"confidence": 0.9177142
},
{
"channel": 0,
"offsetMilliseconds": 9520,
"durationMilliseconds": 400,
"text": "Hi, Mary.",
"words": [
{
"text": "Hi,",
"offsetMilliseconds": 9520,
"durationMilliseconds": 80
},
{
"text": "Mary.",
"offsetMilliseconds": 9600,
"durationMilliseconds": 320
}
],
"locale": "en-US",
"confidence": 0.9177142
},
// More transcription results...
// Redacted for brevity
{
"channel": 1,
"offsetMilliseconds": 4480,
"durationMilliseconds": 1600,
"text": "Hi, my name is Mary Rondo.",
"words": [
{
"text": "Hi,",
"offsetMilliseconds": 4480,
"durationMilliseconds": 400
},
{
"text": "my",
"offsetMilliseconds": 4880,
"durationMilliseconds": 120
},
{
"text": "name",
"offsetMilliseconds": 5000,
"durationMilliseconds": 120
},
{
"text": "is",
"offsetMilliseconds": 5120,
"durationMilliseconds": 160
},
{
"text": "Mary",
"offsetMilliseconds": 5280,
"durationMilliseconds": 240
},
{
"text": "Rondo.",
"offsetMilliseconds": 5520,
"durationMilliseconds": 560
}
],
"locale": "en-US",
"confidence": 0.8989456
},
{
"channel": 1,
"offsetMilliseconds": 6080,
"durationMilliseconds": 1920,
"text": "I'm trying to enroll myself with Contuso.",
"words": [
{
"text": "I'm",
"offsetMilliseconds": 6080,
"durationMilliseconds": 160
},
{
"text": "trying",
"offsetMilliseconds": 6240,
"durationMilliseconds": 200
},
{
"text": "to",
"offsetMilliseconds": 6440,
"durationMilliseconds": 80
},
{
"text": "enroll",
"offsetMilliseconds": 6520,
"durationMilliseconds": 200
},
{
"text": "myself",
"offsetMilliseconds": 6720,
"durationMilliseconds": 360
},
{
"text": "with",
"offsetMilliseconds": 7080,
"durationMilliseconds": 120
},
{
"text": "Contuso.",
"offsetMilliseconds": 7200,
"durationMilliseconds": 800
}
],
"locale": "en-US",
"confidence": 0.8989456
},
// More transcription results...
// Redacted for brevity
]
}
Estas son algunas opciones de propiedad para configurar una transcripción al llamar a la operación Transcripciones: transcribir.