Démarrage rapide : Créer une diarisation en temps réel

Documentation de référence | Package (NuGet) | Exemples supplémentaires sur GitHub

Dans ce guide de démarrage rapide, vous exécutez une application de transcription vocale en texte avec diarisation en temps réel. La diarisation fait la distinction entre les différents intervenants qui participent à la conversation. Le service Speech fournit des informations sur l’orateur qui parlait une partie particulière de la parole transcrite.

Les informations sur l’orateur sont incluses dans le résultat dans le champ ID de l’orateur. L’ID de l’orateur est un identificateur générique attribué à chaque participant à la conversation par le service pendant la reconnaissance, car différents orateurs sont identifiés à partir du contenu audio fourni.

Conseil

Vous pouvez essayer la reconnaissance vocale en temps réel dans Speech Studio sans vous inscrire ni écrire de code. Toutefois, Speech Studio ne prend pas encore en charge la diarisation.

Prérequis

  • Un abonnement Azure. Vous pouvez en créer un gratuitement.
  • Créer une ressource Speech dans le portail Azure.
  • Obtenez la clé de ressource et la région Speech. Une fois votre ressource vocale déployée, sélectionnez Accéder à la ressource pour afficher et gérer les clés.

Configurer l’environnement

Le kit de développement logiciel (SDK) Speech est disponible en tant que package NuGet et implémente .NET Standard 2.0. Ce guide vous invite à installer le SDK Speech plus tard. Consultez d’abord le guide d’installation du SDK pour connaître les éventuelles autres exigences.

Définir des variables d’environnement

Vous devez authentifier votre application pour accéder à Azure AI services. Cet article vous montre comment utiliser des variables d’environnement pour stocker vos informations d’identification. Vous pouvez ensuite accéder aux variables d’environnement à partir de votre code pour authentifier votre application. Pour la production, utilisez un moyen plus sécurisé pour stocker vos informations d’identification et y accéder.

Important

Nous vous recommandons l’authentification Microsoft Entra ID avec les identités managées pour les ressources Azure pour éviter de stocker des informations d’identification avec vos applications qui s’exécutent dans le cloud.

Si vous utilisez une clé API, stockez-la en toute sécurité dans un autre emplacement, par exemple dans Azure Key Vault. N'incluez pas la clé API directement dans votre code et ne la diffusez jamais publiquement.

Pour plus d’informations sur la sécurité des services IA, consultez Authentifier les demandes auprès d’Azure AI services.

Pour définir les variables d'environnement de votre clé de ressource Speech et de votre région, ouvrez une fenêtre de console et suivez les instructions de votre système d'exploitation et de votre environnement de développement.

  • Pour définir la variable d’environnement SPEECH_KEY, remplacez your-key par l’une des clés de votre ressource.
  • Pour définir la variable d’environnement SPEECH_REGION, remplacez your-region par l’une des régions de votre ressource.
setx SPEECH_KEY your-key
setx SPEECH_REGION your-region

Remarque

Si vous avez uniquement besoin d’accéder aux variables d’environnement dans la console en cours d’exécution, vous pouvez la définir avec set au lieu de setx.

Après avoir ajouté les variables d'environnement, vous devrez éventuellement redémarrer tous les programmes qui ont besoin de lire les variables d'environnement, y compris la fenêtre de console. Par exemple, si vous utilisez Visual Studio comme éditeur, redémarrez Visual Studio avant d’exécuter l’exemple.

Implémenter la diarisation à partir d’un fichier avec transcription de conversation

Effectuez ces étapes pour créer une application console et installer le SDK Speech.

  1. Ouvrez une fenêtre d’invite de commandes dans le dossier où vous souhaitez placer le nouveau projet. Exécutez cette commande pour créer une application console avec l’interface CLI .NET.

    dotnet new console
    

    Cette commande crée un fichier Program.cs dans le répertoire de votre projet.

  2. Installez le kit de développement logiciel (SDK) Speech dans votre nouveau projet avec l’interface CLI .NET.

    dotnet add package Microsoft.CognitiveServices.Speech
    
  3. Remplacez le contenu de Program.cs par le code suivant.

    using Microsoft.CognitiveServices.Speech;
    using Microsoft.CognitiveServices.Speech.Audio;
    using Microsoft.CognitiveServices.Speech.Transcription;
    
    class Program 
    {
        // This example requires environment variables named "SPEECH_KEY" and "SPEECH_REGION"
        static string speechKey = Environment.GetEnvironmentVariable("SPEECH_KEY");
        static string speechRegion = Environment.GetEnvironmentVariable("SPEECH_REGION");
    
        async static Task Main(string[] args)
        {
            var filepath = "katiesteve.wav";
            var speechConfig = SpeechConfig.FromSubscription(speechKey, speechRegion);        
            speechConfig.SpeechRecognitionLanguage = "en-US";
            speechConfig.SetProperty(PropertyId.SpeechServiceResponse_DiarizeIntermediateResults, "true"); 
    
            var stopRecognition = new TaskCompletionSource<int>(TaskCreationOptions.RunContinuationsAsynchronously);
    
            // Create an audio stream from a wav file or from the default microphone
            using (var audioConfig = AudioConfig.FromWavFileInput(filepath))
            {
                // Create a conversation transcriber using audio stream input
                using (var conversationTranscriber = new ConversationTranscriber(speechConfig, audioConfig))
                {
                    conversationTranscriber.Transcribing += (s, e) =>
                    {
                        Console.WriteLine($"TRANSCRIBING: Text={e.Result.Text} Speaker ID={e.Result.SpeakerId}");
                    };
    
                    conversationTranscriber.Transcribed += (s, e) =>
                    {
                        if (e.Result.Reason == ResultReason.RecognizedSpeech)
                        {
                            Console.WriteLine();
                            Console.WriteLine($"TRANSCRIBED: Text={e.Result.Text} Speaker ID={e.Result.SpeakerId}");
                            Console.WriteLine();
                        }
                        else if (e.Result.Reason == ResultReason.NoMatch)
                        {
                            Console.WriteLine($"NOMATCH: Speech could not be transcribed.");
                        }
                    };
    
                    conversationTranscriber.Canceled += (s, e) =>
                    {
                        Console.WriteLine($"CANCELED: Reason={e.Reason}");
    
                        if (e.Reason == CancellationReason.Error)
                        {
                            Console.WriteLine($"CANCELED: ErrorCode={e.ErrorCode}");
                            Console.WriteLine($"CANCELED: ErrorDetails={e.ErrorDetails}");
                            Console.WriteLine($"CANCELED: Did you set the speech resource key and region values?");
                            stopRecognition.TrySetResult(0);
                        }
    
                        stopRecognition.TrySetResult(0);
                    };
    
                    conversationTranscriber.SessionStopped += (s, e) =>
                    {
                        Console.WriteLine("\n    Session stopped event.");
                        stopRecognition.TrySetResult(0);
                    };
    
                    await conversationTranscriber.StartTranscribingAsync();
    
                    // Waits for completion. Use Task.WaitAny to keep the task rooted.
                    Task.WaitAny(new[] { stopRecognition.Task });
    
                    await conversationTranscriber.StopTranscribingAsync();
                }
            }
        }
    }
    
  4. Obtenez l’exemple de fichier audio ou utilisez votre propre fichier .wav. Remplacez katiesteve.wav par le chemin d’accès et le nom de votre fichier .wav.

    L’application reconnaît la parole de plusieurs participants à la conversation. Votre fichier audio doit contenir plusieurs haut-parleurs.

  5. Pour modifier la langue de la reconnaissance vocale, remplacez en-US par une autre langue prise en charge. Par exemple, es-ES pour l’espagnol (Espagne). La langue par défaut est en-US si vous ne spécifiez pas de langue. Pour plus d’informations sur l’identification de l’une des langues qui peuvent être parlées, consultez Identification de la langue.

  6. Exécutez votre application console pour démarrer la transcription de conversation :

    dotnet run
    

Important

N’oubliez pas de définir les variables d’environnement SPEECH_KEY et SPEECH_REGION. Si vous ne définissez pas ces variables, l’exemple échoue avec un message d’erreur.

La conversation transcrite doit être sortie sous forme de texte :

TRANSCRIBING: Text=good morning steve Speaker ID=Unknown
TRANSCRIBING: Text=good morning steve how are Speaker ID=Guest-1
TRANSCRIBING: Text=good morning steve how are you doing today Speaker ID=Guest-1

TRANSCRIBED: Text=Good morning, Steve. How are you doing today? Speaker ID=Guest-1

TRANSCRIBING: Text=good morning katie Speaker ID=Unknown
TRANSCRIBING: Text=good morning katie i hope Speaker ID=Guest-2
TRANSCRIBING: Text=good morning katie i hope you're having a great Speaker ID=Guest-2
TRANSCRIBING: Text=good morning katie i hope you're having a great start to Speaker ID=Guest-2
TRANSCRIBING: Text=good morning katie i hope you're having a great start to your day Speaker ID=Guest-2

TRANSCRIBED: Text=Good morning, Katie. I hope you're having a great start to your day. Speaker ID=Guest-2

