How to implement tic, toc and pause in audioPlugins?

2 visualizaciones (últimos 30 días)
Lorenzo Tonelli
Lorenzo Tonelli el 29 de Sept. de 2022
Comentada: Lorenzo Tonelli el 29 de Sept. de 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);

Respuestas (1)

Kevin Holly
Kevin Holly el 29 de Sept. de 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 comentario
Lorenzo Tonelli
Lorenzo Tonelli el 29 de Sept. de 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]) ...
)

Iniciar sesión para comentar.

Categorías

Más información sobre Simulation, Tuning, and Visualization en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by