Basic4ppc - Windows Mobile Development  

Go Back   Basic4ppc - Windows Mobile Development > Foreign Languages > Spanish Forum
Home Register FAQ Members List Search Today's Posts Mark Forums Read


Enlazar "wrap" TTS español


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-20-2007, 01:00 PM
Newbie
 
Join Date: Oct 2007
Posts: 5
Default Enlazar "wrap" TTS español

Saludos a todos, soy relativamente nuevo en este foro y he estado leyendo threads que me están resultando muy interesantes y educativos en mis primeros pasitos con Basic4PPC.
Sobre todo me he interesado por los mensajes sobre librerías TTS para que hable la "bicha"
He probado la librería FLITE (que habla en inglés) y se me ha ocurrido probar otra que habla supuestamente en español, dentro del diccionario Lingvosoft Talking Dicc English Spanish hay una librería de TTS español llamada TTS_SPA.DLL (supongo que no será delito cacharrear sin ánimo de lucro con librerías de terceros) y he preparado un enlace mediante TTSWRAP.DLL para que se pueda invocar desde Basic4PPC.
Bueno hasta aquí bien, pero solo consigo que pronuncie la primera letra del texto deseado.
No sé si alguien sabe como resolver el problema. ¿Como conseguir que pronuncie la frase completa?
Adjunto la librería y el enlazador por si quereis probarlo.

Felices Pascuas
Attached Files
File Type: zip TTS.zip (60.0 KB, 10 views)
Reply With Quote
  #2 (permalink)  
Old 12-20-2007, 04:22 PM
Junior Member
 
Join Date: Apr 2007
Location: Spain
Posts: 13
Default

¿Funciona en Desktop, o solo en PPC?
__________________
Discovering Basic4PPC, Great Job!!!
Reply With Quote
  #3 (permalink)  
Old 12-20-2007, 06:11 PM
Newbie
 
Join Date: Oct 2007
Posts: 5
Default La versión desktop

La librería posteada antes solo es para la PDA.
Ahora posteo lo mismo pero con una librería TTS_SPA.DLL de versión windows.
Curiosamente en este caso pronuncia toda la frase que se teclee. Claro compilándolo para Desktop y ejecutándolo en el PC.
Saludos,
Attached Files
File Type: zip voz desktop.zip (70.4 KB, 7 views)
Reply With Quote
  #4 (permalink)  
Old 12-22-2007, 04:54 PM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 1,208
Awards Showcase
Forum Contributer 
Total Awards: 1
Default

Quote:
Originally Posted by CANCUNATNIGHT View Post
Bueno hasta aquí bien, pero solo consigo que pronuncie la primera letra del texto deseado.
I can just about read, but not write Spanish. I had a similar effect porting the Flite library. .NET strings are UTF-16 but the C based Flite code wanted ASCI strings so Flite saw the first character then a zero which it treated as end of string. I had to repack the string to make it work.
Reply With Quote
  #5 (permalink)  
Old 12-23-2007, 05:27 PM
Newbie
 
Join Date: Oct 2007
Posts: 5
Default Thanks

English:
First one, thanks for your answer Agraham.
I supose that the string conversion from UTF16 to ASCII encode must be done into the original dll (in my case in TTS_SPA.DLL), so I can't continue (the DLL is from Lingvosoft and I have no permission for dissassemble)
Or is it possible make it in C#, into the wrapp dll?

Merry Christmas
------
Now spanish:
Lo primero, gracias por tu respuesta Agraham.
Supongo que la conversión de la cadena de la codificación UTF16 a la de ASCII debe realizarse dentro de la librería original (en mi caso TTS_SPA.DLL), en ese caso no puedo continuar (la librería es propiedad de Lingvosoft y no tengo permiso para desensamblarla).
¿O es posible que la conversión pueda hacerse desde C#, dentro del enlazador wrap?
Feliz Navidad.
Reply With Quote
  #6 (permalink)  
Old 12-23-2007, 06:27 PM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 1,208
Awards Showcase
Forum Contributer 
Total Awards: 1
Default

Quote:
Originally Posted by CANCUNATNIGHT View Post
Or is it possible make it in C#, into the wrapp dll?
You could try encoding the string into a byte array as UTF-8, stick a 0 after the last byte of the string to terminate it and pass the byte array.
Code:
using System;
using System.Text;
class UTF8EncodingExample {
    public static void Main() {
        // Create a UTF-8 encoding.
        UTF8Encoding utf8 = new UTF8Encoding();
        
        // A Unicode string with two characters outside an 8-bit code range.
        String unicodeString =
            "This unicode string contains two characters " +
            "with codes outside an 8-bit code range, " +
            "Pi (\u03a0) and Sigma (\u03a3).";
        Console.WriteLine("Original string:");
        Console.WriteLine(unicodeString);

        // Encode the string.
        Byte[] encodedBytes = utf8.GetBytes(unicodeString);
        Console.WriteLine();
        Console.WriteLine("Encoded bytes:");
        foreach (Byte b in encodedBytes) {
            Console.Write("[{0}]", b);
        }
        Console.WriteLine();
        
        // Decode bytes back to string.
        // Notice Pi and Sigma characters are still present.
        String decodedString = utf8.GetString(encodedBytes);
        Console.WriteLine();
        Console.WriteLine("Decoded bytes:");
        Console.WriteLine(decodedString);
    }
}
Reply With Quote
  #7 (permalink)  
Old 12-27-2007, 11:26 AM
Newbie
 
Join Date: Oct 2007
Posts: 5
Default Solucionado TTS español device

Gracias a la pista que remite Agraham, he enlazado la librería de voz y ahora parece que funciona bien. Pronuncia toda la frase, reconoce vocales acentuadas, la ñ y demás caracteres españoles.
El código que he incluido en el enlazador "wrap" TTSwrap.dll es el siguiente:
------------------------------------------------------------------------
Thanks to Agraham for his trail, I have wrapped the TTS library and now, it seems to speak all the sentence, it admits accentuated vocal, the ñ character and others spanish symbols.
The code included for the class in the ttswrap.dll is the follow:

-----------------------------------------------------------------------
namespace Ttswrap
{
using System;
using System.Runtime.InteropServices;

public class esp : IDisposable
{
public esp()
{
Init_TTS();
}
[DllImport("TTS_spa.dll")]
private static extern void DeInit_TTS();
public void Dispose()
{
DeInit_TTS();
}
[DllImport("TTS_spa.dll")]
private static extern void Init_TTS();
[DllImport("TTS_spa.dll")]
private static extern int Say_TTS(byte[] texto);

public int Voz(string texto)
{
return Say_TTS(System.Text.UnicodeEncoding.Default.GetByt es(texto));
}
}
}
-------------------------------------------------------------------------

Happy New Year
Attached Files
File Type: zip voz TTS device.zip (60.1 KB, 9 views)
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Is there any thing like Visual Basic "Tabbed dialog control" in Basic4ppc? mozaharul Questions & Help Needed 6 03-23-2008 11:07 AM
Image Button kommt nicht wieder "hoch" troll German Forum 3 02-22-2008 09:03 AM
calling the device's "Programs" or "settings" screens HarleyM Questions & Help Needed 0 12-05-2007 02:59 AM
Avoid the "optional resource assembly cannot be found" Erel Code Samples & Tips 1 07-12-2007 10:24 AM
simplest "clikable label" workaroud Cableguy Code Samples & Tips 0 05-31-2007 12:35 PM


All times are GMT. The time now is 01:08 PM.


Powered by vBulletin® Version 3.6.10
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.1.0