TRANSCRIBING: Text=have you tried Speaker ID=Unknown
TRANSCRIBING: Text=have you tried the latest Speaker ID=Unknown
TRANSCRIBING: Text=have you tried the latest real time Speaker ID=Guest-1
TRANSCRIBING: Text=have you tried the latest real time diarization Speaker ID=Guest-1
TRANSCRIBING: Text=have you tried the latest real time diarization in Speaker ID=Guest-1
TRANSCRIBING: Text=have you tried the latest real time diarization in microsoft Speaker ID=Guest-1
TRANSCRIBING: Text=have you tried the latest real time diarization in microsoft speech Speaker ID=Guest-1
TRANSCRIBING: Text=have you tried the latest real time diarization in microsoft speech service Speaker ID=Guest-1
TRANSCRIBING: Text=have you tried the latest real time diarization in microsoft speech service which Speaker ID=Guest-1
TRANSCRIBING: Text=have you tried the latest real time diarization in microsoft speech service which can Speaker ID=Guest-1
TRANSCRIBING: Text=have you tried the latest real time diarization in microsoft speech service which can tell you Speaker ID=Guest-1
TRANSCRIBING: Text=have you tried the latest real time diarization in microsoft speech service which can tell you who said Speaker ID=Guest-1
TRANSCRIBING: Text=have you tried the latest real time diarization in microsoft speech service which can tell you who said what Speaker ID=Guest-1
TRANSCRIBING: Text=have you tried the latest real time diarization in microsoft speech service which can tell you who said what in Speaker ID=Guest-1
TRANSCRIBING: Text=have you tried the latest real time diarization in microsoft speech service which can tell you who said what in real time Speaker ID=Guest-1

TRANSCRIBED: Text=Have you tried the latest real time diarization in Microsoft Speech Service which can tell you who said what in real time? Speaker ID=Guest-1

TRANSCRIBING: Text=not yet Speaker ID=Unknown
TRANSCRIBING: Text=not yet i Speaker ID=Guest-2
TRANSCRIBING: Text=not yet i've been using Speaker ID=Guest-2
TRANSCRIBING: Text=not yet i've been using the Speaker ID=Guest-2
TRANSCRIBING: Text=not yet i've been using the batch Speaker ID=Guest-2
TRANSCRIBING: Text=not yet i've been using the batch trans Speaker ID=Guest-2
TRANSCRIBING: Text=not yet i've been using the batch transcription with Speaker ID=Guest-2
TRANSCRIBING: Text=not yet i've been using the batch transcription with diarization Speaker ID=Guest-2  
TRANSCRIBING: Text=not yet i've been using the batch transcription with diarization function Speaker ID=Guest-2
TRANSCRIBING: Text=not yet i've been using the batch transcription with diarization functionality Speaker ID=Guest-2
TRANSCRIBING: Text=not yet i've been using the batch transcription with diarization functionality but Speaker ID=Guest-2
TRANSCRIBING: Text=not yet i've been using the batch transcription with diarization functionality but it Speaker ID=Guest-2
TRANSCRIBING: Text=not yet i've been using the batch transcription with diarization functionality but it produc Speaker ID=Guest-2
TRANSCRIBING: Text=not yet i've been using the batch transcription with diarization functionality but it produces Speaker ID=Guest-2
TRANSCRIBING: Text=not yet i've been using the batch transcription with diarization functionality but it produces di Speaker ID=Guest-2
TRANSCRIBING: Text=not yet i've been using the batch transcription with diarization functionality but it produces diarization Speaker ID=Guest-2
TRANSCRIBING: Text=not yet i've been using the batch transcription with diarization functionality but it produces diarization results Speaker ID=Guest-2
TRANSCRIBING: Text=not yet i've been using the batch transcription with diarization functionality but it produces diarization results after Speaker ID=Guest-2
TRANSCRIBING: Text=not yet i've been using the batch transcription with diarization functionality but it produces diarization results after the Speaker ID=Guest-2
TRANSCRIBING: Text=not yet i've been using the batch transcription with diarization functionality but it produces diarization results after the whole Speaker ID=Guest-2
TRANSCRIBING: Text=not yet i've been using the batch transcription with diarization functionality but it produces diarization results after the whole audio Speaker ID=Guest-2
TRANSCRIBING: Text=not yet i've been using the batch transcription with diarization functionality but it produces diarization results after the whole audio is Speaker ID=Guest-2
TRANSCRIBING: Text=not yet i've been using the batch transcription with diarization functionality but it produces diarization results after the whole audio is processed Speaker ID=Guest-2
TRANSCRIBING: Text=not yet i've been using the batch transcription with diarization functionality but it produces diarization results after the whole audio is processed is the Speaker ID=Guest-2
TRANSCRIBING: Text=not yet i've been using the batch transcription with diarization functionality but it produces diarization results after the whole audio is processed is the new Speaker ID=Guest-2
TRANSCRIBING: Text=not yet i've been using the batch transcription with diarization functionality but it produces diarization results after the whole audio is processed is the new feature Speaker ID=Guest-2  
TRANSCRIBING: Text=not yet i've been using the batch transcription with diarization functionality but it produces diarization results after the whole audio is processed is the new feature able to Speaker ID=Guest-2
TRANSCRIBING: Text=not yet i've been using the batch transcription with diarization functionality but it produces diarization results after the whole audio is processed is the new feature able to di Speaker ID=Guest-2
TRANSCRIBING: Text=not yet i've been using the batch transcription with diarization functionality but it produces diarization results after the whole audio is processed is the new feature able to diarize Speaker ID=Guest-2
TRANSCRIBING: Text=not yet i've been using the batch transcription with diarization functionality but it produces diarization results after the whole audio is processed is the new feature able to diarize in real Speaker ID=Guest-2
TRANSCRIBING: Text=not yet i've been using the batch transcription with diarization functionality but it produces diarization results after the whole audio is processed is the new feature able to diarize in real time Speaker ID=Guest-2

TRANSCRIBED: Text=Not yet. I've been using the batch transcription with diarization functionality, but it produces diarization results after the whole audio is processed. Is the new feature able to diarize in real time? Speaker ID=Guest-2

TRANSCRIBING: Text=absolutely Speaker ID=Unknown
TRANSCRIBING: Text=absolutely i Speaker ID=Unknown
TRANSCRIBING: Text=absolutely i recom Speaker ID=Guest-1
TRANSCRIBING: Text=absolutely i recommend Speaker ID=Guest-1
TRANSCRIBING: Text=absolutely i recommend you give it a try Speaker ID=Guest-1

TRANSCRIBED: Text=Absolutely, I recommend you give it a try. Speaker ID=Guest-1

TRANSCRIBING: Text=that's exc Speaker ID=Unknown
TRANSCRIBING: Text=that's exciting Speaker ID=Unknown
TRANSCRIBING: Text=that's exciting let me try Speaker ID=Guest-2
TRANSCRIBING: Text=that's exciting let me try it right now Speaker ID=Guest-2

TRANSCRIBED: Text=That's exciting. Let me try it right now. Speaker ID=Guest-2

Les orateurs sont identifiés comme invités 1, invités 2, etc., en fonction du nombre d’orateurs dans la conversation.

Remarque

Il est possible que vous voyiez Speaker ID=Unknown dans certains des résultats intermédiaires anticipés quand l’intervenant n’est pas encore identifié. Sans les résultats de diarisation intermédiaires (si vous ne définissez pas la propriété PropertyId.SpeechServiceResponse_DiarizeIntermediateResults sur « true »), l’ID de l’intervenant est toujours « Inconnu ».

Nettoyer les ressources

Vous pouvez utiliser le portail Azure ou l’interface de ligne de commande (CLI) Azure pour supprimer la ressource Speech que vous avez créée.

Documentation de référence | Package (NuGet) | Exemples supplémentaires sur GitHub

Dans ce guide de démarrage rapide, vous exécutez une application de transcription vocale en texte avec diarisation en temps réel. La diarisation fait la distinction entre les différents intervenants qui participent à la conversation. Le service Speech fournit des informations sur l’orateur qui parlait une partie particulière de la parole transcrite.

Les informations sur l’orateur sont incluses dans le résultat dans le champ ID de l’orateur. L’ID de l’orateur est un identificateur générique attribué à chaque participant à la conversation par le service pendant la reconnaissance, car différents orateurs sont identifiés à partir du contenu audio fourni.

Conseil

Vous pouvez essayer la reconnaissance vocale en temps réel dans Speech Studio sans vous inscrire ni écrire de code. Toutefois, Speech Studio ne prend pas encore en charge la diarisation.

Prérequis

  • Un abonnement Azure. Vous pouvez en créer un gratuitement.
  • Créer une ressource Speech dans le portail Azure.
  • Obtenez la clé de ressource et la région Speech. Une fois votre ressource vocale déployée, sélectionnez Accéder à la ressource pour afficher et gérer les clés.

Configurer l’environnement

Le kit de développement logiciel (SDK) Speech est disponible en tant que package NuGet et implémente .NET Standard 2.0. Ce guide vous invite à installer le SDK Speech plus tard. Consultez d’abord le guide d’installation du SDK pour connaître les éventuelles autres exigences.

Définir des variables d’environnement

Vous devez authentifier votre application pour accéder à Azure AI services. Cet article vous montre comment utiliser des variables d’environnement pour stocker vos informations d’identification. Vous pouvez ensuite accéder aux variables d’environnement à partir de votre code pour authentifier votre application. Pour la production, utilisez un moyen plus sécurisé pour stocker vos informations d’identification et y accéder.

Important

Nous vous recommandons l’authentification Microsoft Entra ID avec les identités managées pour les ressources Azure pour éviter de stocker des informations d’identification avec vos applications qui s’exécutent dans le cloud.

Si vous utilisez une clé API, stockez-la en toute sécurité dans un autre emplacement, par exemple dans Azure Key Vault. N'incluez pas la clé API directement dans votre code et ne la diffusez jamais publiquement.

Pour plus d’informations sur la sécurité des services IA, consultez Authentifier les demandes auprès d’Azure AI services.

Pour définir les variables d'environnement de votre clé de ressource Speech et de votre région, ouvrez une fenêtre de console et suivez les instructions de votre système d'exploitation et de votre environnement de développement.

  • Pour définir la variable d’environnement SPEECH_KEY, remplacez your-key par l’une des clés de votre ressource.
  • Pour définir la variable d’environnement SPEECH_REGION, remplacez your-region par l’une des régions de votre ressource.
setx SPEECH_KEY your-key
setx SPEECH_REGION your-region

Remarque

