Change from wavplay to audioplayer

26 ビュー (過去 30 日間)
Hassan Bosha
Hassan Bosha 2019 年 2 月 24 日
コメント済み: Walter Roberson 2020 年 10 月 30 日
function play_Callback(hObject, eventdata, handles)
% hObject handle to play (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global stop file_name C;
stop=1;
equalizer_play();
function equalizer_play()
global stop file_name C;
[x,Fs]= audioread(file_name);
[a,b]=coef();
l_bucata=2*Fs;
Nb=round(length(x)/l_bucata);
y=0;
for i=1:floor(Nb)
bucata=x((i-1)*l_bucata+1:i*l_bucata);
for k=1:5
y=y+filter(10^(C(k)/20)*b{k},a{k},bucata);
if(stop==0)
break;
end
end
wavplay(y,Fs,'async');
y=0;
if(stop==0)
break;
end
end
i want to change this code to fit audioplayer() ?

採用された回答

Walter Roberson
Walter Roberson 2019 年 2 月 24 日
編集済み: Walter Roberson 2019 年 2 月 25 日
p = audioplayer(y, Fs);
playblocking(p);
Note that using playblocking() is not exactly the same as what you have now. Your current code loops back around and starts playing the new y for the next i while the first wavplay is still playing, and leaves up to floor(Nb) sounds playing simultaneously when the function returns. It is possible to emulate that behaviour, but is it really what you want?
  7 件のコメント
Hassan Bosha
Hassan Bosha 2019 年 2 月 26 日
will that possible to be done through my code ?
if it's can u show some code examples ?
Walter Roberson
Walter Roberson 2019 年 2 月 26 日

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

その他の回答 (1 件)

Jeje Ahmad
Jeje Ahmad 2020 年 10 月 29 日
Hi i am trying a code but give me this error
Undefined function or variable 'audioplayr'.
Error in CELP_RUN (line 31)
wavplay(x,8000); and my virsion matlab is 2016a
can you help me?
  4 件のコメント
Jeje Ahmad
Jeje Ahmad 2020 年 10 月 30 日
i am test this code but give me this errot
Undefined function or variable 'audioplayr'.
Error in CELP_RUN (line 34)
audioplayr(xhat1,8000);
Walter Roberson
Walter Roberson 2020 年 10 月 30 日
You need to create a file named audioplayr.m with content
function varargout = audioplayr(varargin)
[varargout{:}] = audioplayer(varargin{:});

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

カテゴリ

Help Center および File ExchangeAudio and Video Data についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by