Filter löschen
Filter löschen

How to implement tic, toc and pause in audioPlugins?

1 Ansicht (letzte 30 Tage)
Lorenzo Tonelli
Lorenzo Tonelli am 29 Sep. 2022
Kommentiert: Lorenzo Tonelli am 29 Sep. 2022
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);

Antworten (1)

Kevin Holly
Kevin Holly am 29 Sep. 2022
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 Kommentar
Lorenzo Tonelli
Lorenzo Tonelli am 29 Sep. 2022
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]) ...
)

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Simulation, Tuning, and Visualization finden Sie in Help Center und File Exchange

Produkte


Version

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by