Si vous avez uniquement besoin d’accéder aux variables d’environnement dans la console en cours d’exécution, vous pouvez la définir avec set au lieu de setx.

Après avoir ajouté les variables d'environnement, vous devrez éventuellement redémarrer tous les programmes qui ont besoin de lire les variables d'environnement, y compris la fenêtre de console. Par exemple, si vous utilisez Visual Studio comme éditeur, redémarrez Visual Studio avant d’exécuter l’exemple.

Implémenter la diarisation à partir d’un fichier avec transcription de conversation

Effectuez ces étapes pour créer une application console et installer le SDK Speech.

  1. Créez un projet console en C++ dans Visual Studio Community 2022, nommé ConversationTranscription.

  2. Sélectionnez Outils>Gestionnaire de package NuGet>Console du Gestionnaire de package. Dans la Console du Gestionnaire de package, exécutez cette commande :

    Install-Package Microsoft.CognitiveServices.Speech
    
  3. Remplacez le contenu de ConversationTranscription.cpp par le code suivant.

    #include <iostream> 
    #include <stdlib.h>
    #include <speechapi_cxx.h>
    #include <future>
    
    using namespace Microsoft::CognitiveServices::Speech;
    using namespace Microsoft::CognitiveServices::Speech::Audio;
    using namespace Microsoft::CognitiveServices::Speech::Transcription;
    
    std::string GetEnvironmentVariable(const char* name);
    
    int main()
    {
        // This example requires environment variables named "SPEECH_KEY" and "SPEECH_REGION"
        auto speechKey = GetEnvironmentVariable("SPEECH_KEY");
        auto speechRegion = GetEnvironmentVariable("SPEECH_REGION");
    
        if ((size(speechKey) == 0) || (size(speechRegion) == 0)) {
            std::cout << "Please set both SPEECH_KEY and SPEECH_REGION environment variables." << std::endl;
            return -1;
        }
    
        auto speechConfig = SpeechConfig::FromSubscription(speechKey, speechRegion);
        speechConfig->SetProperty(PropertyId::SpeechServiceResponse_DiarizeIntermediateResults, "true"); 
    
        speechConfig->SetSpeechRecognitionLanguage("en-US");
    
        auto audioConfig = AudioConfig::FromWavFileInput("katiesteve.wav");
        auto conversationTranscriber = ConversationTranscriber::FromConfig(speechConfig, audioConfig);
    
        // promise for synchronization of recognition end.
        std::promise<void> recognitionEnd;
    
        // Subscribes to events.
        conversationTranscriber->Transcribing.Connect([](const ConversationTranscriptionEventArgs& e)
            {
                std::cout << "TRANSCRIBING:" << e.Result->Text << std::endl;
                std::cout << "Speaker ID=" << e.Result->SpeakerId << std::endl;
            });
    
        conversationTranscriber->Transcribed.Connect([](const ConversationTranscriptionEventArgs& e)
            {
                if (e.Result->Reason == ResultReason::RecognizedSpeech)
                {
                    std::cout << "\n" << "TRANSCRIBED: Text=" << e.Result->Text << std::endl;
                    std::cout << "Speaker ID=" << e.Result->SpeakerId << "\n" << std::endl;
                }
                else if (e.Result->Reason == ResultReason::NoMatch)
                {
                    std::cout << "NOMATCH: Speech could not be transcribed." << std::endl;
                }
            });
    
        conversationTranscriber->Canceled.Connect([&recognitionEnd](const ConversationTranscriptionCanceledEventArgs& e)
            {
                auto cancellation = CancellationDetails::FromResult(e.Result);
                std::cout << "CANCELED: Reason=" << (int)cancellation->Reason << std::endl;
    
                if (cancellation->Reason == CancellationReason::Error)
                {
                    std::cout << "CANCELED: ErrorCode=" << (int)cancellation->ErrorCode << std::endl;
                    std::cout << "CANCELED: ErrorDetails=" << cancellation->ErrorDetails << std::endl;
                    std::cout << "CANCELED: Did you set the speech resource key and region values?" << std::endl;
                }
                else if (cancellation->Reason == CancellationReason::EndOfStream)
                {
                    std::cout << "CANCELED: Reach the end of the file." << std::endl;
                }
            });
    
        conversationTranscriber->SessionStopped.Connect([&recognitionEnd](const SessionEventArgs& e)
            {
                std::cout << "Session stopped.";
                recognitionEnd.set_value(); // Notify to stop recognition.
            });
    
        conversationTranscriber->StartTranscribingAsync().wait();
    
        // Waits for recognition end.
        recognitionEnd.get_future().wait();
    
        conversationTranscriber->StopTranscribingAsync().wait();
    }
    
    std::string GetEnvironmentVariable(const char* name)
    {
    #if defined(_MSC_VER)
        size_t requiredSize = 0;
        (void)getenv_s(&requiredSize, nullptr, 0, name);
        if (requiredSize == 0)
        {
            return "";
        }
        auto buffer = std::make_unique<char[]>(requiredSize);
        (void)getenv_s(&requiredSize, buffer.get(), requiredSize, name);
        return buffer.get();
    #else
        auto value = getenv(name);
        return value ? value : "";
    #endif
    }
    
  4. Obtenez l’exemple de fichier audio ou utilisez votre propre fichier .wav. Remplacez katiesteve.wav par le chemin d’accès et le nom de votre fichier .wav.

    L’application reconnaît la parole de plusieurs participants à la conversation. Votre fichier audio doit contenir plusieurs haut-parleurs.

  5. Pour modifier la langue de la reconnaissance vocale, remplacez en-US par une autre langue prise en charge. Par exemple, es-ES pour l’espagnol (Espagne). La langue par défaut est en-US si vous ne spécifiez pas de langue. Pour plus d’informations sur l’identification de l’une des langues qui peuvent être parlées, consultez Identification de la langue.

  6. Générez et exécutez votre application pour démarrer la transcription de conversation :

    Important

    N’oubliez pas de définir les variables d’environnement SPEECH_KEY et SPEECH_REGION. Si vous ne définissez pas ces variables, l’exemple échoue avec un message d’erreur.

La conversation transcrite doit être sortie sous forme de texte :

TRANSCRIBING:good morning
Speaker ID=Unknown
TRANSCRIBING:good morning steve
Speaker ID=Unknown
TRANSCRIBING:good morning steve how are you doing
Speaker ID=Guest-1
TRANSCRIBING:good morning steve how are you doing today
Speaker ID=Guest-1

TRANSCRIBED: Text=Good morning, Steve. How are you doing today?
Speaker ID=Guest-1

TRANSCRIBING:good
Speaker ID=Unknown
TRANSCRIBING:good morning
Speaker ID=Unknown
TRANSCRIBING:good morning kat
Speaker ID=Unknown
TRANSCRIBING:good morning katie i hope you're having a
Speaker ID=Guest-2
TRANSCRIBING:good morning katie i hope you're having a great start to your day
Speaker ID=Guest-2

TRANSCRIBED: Text=Good morning, Katie. I hope you're having a great start to your day.
Speaker ID=Guest-2

TRANSCRIBING:have you
Speaker ID=Unknown
TRANSCRIBING:have you tried
Speaker ID=Unknown
TRANSCRIBING:have you tried the latest
Speaker ID=Unknown
TRANSCRIBING:have you tried the latest real
Speaker ID=Guest-1
TRANSCRIBING:have you tried the latest real time
Speaker ID=Guest-1
TRANSCRIBING:have you tried the latest real time diarization
Speaker ID=Guest-1
TRANSCRIBING:have you tried the latest real time diarization in
Speaker ID=Guest-1
TRANSCRIBING:have you tried the latest real time diarization in microsoft
Speaker ID=Guest-1
TRANSCRIBING:have you tried the latest real time diarization in microsoft speech
Speaker ID=Guest-1
TRANSCRIBING:have you tried the latest real time diarization in microsoft speech service
Speaker ID=Guest-1
TRANSCRIBING:have you tried the latest real time diarization in microsoft speech service which
Speaker ID=Guest-1
TRANSCRIBING:have you tried the latest real time diarization in microsoft speech service which can
Speaker ID=Guest-1
TRANSCRIBING:have you tried the latest real time diarization in microsoft speech service which can tell you
Speaker ID=Guest-1
TRANSCRIBING:have you tried the latest real time diarization in microsoft speech service which can tell you who said
Speaker ID=Guest-1
TRANSCRIBING:have you tried the latest real time diarization in microsoft speech service which can tell you who said what
Speaker ID=Guest-1
TRANSCRIBING:have you tried the latest real time diarization in microsoft speech service which can tell you who said what in
Speaker ID=Guest-1
TRANSCRIBING:have you tried the latest real time diarization in microsoft speech service which can tell you who said what in real time
Speaker ID=Guest-1

TRANSCRIBED: Text=Have you tried the latest real time diarization in Microsoft Speech Service which can tell you who said what in real time?
Speaker ID=Guest-1

