Bagikan melalui


Mulai cepat: Membuat diarisasi real-time

Paket dokumentasi | referensi (NuGet) | Sampel tambahan di GitHub

Dalam mulai cepat ini, Anda menjalankan aplikasi untuk transkripsi ucapan ke teks dengan diarisasi real time. Diarisasi membedakan antara berbagai pembicara yang berpartisipasi dalam percakapan. Layanan Ucapan menyediakan informasi tentang pembicara mana yang berbicara bagian tertentu dari ucapan yang ditranskripsikan.

Informasi pembicara disertakan dalam hasil di bidang ID pembicara. ID pembicara adalah pengidentifikasi generik yang ditetapkan untuk setiap peserta percakapan oleh layanan selama pengenalan karena pembicara yang berbeda sedang diidentifikasi dari konten audio yang disediakan.

Tip

Anda dapat mencoba ucapan real time ke teks di Speech Studio tanpa mendaftar atau menulis kode apa pun. Namun, Speech Studio belum mendukung diarisasi.

Prasyarat

  • Langganan Azure. Anda dapat membuatnya secara gratis.
  • Buat sumber daya Ucapan di portal Azure.
  • Dapatkan kunci dan wilayah sumber daya Ucapan. Setelah sumber daya Azure Cognitive Service untuk Ucapan Anda disebarkan, pilih Buka sumber daya untuk melihat dan mengelola kunci.

Menyiapkan lingkungan

Speech SDK tersedia sebagai paket NuGet dan menerapkan .NET Standar 2.0. Anda menginstal Speech SDK nanti dalam panduan ini, tetapi pertama-tama periksa panduan penginstalan SDK untuk persyaratan lainnya.

Atur variabel lingkungan

Anda perlu mengautentikasi aplikasi Anda untuk mengakses layanan Azure AI. Artikel ini memperlihatkan kepada Anda cara menggunakan variabel lingkungan untuk menyimpan kredensial Anda. Anda kemudian dapat mengakses variabel lingkungan dari kode Anda untuk mengautentikasi aplikasi Anda. Untuk produksi, gunakan cara yang lebih aman untuk menyimpan dan mengakses kredensial Anda.

Penting

Kami merekomendasikan autentikasi ID Microsoft Entra dengan identitas terkelola untuk sumber daya Azure untuk menghindari penyimpanan kredensial dengan aplikasi Anda yang berjalan di cloud.

Jika Anda menggunakan kunci API, simpan dengan aman di tempat lain, seperti di Azure Key Vault. Jangan sertakan kunci API langsung dalam kode Anda, dan jangan pernah mempostingnya secara publik.

Untuk informasi selengkapnya tentang keamanan layanan AI, lihat Mengautentikasi permintaan ke layanan Azure AI.

Untuk mengatur variabel lingkungan untuk kunci dan wilayah sumber daya Ucapan Anda, buka jendela konsol, dan ikuti instruksi untuk sistem operasi dan lingkungan pengembangan Anda.

  • Untuk mengatur SPEECH_KEY variabel lingkungan, ganti kunci Anda dengan salah satu kunci untuk sumber daya Anda.
  • Untuk mengatur SPEECH_REGION variabel lingkungan, ganti wilayah Anda dengan salah satu wilayah untuk sumber daya Anda.
setx SPEECH_KEY your-key
setx SPEECH_REGION your-region

Catatan

Jika Anda hanya perlu mengakses variabel lingkungan di konsol saat ini, Anda dapat mengatur variabel lingkungan dengan set alih-alih setx.

Setelah menambahkan variabel lingkungan, Anda mungkin perlu memulai ulang program apa pun yang perlu membaca variabel lingkungan, termasuk jendela konsol. Misalnya, jika Anda menggunakan Visual Studio sebagai editor, mulai ulang Visual Studio sebelum Menjalankan contoh.

Menerapkan diarisasi dari file dengan transkripsi percakapan

