필터 지우기
필터 지우기

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

조회 수: 2 (최근 30일)
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?

답변 (0개)

커뮤니티

더 많은 답변 보기:  ThingSpeak 커뮤니티

카테고리

Help CenterFile Exchange에서 Audio I/O and Waveform Generation에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by