Borrar filtros
Borrar filtros

How to do real-time audio information tracking using ThingSpeak when an Audio file is being played in MATLAB?

2 visualizaciones (últimos 30 días)
Hi
I am using the following code in 'ThingSpeak' to read information from a weblocation where the music file resides, and playing it using MATLAB 'audioplayer'
options = weboptions('Timeout', 1000) % Set Timeout to 1000 seconds
filename = webread('http://file-examples.com/wp-content/uploads/2017/11/file_example_MP3_5MG.mp3', options) % Read file from weblocation
a = audioinfo(char('filename')) % Read audio Information (working for local files, but Error using audioinfo (line 51) The filename specified was not found in the MATLAB path. Error in AudioFileHandling (line 4) a = audioinfo(char('filename'))
tout = (0:(a.Duration))' %Duration of file
[y, Fs] = audioread(char('filename')) %Reading audio file in terms of data and sampling frequency
player = audioplayer(y, Fs) %play audio
sound(y,Fs) % play sound
tStamp = datetime % Simulation time
I am using following codes to write the information in real-time to my channel on ThingSpeak
writeApiKey = '17SAMBZBPAWHPXEE' %Write API Key
channelID = 629096 %Channel ID
save thingSpeakApi.mat writeApiKey channelID %Mat File info
load thingSpeakApi %Mat file loading
thingSpeakURL = 'http://api.thingspeak.com' %URL
thingSpeakWriteURL = [thingSpeakURL '/update'] %Write URL
fieldName = 'field1' % Field name
fieldValue = a % assigning with filename audioinfo a
response = webwrite(thingSpeakWriteURL,'api_key',writeApiKey,fieldName,fieldValue) % Local response output
But what is happening that the code get simulated and then the file plays instead of realtime, and the information gets written in bulk on ThingSpeak channel which generally leads to timeout. Please let me know a solution in this regard. May we store the audio file itself in ThingSpeak?

Respuestas (0)

Comunidades de usuarios

Más respuestas en  ThingSpeak Community

Categorías

Más información sobre Audio I/O and Waveform Generation en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by