TRANSCRIBING:not yet
Speaker ID=Unknown
TRANSCRIBING:not yet i
Speaker ID=Guest-2
TRANSCRIBING:not yet i've been using
Speaker ID=Guest-2
TRANSCRIBING:not yet i've been using the
Speaker ID=Guest-2
TRANSCRIBING:not yet i've been using the batch
Speaker ID=Guest-2
TRANSCRIBING:not yet i've been using the batch trans
Speaker ID=Guest-2
TRANSCRIBING:not yet i've been using the batch transcription with
Speaker ID=Guest-2
TRANSCRIBING:not yet i've been using the batch transcription with diarization
Speaker ID=Guest-2
TRANSCRIBING:not yet i've been using the batch transcription with diarization function
Speaker ID=Guest-2
TRANSCRIBING:not yet i've been using the batch transcription with diarization functionality
Speaker ID=Guest-2
TRANSCRIBING:not yet i've been using the batch transcription with diarization functionality but
Speaker ID=Guest-2
TRANSCRIBING:not yet i've been using the batch transcription with diarization functionality but it
Speaker ID=Guest-2
TRANSCRIBING:not yet i've been using the batch transcription with diarization functionality but it produces
Speaker ID=Guest-2
TRANSCRIBING:not yet i've been using the batch transcription with diarization functionality but it produces di
Speaker ID=Guest-2
TRANSCRIBING:not yet i've been using the batch transcription with diarization functionality but it produces diarization
Speaker ID=Guest-2
TRANSCRIBING:not yet i've been using the batch transcription with diarization functionality but it produces diarization results
Speaker ID=Guest-2
TRANSCRIBING:not yet i've been using the batch transcription with diarization functionality but it produces diarization results after
Speaker ID=Guest-2
TRANSCRIBING:not yet i've been using the batch transcription with diarization functionality but it produces diarization results after the
Speaker ID=Guest-2
TRANSCRIBING:not yet i've been using the batch transcription with diarization functionality but it produces diarization results after the whole
Speaker ID=Guest-2
TRANSCRIBING:not yet i've been using the batch transcription with diarization functionality but it produces diarization results after the whole audio
Speaker ID=Guest-2
TRANSCRIBING:not yet i've been using the batch transcription with diarization functionality but it produces diarization results after the whole audio is
Speaker ID=Guest-2
TRANSCRIBING:not yet i've been using the batch transcription with diarization functionality but it produces diarization results after the whole audio is processed
Speaker ID=Guest-2
TRANSCRIBING:not yet i've been using the batch transcription with diarization functionality but it produces diarization results after the whole audio is processed is the
Speaker ID=Guest-2
TRANSCRIBING:not yet i've been using the batch transcription with diarization functionality but it produces diarization results after the whole audio is processed is the new
Speaker ID=Guest-2
TRANSCRIBING:not yet i've been using the batch transcription with diarization functionality but it produces diarization results after the whole audio is processed is the new feature
Speaker ID=Guest-2
TRANSCRIBING:not yet i've been using the batch transcription with diarization functionality but it produces diarization results after the whole audio is processed is the new feature able to
Speaker ID=Guest-2
TRANSCRIBING:not yet i've been using the batch transcription with diarization functionality but it produces diarization results after the whole audio is processed is the new feature able to di
Speaker ID=Guest-2
TRANSCRIBING:not yet i've been using the batch transcription with diarization functionality but it produces diarization results after the whole audio is processed is the new feature able to diarize
Speaker ID=Guest-2
TRANSCRIBING:not yet i've been using the batch transcription with diarization functionality but it produces diarization results after the whole audio is processed is the new feature able to diarize in real
Speaker ID=Guest-2
TRANSCRIBING:not yet i've been using the batch transcription with diarization functionality but it produces diarization results after the whole audio is processed is the new feature able to diarize in real time
Speaker ID=Guest-2

TRANSCRIBED: Text=Not yet. I've been using the batch transcription with diarization functionality, but it produces diarization results after the whole audio is processed. Is the new feature able to diarize in real time?
Speaker ID=Guest-2

TRANSCRIBING:absolutely
Speaker ID=Unknown
TRANSCRIBING:absolutely i
Speaker ID=Unknown
TRANSCRIBING:absolutely i recom
Speaker ID=Guest-1
TRANSCRIBING:absolutely i recommend
Speaker ID=Guest-1
TRANSCRIBING:absolutely i recommend you
Speaker ID=Guest-1
TRANSCRIBING:absolutely i recommend you give it a try
Speaker ID=Guest-1

TRANSCRIBED: Text=Absolutely, I recommend you give it a try.
Speaker ID=Guest-1

TRANSCRIBING:that's exc
Speaker ID=Unknown
TRANSCRIBING:that's exciting
Speaker ID=Unknown
TRANSCRIBING:that's exciting let me
Speaker ID=Guest-2
TRANSCRIBING:that's exciting let me try
Speaker ID=Guest-2
TRANSCRIBING:that's exciting let me try it right now
Speaker ID=Guest-2

TRANSCRIBED: Text=That's exciting. Let me try it right now.
Speaker ID=Guest-2

Les orateurs sont identifiés comme invités 1, invités 2, etc., en fonction du nombre d’orateurs dans la conversation.

Remarque

Il est possible que vous voyiez Speaker ID=Unknown dans certains des résultats intermédiaires anticipés quand l’intervenant n’est pas encore identifié. Sans les résultats de diarisation intermédiaires (si vous ne définissez pas la propriété PropertyId::SpeechServiceResponse_DiarizeIntermediateResults sur « true »), l’ID de l’intervenant est toujours « Inconnu ».

Nettoyer les ressources

Vous pouvez utiliser le portail Azure ou l’interface de ligne de commande (CLI) Azure pour supprimer la ressource Speech que vous avez créée.

Documentation de référence | Package (Go) | Exemples supplémentaires sur GitHub

Le Kit de développement logiciel (SDK) Speech pour le langage de programmation Go ne prend pas en charge la transcription de conversation. Sélectionnez un autre langage de programmation, ou la référence Go et des exemples liés au début de cet article.

Documentation de référence | Exemples supplémentaires sur GitHub

Dans ce guide de démarrage rapide, vous exécutez une application de transcription vocale en texte avec diarisation en temps réel. La diarisation fait la distinction entre les différents intervenants qui participent à la conversation. Le service Speech fournit des informations sur l’orateur qui parlait une partie particulière de la parole transcrite.

Les informations sur l’orateur sont incluses dans le résultat dans le champ ID de l’orateur. L’ID de l’orateur est un identificateur générique attribué à chaque participant à la conversation par le service pendant la reconnaissance, car différents orateurs sont identifiés à partir du contenu audio fourni.

Conseil

Vous pouvez essayer la reconnaissance vocale en temps réel dans Speech Studio sans vous inscrire ni écrire de code. Toutefois, Speech Studio ne prend pas encore en charge la diarisation.

Prérequis

  • Un abonnement Azure. Vous pouvez en créer un gratuitement.
  • Créer une ressource Speech dans le portail Azure.
  • Obtenez la clé de ressource et la région Speech. Une fois votre ressource vocale déployée, sélectionnez Accéder à la ressource pour afficher et gérer les clés.

Configurer l’environnement

Pour configurer votre environnement, installez le SDK Speech. L’exemple de ce guide de démarrage rapide fonctionne avec le runtime Java.

  1. Installez Apache Maven. Exécutez ensuite mvn -v pour confirmer la réussite de l’installation.

  2. Créez un fichier pom.xml à la racine de votre projet, puis copiez-y ce qui suit :

    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
        <modelVersion>4.0.0</modelVersion>
        <groupId>com.microsoft.cognitiveservices.speech.samples</groupId>
        <artifactId>quickstart-eclipse</artifactId>
        <version>1.0.0-SNAPSHOT</version>
        <build>
            <sourceDirectory>src</sourceDirectory>
            <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.7.0</version>
                <configuration>
                <source>1.8</source>
                <target>1.8</target>
                </configuration>
            </plugin>
            </plugins>
        </build>
        <dependencies>
            <dependency>
            <groupId>com.microsoft.cognitiveservices.speech</groupId>
            <artifactId>client-sdk</artifactId>
            <version>1.40.0</version>
            </dependency>
        </dependencies>
    </project>
    
  3. Installez le SDK Speech et les dépendances.

    mvn clean dependency:copy-dependencies
    

Définir des variables d’environnement

Vous devez authentifier votre application pour accéder à Azure AI services. Cet article vous montre comment utiliser des variables d’environnement pour stocker vos informations d’identification. Vous pouvez ensuite accéder aux variables d’environnement à partir de votre code pour authentifier votre application. Pour la production, utilisez un moyen plus sécurisé pour stocker vos informations d’identification et y accéder.

Important

Nous vous recommandons l’authentification Microsoft Entra ID avec les identités managées pour les ressources Azure pour éviter de stocker des informations d’identification avec vos applications qui s’exécutent dans le cloud.

Si vous utilisez une clé API, stockez-la en toute sécurité dans un autre emplacement, par exemple dans Azure Key Vault. N'incluez pas la clé API directement dans votre code et ne la diffusez jamais publiquement.

Pour plus d’informations sur la sécurité des services IA, consultez Authentifier les demandes auprès d’Azure AI services.

Pour définir les variables d'environnement de votre clé de ressource Speech et de votre région, ouvrez une fenêtre de console et suivez les instructions de votre système d'exploitation et de votre environnement de développement.

  • Pour définir la variable d’environnement SPEECH_KEY, remplacez your-key par l’une des clés de votre ressource.
  • Pour définir la variable d’environnement SPEECH_REGION, remplacez your-region par l’une des régions de votre ressource.
setx SPEECH_KEY your-key
setx SPEECH_REGION your-region

Remarque

Si vous avez uniquement besoin d’accéder aux variables d’environnement dans la console en cours d’exécution, vous pouvez la définir avec set au lieu de setx.

Après avoir ajouté les variables d'environnement, vous devrez éventuellement redémarrer tous les programmes qui ont besoin de lire les variables d'environnement, y compris la fenêtre de console. Par exemple, si vous utilisez Visual Studio comme éditeur, redémarrez Visual Studio avant d’exécuter l’exemple.

Implémenter la diarisation à partir d’un fichier avec transcription de conversation