Ikuti langkah-langkah ini untuk membuat aplikasi konsol dan menginstal Speech SDK.

  1. Buka jendela prompt perintah di folder tempat Anda menginginkan proyek baru. Jalankan perintah ini untuk membuat aplikasi konsol dengan .NET CLI.

    dotnet new console
    

    Perintah ini membuat file Program.cs di direktori proyek Anda.

  2. Pasang Speech SDK di proyek baru Anda dengan .NET CLI.

    dotnet add package Microsoft.CognitiveServices.Speech
    
  3. Ganti isi Program.cs dengan kode berikut.

    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. Dapatkan file audio sampel atau gunakan file Anda sendiri.wav. Ganti katiesteve.wav dengan jalur dan nama file Anda .wav .

    Aplikasi mengenali ucapan dari beberapa peserta dalam percakapan. File audio Anda harus berisi beberapa speaker.

  5. Untuk mengubah bahasa pengenalan ucapan, ganti en-US dengan bahasa lain yang didukung. Misalnya, es-ES untuk Spanyol (Spanyol). Bahasa default adalah en-US jika Anda tidak menentukan bahasa. Untuk detail tentang cara mengidentifikasi salah satu dari beberapa bahasa yang mungkin diucapkan, lihat identifikasi bahasa.

  6. Jalankan aplikasi konsol Anda untuk memulai transkripsi percakapan:

    dotnet run
    

Penting

Pastikan Anda mengatur SPEECH_KEY variabel lingkungan dan SPEECH_REGION . Jika Anda tidak mengatur variabel ini, sampel gagal dengan pesan kesalahan.

Percakapan yang ditranskripsikan harus dihasilkan sebagai teks:

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

Pembicara diidentifikasi sebagai Tamu-1, Tamu-2, dan sebagainya, tergantung pada jumlah pembicara dalam percakapan.

Catatan

Anda mungkin melihat Speaker ID=Unknown di beberapa hasil perantara awal saat pembicara belum diidentifikasi. Tanpa hasil diarisasi menengah (jika Anda tidak mengatur PropertyId.SpeechServiceResponse_DiarizeIntermediateResults properti ke "true"), ID pembicara selalu "Tidak Diketahui".

Membersihkan sumber daya

Anda dapat menggunakan portal Azure atau Azure Command Line Interface (CLI) untuk menghapus sumber daya Ucapan yang Anda buat.

Paket dokumentasi | referensi (NuGet) | Sampel tambahan di GitHub

Dalam mulai cepat ini, Anda menjalankan aplikasi untuk transkripsi ucapan ke teks dengan diarisasi real time. Diarisasi membedakan antara berbagai pembicara yang berpartisipasi dalam percakapan. Layanan Ucapan menyediakan informasi tentang pembicara mana yang berbicara bagian tertentu dari ucapan yang ditranskripsikan.

Informasi pembicara disertakan dalam hasil di bidang ID pembicara. ID pembicara adalah pengidentifikasi generik yang ditetapkan untuk setiap peserta percakapan oleh layanan selama pengenalan karena pembicara yang berbeda sedang diidentifikasi dari konten audio yang disediakan.

Tip

Anda dapat mencoba ucapan real time ke teks di Speech Studio tanpa mendaftar atau menulis kode apa pun. Namun, Speech Studio belum mendukung diarisasi.

Prasyarat

  • Langganan Azure. Anda dapat membuatnya secara gratis.
  • Buat sumber daya Ucapan di portal Azure.
  • Dapatkan kunci dan wilayah sumber daya Ucapan. Setelah sumber daya Azure Cognitive Service untuk Ucapan Anda disebarkan, pilih Buka sumber daya untuk melihat dan mengelola kunci.

Menyiapkan lingkungan

Speech SDK tersedia sebagai paket NuGet dan menerapkan .NET Standar 2.0. Anda menginstal Speech SDK nanti dalam panduan ini, tetapi pertama-tama periksa panduan penginstalan SDK untuk persyaratan lainnya.

Atur variabel lingkungan

