compress audio signal recorded in GUI

1 回表示 (過去 30 日間)
Muhammad Talha Bashir
Muhammad Talha Bashir 2021 年 6 月 18 日
回答済み: Walter Roberson 2021 年 6 月 18 日
function pushbutton_Callback(hObject, eventdata, handles)
r=audiorecorder;
recordblocking(r,5);
play(r);
mr=getaudiodata(r);
axes(handles.axes1);
plot(mr);
In this code I want to apply compression on the recorded signal 'mr'.
  1 件のコメント
Rik
Rik 2021 年 6 月 18 日
The context of a GUI is almost never relevant, nor is it here.
You need to write code that does the compression you want. Then you can call that function in your GUI.
Have a read here and here. It will greatly improve your chances of getting an answer.

サインインしてコメントする。

採用された回答

Walter Roberson
Walter Roberson 2021 年 6 月 18 日
%one way of compressing
compressed_mr1 = mr(1:2:end,:);
%another way of compressing
compressed_mr2 = resample(mr(:,1), 8000, 22050);
%another way of compressing
tn = tempname;
fid = fopen(tn, 'w');
fwrite(fid, mr(:,1), 'double');
fclose(fid);
zip([tn '.zip'], tn);
fid = fopen([tn .zip'], 'r');
compressed_mr3 = fread(fid, [1 inf], '*uint8');
fclose(fid)

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMATLAB についてさらに検索

製品


リリース

R2015a

Community Treasure Hunt

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

Start Hunting!

Translated by