Suivez les étapes suivantes pour créer une application console pour la transcription des conversations.

  1. Créez un fichier nommé ConversationTranscription.java dans le même répertoire racine du projet.

  2. Copiez le code ci-après dans ConversationTranscription.java :

    import com.microsoft.cognitiveservices.speech.*;
    import com.microsoft.cognitiveservices.speech.audio.AudioConfig;
    import com.microsoft.cognitiveservices.speech.transcription.*;
    
    import java.util.concurrent.Semaphore;
    import java.util.concurrent.ExecutionException;
    import java.util.concurrent.Future;
    
    public class ConversationTranscription {
        // This example requires environment variables named "SPEECH_KEY" and "SPEECH_REGION"
        private static String speechKey = System.getenv("SPEECH_KEY");
        private static String speechRegion = System.getenv("SPEECH_REGION");
    
        public static void main(String[] args) throws InterruptedException, ExecutionException {
    
            SpeechConfig speechConfig = SpeechConfig.fromSubscription(speechKey, speechRegion);
            speechConfig.setSpeechRecognitionLanguage("en-US");
            AudioConfig audioInput = AudioConfig.fromWavFileInput("katiesteve.wav");
            speechConfig.setProperty(PropertyId.SpeechServiceResponse_DiarizeIntermediateResults, "true");
    
            Semaphore stopRecognitionSemaphore = new Semaphore(0);
    
            ConversationTranscriber conversationTranscriber = new ConversationTranscriber(speechConfig, audioInput);
            {
                // Subscribes to events.
                conversationTranscriber.transcribing.addEventListener((s, e) -> {
                    System.out.println("TRANSCRIBING: Text=" + e.getResult().getText() + " Speaker ID=" + e.getResult().getSpeakerId() );
                });
    
                conversationTranscriber.transcribed.addEventListener((s, e) -> {
                    if (e.getResult().getReason() == ResultReason.RecognizedSpeech) {
                        System.out.println();
                        System.out.println("TRANSCRIBED: Text=" + e.getResult().getText() + " Speaker ID=" + e.getResult().getSpeakerId() );
                        System.out.println();
                    }
                    else if (e.getResult().getReason() == ResultReason.NoMatch) {
                        System.out.println("NOMATCH: Speech could not be transcribed.");
                    }
                });
    
                conversationTranscriber.canceled.addEventListener((s, e) -> {
                    System.out.println("CANCELED: Reason=" + e.getReason());
    
                    if (e.getReason() == CancellationReason.Error) {
                        System.out.println("CANCELED: ErrorCode=" + e.getErrorCode());
                        System.out.println("CANCELED: ErrorDetails=" + e.getErrorDetails());
                        System.out.println("CANCELED: Did you update the subscription info?");
                    }
    
                    stopRecognitionSemaphore.release();
                });
    
                conversationTranscriber.sessionStarted.addEventListener((s, e) -> {
                    System.out.println("\n    Session started event.");
                });
    
                conversationTranscriber.sessionStopped.addEventListener((s, e) -> {
                    System.out.println("\n    Session stopped event.");
                });
    
                conversationTranscriber.startTranscribingAsync().get();
    
                // Waits for completion.
                stopRecognitionSemaphore.acquire();
    
                conversationTranscriber.stopTranscribingAsync().get();
            }
    
            speechConfig.close();
            audioInput.close();
            conversationTranscriber.close();
    
            System.exit(0);
        }
    }
    
  3. Obtenez l’exemple de fichier audio ou utilisez votre propre fichier .wav. Remplacez katiesteve.wav par le chemin d’accès et le nom de votre fichier .wav.

    L’application reconnaît la parole de plusieurs participants à la conversation. Votre fichier audio doit contenir plusieurs haut-parleurs.

  4. Pour modifier la langue de la reconnaissance vocale, remplacez en-US par une autre langue prise en charge. Par exemple, es-ES pour l’espagnol (Espagne). La langue par défaut est en-US si vous ne spécifiez pas de langue. Pour plus d’informations sur l’identification de l’une des langues qui peuvent être parlées, consultez Identification de la langue.

  5. Exécutez votre nouvelle application console pour démarrer la transcription de conversation :

    javac ConversationTranscription.java -cp ".;target\dependency\*"
    java -cp ".;target\dependency\*" ConversationTranscription
    

Important

N’oubliez pas de définir les variables d’environnement SPEECH_KEY et SPEECH_REGION. Si vous ne définissez pas ces variables, l’exemple échoue avec un message d’erreur.

La conversation transcrite doit être sortie sous forme de texte :

TRANSCRIBING: Text=good morning Speaker ID=Unknown
TRANSCRIBING: Text=good morning steve Speaker ID=Unknown
TRANSCRIBING: Text=good morning steve how Speaker ID=Guest-1
TRANSCRIBING: Text=good morning steve how are you doing Speaker ID=Guest-1
TRANSCRIBING: Text=good morning steve how are you doing today Speaker ID=Guest-1

TRANSCRIBED: Text=Good morning, Steve. How are you doing today? Speaker ID=Guest-1

TRANSCRIBING: Text=good morning katie i hope Speaker ID=Guest-2
TRANSCRIBING: Text=good morning katie i hope you're having a Speaker ID=Guest-2
TRANSCRIBING: Text=good morning katie i hope you're having a great Speaker ID=Guest-2
TRANSCRIBING: Text=good morning katie i hope you're having a great start to Speaker ID=Guest-2
TRANSCRIBING: Text=good morning katie i hope you're having a great start to your day Speaker ID=Guest-2

TRANSCRIBED: Text=Good morning, Katie. I hope you're having a great start to your day. Speaker ID=Guest-2

TRANSCRIBING: Text=have you tried Speaker ID=Unknown
TRANSCRIBING: Text=have you tried the latest Speaker ID=Unknown
TRANSCRIBING: Text=have you tried the latest real Speaker ID=Guest-1
TRANSCRIBING: Text=have you tried the latest real time Speaker ID=Guest-1
TRANSCRIBING: Text=have you tried the latest real time diarization Speaker ID=Guest-1
TRANSCRIBING: Text=have you tried the latest real time diarization in Speaker ID=Guest-1
TRANSCRIBING: Text=have you tried the latest real time diarization in microsoft Speaker ID=Guest-1
TRANSCRIBING: Text=have you tried the latest real time diarization in microsoft speech Speaker ID=Guest-1
TRANSCRIBING: Text=have you tried the latest real time diarization in microsoft speech service Speaker ID=Guest-1
TRANSCRIBING: Text=have you tried the latest real time diarization in microsoft speech service which Speaker ID=Guest-1
TRANSCRIBING: Text=have you tried the latest real time diarization in microsoft speech service which can Speaker ID=Guest-1
TRANSCRIBING: Text=have you tried the latest real time diarization in microsoft speech service which can tell you Speaker ID=Guest-1
TRANSCRIBING: Text=have you tried the latest real time diarization in microsoft speech service which can tell you who said Speaker ID=Guest-1
TRANSCRIBING: Text=have you tried the latest real time diarization in microsoft speech service which can tell you who said what Speaker ID=Guest-1
TRANSCRIBING: Text=have you tried the latest real time diarization in microsoft speech service which can tell you who said what in Speaker ID=Guest-1
TRANSCRIBING: Text=have you tried the latest real time diarization in microsoft speech service which can tell you who said what in real time Speaker ID=Guest-1

TRANSCRIBED: Text=Have you tried the latest real time diarization in Microsoft Speech Service which can tell you who said what in real time? Speaker ID=Guest-1

TRANSCRIBING: Text=not yet Speaker ID=Unknown
TRANSCRIBING: Text=not yet i Speaker ID=Guest-2
TRANSCRIBING: Text=not yet i've been using Speaker ID=Guest-2
TRANSCRIBING: Text=not yet i've been using the Speaker ID=Guest-2
TRANSCRIBING: Text=not yet i've been using the batch Speaker ID=Guest-2
TRANSCRIBING: Text=not yet i've been using the batch trans Speaker ID=Guest-2
TRANSCRIBING: Text=not yet i've been using the batch transcription with Speaker ID=Guest-2
TRANSCRIBING: Text=not yet i've been using the batch transcription with diarization Speaker ID=Guest-2
TRANSCRIBING: Text=not yet i've been using the batch transcription with diarization function Speaker ID=Guest-2
TRANSCRIBING: Text=not yet i've been using the batch transcription with diarization functionality Speaker ID=Guest-2
TRANSCRIBING: Text=not yet i've been using the batch transcription with diarization functionality but Speaker ID=Guest-2
TRANSCRIBING: Text=not yet i've been using the batch transcription with diarization functionality but it Speaker ID=Guest-2
TRANSCRIBING: Text=not yet i've been using the batch transcription with diarization functionality but it produces Speaker ID=Guest-2
TRANSCRIBING: Text=not yet i've been using the batch transcription with diarization functionality but it produces di Speaker ID=Guest-2
TRANSCRIBING: Text=not yet i've been using the batch transcription with diarization functionality but it produces diarization Speaker ID=Guest-2
TRANSCRIBING: Text=not yet i've been using the batch transcription with diarization functionality but it produces diarization results Speaker ID=Guest-2
TRANSCRIBING: Text=not yet i've been using the batch transcription with diarization functionality but it produces diarization results after Speaker ID=Guest-2
TRANSCRIBING: Text=not yet i've been using the batch transcription with diarization functionality but it produces diarization results after the Speaker ID=Guest-2
TRANSCRIBING: Text=not yet i've been using the batch transcription with diarization functionality but it produces diarization results after the whole Speaker ID=Guest-2
TRANSCRIBING: Text=not yet i've been using the batch transcription with diarization functionality but it produces diarization results after the whole audio Speaker ID=Guest-2
TRANSCRIBING: Text=not yet i've been using the batch transcription with diarization functionality but it produces diarization results after the whole audio is Speaker ID=Guest-2
TRANSCRIBING: Text=not yet i've been using the batch transcription with diarization functionality but it produces diarization results after the whole audio is processed Speaker ID=Guest-2
TRANSCRIBING: Text=not yet i've been using the batch transcription with diarization functionality but it produces diarization results after the whole audio is processed is the Speaker ID=Guest-2
TRANSCRIBING: Text=not yet i've been using the batch transcription with diarization functionality but it produces diarization results after the whole audio is processed is the new Speaker ID=Guest-2
TRANSCRIBING: Text=not yet i've been using the batch transcription with diarization functionality but it produces diarization results after the whole audio is processed is the new feature Speaker ID=Guest-2
TRANSCRIBING: Text=not yet i've been using the batch transcription with diarization functionality but it produces diarization results after the whole audio is processed is the new feature able to Speaker ID=Guest-2
TRANSCRIBING: Text=not yet i've been using the batch transcription with diarization functionality but it produces diarization results after the whole audio is processed is the new feature able to di Speaker ID=Guest-2
TRANSCRIBING: Text=not yet i've been using the batch transcription with diarization functionality but it produces diarization results after the whole audio is processed is the new feature able to diarize in real Speaker ID=Guest-2
TRANSCRIBING: Text=not yet i've been using the batch transcription with diarization functionality but it produces diarization results after the whole audio is processed is the new feature able to diarize in real time Speaker ID=Guest-2

