How to implement tic, toc and pause in audioPlugins?

1 次查看(过去 30 天)
I'm implementing a digital delay using real-time audio plugins. I need a button on the GUI that does the same of this code. Basically I want to give the delay time as an average time between 4 inputs, using a dedicated button on the GUI to avoid knowing the exact value of such time in milliseconds. I'm sure I cannot just use this code, is there an "optimal way" to do it?
a = zeros(1,4);
disp('Press now to start the sequence')
pause
tic
%requesting input
disp('Press')
pause
a(1) = toc;
tic
%requesting input
disp('Press')
pause
a(2) = toc;
tic
%requesting input
disp('Press')
pause
a(3) = toc;
tic
%requesting input
disp('Press')
pause
a(4) = toc;
%average
time = mean(a);

回答(1 个)

Kevin Holly
Kevin Holly 2022-9-29
If you are trying to create a UI, you could create an app with App Designer as shown attached. Let me know if this addresses your question.
  1 个评论
Lorenzo Tonelli
Lorenzo Tonelli 2022-9-29
I'm forced to use the UI designer with object oriented languages, this one:
properties (Constant)
PluginInterface = audioPluginInterface(...
audioPluginParameter('DoubleEcho', ...
'Style','vtoggle', ...
'Layout',[2,6], ...
'DisplayNameLocation','Above'),...
audioPluginParameter('Gain', ...
'DisplayName','Echo Level', ...
'Mapping', {'lin',0,3}, ...
'Style', 'rotaryknob', ...
'Layout', [2,1], ...
'DisplayNameLocation','Above'), ...
audioPluginParameter('Time',...
'DisplayName', 'Echo Time',...
'Mapping', {'lin',0,1}, ...
'Label', 'Seconds', ...
'Style', 'rotaryknob', ...
'Layout', [2,2], ...
'DisplayNameLocation','Above'),...
audioPluginParameter('Repetitions', ...
'DisplayName', 'Repetitions',...
'Mapping',{'int',1,2}, ...
'Style', 'rotaryknob', ...
'Layout', [2,4], ...
'DisplayNameLocation','Above'), ...
audioPluginParameter('Mode', ...
'DisplayName', 'Amplitude Decay Mode', ...
'Mapping', {'enum' , 'Linear', 'Exponential','Aggressive'}, ...
'Style', 'dropdown', ...
'Layout', [4,1;4,2], ...
'DisplayNameLocation','Above'), ...
audioPluginGridLayout(...
'RowHeight', [ 20, 130, 20, 30, 80], ...
'ColumnWidth', [100, 100, 40, 80, 20, 80]) ...
)

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Simulation, Tuning, and Visualization 的更多信息

产品


版本

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by