Profilo di Machine Transal...Machine Translation - th...FotoBlog Strumenti Guida

Blog


08 ottobre

A simple ASP Translate to Speech Application/Um exemplo de Traducao com Voz em ASP

So here is a first sample application using the new service. It’s a really basic Javascript client that doesn’t do much more than formatting a string with the url and the correct parameters to invoke the T2S feature. The only thing that is remotely interesting is that this string is passed directly to the Media Player Active X, so there’s no extra work to play the wave file.

You can play with the app here: http://www.h2ktech.net/h2ktechsamples/Translate2SpeechSample.aspx (by the way, I’ll be posting all new samples to this very same location). You can ‘view source’ to check the code, or simply download it from the text file: http://www.h2ktech.net/h2ktechsamples/Translate2SpeechSample.cs.txt

The two Javascript functions work as follows:

  • InvokeService builds the string based on the content of the textbox (there’s some basic filtering to emulate escaping some characters) and adds the language parameters based on the dropdown.
image

  • PlayWave: uses the iframe as a container and creates a document on the fly with references to the Media Player Active X. It also adds a regular http link (like the ones in the previous blog post) in case the users doesn’t have (and doesn’t want to install) the control.

image

Here’s a good reference on embedding Media Active X controls: http://cit.ucsf.edu/embedmedia/step3.php

Give it a try, and feel free to play with the code – just don’t use it for any commercial application alright?

Cheers,
Helvecio

English - Portuguese

Aqui está um primeiro exemplo de um aplicativo usando o novo serviço. É um programa realmente básico em JavaScript que não faz muito mais do que formatar uma string com a url e os parâmetros corretos para invocar o recurso de T2S. A única coisa que é remotamente interessante é que esta string é passaao diretamente para o Active X do Media Player, portanto, não há nenhum trabalho extra para reproduzir o arquivo wave.

Você pode brincar com o aplicativo aqui: http://www.h2ktech.NET/h2ktechsamples/Translate2SpeechSample.aspx (a propósito, eu vou colocar todos os code samples neste mesmo local daqui para frente). Você pode 'Exibir fonte' para ler o código, ou simplesmente o download do arquivo de texto:http://www.h2ktech.NET/h2ktechsamples/Translate2SpeechSample.cs.txt

As duas funções de JavaScript funcionam da seguinte forma:

  • InvokeService constrói a cadeia de caracteres com base no conteúdo da caixa de texto (adicionei alguns filtros básicos para emular escaping alguns caracteres) e adicionar os parâmetros de idiomas com base na lista.

  • PlayWave: utiliza o iframe como um recipiente e cria um documento com referências para o Media Player ACTIVEX. Também adiciona um link http normal (como aqueles na postagem do blog anterior), caso os usuários não tenham (e não queiram instalar) o controle.

Aqui está uma boa referência sobre a incorporação de controles Active X de mídia: http://Cit.ucsf.edu/embedmedia/step3.php

Experimente e sinta-se a vontade para brincar com o código – só não use em nenhum aplicativo comercial ok?

[]s,
Helvecio


Commenti

Attendere...
Il commento immesso è troppo lungo. Immetti un commento più breve.
Immissione non effettuata. Riprova.
Impossibile aggiungere il commento al momento. Riprova più tardi.
Per aggiungere un commento è necessaria l'autorizzazione di un genitore. Chiedi autorizzazione
I tuoi genitori hanno disattivato i commenti.
Impossibile eliminare il commento al momento. Riprova più tardi.
Hai raggiunto il numero massimo di commenti pubblicabili giornalmente. Riprova tra 24 ore.
Impossibile lasciare commenti. La funzionalità è stata disattivata perché i sistemi hanno rilevato una possibile attività di spamming dal tuo account. Se ritieni che il tuo account è stato disattivato per errore, contatta il supporto tecnico di Windows Live.
Esegui il seguente controllo di protezione per completare la pubblicazione del commento.
I caratteri digitati nel controllo di protezione devono corrispondere ai caratteri dell'immagine o della riproduzione audio.

Per aggiungere un commento, accedi con il tuo Windows Live ID (se utilizzi Hotmail, Messenger o Xbox LIVE possiedi già un Windows Live ID). Accedi


Non hai ancora un Windows Live ID? Registrati

Riferimenti

L'URL di riferimento per questo intervento è:
http://mtbotprototype.spaces.live.com/blog/cns!3F1A4578DEE8B!1340.trak
Blog che fanno riferimento a questo intervento
  • Nessuno