TRANSCRIBED: Text=Not yet. I've been using the batch transcription with diarization functionality, but it produces diarization results after the whole audio is processed. Is the new feature able to diarize in real time? Speaker ID=Guest-2

TRANSCRIBING: Text=absolutely Speaker ID=Unknown
TRANSCRIBING: Text=absolutely i recom Speaker ID=Guest-1
TRANSCRIBING: Text=absolutely i recommend Speaker ID=Guest-1
TRANSCRIBING: Text=absolutely i recommend you Speaker ID=Guest-1
TRANSCRIBING: Text=absolutely i recommend you give it a try Speaker ID=Guest-1

TRANSCRIBED: Text=Absolutely, I recommend you give it a try. Speaker ID=Guest-1

TRANSCRIBING: Text=that's exc Speaker ID=Unknown
TRANSCRIBING: Text=that's exciting Speaker ID=Unknown
TRANSCRIBING: Text=that's exciting let me try Speaker ID=Guest-2
TRANSCRIBING: Text=that's exciting let me try it right now Speaker ID=Guest-2

TRANSCRIBED: Text=That's exciting. Let me try it right now. Speaker ID=Guest-2

Les orateurs sont identifiés comme invités 1, invités 2, etc., en fonction du nombre d’orateurs dans la conversation.

Remarque

Il est possible que vous voyiez Speaker ID=Unknown dans certains des résultats intermédiaires anticipés quand l’intervenant n’est pas encore identifié. Sans les résultats de diarisation intermédiaires (si vous ne définissez pas la propriété PropertyId.SpeechServiceResponse_DiarizeIntermediateResults sur « true »), l’ID de l’intervenant est toujours « Inconnu ».

Nettoyer les ressources

Vous pouvez utiliser le portail Azure ou l’interface de ligne de commande (CLI) Azure pour supprimer la ressource Speech que vous avez créée.

Documentation de référence | Package (npm) | Exemples supplémentaires sur GitHub | Code source de la bibliothèque

Dans ce guide de démarrage rapide, vous exécutez une application de transcription vocale en texte avec diarisation en temps réel. La diarisation fait la distinction entre les différents intervenants qui participent à la conversation. Le service Speech fournit des informations sur l’orateur qui parlait une partie particulière de la parole transcrite.

Les informations sur l’orateur sont incluses dans le résultat dans le champ ID de l’orateur. L’ID de l’orateur est un identificateur générique attribué à chaque participant à la conversation par le service pendant la reconnaissance, car différents orateurs sont identifiés à partir du contenu audio fourni.

Conseil

Vous pouvez essayer la reconnaissance vocale en temps réel dans Speech Studio sans vous inscrire ni écrire de code. Toutefois, Speech Studio ne prend pas encore en charge la diarisation.

Prérequis

  • Un abonnement Azure. Vous pouvez en créer un gratuitement.
  • Créer une ressource Speech dans le portail Azure.
  • Obtenez la clé de ressource et la région Speech. Une fois votre ressource vocale déployée, sélectionnez Accéder à la ressource pour afficher et gérer les clés.

Configurer l’environnement

Pour configurer votre environnement, installez le SDK Speech pour JavaScript. Si vous voulez simplement le nom du package pour effectuer l’installation, exécutez npm install microsoft-cognitiveservices-speech-sdk. Pour obtenir des instructions d’installation, consultez le guide d’installation SDK.

Définir des variables d’environnement

Vous devez authentifier votre application pour accéder à Azure AI services. Cet article vous montre comment utiliser des variables d’environnement pour stocker vos informations d’identification. Vous pouvez ensuite accéder aux variables d’environnement à partir de votre code pour authentifier votre application. Pour la production, utilisez un moyen plus sécurisé pour stocker vos informations d’identification et y accéder.

Important

Nous vous recommandons l’authentification Microsoft Entra ID avec les identités managées pour les ressources Azure pour éviter de stocker des informations d’identification avec vos applications qui s’exécutent dans le cloud.

Si vous utilisez une clé API, stockez-la en toute sécurité dans un autre emplacement, par exemple dans Azure Key Vault. N'incluez pas la clé API directement dans votre code et ne la diffusez jamais publiquement.

Pour plus d’informations sur la sécurité des services IA, consultez Authentifier les demandes auprès d’Azure AI services.

Pour définir les variables d'environnement de votre clé de ressource Speech et de votre région, ouvrez une fenêtre de console et suivez les instructions de votre système d'exploitation et de votre environnement de développement.

  • Pour définir la variable d’environnement SPEECH_KEY, remplacez your-key par l’une des clés de votre ressource.
  • Pour définir la variable d’environnement SPEECH_REGION, remplacez your-region par l’une des régions de votre ressource.
setx SPEECH_KEY your-key
setx SPEECH_REGION your-region

Remarque

Si vous avez uniquement besoin d’accéder aux variables d’environnement dans la console en cours d’exécution, vous pouvez la définir avec set au lieu de setx.

Après avoir ajouté les variables d'environnement, vous devrez éventuellement redémarrer tous les programmes qui ont besoin de lire les variables d'environnement, y compris la fenêtre de console. Par exemple, si vous utilisez Visual Studio comme éditeur, redémarrez Visual Studio avant d’exécuter l’exemple.

Implémenter la diarisation à partir d’un fichier avec transcription de conversation

Suivez les étapes suivantes pour créer une nouvelle application console pour la transcription des conversations.

  1. Ouvrez une fenêtre d’invite de commandes à l’emplacement où vous souhaitez placer le nouveau projet, puis créez un fichier nommé ConversationTranscription.js.

  2. Installez le SDK Speech pour JavaScript :

    npm install microsoft-cognitiveservices-speech-sdk
    
  3. Copiez le code ci-après dans ConversationTranscription.js :

    const fs = require("fs");
    const sdk = require("microsoft-cognitiveservices-speech-sdk");
    
    // This example requires environment variables named "SPEECH_KEY" and "SPEECH_REGION"
    const speechConfig = sdk.SpeechConfig.fromSubscription(process.env.SPEECH_KEY, process.env.SPEECH_REGION);
    
    function fromFile() {
        const filename = "katiesteve.wav";
    
        let audioConfig = sdk.AudioConfig.fromWavFileInput(fs.readFileSync(filename));
        let conversationTranscriber = new sdk.ConversationTranscriber(speechConfig, audioConfig);
    
        var pushStream = sdk.AudioInputStream.createPushStream();
    
        fs.createReadStream(filename).on('data', function(arrayBuffer) {
            pushStream.write(arrayBuffer.slice());
        }).on('end', function() {
            pushStream.close();
        });
    
        console.log("Transcribing from: " + filename);
    
        conversationTranscriber.sessionStarted = function(s, e) {
            console.log("SessionStarted event");
            console.log("SessionId:" + e.sessionId);
        };
        conversationTranscriber.sessionStopped = function(s, e) {
            console.log("SessionStopped event");
            console.log("SessionId:" + e.sessionId);
            conversationTranscriber.stopTranscribingAsync();
        };
        conversationTranscriber.canceled = function(s, e) {
            console.log("Canceled event");
            console.log(e.errorDetails);
            conversationTranscriber.stopTranscribingAsync();
        };
        conversationTranscriber.transcribed = function(s, e) {
            console.log("TRANSCRIBED: Text=" + e.result.text + " Speaker ID=" + e.result.speakerId);
        };
    
        // Start conversation transcription
        conversationTranscriber.startTranscribingAsync(
            function () {},
            function (err) {
                console.trace("err - starting transcription: " + err);
            }
        );
    
    }
    fromFile();
    
  4. Obtenez l’exemple de fichier audio ou utilisez votre propre fichier .wav. Remplacez katiesteve.wav par le chemin d’accès et le nom de votre fichier .wav.

    L’application reconnaît la parole de plusieurs participants à la conversation. Votre fichier audio doit contenir plusieurs haut-parleurs.

  5. Pour modifier la langue de la reconnaissance vocale, remplacez en-US par une autre langue prise en charge. Par exemple, es-ES pour l’espagnol (Espagne). La langue par défaut est en-US si vous ne spécifiez pas de langue. Pour plus d’informations sur l’identification de l’une des langues qui peuvent être parlées, consultez Identification de la langue.

  6. Exécutez votre nouvelle application console pour démarrer la reconnaissance vocale à partir d’un fichier :

    node.exe ConversationTranscription.js
    

Important

N’oubliez pas de définir les variables d’environnement SPEECH_KEY et SPEECH_REGION. Si vous ne définissez pas ces variables, l’exemple échoue avec un message d’erreur.

La conversation transcrite doit être sortie sous forme de texte :