Anda perlu mengautentikasi aplikasi Anda untuk mengakses layanan Azure AI. Artikel ini memperlihatkan kepada Anda cara menggunakan variabel lingkungan untuk menyimpan kredensial Anda. Anda kemudian dapat mengakses variabel lingkungan dari kode Anda untuk mengautentikasi aplikasi Anda. Untuk produksi, gunakan cara yang lebih aman untuk menyimpan dan mengakses kredensial Anda.

Penting

Kami merekomendasikan autentikasi ID Microsoft Entra dengan identitas terkelola untuk sumber daya Azure untuk menghindari penyimpanan kredensial dengan aplikasi Anda yang berjalan di cloud.

Jika Anda menggunakan kunci API, simpan dengan aman di tempat lain, seperti di Azure Key Vault. Jangan sertakan kunci API langsung dalam kode Anda, dan jangan pernah mempostingnya secara publik.

Untuk informasi selengkapnya tentang keamanan layanan AI, lihat Mengautentikasi permintaan ke layanan Azure AI.

Untuk mengatur variabel lingkungan untuk kunci dan wilayah sumber daya Ucapan Anda, buka jendela konsol, dan ikuti instruksi untuk sistem operasi dan lingkungan pengembangan Anda.

  • Untuk mengatur SPEECH_KEY variabel lingkungan, ganti kunci Anda dengan salah satu kunci untuk sumber daya Anda.
  • Untuk mengatur SPEECH_REGION variabel lingkungan, ganti wilayah Anda dengan salah satu wilayah untuk sumber daya Anda.
setx SPEECH_KEY your-key
setx SPEECH_REGION your-region

Catatan

Jika Anda hanya perlu mengakses variabel lingkungan di konsol saat ini, Anda dapat mengatur variabel lingkungan dengan set alih-alih setx.

Setelah menambahkan variabel lingkungan, Anda mungkin perlu memulai ulang program apa pun yang perlu membaca variabel lingkungan, termasuk jendela konsol. Misalnya, jika Anda menggunakan Visual Studio sebagai editor, mulai ulang Visual Studio sebelum Menjalankan contoh.

Menerapkan diarisasi dari file dengan transkripsi percakapan

Ikuti langkah-langkah ini untuk membuat aplikasi konsol dan menginstal Speech SDK.

  1. Buat proyek konsol C++ baru di Visual Studio Community 2022 bernama ConversationTranscription.

  2. Pilih Alat>Konsol Manajer Paket Manajer>Paket Nuget. Di Konsol Manajer Paket, jalankan perintah ini:

    Install-Package Microsoft.CognitiveServices.Speech
    
  3. Ganti isi ConversationTranscription.cpp dengan kode berikut.

    #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. Dapatkan file audio sampel atau gunakan file Anda sendiri.wav. Ganti katiesteve.wav dengan jalur dan nama file Anda .wav .

    Aplikasi mengenali ucapan dari beberapa peserta dalam percakapan. File audio Anda harus berisi beberapa speaker.

  5. Untuk mengubah bahasa pengenalan ucapan, ganti en-US dengan bahasa lain yang didukung. Misalnya, es-ES untuk Spanyol (Spanyol). Bahasa default adalah en-US jika Anda tidak menentukan bahasa. Untuk detail tentang cara mengidentifikasi salah satu dari beberapa bahasa yang mungkin diucapkan, lihat identifikasi bahasa.

  6. Bangun dan jalankan aplikasi Anda untuk memulai transkripsi percakapan:

    Penting

    Pastikan Anda mengatur SPEECH_KEY variabel lingkungan dan SPEECH_REGION . Jika Anda tidak mengatur variabel ini, sampel gagal dengan pesan kesalahan.

Percakapan yang ditranskripsikan harus dihasilkan sebagai teks:

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

Pembicara diidentifikasi sebagai Tamu-1, Tamu-2, dan sebagainya, tergantung pada jumlah pembicara dalam percakapan.

Catatan

