The Psychology of Winning By Denis Waitley Download Full Version Of this Book Download Full PDF Version of This Book This is the only site that you can get the free. The Psychology of Winning by Dr Dennis Waitley (from. A site that brings both authors and readers into the world of free legal ebooks. Gli Healing gardens sono nati negli Stati Uniti dove hanno avuto grande. Congiunta dei paesi occidentali e, proprio per questo, secondo alcuni. Concerns leave fewer cognitive resources available to guide choice. By pooling and converting them into securities that allow for risk-sharing with non.
![]() -->
In questa guida introduttiva si apprenderà come eseguire la sintesi vocale di testo usando Node.js e l'API REST Sintesi vocale.In this quickstart, you'll learn how to convert text-to-speech using Node.js and the text-to-speech REST API.In questo articolo il corpo della richiesta è strutturato nel formato SSML (Speech Synthesis Markup Language), che consente di scegliere la voce e la lingua della risposta.The request body in this guide is structured as Speech Synthesis Markup Language (SSML), which allows you to choose the voice and language of the response.
Per questo argomento di avvio rapido, è necessario avere un account di Servizi cognitivi di Azure con una risorsa del servizio Voce.This quickstart requires an Azure Cognitive Services account with a Speech service resource.Se non si dispone di un account, è possibile usare la versione di valutazione gratuita per ottenere una chiave di sottoscrizione.If you don't have an account, you can use the free trial to get a subscription key.
![]() PrerequisitiPrerequisites
Questa guida introduttiva richiede:This quickstart requires:
Creare un progetto e richiedere le dipendenzeCreate a project and require dependencies
Creare un nuovo progetto Node.js con l'IDE o l'editor preferito.Create a new Node.js project using your favorite IDE or editor.Copiare quindi questo frammento di codice nel progetto all'interno di un file denominato
tts.js .Then copy this code snippet into your project in a file named tts.js .
Nota
![]()
Se non si è mai usato questi moduli, sarà necessario installarli prima di eseguire il programma.If you haven't used these modules you'll need to install them before running your program.Per installare questi pacchetti, eseguire:
npm install request request-promise xmlbuilder readline-sync .To install these packages, run: npm install request request-promise xmlbuilder readline-sync .
Ottenere un token di accessoGet an access token
L'API REST Sintesi vocale necessita di un token di accesso per l'autenticazione.The text-to-speech REST API requires an access token for authentication.Per ottenere un token di accesso, è necessario uno scambio.To get an access token, an exchange is required.Questa funzione scambia la chiave di sottoscrizione del servizio Voce con un token di accesso usando l'endpoint
issueToken .This function exchanges your Speech service subscription key for an access token using the issueToken endpoint.
L'esempio presuppone che la sottoscrizione del servizio Voce si trovi nell'area Stati Uniti occidentali.This sample assumes that your Speech service subscription is in the West US region.Se si usa un'area diversa, aggiornare il valore per
uri .If you're using a different region, update the value for uri .Per un elenco completo, vedere Aree.For a full list, see Regions.
Copiare questo codice nel progetto:Copy this code into your project:
Nota
Per altre informazioni sull'autenticazione, vedere Eseguire l'autenticazione con un token di autenticazione.For more information on authentication, see Authenticate with an access token.
Nella sezione successiva si creerà la funzione per chiamare l'API di sintesi vocale e salvare la risposta vocale sintetizzata.In the next section, we'll create the function to call the text-to-speech API and save the synthesized speech response.
Eseguire una richiesta e salvare la rispostaMake a request and save the response
In questa sezione si creerà la richiesta all'API di sintesi vocale e si salverà la risposta vocale.Here you're going to build the request to the text-to-speech API and save the speech response.Questo esempio presuppone che si usi l'endpoint Stati Uniti occidentali.This sample assumes you're using the West US endpoint.Se la risorsa è registrata in un'area diversa, assicurarsi di aggiornare il valore di
uri .If your resource is registered to a different region, make sure you update the uri .Per altre informazioni, vedere Aree del servizio Voce.For more information, see Speech service regions.
È quindi necessario aggiungere le intestazioni obbligatorie per la richiesta.Next, you need to add required headers for the request.Assicurarsi di aggiornare
User-Agent con il nome della risorsa, che si trova nel portale di Azure, e impostare X-Microsoft-OutputFormat sul formato di output audio preferito.Make sure that you update User-Agent with the name of your resource (located in the Azure portal), and set X-Microsoft-OutputFormat to your preferred audio output.Per un elenco completo dei formati di output, vedere Output audio.For a full list of output formats, see Audio outputs.
Creare quindi il corpo della richiesta nel formato SSML (Speech Synthesis Markup Language).Then construct the request body using Speech Synthesis Markup Language (SSML).Questo esempio definisce la struttura e usa l'input
text creato in precedenza.This sample defines the structure, and uses the text input you created earlier.
Nota
Questo esempio usa il carattere voce
JessaRUS .This sample uses the JessaRUS voice font.Per un elenco completo di voci e lingue fornite da Microsoft, vedere Supporto per le lingue.For a complete list of Microsoft provided voices/languages, see Language support.Se si vuole creare una voce unica, riconoscibile per il proprio marchio, vedere Creazione di caratteri voce personalizzati.If you're interested in creating a unique, recognizable voice for your brand, see Creating custom voice fonts.
Si creerà infine una richiesta da inviare al servizio.Finally, you'll make a request to the service.Se la richiesta ha esito positivo e viene restituito il codice di stato 200, la risposta di sintesi vocale viene scritta come
TTSOutput.wav .If the request is successful, and a 200 status code is returned, the speech response is written as TTSOutput.wav .
Combinare tutti gli elementiPut it all together
La procedura è quasi terminata.You're almost done.L'ultimo passaggio consiste nel creare una funzione asincrona.The last step is to create an asynchronous function.Questa funzione legge la chiave della sottoscrizione da una variabile di ambiente, richiede il testo, ottiene un token, attende il completamento della richiesta e quindi converte il testo in voce e salva l'audio come file WAV.This function will read your subscription key from an environment variable, prompt for text, get a token, wait for the request to complete, then convert the text-to-speech and save the audio as a .wav.
Se non si ha familiarità con le variabili di ambiente o si preferisce eseguire test con la chiave della sottoscrizione hardcoded come stringa, sostituire
process.env.SPEECH_SERVICE_KEY con la chiave della sottoscrizione come stringa.If you're unfamiliar with environment variables or prefer to test with your subscription key hardcoded as a string, replace process.env.SPEECH_SERVICE_KEY with your subscription key as a string.
Eseguire l'app di esempioRun the sample app
A questo punto è possibile eseguire l'app di sintesi vocale di esempio.That's it, you're ready to run your text-to-speech sample app.Dalla riga di comando, o dalla sessione di terminale, passare alla directory del progetto ed eseguire:From the command line (or terminal session), navigate to your project directory and run:
Quando richiesto, digitare un testo qualsiasi di cui eseguire la sintesi vocale.When prompted, type in whatever you'd like to convert from text-to-speech.Se l'operazione ha esito positivo, il file della sintesi vocale viene salvato nella cartella del progetto.If successful, the speech file is located in your project folder.Riprodurlo con il lettore multimediale preferito.Play it using your favorite media player.
Pulire le risorseClean up resources
Assicurarsi di rimuovere eventuali informazioni riservate dal codice sorgente dell'app di esempio, ad esempio le chiavi di sottoscrizione.Make sure to remove any confidential information from your sample app's source code, like subscription keys.
Passaggi successiviNext stepsVedere ancheSee also![]() Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
March 2023
Categories |