### Start Flask Development Server Source: https://github.com/azure-samples/cognitive-services-speech-sdk/blob/master/samples/python/web/avatar/README.md Starts the Flask development server to host the web UI for the sample. This command makes the application accessible at http://localhost:5000. ```bash python -m flask run -h 0.0.0.0 -p 5000 ``` -------------------------------- ### Run the Python Sample Source: https://github.com/azure-samples/cognitive-services-speech-sdk/blob/master/quickstart/python/from-microphone/README.md Execute the quickstart sample script from the console after navigating to the downloaded directory. Ensure you replace placeholder values for SubscriptionKey and Endpoint. ```sh python quickstart.py ``` -------------------------------- ### Install Bicep CLI Source: https://github.com/azure-samples/cognitive-services-speech-sdk/blob/master/samples/ingestion/ingestion-client/infra/guide.md Installs the Bicep CLI tool via the Azure CLI. ```bash az bicep install ``` -------------------------------- ### Troubleshooting Log Example (Java) Source: https://github.com/azure-samples/cognitive-services-speech-sdk/blob/master/samples/java/android/compressed-input/README.md An example log message indicating a file not found error when the input audio file is not in the expected location. ```java 4059-4059/com.microsoft.cognitiveservices.speech.samples.compressedinput E/SpeechSDKDemo: unexpected /storage/emulated/0/input/whatstheweatherlike.mp3 (No such file or directory) ``` -------------------------------- ### Run the Chatting Sample Source: https://github.com/azure-samples/cognitive-services-speech-sdk/blob/master/scenarios/python/console/language-learning/chatting/README.md Execute the Python sample script to start the language learning application. Update placeholder values with your Azure resource details before running. ```sh python3 chatting_sample.py ``` -------------------------------- ### Install Python Client Library Source: https://github.com/azure-samples/cognitive-services-speech-sdk/blob/master/samples/batch/python/README.md Install the generated Python client module using pip. Replace 'path/to/package/python-client' with the actual path to your extracted client library. ```bash pip install path/to/package/python-client ``` -------------------------------- ### Run Microphone Streaming Sample Source: https://github.com/azure-samples/cognitive-services-speech-sdk/blob/master/samples/js/node/README.md Initiate the microphone-based speech recognition sample. Ensure Sox is installed and prerequisites are met. ```shell node micSTT.js ``` -------------------------------- ### Restore project dependencies Source: https://github.com/azure-samples/cognitive-services-speech-sdk/blob/master/scenarios/csharp/dotnetcore/multi-tier/SpeechSDKRemoteClientApp/README.md Execute this command to download and install all necessary NuGet packages for the project. ```bash dotnet restore ``` -------------------------------- ### Install required packages Source: https://github.com/azure-samples/cognitive-services-speech-sdk/blob/master/samples/python/console/long-form-text-synthesis/readme.md Installs the necessary Python packages for the Speech SDK. Ensure you have Python and pip installed. ```sh pip install -r requirements.txt ``` -------------------------------- ### Install Dependency Modules Source: https://github.com/azure-samples/cognitive-services-speech-sdk/blob/master/samples/video-translation/python/readme.md Install the required Python packages using pip. ```bash pip3 install termcolor pip3 install orjson pip3 install urllib3 pip3 install requests pip3 install pydantic ``` -------------------------------- ### Initialize and Use Speech SDK Wrapper Source: https://github.com/azure-samples/cognitive-services-speech-sdk/blob/master/scenarios/csharp/dotnetcore/multi-tier/SpeechSDKRemoteServiceCore/README.md Demonstrates how to create configuration, initialize the SpeechSDKWrapper with configuration and transport, start recognition, send audio data, and stop recognition. ```csharp // Create configuration var config = new BasicConfigurationService { SpeechServiceEndpoint = new Uri("your_endpoint"), SpeechServiceRegion = "your_region", SpeechServiceKey = "your_key" }; // Initialize wrapper with config and transport var wrapper = new SpeechSDKWrapper( speechConfig, audioFormat, responseTransport); // Start recognition await wrapper.StartRecognitionAsync(); // Send audio data wrapper.OnAudioReceived(audioData); // Stop recognition await wrapper.StopRecognition(); ``` -------------------------------- ### Build the C# sample with .NET Core CLI Source: https://github.com/azure-samples/cognitive-services-speech-sdk/blob/master/samples/csharp/dotnetcore/console/README.md Use this command to compile the project from the directory containing the sample. ```bash dotnet build samples/samples.csproj ``` -------------------------------- ### Install Azure CLI Source: https://github.com/azure-samples/cognitive-services-speech-sdk/blob/master/samples/ingestion/ingestion-client/infra/guide.md Installs the Azure CLI on Linux systems using a shell script. ```bash curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash ``` -------------------------------- ### Build Sample with .NET CLI Source: https://github.com/azure-samples/cognitive-services-speech-sdk/blob/master/samples/csharp/dotnetcore/embedded-speech/README.md Builds the sample project using the .NET CLI. Use '--configuration=Release' for a release build. ```sh dotnet build samples/samples.csproj ``` ```sh dotnet build --configuration=Release samples/samples.csproj ``` -------------------------------- ### Verify Python Client Installation Source: https://github.com/azure-samples/cognitive-services-speech-sdk/blob/master/samples/batch/python/README.md Verify that the 'swagger_client' package has been successfully installed in your Python environment. ```python python -c "import swagger_client" ``` -------------------------------- ### Build sample with .NET Core CLI Source: https://github.com/azure-samples/cognitive-services-speech-sdk/blob/master/quickstart/csharp/dotnetcore/from-microphone/README.md Use the .NET Core CLI to build the sample project. Ensure you have replaced placeholder subscription keys and endpoints in the source code. ```bash dotnet build helloworld/helloworld.csproj ``` -------------------------------- ### Execute Sample Code Source: https://github.com/azure-samples/cognitive-services-speech-sdk/blob/master/samples/batch-synthesis/python/README.md Run the synthesis script after configuring the environment. ```sh python synthesis.py ``` -------------------------------- ### Install Python Dependencies Source: https://github.com/azure-samples/cognitive-services-speech-sdk/blob/master/samples/batch-avatar/python/README.md Install the required Python packages using pip. Ensure you have a requirements.txt file. ```sh pip install -r requirements.txt ``` -------------------------------- ### Build and Run the Speech Recognition Sample Source: https://github.com/azure-samples/cognitive-services-speech-sdk/blob/master/quickstart/cpp/linux/from-microphone/README.md Compile the C++ sample using 'make' and then run the generated executable. Ensure the Speech SDK libraries are correctly configured in the environment. ```shell make ./helloworld ``` -------------------------------- ### Install CocoaPod dependencies Source: https://github.com/azure-samples/cognitive-services-speech-sdk/blob/master/quickstart/swift/ios/text-to-speech/README.md Run this command in the terminal within the project directory to install the Speech SDK. ```bash pod install ``` -------------------------------- ### Clone the repository Source: https://github.com/azure-samples/cognitive-services-speech-sdk/blob/master/scenarios/csharp/dotnetcore/multi-tier/SpeechSDKRemoteClientApp/README.md Use this command to download the sample project from GitHub. ```bash git clone https://github.com/Azure-Samples/cognitive-services-speech-sdk ``` -------------------------------- ### Install Scipy Package for Transcription Source: https://github.com/azure-samples/cognitive-services-speech-sdk/blob/master/samples/python/console/README.md Install the Scipy package if you plan to use the transcription sample. This package is required for specific audio processing tasks. ```sh pip install scipy ``` -------------------------------- ### Start Continuous Speech Recognition Source: https://github.com/azure-samples/cognitive-services-speech-sdk/blob/master/samples/js/browser/public/index.html Starts a continuous speech recognition operation. This mode is event-driven, as there isn't a single result to handle via continuation. ```javascript function doContinuousRecognition() { resetUiForScenarioStart(); var audioConfig = getAudioConfig(); var speechConfig = getSpeechConfig(SpeechSDK.SpeechConfig); if (!speechConfig) return; // Create the SpeechRecognizer and set up common event handlers and PhraseList data reco = new SpeechSDK.SpeechRecognizer(speechConfig, audioConfig); applyCommonConfigurationTo(reco); // Start the continuous recognition. Note that, in this continuous scenario, activity is purely event- // driven, as use of continuation (as is in the single-shot sample) isn't applicable when there's not a // single result. reco.startContinuousRecognitionAsync(); } ``` -------------------------------- ### Run the Sample with Maven Exec Plugin Source: https://github.com/azure-samples/cognitive-services-speech-sdk/blob/master/samples/java/jre/tts-text-stream/README.md Execute the Java sample application using the Maven Exec Plugin. ```bash mvn exec:java ``` -------------------------------- ### Run Speech SDK Sample Source: https://github.com/azure-samples/cognitive-services-speech-sdk/blob/master/samples/js/node/README.md Execute the main sample script with optional arguments to specify functionality (speech, translate, synthesis) and an audio filename. ```shell node index.js [speech|translate|synthesis] {filename} ``` -------------------------------- ### Install Speech SDK Python Package Source: https://github.com/azure-samples/cognitive-services-speech-sdk/blob/master/quickstart/python/from-microphone/quickstart.ipynb Install the Cognitive Services Speech SDK Python package using pip. This command is required before using the SDK. ```sh pip install azure-cognitiveservices-speech ``` -------------------------------- ### Run Compressed Audio Input Sample Source: https://github.com/azure-samples/cognitive-services-speech-sdk/blob/master/samples/cpp/linux/compressed-audio-input/README.md Execute the compiled sample application, providing the path to your MP3 or Opus audio file as a command-line argument. ```bash ./compressed-audio-input ``` -------------------------------- ### Initialize and Start Conversation Transcriber Source: https://github.com/azure-samples/cognitive-services-speech-sdk/blob/master/quickstart/javascript/browser/conversation-transcription/conversation-transcription.html Initializes the Conversation Transcriber with subscription key, region, and audio input. Starts the transcription process and enables UI controls. ```javascript var SpeechSDK; var SpeechSDK = window.SpeechSDK; // status fields and start button in UI var phraseDiv; var resultDiv; var startTranscriberButton, stopTranscriberButton, filePicker; // subscription key and region for speech services. var subscriptionKey, serviceRegion; var transcriber; var audioFile; document.addEventListener("DOMContentLoaded", () => { startTranscriberButton = document.getElementById("startTranscriberButton"); stopTranscriberButton = document.getElementById("stopTranscriberButton"); subscriptionKey = document.getElementById("subscriptionKey"); serviceRegion = document.getElementById("serviceRegion"); phraseDiv = document.getElementById("phraseDiv"); resultDiv = document.getElementById("resultDiv"); filePicker = document.getElementById("filePicker"); var lastRecognized = "" filePicker.addEventListener("change", () => { audioFile = filePicker.files[0]; }); startTranscriberButton.addEventListener("click", () => { phraseDiv.innerHTML = ""; resultDiv.innerHTML = ""; lastRecognized = "" if (!subscriptionKey.value || subscriptionKey.value === "subscription") { alert("Please enter your Microsoft Cognitive Services Speech subscription key!"); startTranscriberButton.disabled = false; return; } var speechConfig = SpeechSDK.SpeechConfig.fromSubscription(subscriptionKey.value, serviceRegion.value); var audioConfig = SpeechSDK.AudioConfig.fromWavFileInput(audioFile); transcriber = new SpeechSDK.ConversationTranscriber(speechConfig, audioConfig); transcriber.sessionStarted = function (s, e) { window.console.log(e); } transcriber.sessionStopped = function (s, e) { window.console.log(e); startTranscriberButton.disabled = false; } transcriber.canceled = function (s, e) { window.console.log(e); } transcriber.transcribing = function (s, e) { // Uncomment line below to see intermediate results in console // window.console.log(e); }; // The event recognized signals that a final recognition result is received. // This is the final event that a phrase has been recognized. // For transcription, you will get one recognized event for each phrase recognized. transcriber.transcribed = function (s, e) { window.console.log(e); // Indicates that recognizable speech was not detected, and that recognition is done. if (e.result.reason === SpeechSDK.ResultReason.NoMatch) { var noMatchDetail = SpeechSDK.NoMatchDetails.fromResult(e.result); resultDiv.innerHTML += "(transcribed) Reason: " + SpeechSDK.ResultReason[e.result.reason] + " NoMatchReason: " + SpeechSDK.NoMatchReason[noMatchDetail.reason] + "\r\n"; } else { resultDiv.innerHTML += "(transcribed) Reason: " + SpeechSDK.ResultReason[e.result.reason] + " Text: " + e.result.text + "\r\n"; resultDiv.innerHTML += "(transcribed) SpeakerId: " + e.result.speakerId + "\r\n"; } lastRecognized += e.result.text + "\r\n"; phraseDiv.innerHTML = lastRecognized; }; transcriber.startTranscribingAsync( () => { window.console.log("startTranscribing complete"); }, (error) => { window.console.log(error); transcriber.close(); transcriber = undefined; startTranscriberButton.disabled = false; stopTranscriberButton.disabled = true; }); startTranscriberButton.disabled = true; stopTranscriberButton.disabled = false; }); stopTranscriberButton.addEventListener("click", function () { transcriber.stopTranscribingAsync( () => { transcriber.close(); transcriber = undefined; startTranscriberButton.disabled = false; stopTranscriberButton.disabled = true; }, (error) => { window.console.log(error); transcriber.close(); transcriber = undefined; startTranscriberButton.disabled = false; stopTranscriberButton.disabled = true; }); }); if (!!window.SpeechSDK) { SpeechSDK = window.SpeechSDK; startTranscriberButton.disabled = false; stopTranscriberButton.disabled = true; document.getElementById('content').style.display = 'block'; document.getElementById('warning').style.display = 'none'; } }); ``` -------------------------------- ### Navigate to the project directory Source: https://github.com/azure-samples/cognitive-services-speech-sdk/blob/master/scenarios/csharp/dotnetcore/multi-tier/SpeechSDKRemoteClientApp/README.md Change your current directory to the root of the cloned project. ```bash cd /git/scenarios/csharp/dotnetcore/multi-tier/SpeechSDKRemoteClientApp ``` -------------------------------- ### Install Azure Identity Package for AAD Token Authentication Source: https://github.com/azure-samples/cognitive-services-speech-sdk/blob/master/samples/python/console/README.md Install the azure-identity package to enable authentication using Azure Active Directory (AAD) token credentials. This is an alternative to using subscription keys. ```sh pip install azure-identity ``` -------------------------------- ### Initialize Speech SDK and Populate Options Source: https://github.com/azure-samples/cognitive-services-speech-sdk/blob/master/samples/js/browser/synthesis.html Initializes the Speech SDK and populates the format options dropdown. Ensure the subscription key and region are correctly configured before use. ```javascript Initialize(function (speechSdk) { SpeechSDK = speechSdk; startSynthesisAsyncButton.disabled = false; downloadButton.disabled = false; pauseButton.disabled = true; resumeButton.disabled = true; formatOptions.innerHTML = ""; Object.keys(SpeechSDK.SpeechSynthesisOutputFormat).forEach(format => { if (isNaN(format) && !format.includes('Siren')) { formatOptions.innerHTML += "" } }); formatOptions.selectedIndex = SpeechSDK.SpeechSynthesisOutputFormat.Audio24Khz48KBitRateMonoMp3; }); ``` -------------------------------- ### Handle Session Start Event Source: https://github.com/azure-samples/cognitive-services-speech-sdk/blob/master/samples/js/browser/index.html Manages UI elements and logs status when a speech recognition session begins. It disables start buttons and enables stop buttons to reflect the active session state. ```javascript function onSessionStarted(sender, sessionEventArgs) { statusDiv.innerHTML += `(sessionStarted) SessionId: ${sessionEventArgs.sessionId} `; for (const thingToDisableDuringSession of thingsToDisableDuringSession) { thingToDisableDuringSession.disabled = true; } scenarioStartButton.disabled = true; scenarioStopButton.disabled = false; } ``` -------------------------------- ### Initialize Java SDK Source: https://github.com/azure-samples/cognitive-services-speech-sdk/blob/master/docs/breaking_changes_1_0_0.md Remove legacy platform binding configuration as the SDK now uses system root certificates. ```java SpeechFactory.configureNativePlatformBindingWithDefaultCertifictae(); ``` -------------------------------- ### Configure Sample App in VS Code Source: https://github.com/azure-samples/cognitive-services-speech-sdk/blob/master/samples/batch/python/README.md Commands to configure, build, and run the sample application using the Azure AI Speech Toolkit extension in Visual Studio Code. ```bash Azure AI Speech Toolkit: Configure Azure Speech Resources ``` ```bash Azure AI Speech Toolkit: Configure and Setup the Sample App ``` ```bash Azure AI Speech Toolkit: Build the Sample App ``` ```bash Azure AI Speech Toolkit: Run the Sample App ``` -------------------------------- ### Handle Session Started Event Source: https://github.com/azure-samples/cognitive-services-speech-sdk/blob/master/samples/js/browser/public/index.html The 'sessionStarted' event is triggered when a new speech recognition session begins. This snippet logs the session ID and updates UI elements by disabling the start button and enabling the stop button. ```javascript function onSessionStarted(sender, sessionEventArgs) { statusDiv.innerHTML += `(sessionStarted) SessionId: ${sessionEventArgs.sessionId}\r\n`; for (const thingToDisableDuringSession of thingsToDisableDuringSession) { thingToDisableDuringSession.disabled = true; } scenarioStartButton.disabled = true; scenarioStopButton.disabled = false; } ``` -------------------------------- ### Initialize Speech SDK and Populate Format Options Source: https://github.com/azure-samples/cognitive-services-speech-sdk/blob/master/samples/js/browser/public/synthesis.html Initializes the Speech SDK and populates a dropdown with available audio output formats. Ensure the Speech SDK is loaded before calling this function. ```javascript Initialize(async function (speechSdk) { SpeechSDK = speechSdk; startSynthesisAsyncButton.disabled = false; downloadButton.disabled = false; pauseButton.disabled = true; resumeButton.disabled = true; formatOptions.innerHTML = ""; Object.keys(SpeechSDK.SpeechSynthesisOutputFormat).forEach(format => { if (isNaN(format) && !format.includes('Siren')) { formatOptions.innerHTML += "" } }); formatOptions.selectedIndex = SpeechSDK.SpeechSynthesisOutputFormat.Audio24Khz48KBitRateMonoMp3; }); ``` -------------------------------- ### Example JSON result structure Source: https://github.com/azure-samples/cognitive-services-speech-sdk/blob/master/docs/pronunciationassessment/how-to-get-spoken-phonemes.md Sample of the JSON structure returned by the Pronunciation Assessment API. ```json { "Format": "Detailed", "RecognitionStatus": "Success", ``` -------------------------------- ### Start Azure Function Locally Source: https://github.com/azure-samples/cognitive-services-speech-sdk/blob/master/samples/ingestion/ingestion-client/FetchTranscription/README.md Launches the Azure Function locally to test code changes. ```bash func start ```