how do I store a few seconds of an mp3 stream using matlab.net.http?
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
I'd like to assign 5 seconds of audio from the following http mp3 stream to a matlab variable using matlab.net.http:
I'm new to matlab.net.http, so any suggestions would be most welcome.
0 Commenti
Risposte (1)
Infinite_king
il 29 Mag 2024
Hi David Sears,
The simplest solution is to download the entire audio and then cut out the unnecessary portion. This can be easily achieved using 'webread'.
% Downloading the audio into MATLAB variables
options = weboptions("ContentType", "audio");
[data, fs] = webread('http://radio.garden/api/ara/content/listen/tMGsmGxF/channel.mp3', options);
% Method 1 ---------------------------
% Saving the audio
audiowrite('audio.mp3', data, fs);
% Reading the first 5 seconds of the audio
[data2, fs2] = audioread('audio.mp3', [1, 5 * fs]);
% Method 2 ----------------------------
% Directly trim the audio from raw data
data3 = data(1:5 * fs, :);
For more information on the above MATLAB functions, refer the following resources,
Hope this is helpful.
0 Commenti
Vedere anche
Categorie
Scopri di più su Audio and Video Data in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!