Anda mungkin melihat Speaker ID=Unknown di beberapa hasil perantara awal saat pembicara belum diidentifikasi. Tanpa hasil diarisasi menengah (jika Anda tidak mengatur PropertyId::SpeechServiceResponse_DiarizeIntermediateResults properti ke "true"), ID pembicara selalu "Tidak Diketahui".

Membersihkan sumber daya

Anda dapat menggunakan portal Azure atau Azure Command Line Interface (CLI) untuk menghapus sumber daya Ucapan yang Anda buat.

Dokumentasi | referensi Paket (Go) | Sampel tambahan di GitHub

Speech SDK untuk bahasa pemrograman Go tidak mendukung transkripsi percakapan. Pilih bahasa pemrograman lain atau referensi Go dan sampel yang ditautkan dari awal artikel ini.

Dokumentasi | referensi Sampel tambahan di GitHub

Dalam mulai cepat ini, Anda menjalankan aplikasi untuk transkripsi ucapan ke teks dengan diarisasi real time. Diarisasi membedakan antara berbagai pembicara yang berpartisipasi dalam percakapan. Layanan Ucapan menyediakan informasi tentang pembicara mana yang berbicara bagian tertentu dari ucapan yang ditranskripsikan.

Informasi pembicara disertakan dalam hasil di bidang ID pembicara. ID pembicara adalah pengidentifikasi generik yang ditetapkan untuk setiap peserta percakapan oleh layanan selama pengenalan karena pembicara yang berbeda sedang diidentifikasi dari konten audio yang disediakan.

Tip

Anda dapat mencoba ucapan real time ke teks di Speech Studio tanpa mendaftar atau menulis kode apa pun. Namun, Speech Studio belum mendukung diarisasi.

Prasyarat

  • Langganan Azure. Anda dapat membuatnya secara gratis.
  • Buat sumber daya Ucapan di portal Azure.
  • Dapatkan kunci dan wilayah sumber daya Ucapan. Setelah sumber daya Azure Cognitive Service untuk Ucapan Anda disebarkan, pilih Buka sumber daya untuk melihat dan mengelola kunci.

Menyiapkan lingkungan

Untuk menyiapkan lingkungan Anda, instal Speech SDK. Contoh dalam mulai cepat ini berfungsi dengan Runtime Java.

  1. Menginstal Apache Maven. Kemudian jalankan mvn -v untuk mengonfirmasi keberhasilan penginstalan.

  2. Buat file pom.xml baru di root proyek Anda, dan salin berikut ini ke dalamnya:

    <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. Instal SDK Ucapan dan dependensi.

    mvn clean dependency:copy-dependencies
    

Atur variabel lingkungan

Anda perlu mengautentikasi aplikasi Anda untuk mengakses layanan Azure AI. Artikel ini memperlihatkan kepada Anda cara menggunakan variabel lingkungan untuk menyimpan kredensial Anda. Anda kemudian dapat mengakses variabel lingkungan dari kode Anda untuk mengautentikasi aplikasi Anda. Untuk produksi, gunakan cara yang lebih aman untuk menyimpan dan mengakses kredensial Anda.

Penting

Kami merekomendasikan autentikasi ID Microsoft Entra dengan identitas terkelola untuk sumber daya Azure untuk menghindari penyimpanan kredensial dengan aplikasi Anda yang berjalan di cloud.

Jika Anda menggunakan kunci API, simpan dengan aman di tempat lain, seperti di Azure Key Vault. Jangan sertakan kunci API langsung dalam kode Anda, dan jangan pernah mempostingnya secara publik.

Untuk informasi selengkapnya tentang keamanan layanan AI, lihat Mengautentikasi permintaan ke layanan Azure AI.

Untuk mengatur variabel lingkungan untuk kunci dan wilayah sumber daya Ucapan Anda, buka jendela konsol, dan ikuti instruksi untuk sistem operasi dan lingkungan pengembangan Anda.

  • Untuk mengatur SPEECH_KEY variabel lingkungan, ganti kunci Anda dengan salah satu kunci untuk sumber daya Anda.
  • Untuk mengatur SPEECH_REGION variabel lingkungan, ganti wilayah Anda dengan salah satu wilayah untuk sumber daya Anda.