SessionStarted event
SessionId:E87AFBA483C2481985F6C9AF719F616B
TRANSCRIBED: Text=Good morning, Steve. Speaker ID=Unknown
TRANSCRIBED: Text=Good morning, Katie. Speaker ID=Unknown
TRANSCRIBED: Text=Have you tried the latest real time diarization in Microsoft Speech Service which can tell you who said what in real time? Speaker ID=Guest-1
TRANSCRIBED: Text=Not yet. I've been using the batch transcription with diarization functionality, but it produces diarization result until whole audio get processed. Speaker ID=Guest-2
TRANSCRIBED: Text=Is the new feature can diarize in real time? Speaker ID=Guest-2
TRANSCRIBED: Text=Absolutely. Speaker ID=Guest-1
TRANSCRIBED: Text=That's exciting. Let me try it right now. Speaker ID=Guest-2
Canceled event
undefined
SessionStopped event
SessionId:E87AFBA483C2481985F6C9AF719F616B

Les orateurs sont identifiés comme invités 1, invités 2, etc., en fonction du nombre d’orateurs dans la conversation.

Nettoyer les ressources

Vous pouvez utiliser le portail Azure ou l’interface de ligne de commande (CLI) Azure pour supprimer la ressource Speech que vous avez créée.

Documentation de référence | Package (téléchargement) | Exemples supplémentaires sur GitHub

Le kit de développement logiciel (SDK) Speech pour Objective-C prend en charge la transcription de conversation, mais nous n’avons pas encore inclus de guide ici. Sélectionnez un autre langage de programmation pour commencer et découvrir les concepts, ou consultez les informations de référence sur Objective-C et les exemples liés au début de cet article.

Documentation de référence | Package (téléchargement) | Exemples supplémentaires sur GitHub

Le kit de développement logiciel (SDK) Speech pour Swift prend en charge la transcription de conversation, mais nous n’avons pas encore inclus de guide ici. Sélectionnez un autre langage de programmation pour commencer et découvrir les concepts, ou consultez les informations de référence sur Swift et les exemples liés au début de cet article.

Documentation de référence | Package (PyPi) | Exemples supplémentaires sur GitHub

Dans ce guide de démarrage rapide, vous exécutez une application de transcription vocale en texte avec diarisation en temps réel. La diarisation fait la distinction entre les différents intervenants qui participent à la conversation. Le service Speech fournit des informations sur l’orateur qui parlait une partie particulière de la parole transcrite.

Les informations sur l’orateur sont incluses dans le résultat dans le champ ID de l’orateur. L’ID de l’orateur est un identificateur générique attribué à chaque participant à la conversation par le service pendant la reconnaissance, car différents orateurs sont identifiés à partir du contenu audio fourni.

Conseil

Vous pouvez essayer la reconnaissance vocale en temps réel dans Speech Studio sans vous inscrire ni écrire de code. Toutefois, Speech Studio ne prend pas encore en charge la diarisation.

Prérequis

  • Un abonnement Azure. Vous pouvez en créer un gratuitement.
  • Créer une ressource Speech dans le portail Azure.
  • Obtenez la clé de ressource et la région Speech. Une fois votre ressource vocale déployée, sélectionnez Accéder à la ressource pour afficher et gérer les clés.

Configurer l’environnement

Le kit SDK Speech pour Python est disponible sous forme de module Python Package Index (PyPI). Le Kit de développement logiciel (SDK) Speech pour Python est compatible avec Windows, Linux et macOS.

Installez Python 3.7 ou une version ultérieure. Vérifiez d’abord le guide d’installation SDK pour toute information complémentaire.

Définir des variables d’environnement

Vous devez authentifier votre application pour accéder à Azure AI services. Cet article vous montre comment utiliser des variables d’environnement pour stocker vos informations d’identification. Vous pouvez ensuite accéder aux variables d’environnement à partir de votre code pour authentifier votre application. Pour la production, utilisez un moyen plus sécurisé pour stocker vos informations d’identification et y accéder.

Important

Nous vous recommandons l’authentification Microsoft Entra ID avec les identités managées pour les ressources Azure pour éviter de stocker des informations d’identification avec vos applications qui s’exécutent dans le cloud.

Si vous utilisez une clé API, stockez-la en toute sécurité dans un autre emplacement, par exemple dans Azure Key Vault. N'incluez pas la clé API directement dans votre code et ne la diffusez jamais publiquement.

Pour plus d’informations sur la sécurité des services IA, consultez Authentifier les demandes auprès d’Azure AI services.

Pour définir les variables d'environnement de votre clé de ressource Speech et de votre région, ouvrez une fenêtre de console et suivez les instructions de votre système d'exploitation et de votre environnement de développement.

  • Pour définir la variable d’environnement SPEECH_KEY, remplacez your-key par l’une des clés de votre ressource.
  • Pour définir la variable d’environnement SPEECH_REGION, remplacez your-region par l’une des régions de votre ressource.
setx SPEECH_KEY your-key
setx SPEECH_REGION your-region

Remarque

Si vous avez uniquement besoin d’accéder aux variables d’environnement dans la console en cours d’exécution, vous pouvez la définir avec set au lieu de setx.

Après avoir ajouté les variables d'environnement, vous devrez éventuellement redémarrer tous les programmes qui ont besoin de lire les variables d'environnement, y compris la fenêtre de console. Par exemple, si vous utilisez Visual Studio comme éditeur, redémarrez Visual Studio avant d’exécuter l’exemple.

Implémenter la diarisation à partir d’un fichier avec transcription de conversation

Suivez ces étapes pour créer une nouvelle application console.

  1. Ouvrez une fenêtre d’invite de commandes à l’emplacement où vous souhaitez placer le nouveau projet, puis créez un fichier nommé conversation_transcription.py.

  2. Exécutez cette commande pour installer le SDK Speech :

    pip install azure-cognitiveservices-speech
    
  3. Copiez le code ci-après dans conversation_transcription.py :

    import os
    import time
    import azure.cognitiveservices.speech as speechsdk
    
    def conversation_transcriber_recognition_canceled_cb(evt: speechsdk.SessionEventArgs):
        print('Canceled event')
    
    def conversation_transcriber_session_stopped_cb(evt: speechsdk.SessionEventArgs):
        print('SessionStopped event')
    
    def conversation_transcriber_transcribed_cb(evt: speechsdk.SpeechRecognitionEventArgs):
        print('\nTRANSCRIBED:')
        if evt.result.reason == speechsdk.ResultReason.RecognizedSpeech:
            print('\tText={}'.format(evt.result.text))
            print('\tSpeaker ID={}\n'.format(evt.result.speaker_id))
        elif evt.result.reason == speechsdk.ResultReason.NoMatch:
            print('\tNOMATCH: Speech could not be TRANSCRIBED: {}'.format(evt.result.no_match_details))
    
    def conversation_transcriber_transcribing_cb(evt: speechsdk.SpeechRecognitionEventArgs):
        print('TRANSCRIBING:')
        print('\tText={}'.format(evt.result.text))
        print('\tSpeaker ID={}'.format(evt.result.speaker_id))
    
    def conversation_transcriber_session_started_cb(evt: speechsdk.SessionEventArgs):
        print('SessionStarted event')
    
    def recognize_from_file():
        # This example requires environment variables named "SPEECH_KEY" and "SPEECH_REGION"
        speech_config = speechsdk.SpeechConfig(subscription=os.environ.get('SPEECH_KEY'), region=os.environ.get('SPEECH_REGION'))
        speech_config.speech_recognition_language="en-US"
        speech_config.set_property(property_id=speechsdk.PropertyId.SpeechServiceResponse_DiarizeIntermediateResults, value='true')
    
        audio_config = speechsdk.audio.AudioConfig(filename="katiesteve.wav")
        conversation_transcriber = speechsdk.transcription.ConversationTranscriber(speech_config=speech_config, audio_config=audio_config)
    
        transcribing_stop = False
    
        def stop_cb(evt: speechsdk.SessionEventArgs):
            #"""callback that signals to stop continuous recognition upon receiving an event `evt`"""
            print('CLOSING on {}'.format(evt))
            nonlocal transcribing_stop
            transcribing_stop = True
    
        # Connect callbacks to the events fired by the conversation transcriber
        conversation_transcriber.transcribed.connect(conversation_transcriber_transcribed_cb)
        conversation_transcriber.transcribing.connect(conversation_transcriber_transcribing_cb)
        conversation_transcriber.session_started.connect(conversation_transcriber_session_started_cb)
        conversation_transcriber.session_stopped.connect(conversation_transcriber_session_stopped_cb)
        conversation_transcriber.canceled.connect(conversation_transcriber_recognition_canceled_cb)
        # stop transcribing on either session stopped or canceled events
        conversation_transcriber.session_stopped.connect(stop_cb)
        conversation_transcriber.canceled.connect(stop_cb)
    
        conversation_transcriber.start_transcribing_async()
    
        # Waits for completion.
        while not transcribing_stop:
            time.sleep(.5)
    
        conversation_transcriber.stop_transcribing_async()
    
    # Main
    
    try:
        recognize_from_file()
    except Exception as err:
        print("Encountered exception. {}".format(err))
    
  4. Obtenez l’exemple de fichier audio ou utilisez votre propre fichier .wav. Remplacez katiesteve.wav par le chemin d’accès et le nom de votre fichier .wav.

    L’application reconnaît la parole de plusieurs participants à la conversation. Votre fichier audio doit contenir plusieurs haut-parleurs.

  5. Pour modifier la langue de la reconnaissance vocale, remplacez en-US par une autre langue prise en charge. Par exemple, es-ES pour l’espagnol (Espagne). La langue par défaut est en-US si vous ne spécifiez pas de langue. Pour plus d’informations sur l’identification de l’une des langues qui peuvent être parlées, consultez Identification de la langue.

  6. Exécutez votre nouvelle application console pour démarrer la transcription de conversation :

    python conversation_transcription.py
    

Important

N’oubliez pas de définir les variables d’environnement SPEECH_KEY et SPEECH_REGION. Si vous ne définissez pas ces variables, l’exemple échoue avec un message d’erreur.

