Alexa Audio Streaming - audio

Is there anything immediately wrong with this response that would cause it to be “invalid”?
{
"type": "AudioPlayer.Play",
"playBehavior": "string",
"audioItem": {
"stream": {
"url": "https://19303.live.streamtheworld.com/WUOMFM.mp3",
"token": "thisisanaudiotoken",
"expectedPreviousToken": "string",
"offsetInMilliseconds": 0
}
}
}
It should just begin streaming the .mp3

There is nothing wrong with the response but audio should be encoded to specific format for Alexa to play it. Please convert your audio using below command,
ffmpeg -i <input-file> -ac 2 -codec:a libmp3lame -b:a 48k -ar 16000 <output-file.mp3>
You can download 'ffmpeg ' from https://www.ffmpeg.org/
If you are using windows CD to the bin folder of ffmeg before run above command.

Related

OpenAI: Stream interrupted (client disconnected)

I'm trying OpenAI.
I have prepared the training data, and used fine_tunes.create. Several minutes later, it showed Stream interrupted (client disconnected).
$ openai api fine_tunes.create -t data_prepared.jsonl
Upload progress: 100%|██████████████████████████████████████████████| 47.2k/47.2k [00:00<00:00, 44.3Mit/s]
Uploaded file from data_prepared.jsonl: file-r6dbTH7rVsp6jJMgbX0L0bZx
Created fine-tune: ft-JRGzkYfXm7wnScUxRSBA2M2h
Streaming events until fine-tuning is complete...
(Ctrl-C will interrupt the stream, but not cancel the fine-tune)
[2022-12-02 11:10:08] Created fine-tune: ft-JRGzkYfXm7wnScUxRSBA2M2h
[2022-12-02 11:10:23] Fine-tune costs $0.06
[2022-12-02 11:10:24] Fine-tune enqueued. Queue number: 11
Stream interrupted (client disconnected).
To resume the stream, run:
openai api fine_tunes.follow -i ft-JRGzkYfXm7wnScUxRSBA2M2h
I tried fine_tunes.follow, several minutes later, it still failed:
$ openai api fine_tunes.follow -i ft-JRGzkYfXm7wnScUxRSBA2M2h
[2022-12-02 11:10:08] Created fine-tune: ft-JRGzkYfXm7wnScUxRSBA2M2h
[2022-12-02 11:10:23] Fine-tune costs $0.06
[2022-12-02 11:10:24] Fine-tune enqueued. Queue number: 11
Stream interrupted (client disconnected).
To resume the stream, run:
openai api fine_tunes.follow -i ft-JRGzkYfXm7wnScUxRSBA2M2h
openai api fine_tunes.list showed:
$ openai api fine_tunes.list
{
"data": [
{
"created_at": 1669975808,
"fine_tuned_model": null,
"hyperparams": {
"batch_size": 2,
"learning_rate_multiplier": 0.1,
"n_epochs": 4,
"prompt_loss_weight": 0.01
},
"id": "ft-JRGzkYfXm7wnScUxRSBA2M2h",
"model": "curie",
"object": "fine-tune",
"organization_id": "org-YyoQqNIrjGHYDnKt9t3T6x2J",
"result_files": [],
"status": "pending",
"training_files": [
{
"bytes": 47174,
"created_at": 1669975808,
"filename": "data_prepared.jsonl",
"id": "file-r6dbTH7rVsp6jJMgbX0L0bZx",
"object": "file",
"purpose": "fine-tune",
"status": "processed",
"status_details": null
}
],
"updated_at": 1669975824,
"validation_files": []
}
],
"object": "list"
}
And $ openai api completions.create -m ft-JRGzkYfXm7wnScUxRSBA2M2h -p aprompt returned Error: That model does not exist (HTTP status code: 404).
Could anyone help?
Apparently, there is a problem with the OpenAI API. (see: this reddit post and this issue on Git) I downgraded my version to v.0.25 by running
pip install openai==0.25.0
That fixed it for me. Although, to be fair, you can expect this to be fixed in the future.
It was a temporary issue of OpenAI, the team fixed that.

Understand ookla speedtest json values

