MATLAB: How to read the audio information of a file directly from internet

audioinfomp3ThingSpeak

% Enter your MATLAB Code below
options = weboptions('Timeout', 1000);
tStamp = datetime;
filename = webread('http://file-examples.com/wp-content/uploads/2017/11/file_example_MP3_5MG.mp3', options);
a= plot(filename);
info = audioinfo(filename);
I am getting following error:
Error using audioinfo
Expected FILENAME to be one of these types:
char, string
Instead its type was matlab.graphics.chart.primitive.Line.
Error in audioinfo (line 48)
validateattributes(filename, {'char', 'string'}, {'vector'}, mfilename, 'FILENAME');
Error in Custom (no starter code) 5 (line 7)
info = audioinfo(a);
I am using Thingspeak as I am not having a working MATLAB license currently.

Best Answer

The error message is clear: webread replies the data delevered from the internet. Therefore the name of the variable "filename" is misleading. Store the obtained data in a file and use the file name as input for audioinfo. But then you get only the parameters which have been defined during writing the file. The original frequency must be requested directly:
[data, freq] = webread('http://file-examples.com/wp-content/uploads/2017/11/file_example_MP3_5MG.mp3', options);
Related Question