setx SPEECH_KEY your-key
setx SPEECH_REGION your-region

Catatan

Jika Anda hanya perlu mengakses variabel lingkungan di konsol saat ini, Anda dapat mengatur variabel lingkungan dengan set alih-alih setx.

Setelah menambahkan variabel lingkungan, Anda mungkin perlu memulai ulang program apa pun yang perlu membaca variabel lingkungan, termasuk jendela konsol. Misalnya, jika Anda menggunakan Visual Studio sebagai editor, mulai ulang Visual Studio sebelum Menjalankan contoh.

Menerapkan diarisasi dari file dengan transkripsi percakapan

Ikuti langkah-langkah ini untuk membuat aplikasi konsol untuk transkripsi percakapan.

  1. Buat file baru bernama ConversationTranscription.java dalam direktori akar proyek yang sama.

  2. Salin kode berikut ke dalam 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. Dapatkan file audio sampel atau gunakan file Anda sendiri.wav. Ganti katiesteve.wav dengan jalur dan nama file Anda .wav .

    Aplikasi mengenali ucapan dari beberapa peserta dalam percakapan. File audio Anda harus berisi beberapa speaker.

  4. Untuk mengubah bahasa pengenalan ucapan, ganti en-US dengan bahasa lain yang didukung. Misalnya, es-ES untuk Spanyol (Spanyol). Bahasa default adalah en-US jika Anda tidak menentukan bahasa. Untuk detail tentang cara mengidentifikasi salah satu dari beberapa bahasa yang mungkin diucapkan, lihat identifikasi bahasa.

  5. Jalankan aplikasi konsol baru Anda untuk memulai transkripsi percakapan:

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

Penting

Pastikan Anda mengatur SPEECH_KEY variabel lingkungan dan SPEECH_REGION . Jika Anda tidak mengatur variabel ini, sampel gagal dengan pesan kesalahan.

Percakapan yang ditranskripsikan harus dihasilkan sebagai teks:

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

Pembicara diidentifikasi sebagai Tamu-1, Tamu-2, dan sebagainya, tergantung pada jumlah pembicara dalam percakapan.

Catatan

Anda mungkin melihat Speaker ID=Unknown di beberapa hasil perantara awal saat pembicara belum diidentifikasi. Tanpa hasil diarisasi menengah (jika Anda tidak mengatur PropertyId.SpeechServiceResponse_DiarizeIntermediateResults properti ke "true"), ID pembicara selalu "Tidak Diketahui".

Membersihkan sumber daya

Anda dapat menggunakan portal Azure atau Azure Command Line Interface (CLI) untuk menghapus sumber daya Ucapan yang Anda buat.

Paket dokumentasi | referensi (npm) | Sampel tambahan pada kode sumber Pustaka GitHub |

Dalam mulai cepat ini, Anda menjalankan aplikasi untuk transkripsi ucapan ke teks dengan diarisasi real time. Diarisasi membedakan antara berbagai pembicara yang berpartisipasi dalam percakapan. Layanan Ucapan menyediakan informasi tentang pembicara mana yang berbicara bagian tertentu dari ucapan yang ditranskripsikan.

Informasi pembicara disertakan dalam hasil di bidang ID pembicara. ID pembicara adalah pengidentifikasi generik yang ditetapkan untuk setiap peserta percakapan oleh layanan selama pengenalan karena pembicara yang berbeda sedang diidentifikasi dari konten audio yang disediakan.

Tip

Anda dapat mencoba ucapan real time ke teks di Speech Studio tanpa mendaftar atau menulis kode apa pun. Namun, Speech Studio belum mendukung diarisasi.

