and again dll and market - page 22

 
Renat Fatkhullin:

Found out why chunked responses from the IBM service are not accepted:

They had incorrect formatting in the Transfer-Encoding response header, where they put a double space instead of a single space. The protocol allows this, but our parser didn't take it into account.

That's why we misread the chunked/sliced stream and couldn't wait for it to finish.


There will be a fix in the next beta. Most likely today.


We launched an embedded Text2Speech service back in the MetaQuotes platform around 2002, but it was kicked out due to poor implementation. Most likely, it will be added to the terminal and MQL5 as a standard functionality.

This is the manly way!

I was too excited about cocoa :)

 
Nikolai Karetnikov:

that's manly!

I got a little excited about cocoa :)

But, for you, the problem will remain up to the standard TEXT TO SPEECH integration. Either 10,000 characters for ALL users of your EA, or a paid plan from IBM for $0.02/1000 words. What to do with the article then? What will you do, if it's not a secret?

 

Here's a working script:

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void OnStart()
  {
   char    post[],result[];
   string  url="https://api.eu-gb.text-to-speech.watson.cloud.ibm.com/instances/9886a3ce-5734-455f-8f78-7a56381da686/v1/synthesize?text=TEST";
   string  headers="Authorization: Basic YXBpa2V5OkdSMWJiM3pWTXM5ZmNOS0w2cEE5LTV6ajlwdFdsaUN1NmVoOW91cFVucFpC\r\n";
   string  result_headers;
   int     status;
//---
   status=WebRequest("GET",url,headers,100000,post,result,result_headers);
   if(status==-1)
     {
      Print("Ошибка в WebRequest. Код ошибки  =",GetLastError());
      //---
      StringSetLength(url,StringFind(url,"/",8));
      MessageBox("Необходимо добавить адрес '"+url+"' в список разрешенных URL во вкладке 'Советники'","Ошибка",MB_ICONINFORMATION);
     }
   else
     {
      if(status==200)
        {
         //--- успешная загрузка
         PrintFormat("Файл успешно загружен, размер %d байт.",ArraySize(result));
         PrintFormat("Заголовки сервера: %s",result_headers);
         //--- сохраняем данные в файл
         int filehandle=FileOpen("result.ogg",FILE_WRITE|FILE_BIN);
         if(filehandle!=INVALID_HANDLE)
           {
            //--- сохраняем содержимое массива result[] в файл
            FileWriteArray(filehandle,result,0,ArraySize(result));
            //--- закрываем файл
            FileClose(filehandle);
           }
         else
            Print("Ошибка в FileOpen. Код ошибки =",GetLastError());
        }
      else
         PrintFormat("Ошибка загрузки '%s', код %d",url,status);
     }
  }
 
Renat Fatkhullin:

Here's a working script:

the script loads some file result.ogg.

only it is not clear, what is this file ? how to listen to it ?

I tried it in a different format.

Snapshot1

Snapshot2

 
Alexsandr San:

the script loads some file result.ogg.

only it's not clear, what is this file ? how can i listen to it ?

I tried it in a different format.


and here I am a plain text of two English words (Traders Forum.txt)

Photo by

Snapshot3

Files:
 

I understand that it is possible to send (file.txt) and receive it in ( file.wav) format

------------------------------------------

here is the script WebRequest.mq5 inWebRequest.wav

Shot4

Picture5

Files:
WebRequest.zip  5806 kb
 
Alexsandr San:
I understand that you could somehow arrange to send (file.txt) and receive it in ( file.wav) format

At the moment, this is not very cost-effective. That is, IBM's service sends files that are not yet readable by WebRequest (should be fixed soon), but even when they are, free use of theText to Speech serviceis limited to 10,000 characters per month. That is, they'll convert a small paragraph and that's it. There is a paid option (this is for those who really need it). Perhaps if you find a free text dubbing service without restrictions, you can try to make up all over again. But I don't think there are any...

We are reassured by introduction ofText to Speech in terminal and language, which would be certainly gorgeous for AI developers, but, it will take time. Imho, it's better to wait now...

 
Alexsandr San:

the script loads some result.ogg file.

Beta 2472 is already available and it works with the IBM service.

This service does not output files in wav, but in ogg format.

 
google can wav and 4m characters free (or 1m with network processing) per month
 
Renat Fatkhullin:

Here's a working script:

Yes! )