Main Content


Visualize audio levels in audio meter display

Since R2023b



    visualize(lvlMeter) opens an audio meter display using a uiaudiometer component. The meter is updated with the computed audio peak levels as the simulation progresses.

    uimeter = visualize(lvlMeter) returns a handle to the audio meter UI component.


    collapse all

    Create an audioLevelMeter object and call visualize to open an audio meter display.

    lvlMeter = audioLevelMeter;

    Create an audio file reader and a device writer to stream audio from a file and play it on your device.

    reader = dsp.AudioFileReader("FunkyDrums-44p1-stereo-25secs.mp3");
    player = audioDeviceWriter(SampleRate=reader.SampleRate);

    In an audio stream loop, read the audio from the file and play it to your device. The audio meter visualization updates at each call.

    while ~isDone(reader)
        audioIn = reader();

    Input Arguments

    collapse all

    Audio level meter object to visualize, specified as an audioLevelMeter object.

    Output Arguments

    collapse all

    Audio meter UI component, returned as a handle to the uiaudiometer component. You can use the handle to change the properties specified in Meter Properties.

    Version History

    Introduced in R2023b