Prasyarat

  • Langganan Azure. Anda dapat membuatnya secara gratis.
  • Buat sumber daya Ucapan di portal Azure.
  • Dapatkan kunci dan wilayah sumber daya Ucapan. Setelah sumber daya Azure Cognitive Service untuk Ucapan Anda disebarkan, pilih Buka sumber daya untuk melihat dan mengelola kunci.

Menyiapkan lingkungan

Untuk menyiapkan lingkungan Anda, instal Speech SDK untuk JavaScript. Jika Anda hanya ingin menginstal nama paket, jalankan npm install microsoft-cognitiveservices-speech-sdk. Untuk petunjuk penginstalan terpandu, lihat panduan penginstalan SDK.

Atur variabel lingkungan

Anda perlu mengautentikasi aplikasi Anda untuk mengakses layanan Azure AI. Artikel ini memperlihatkan kepada Anda cara menggunakan variabel lingkungan untuk menyimpan kredensial Anda. Anda kemudian dapat mengakses variabel lingkungan dari kode Anda untuk mengautentikasi aplikasi Anda. Untuk produksi, gunakan cara yang lebih aman untuk menyimpan dan mengakses kredensial Anda.

Penting

Kami merekomendasikan autentikasi ID Microsoft Entra dengan identitas terkelola untuk sumber daya Azure untuk menghindari penyimpanan kredensial dengan aplikasi Anda yang berjalan di cloud.

Jika Anda menggunakan kunci API, simpan dengan aman di tempat lain, seperti di Azure Key Vault. Jangan sertakan kunci API langsung dalam kode Anda, dan jangan pernah mempostingnya secara publik.

Untuk informasi selengkapnya tentang keamanan layanan AI, lihat Mengautentikasi permintaan ke layanan Azure AI.

Untuk mengatur variabel lingkungan untuk kunci dan wilayah sumber daya Ucapan Anda, buka jendela konsol, dan ikuti instruksi untuk sistem operasi dan lingkungan pengembangan Anda.

  • Untuk mengatur SPEECH_KEY variabel lingkungan, ganti kunci Anda dengan salah satu kunci untuk sumber daya Anda.
  • Untuk mengatur SPEECH_REGION variabel lingkungan, ganti wilayah Anda dengan salah satu wilayah untuk sumber daya Anda.
setx SPEECH_KEY your-key
setx SPEECH_REGION your-region

Catatan

Jika Anda hanya perlu mengakses variabel lingkungan di konsol saat ini, Anda dapat mengatur variabel lingkungan dengan set alih-alih setx.

Setelah menambahkan variabel lingkungan, Anda mungkin perlu memulai ulang program apa pun yang perlu membaca variabel lingkungan, termasuk jendela konsol. Misalnya, jika Anda menggunakan Visual Studio sebagai editor, mulai ulang Visual Studio sebelum Menjalankan contoh.

Menerapkan diarisasi dari file dengan transkripsi percakapan

Ikuti langkah-langkah ini untuk membuat aplikasi konsol baru untuk transkripsi percakapan.

  1. Buka jendela prompt perintah tempat Anda menginginkan proyek baru, dan buat file baru bernama ConversationTranscription.js.

  2. Instal SDK Ucapan untuk JavaScript:

    npm install microsoft-cognitiveservices-speech-sdk
    
  3. Salin kode berikut ke dalam 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. Dapatkan file audio sampel atau gunakan file Anda sendiri.wav. Ganti katiesteve.wav dengan jalur dan nama file Anda .wav .

    Aplikasi mengenali ucapan dari beberapa peserta dalam percakapan. File audio Anda harus berisi beberapa speaker.

  5. Untuk mengubah bahasa pengenalan ucapan, ganti en-US dengan bahasa lain yang didukung. Misalnya, es-ES untuk Spanyol (Spanyol). Bahasa default adalah en-US jika Anda tidak menentukan bahasa. Untuk detail tentang cara mengidentifikasi salah satu dari beberapa bahasa yang mungkin diucapkan, lihat identifikasi bahasa.

  6. Jalankan aplikasi konsol baru Anda untuk memulai pengenalan ucapan dari file:

    node.exe ConversationTranscription.js
    