I'm having some difficulties matching the json results with the values shown on the website:
I run the test with speedtest -f json-pretty -u bps
{
"type": "result",
"timestamp": "2022-03-16T01:40:00Z",
"ping": {
"jitter": 68.655000000000001,
"latency": 11.285
},
"download": {
"bandwidth": 804925,
"bytes": 5394240,
"elapsed": 6706
},
"upload": {
"bandwidth": 97467,
"bytes": 1321920,
"elapsed": 15005
},
"result": {
"id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"url": "https://www.speedtest.net/result/c/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"persisted": true
}
}
But when I go to the url, I see this:
How do those 3 download values become 6.44Mbps ?
Those 3 values mean:
Bandwidth - Actual internet download speed in Bps (Bytes per second), from man speedtest:
The human-readable format defaults to Mbps
and any machine-readable formats (csv, tsv, json, jsonl, json-pretty) use bytes as the unit of measure with max precision.
To get value in Mbps, as in following image you have to divide it by 125000:
The bytes per second measurements can be transformed into the human-readable output format default unit of megabits (Mbps) by dividing the bytes per second value by 125,000.
Bytes - Volume of data used during the test (also in bytes)
Elapsed - Duration of testing download speed, in ms - how much time the testing took.

how to convert linear16 text-to-speech to audio file

I just started to play with Google Text-To-Speech API. I generated a post request to:
https://texttospeech.googleapis.com/v1/text:synthesize?fields=audioContent&key={YOUR_API_KEY}
with the following data:
{
"input": {
"text": "Hola esto es una prueba"
},
"voice": {
"languageCode": "es-419"
},
"audioConfig": {
"audioEncoding": "LINEAR16",
"speakingRate": 1,
"pitch": 0
}
}
and I got a 200 response, with the content:
{
"audioContent" : "UklGRn6iCwBXQVZFZm10I...(super long string)"
}
I am assuming this is encoded (or decoded, not sure about the naming), but I would like to actually hear what is that "audioContent".
As Tanaike pointed out, the response is indeed Base64. To actually listen the audio, I pasted the base64 encoded string into a file, then ran:
base64 -d audio.txt > audio.wav
and that made the trick.

Chrome extension: Can't make chrome.desktopCapture.chooseDesktopMedia capture window audio

I'm trying to use the chrome.desktopCapture.chooseDesktopMedia API in order to capture audio from the extension window.
I'm sending the capture request from the popup.js page.
Manifest:
{
"background": {
"scripts": [ "background.js" ]
},
"browser_action": {
"default_icon": "style/icons/icon16.png",
"default_title": "__MSG_name__"
},
"default_locale": "en",
"description": "__MSG_description__",
"icons": {
"128": "style/icons/icon128.png"
},
"manifest_version": 2,
"name": "__MSG_extName__",
"permissions": ["activeTab","desktopCapture"],
"offline_enabled": true,
"short_name": "__MSG_short__",
"version": "1.0.9"
}
function:
chrome.desktopCapture.chooseDesktopMedia(["window"], function (streamId) {
var audioStream = navigator.mediaDevices.getUserMedia({
audio: true,
chromeMediaSource: 'desktop',
chromeMediaSourceId: streamId
});
audioStream.then(function (mediaStream) {...}
I have tried using different parameters, but whenever I omit: audio:true, I get :
Failed to execute 'getUserMedia' on 'MediaDevices': At least one of
audio and video must be requested(…).
The following code doesn't appear in the API, but I've read about it here and tried it, the previous error applies to it as well:
audio: {
mandatory: {
chromeMediaSource: 'desktop',
chromeMediaSourceId: streamId
}
}
When I do use audio:true, it records the mic, even though I get the source window selection dialog.
What am I doing wrong?
After experimenting with the code a bit, it seems to me like the only way to capture the system audio is through the video parameter. I wasn't able to capture a non-mic audio using the audio parameter. The screen recorder app is doing the same thing - system audio is recorded through the video.

Not receiving notifications using Instagram Realtime API

I'm using the Intagram Realtime API which the doc is here https://instagram.com/developer/realtime/ in order to receive a notification every time someone takes a picture in a geofence.
I'm using this structure but my URL is not being called when I take a photo inside the fence:
curl -F 'client_id=CLIENT-ID' \
-F 'client_secret=CLIENT-SECRET' \
-F 'object=geography' \
-F 'aspect=media' \
-F 'lat=35.657872' \
-F 'lng=139.70232' \
-F 'radius=1000' \
-F 'callback_url=http://my_public_url' \
https://api.instagram.com/v1/subscriptions/
Trying to list the Instagram subscriptions in order to see if my subscription is there, I got the following response:
{
"meta": {
"code": 200
},
"data": [{
"object": "geography",
"object_id": "12921209",
"aspect": "media",
"callback_url": "http://my_public_url",
"type": "subscription",
"id": "19351203"
}]
}
The weird thing to notice is that the fields, lat, lng and radius are not being shown.
Any ideas how to make everything work?
You need to query Instagram with that location ID after you receive a notification that new media has been posted matching your criteria. That object is designed to let you know what you need to ask Instagram for, not to give you media info.

Resources