real-凯发k8网页登录

main content

real-time parameter tuning

parameter tuning is the ability to modify parameters of your audio system in real time while streaming an audio signal. in algorithm development, tunable parameters enable you to quickly prototype and test various parameter configurations. in deployed applications, tunable parameters enable users to fine-tune general algorithms for specific purposes, and to react to changing dynamics.

audio toolbox™ is optimized for parameter tuning in a real-time audio stream. the system objects, blocks, and audio plugins provide various tunable parameters, including sample rate and frame size, making them robust tools when used in an audio stream loop.

to optimize your use of audio toolbox, package your audio processing algorithm as an audio plugin. packaging your audio algorithm as an audio plugin enables you to graphically tune your algorithm using or :

  • –– creates a user interface (ui) for tunable parameters, enables you to specify input and output from your audio stream loop, and provides access to analysis tools such as the time scope and spectrum analyzer. packaging your code as an audio plugin also enables you to quickly synchronize your parameters with midi controls.

  • –– creates a ui for tunable parameters that can be used from any matlab® programmatic environment. you can customize your parameter controls to render as knobs, sliders, rocker switches, toggle switches, check boxes, or drop-downs. you can also define a custom background color, background image, or both. you can then place your audio plugin in an audio processing loop in a programmatic environment such as a script, and then tune parameters while the loop executes.

for more information, see .

other methods to create uis in matlab include:

  • app designer –– development environment for a large set of interactive controls with support for 2-d plots. see for more information.

  • programmatic workflow –– use matlab functions to define your app element-by-element. this tutorial uses a programmatic approach.

see for a more detailed list of the costs and benefits of the different approaches to parameter tuning.

programmatic parameter tuning

if you can not package your algorithm as an audio plugin, you can create a tuning ui using basic matlab techniques.

this tutorial contains three files:

  1. parameterref –– class definition that contains tunable parameters

  2. parametertuningui –– function that creates a ui for parameter tuning

  3. audioprocessingscript –– script for audio processing

inspect the diagram for an overview of how real-time parameter tuning is implemented. to implement real-time parameter tuning, walk through the example for explanations and step-by-step instructions.

1. create class with tunable parameters

to tune a parameter in an audio stream loop using a ui, you need to associate the parameter with the position of a ui widget. to associate a parameter with a ui widget, make the parameter an object of a handle class. objects of handle classes are passed by reference, meaning that you can modify the value of the object in one place and use the updated value in another. for example, you can modify the value of the object using a slider on a figure and use the updated value in an audio processing loop.

open the class definition file.

classdef parameterref < handle
    properties
        name
        value
    end
end

objects of the parameterref class have a name and value. the name is for display purposes on the ui. you use the value for tuning.

2. create function to generate a ui

the parametertuningui function accepts your parameter, specified as an object handle, and the desired range. the function creates a figure with a slider associated with your parameter. the nested function, slidercb, is called whenever the slider position changes. the slider callback function maps the position of the slider to the parameter range, updates the value of the parameter, and updates the text on the ui. you can easily modify this function to tune multiple parameters in the same ui.

 

3. create script for audio processing

the audio processing script:

  1. creates input and output objects for an audio stream loop.

  2. creates an object of the handle class, parameterref, that stores your parameter name and value.

  3. calls the tuning ui function, parametertuningui, with your parameter and the parameter range.

  4. processes the audio in a loop. you can tune your parameter, x, in the audio stream loop.

 

while the script runs, move the position of the slider to update your parameter value and hear the result.

see also

|

related topics

网站地图