IBM Watson Text to Speech Output File has No Sound - text-to-speech

I tried the IBM Watson Text to Speech curl example, it produced a .wav file. I also generated an .mp3, and .ogg files. none of them would play a sound output. I am using Windows 10.
curl -X POST -u "apikey:{my apikey}" --header "Content-Type: application/json" --data "text:hello world" --output hello_world.ogg "{my url}/v1/synthesize/"

If your audio files are not playing, then the chances are that they are not audio files. You are directing any output into your "audio" files, this includes any error messages. If you cat or browse an "audio" file, you will see that it contains text indicating why an audio file was not generated.
I guess this is a duplicate of Having issues with IBM Watson TTS using Curl
Answer update
Re: your comment - That error is typical of a json conversion error. Looking at the API documentation - https://cloud.ibm.com/apidocs/text-to-speech#synthesize - the API is expecting the input data in a json format.
ie.
--data "{\"text\":\"Hello world\"}"

Related

Downloading PDF report from kibana/elasticsearch using API call

I am trying to generate PDF reports and download them using a script. I followed below instructions.
https://github.com/elastic/kibana/blob/master/docs/user/reporting/automating-report-generation.asciidoc
I am able to queue the report and i also got a download url ()/api/.../download/xyzdrfd but when i am trying wget on the url, It's not working. I have no idea how to download that report using APIs so just tried with wget.
Can anyone tell me how to download the reports from API call?
The download might not be happening due to some redirects happening on the page. Use -L option with curl command to get it working. I did it specifically using the Kibana endpoint to download a PDF file. Replace the username and passsword with the basic auth credentials of yours. Use -o option to specify the downloaded file name. Below is the complete example of the command:
curl -L -u username:password -o download.pdf https://endpoint.com:9244/s/bi-/api/reporting/jobs/download/ktl8n95q001edfc210feaz0r

Telegram Bot API: voice message audio spectrogram is missing. A bug?

