Streaming or sending audio data to ThingSpeak | General | Forum

Avatar

Please consider registering
Guest

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —






— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed sp_TopicIcon
Streaming or sending audio data to ThingSpeak
No permission to create posts
March 4, 2019
9:01 am
Avatar
ArunPradhan
New Member
Members
Forum Posts: 2
Member Since:
March 4, 2019
sp_UserOfflineSmall Offline

Hi ,

I am trying to develop IoT based Audio Analytics using ThingSpeak cloud

Hi ,
I am planing to capture Audio using MIC from PC /Matlab or using other device like RaspberryPi

Anybody can help me on how to stream Audio data from Mic to ThinkSpeak cloud , can I use MQTT or other REST API Like HTTP with WebSockets ?
If then, Then how ? Any example ? It would be best to do so in real time as well.

Even if I bring , then how to save audio in .wav file ? How to send wave file to user to their mobile?

Thanks
Arun

March 4, 2019
3:31 pm
Avatar
cstapels
Moderator
Members


Moderators
Forum Posts: 861
Member Since:
March 7, 2017
sp_UserOfflineSmall Offline

ThingSpeak is finely tuned for uploading low sample rate data. However, it is possible to use the full capability of ThingSpeak to send and playback audio data. We have succeeded in sending compressed audio files by using the full 255 characters in each field and also the location and status fields. You will then need to decode the data on the receive side. Since you have access to MATLAB, the many steps of encoding and decoding can be completed fairly easily, but sending so much data will consume messages on ThingSpeak. A paid license will greatly increase the potential through put.
Please consider sharing your encoding and decoding scripts on File Exchange if you are able to get it working.

March 5, 2019
6:46 am
Avatar
ArunPradhan
New Member
Members
Forum Posts: 2
Member Since:
March 4, 2019
sp_UserOfflineSmall Offline

Hi ,

Thanks for your reply .

I can down Sample to reduce the the size , I need to send minimum of minimum duration 1 minute.
Let's say , my sample rate is kHz , then 4000 samples ( 16 bit size each sample ) per second ,so , in 60 second 24000 samples in total
I am new in ThinkSpeak , I have these questions
1) This means , character buffer size is 255 bytes , i.e , 256 samples in each buffer that I can send each time from my sensor node /PC
How do I insert such buffer of 255 characters in channel filed and send using ThinkSpeak RESTfull API ? Any example ?
2) I believe I have to loop this request 24000/256 = 94 times , right ? How do I do this looping ?
3) Do I need to wait for response for sending next chunk in the loop ?
4) Similarly , how I do retrieve these chunks of 256 samples buffer in ThinkSpeak cloud and combine to get this 1 minute duration Finally , Any example ?

Thanks
Arun

March 5, 2019
9:40 am
Avatar
cstapels
Moderator
Members


Moderators
Forum Posts: 861
Member Since:
March 7, 2017
sp_UserOfflineSmall Offline

I would strongly recommend going through the Getting Started tutorial to orient yourself with ThingSpeak processes. Its pretty quick, and covers a lot of our features.
https://www.mathworks.com/help/thingspeak/getting-started-with-thingspeak.html

Regarding your questions:
1. There are several ways to write date to ThingSpeak, covered here: https://www.mathworks.com/help/thingspeak/write-data.html
Specifically the REST API for writing data (with lots of examples) is here:
https://www.mathworks.com/help/thingspeak/writedata.html
I am not sure how fast you will want to ingest your data. You may be able to get higher throughput with a bulk write, which allows you to write multiple entries with one POST>
https://www.mathworks.com/help/thingspeak/bulkwritejsondata.html
if your samples were 1 byte each, you can save 2805 in a single entry (8 fields,status and lat/long). You also may be able to use compression to do better.
You could use approximately 9 entries to upload 1 minute of your data.

2. The rate limit will make looping difficult in a single MATLAB script. You can write a single script and then use the TimeControl app to call the script at regular intervals.
https://www.mathworks.com/help/thingspeak/timecontrol-app.html AS I described above, you may be able to use the bulk write feature to complete the task in fewer repetitions.

3. Yes you will need to wait before writing additional data, up to 15 seconds for a free account. The rate limits are described in the how to buy page:
https://thingspeak.com/prices

4. Here are the ways to read data from a channel:
https://www.mathworks.com/help/thingspeak/read-data-from-channel.html

Four your case, since you probably want to analyze the data with MATLAB, I would use a MATLAB analysis to read the data, starting with thingSpeakRead.
https://www.mathworks.com/help/thingspeak/thingspeakread.html

Then you can process the data in the script, and possibly re write the data to another channel.
Here is an example showing how to read data from a channel, process it, and the write it back to another channel:
https://www.mathworks.com/help/thingspeak/remove-outliers-from-wind-speed-data.html

Forum Timezone: America/New_York

Most Users Ever Online: 166

Currently Online:
15 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

rw950431: 272

Vinod: 240

piajola: 95

turgo: 70

vespapierre: 63

Adarsh_Murthy: 62

Member Stats:

Guest Posters: 1

Members: 8665

Moderators: 1

Admins: 2

Forum Stats:

Groups: 3

Forums: 14

Topics: 1600

Posts: 5760

Newest Members:

khanhNguyen_CT, susyburr, quijano__, meosuckhoe, briskpanda, Dejw0089

Moderators: cstapels: 460

Administrators: Hans: 405, lee: 457