Penting

Pastikan Anda mengatur SPEECH_KEY variabel lingkungan dan SPEECH_REGION . Jika Anda tidak mengatur variabel ini, sampel gagal dengan pesan kesalahan.

Percakapan yang ditranskripsikan harus dihasilkan sebagai teks:

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

Pembicara diidentifikasi sebagai Tamu-1, Tamu-2, dan sebagainya, tergantung pada jumlah pembicara dalam percakapan.

Membersihkan sumber daya

Anda dapat menggunakan portal Azure atau Azure Command Line Interface (CLI) untuk menghapus sumber daya Ucapan yang Anda buat.

Paket dokumentasi | referensi (unduh) | Sampel tambahan di GitHub

Speech SDK for Objective-C memang mendukung transkripsi percakapan, tetapi kami belum menyertakan panduan di sini. Silakan pilih bahasa pemrograman lain untuk memulai dan belajar tentang konsep, atau lihat referensi Objective-C dan sampel yang ditautkan dari awal artikel ini.

Paket dokumentasi | referensi (unduh) | Sampel tambahan di GitHub

Speech SDK for Swift memang mendukung transkripsi percakapan, tetapi kami belum menyertakan panduan di sini. Silakan pilih bahasa pemrograman lain untuk memulai dan mempelajari tentang konsep, atau lihat referensi Swift dan sampel yang ditautkan dari awal artikel ini.

Paket dokumentasi | referensi (PyPi) | Sampel tambahan di GitHub

Dalam mulai cepat ini, Anda menjalankan aplikasi untuk transkripsi ucapan ke teks dengan diarisasi real time. Diarisasi membedakan antara berbagai pembicara yang berpartisipasi dalam percakapan. Layanan Ucapan menyediakan informasi tentang pembicara mana yang berbicara bagian tertentu dari ucapan yang ditranskripsikan.

Informasi pembicara disertakan dalam hasil di bidang ID pembicara. ID pembicara adalah pengidentifikasi generik yang ditetapkan untuk setiap peserta percakapan oleh layanan selama pengenalan karena pembicara yang berbeda sedang diidentifikasi dari konten audio yang disediakan.

Tip

Anda dapat mencoba ucapan real time ke teks di Speech Studio tanpa mendaftar atau menulis kode apa pun. Namun, Speech Studio belum mendukung diarisasi.

Prasyarat

  • Langganan Azure. Anda dapat membuatnya secara gratis.
  • Buat sumber daya Ucapan di portal Azure.
  • Dapatkan kunci dan wilayah sumber daya Ucapan. Setelah sumber daya Azure Cognitive Service untuk Ucapan Anda disebarkan, pilih Buka sumber daya untuk melihat dan mengelola kunci.

Menyiapkan lingkungan

Speech SDK untuk Python tersedia sebagai modul Indeks Paket Python (PyPI). Speech SDK untuk Python kompatibel dengan Windows, Linux, dan macOS.

Instal versi Python dari 3.7 atau yang lebih baru. Pertama-tama periksa panduan penginstalan SDK untuk persyaratan lain.

Atur variabel lingkungan

Anda perlu mengautentikasi aplikasi Anda untuk mengakses layanan Azure AI. Artikel ini memperlihatkan kepada Anda cara menggunakan variabel lingkungan untuk menyimpan kredensial Anda. Anda kemudian dapat mengakses variabel lingkungan dari kode Anda untuk mengautentikasi aplikasi Anda. Untuk produksi, gunakan cara yang lebih aman untuk menyimpan dan mengakses kredensial Anda.

Penting

Kami merekomendasikan autentikasi ID Microsoft Entra dengan identitas terkelola untuk sumber daya Azure untuk menghindari penyimpanan kredensial dengan aplikasi Anda yang berjalan di cloud.

Jika Anda menggunakan kunci API, simpan dengan aman di tempat lain, seperti di Azure Key Vault. Jangan sertakan kunci API langsung dalam kode Anda, dan jangan pernah mempostingnya secara publik.