I'm developing a Telegram bot and I have a question about sendvoice API to send voice (audio) messages.
I push a OGG file converting from a MP3 source file, using ffmpeg for conversion, with the command:
$ ffmpeg -loglevel panic -i \
/path/to/la_piattaforma_telegram_è_perfetta.mp3 \
-c:a libopus -compression_level 10 -frame_duration 60 -vbr on -application voip \
/path/to/la_piattaforma_telegram_è_perfetta.ogg -y
BTW, the MIME type appears correct:
$ file --mime-type -b \
/path/to/la_piattaforma_telegram_è_perfetta.ogg
audio/ogg
The audio file is correctly played as expected, but the (minor) problem I have is that Telegram client (desktop/android/any) doesn't show the "waveform" (audio spectogram, as that in the blue widget in the image below), instead the waveform is visualized as a single line.
Any idea about how to show the waveform graphic? There is any specific OPUS format required to allow nice visualization?
$ mediainfo /path/to/la_piattaforma_telegram_è_perfetta.ogg
General
Complete name : /path/to/la_piattaforma_telegram_è_perfetta.ogg
Format : Ogg
File size : 5.37 KiB
Duration : 2 s 79 ms
Overall bit rate : 21.2 kb/s
Audio
ID : 1485113069 (0x588506ED)
Format : Opus
Duration : 2 s 79 ms
Channel(s) : 1 channel
Channel positions : Front: C
Sampling rate : 16.0 kHz
Compression mode : Lossy
Writing library : libopus unknown-fixed
The lack of the waveform visualization could be because the audio track is mono (1 channel)?
I solved the issue.
It was my fault/bug (mostly). I answer now to my self to share the solution I just found.
Telegram SendVoice API docs states audio file to be sent must be in an .OGG file encoded with OPUS,
so, as described in my question, I used ffmpeg to convert the original (source) file, that was an .MP3, to the .OGG required format.
Unfortunately, for a bug in my program I sent the MP3 original audio instead of the converted OGG :(
Weirdly, Telegram API accept the MP3 audio format WITHOUT errors, but in this case DOES NOT display the spectrogram (showing instead just a continuous line).
Now, by sending the correct .OGG file I get the expected spectrogram!
BTW, to be picky, there is still a MINOR bug on Telegram API, related to the specifications on the API endpoint documentation (sendVoice does accept ALSO .MP3 and not only .OGG files).

Telegram API SendVoice method sends voice as file

I'm trying to send voice message thorough SendVoice method but it sends the voice as a simple ogg file ( not playable ).
https://api.telegram.org/bot<token>/sendVoice?chat_id=x&voice=http://majidamiri.com/up/5.ogg
In the Telegram API SendVoice it points that the file should be in .ogg opus format , so I converted a mp3 file to opus ogg by ffmpeg with this code :
<?php $myConvert = exec('ffmpeg.exe -i 1.mp3 -acodec libopus -b:a 64k -vbr off -compression_level 10 5.ogg'); ?>
And again like before it sends it as file.
My ogg Link : https://majidamiri.com/up/5.ogg
Can you help me with this issue ?
Thank you all .
I finally made this work, with the help of Telegram support. This is an example with all the flags needed:
ffmpeg -i test.mp3 -ac 1 -map 0:a -codec:a opus -b:a 128k -vbr off -ar 24000 test.ogg
Tested on both Android and Telegram web.

How to download all my caldav and carddav data with one wget / curl?

Until now, I used Google Calender and do my personal backup with a daily wget of the public ".ics"Link.
Now I want to switch to a new Service who has only caldavaccess.
Is there a possibility to download all my caldav and carddav data with one wget / curl?
This downloaded data should give me the possibility to backup lost data.
Thanks in advance.
edit
I created a very simple php file which works in the way hmh explained. Don't know if this way works for different providers, but for mailbox.org, it works well.
You can find it here https://gist.github.com/ahemwe/a2eaae4d56ac85969cf2.
Please be more specific, what is the new service/server you are using?
This is not specifically CalDAV, but most DAV servers still provide a way to grab all events/todos using a single GET. Usually by targeting the relevant collection with a GET, e.g. like either one of those:
curl -X GET -u login -H "Accept: text/calendar" https://myserver/joe/home/
curl -X GET -u login -H "Accept: text/calendar" https://myserver/joe/home.ics
In CalDAV/CardDAV you can grab the whole contents of a collection using a PROPFIND:
curl -X PROPFIND -u login -H "Content-Type: text/xml" -H "Depth: 1" \
--data "<propfind xmlns='DAV:'><prop><calendar-data xmlns='urn:ietf:params:xml:ns:caldav'/></prop></propfind>" \
https://myserver/joe/home/
Replace calendar-data with
<address-data xmlns="urn:ietf:params:xml:ns:carddav"/>
for CardDAV.
This will give you an XML entity which has the iCal/vCard contents embedded. To restore it, you would need to parse the XML and extract the data (not hard).
Note: Although plain standard, some servers reject that or just omit the content (lame! file bug reports ;-).
Specifically for people using Baïkal (>= 0.3.3; other Sabre/dav-based solutions will be similar), you can go directly to
https://<Baïkal location>/html/dav.php/
in a browser and get an html interface that allows you to download ics files, and so also allows you to find the right links for those for use with curl/wget.
I tried the accepted answer which did not work for me. With my CalDAV calendar provider I can, however, retrieve all calendar files using
wget -c -r -l 1 -nc --user='[myuser]' --password='[mypassword]' --accept=ics '[url]'
where [myuser] and [mypassword] are what you expect and [url] is the same URL as the one that you enter in your regular CalDAV software (as specified by your provider).
The command creates a directory containing all the ICS-files representing the calendar items. A similar command works for my addressbook.

Can't upload file to a server using curl

I'm trying to upload a file to a server using curl. It should be uploaded a binary file regardless the format it is in. But I'm having an error:
curl -d #/home/alex/123.log localhost:9000/myupload/
The error (the warning, actually) is
Warning: Couldn't read data from file "123.log", this makes an empty POST.
P.S. Shouldn't I use --data-binary instead of -d? I didn't find any documentation for --data-binary.
Copied from Curl's document:
-d, --data is the same as --data-ascii. To post data purely binary, you should instead use the --data-binary option. To URL-encode the value of a form field you may use --data-urlencode.
More about the --data-binary parameter.
Note: Make sure you have permission to access the file that you wanted to upload to the sever.