La conversation transcrite doit être sortie sous forme de texte :

TRANSCRIBING:
        Text=good morning
        Speaker ID=Unknown
TRANSCRIBING:
        Text=good morning steve
        Speaker ID=Unknown
TRANSCRIBING:
        Text=good morning steve how are
        Speaker ID=Guest-1
TRANSCRIBING:
        Text=good morning steve how are you doing today
        Speaker ID=Guest-1

TRANSCRIBED:
        Text=Good morning, Steve. How are you doing today?
        Speaker ID=Guest-1

TRANSCRIBING:
        Text=good morning katie
        Speaker ID=Unknown
TRANSCRIBING:
        Text=good morning katie i hope you're having a
        Speaker ID=Guest-2
TRANSCRIBING:
        Text=good morning katie i hope you're having a great start to
        Speaker ID=Guest-2
TRANSCRIBING:
        Text=good morning katie i hope you're having a great start to your day
        Speaker ID=Guest-2

TRANSCRIBED:
        Text=Good morning, Katie. I hope you're having a great start to your day.
        Speaker ID=Guest-2

TRANSCRIBING:
        Text=have you
        Speaker ID=Unknown
TRANSCRIBING:
        Text=have you tried
        Speaker ID=Unknown
TRANSCRIBING:
        Text=have you tried the latest
        Speaker ID=Unknown
TRANSCRIBING:
        Text=have you tried the latest real
        Speaker ID=Guest-1
TRANSCRIBING:
        Text=have you tried the latest real time
        Speaker ID=Guest-1
TRANSCRIBING:
        Text=have you tried the latest real time diarization
        Speaker ID=Guest-1
TRANSCRIBING:
        Text=have you tried the latest real time diarization in
        Speaker ID=Guest-1
TRANSCRIBING:
        Text=have you tried the latest real time diarization in microsoft
        Speaker ID=Guest-1
TRANSCRIBING:
        Text=have you tried the latest real time diarization in microsoft speech
        Speaker ID=Guest-1
TRANSCRIBING:
        Text=have you tried the latest real time diarization in microsoft speech service
        Speaker ID=Guest-1
TRANSCRIBING:
        Text=have you tried the latest real time diarization in microsoft speech service which
        Speaker ID=Guest-1
TRANSCRIBING:
        Text=have you tried the latest real time diarization in microsoft speech service which can
        Speaker ID=Guest-1
TRANSCRIBING:
        Text=have you tried the latest real time diarization in microsoft speech service which can tell you
        Speaker ID=Guest-1
TRANSCRIBING:
        Text=have you tried the latest real time diarization in microsoft speech service which can tell you who said        
        Speaker ID=Guest-1
TRANSCRIBING:
        Text=have you tried the latest real time diarization in microsoft speech service which can tell you who said what   
        Speaker ID=Guest-1
TRANSCRIBING:
        Text=have you tried the latest real time diarization in microsoft speech service which can tell you who said what in
        Speaker ID=Guest-1
TRANSCRIBING:
        Text=have you tried the latest real time diarization in microsoft speech service which can tell you who said what in real time
        Speaker ID=Guest-1

TRANSCRIBED:
        Text=Have you tried the latest real time diarization in Microsoft Speech Service which can tell you who said what in real time?
        Speaker ID=Guest-1

TRANSCRIBING:
        Text=not yet
        Speaker ID=Unknown
TRANSCRIBING:
        Text=not yet i
        Speaker ID=Guest-2
TRANSCRIBING:
        Text=not yet i've been using
        Speaker ID=Guest-2
TRANSCRIBING:
        Text=not yet i've been using the
        Speaker ID=Guest-2
TRANSCRIBING:
        Text=not yet i've been using the batch
        Speaker ID=Guest-2
TRANSCRIBING:
        Text=not yet i've been using the batch trans
        Speaker ID=Guest-2
TRANSCRIBING:
        Text=not yet i've been using the batch transcription with
        Speaker ID=Guest-2
TRANSCRIBING:
        Text=not yet i've been using the batch transcription with diarization
        Speaker ID=Guest-2
TRANSCRIBING:
        Text=not yet i've been using the batch transcription with diarization function
        Speaker ID=Guest-2
TRANSCRIBING:
        Text=not yet i've been using the batch transcription with diarization functionality
        Speaker ID=Guest-2
TRANSCRIBING:
        Text=not yet i've been using the batch transcription with diarization functionality but
        Speaker ID=Guest-2
TRANSCRIBING:
        Text=not yet i've been using the batch transcription with diarization functionality but it
        Speaker ID=Guest-2
TRANSCRIBING:
        Text=not yet i've been using the batch transcription with diarization functionality but it produces
        Speaker ID=Guest-2
TRANSCRIBING:
        Text=not yet i've been using the batch transcription with diarization functionality but it produces di
        Speaker ID=Guest-2
TRANSCRIBING:
        Text=not yet i've been using the batch transcription with diarization functionality but it produces diarization     
        Speaker ID=Guest-2
TRANSCRIBING:
        Text=not yet i've been using the batch transcription with diarization functionality but it produces diarization results
        Speaker ID=Guest-2
TRANSCRIBING:
        Text=not yet i've been using the batch transcription with diarization functionality but it produces diarization results after
        Speaker ID=Guest-2
TRANSCRIBING:
        Text=not yet i've been using the batch transcription with diarization functionality but it produces diarization results after the
        Speaker ID=Guest-2
TRANSCRIBING:
        Text=not yet i've been using the batch transcription with diarization functionality but it produces diarization results after the whole
        Speaker ID=Guest-2
TRANSCRIBING:
        Text=not yet i've been using the batch transcription with diarization functionality but it produces diarization results after the whole audio
        Speaker ID=Guest-2
TRANSCRIBING:
        Text=not yet i've been using the batch transcription with diarization functionality but it produces diarization results after the whole audio is
        Speaker ID=Guest-2
TRANSCRIBING:
        Text=not yet i've been using the batch transcription with diarization functionality but it produces diarization results after the whole audio is processed
        Speaker ID=Guest-2
TRANSCRIBING:
        Text=not yet i've been using the batch transcription with diarization functionality but it produces diarization results after the whole audio is processed is the
        Speaker ID=Guest-2
TRANSCRIBING:
        Text=not yet i've been using the batch transcription with diarization functionality but it produces diarization results after the whole audio is processed is the new
        Speaker ID=Guest-2
TRANSCRIBING:
        Text=not yet i've been using the batch transcription with diarization functionality but it produces diarization results after the whole audio is processed is the new feature
        Speaker ID=Guest-2
TRANSCRIBING:
        Text=not yet i've been using the batch transcription with diarization functionality but it produces diarization results after the whole audio is processed is the new feature able to
        Speaker ID=Guest-2
TRANSCRIBING:
        Text=not yet i've been using the batch transcription with diarization functionality but it produces diarization results after the whole audio is processed is the new feature able to di
        Speaker ID=Guest-2
TRANSCRIBING:
        Text=not yet i've been using the batch transcription with diarization functionality but it produces diarization results after the whole audio is processed is the new feature able to diarize in real
        Speaker ID=Guest-2
TRANSCRIBING:
        Text=not yet i've been using the batch transcription with diarization functionality but it produces diarization results after the whole audio is processed is the new feature able to diarize in real time
        Speaker ID=Guest-2

TRANSCRIBED:
        Text=Not yet. I've been using the batch transcription with diarization functionality, but it produces diarization results after the whole audio is processed. Is the new feature able to diarize in real time?
        Speaker ID=Guest-2

TRANSCRIBING:
        Text=absolutely
        Speaker ID=Unknown
TRANSCRIBING:
        Text=absolutely i
        Speaker ID=Unknown
TRANSCRIBING:
        Text=absolutely i recom
        Speaker ID=Guest-1
TRANSCRIBING:
        Text=absolutely i recommend
        Speaker ID=Guest-1
TRANSCRIBING:
        Text=absolutely i recommend you give it a try
        Speaker ID=Guest-1

TRANSCRIBED:
        Text=Absolutely, I recommend you give it a try.
        Speaker ID=Guest-1

TRANSCRIBING:
        Text=that's exc
        Speaker ID=Unknown
TRANSCRIBING:
        Text=that's exciting
        Speaker ID=Unknown
TRANSCRIBING:
        Text=that's exciting let me
        Speaker ID=Guest-2
TRANSCRIBING:
        Text=that's exciting let me try
        Speaker ID=Guest-2
TRANSCRIBING:
        Text=that's exciting let me try it right now
        Speaker ID=Guest-2

TRANSCRIBED:
        Text=That's exciting. Let me try it right now.
        Speaker ID=Guest-2

Les orateurs sont identifiés comme invités 1, invités 2, etc., en fonction du nombre d’orateurs dans la conversation.

Remarque

Il est possible que vous voyiez Speaker ID=Unknown dans certains des résultats intermédiaires anticipés quand l’intervenant n’est pas encore identifié. Sans les résultats de diarisation intermédiaires (si vous ne définissez pas la propriété PropertyId.SpeechServiceResponse_DiarizeIntermediateResults sur « true »), l’ID de l’intervenant est toujours « Inconnu ».

Nettoyer les ressources

Vous pouvez utiliser le portail Azure ou l’interface de ligne de commande (CLI) Azure pour supprimer la ressource Speech que vous avez créée.

Informations de référence sur l’API REST de reconnaissance vocale | Informations de référence sur l’API REST de reconnaissance vocale pour l’audio court | Exemples supplémentaires sur GitHub

L’API REST ne prend pas en charge la transcription de conversation. Sélectionnez un autre langage de programmation ou outil en haut de cette page.

L’interface CLI Speech ne prend pas en charge la transcription de conversation. Sélectionnez un autre langage de programmation ou outil en haut de cette page.

Étape suivante