Untuk informasi selengkapnya tentang keamanan layanan AI, lihat Mengautentikasi permintaan ke layanan Azure AI.

Untuk mengatur variabel lingkungan untuk kunci dan wilayah sumber daya Ucapan Anda, buka jendela konsol, dan ikuti instruksi untuk sistem operasi dan lingkungan pengembangan Anda.

  • Untuk mengatur SPEECH_KEY variabel lingkungan, ganti kunci Anda dengan salah satu kunci untuk sumber daya Anda.
  • Untuk mengatur SPEECH_REGION variabel lingkungan, ganti wilayah Anda dengan salah satu wilayah untuk sumber daya Anda.
setx SPEECH_KEY your-key
setx SPEECH_REGION your-region

Catatan

Jika Anda hanya perlu mengakses variabel lingkungan di konsol saat ini, Anda dapat mengatur variabel lingkungan dengan set alih-alih setx.

Setelah menambahkan variabel lingkungan, Anda mungkin perlu memulai ulang program apa pun yang perlu membaca variabel lingkungan, termasuk jendela konsol. Misalnya, jika Anda menggunakan Visual Studio sebagai editor, mulai ulang Visual Studio sebelum Menjalankan contoh.

Menerapkan diarisasi dari file dengan transkripsi percakapan

Ikuti langkah-langkah ini untuk membuat aplikasi konsol baru.

  1. Buka jendela prompt perintah tempat Anda menginginkan proyek baru, dan buat file baru bernama conversation_transcription.py.

  2. Jalankan perintah ini untuk menginstal SDK Ucapan:

    pip install azure-cognitiveservices-speech
    
  3. Salin kode berikut ke dalam 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. Dapatkan file audio sampel atau gunakan file Anda sendiri.wav. Ganti katiesteve.wav dengan jalur dan nama file Anda .wav .

    Aplikasi mengenali ucapan dari beberapa peserta dalam percakapan. File audio Anda harus berisi beberapa speaker.

  5. Untuk mengubah bahasa pengenalan ucapan, ganti en-US dengan bahasa lain yang didukung. Misalnya, es-ES untuk Spanyol (Spanyol). Bahasa default adalah en-US jika Anda tidak menentukan bahasa. Untuk detail tentang cara mengidentifikasi salah satu dari beberapa bahasa yang mungkin diucapkan, lihat identifikasi bahasa.

  6. Jalankan aplikasi konsol baru Anda untuk memulai transkripsi percakapan:

    python conversation_transcription.py
    

Penting

Pastikan Anda mengatur SPEECH_KEY variabel lingkungan dan SPEECH_REGION . Jika Anda tidak mengatur variabel ini, sampel gagal dengan pesan kesalahan.

Percakapan yang ditranskripsikan harus dihasilkan sebagai teks:

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

Pembicara diidentifikasi sebagai Tamu-1, Tamu-2, dan sebagainya, tergantung pada jumlah pembicara dalam percakapan.

Catatan

Anda mungkin melihat Speaker ID=Unknown di beberapa hasil perantara awal saat pembicara belum diidentifikasi. Tanpa hasil diarisasi menengah (jika Anda tidak mengatur PropertyId.SpeechServiceResponse_DiarizeIntermediateResults properti ke "true"), ID pembicara selalu "Tidak Diketahui".

Membersihkan sumber daya

Anda dapat menggunakan portal Azure atau Azure Command Line Interface (CLI) untuk menghapus sumber daya Ucapan yang Anda buat.

Rest API ucapan ke teks mereferensikan Ucapan ke teks REST API untuk referensi | audio singkat Sampel tambahan di GitHub |

REST API tidak mendukung transkripsi percakapan. Silakan pilih bahasa atau alat pemrograman lain dari bagian atas halaman ini.

Speech CLI tidak mendukung transkripsi percakapan. Silakan pilih bahasa atau alat pemrograman lain dari bagian atas halaman ini.

Langkah selanjutnya