主要内容

parametertuner

Tune object parameters while streaming

描述

example

H= parameterTuner(obj)创建一个参数调整UI并返回图形句柄,H.

例子

全部折叠

parametertuner使您能够以图形方式调整多个对象的参数。在此示例中,您使用交叉过滤器将信号分为多个子带,然后对子带应用不同的效果。

创建一个dsp.AudioFileReaderto read in audio frame-by-frame. Create anaudioDeviceWriter将音频写入您的声卡。

filereader = dsp.audiofilereader('Funkydrums-48-Stereo-25secs.mp3',...'PlayCount',2);deviceWriter = audioDeviceWriter ('SampleRate',fileReader.mamplater);

创建一个跨界式滤波器有两个分频器将音频分为三个频段。称呼可视化绘制过滤器的频率响应。称呼parametertunerto open a UI to tune the crossover frequencies while streaming.

xFilt = crossoverFilter('SampleRate',fileReader.mamplater,'NumCrossovers',2);可视化(xFilt) parameterTuner(xFilt)

Create two压缩机objects to apply dynamic range compression on two of the subbands. Call可视化to plot the static characteristic of both of the compressors. Callparametertunerto open UIs to tune the static characteristics.

cmpr1 = compressor('SampleRate',fileReader.mamplater);可视化(cmpr1) parameterTuner(cmpr1)

cmpr2 = compressor('SampleRate',fileReader.mamplater);可视化(cmpr2) parameterTuner(cmpr2)

创建一个nAudiopluginexample.chorus将合唱效果应用于其中一个乐队。称呼parametertuner打开UI来调整合唱插件参数。

chorus = audiopluginexample.Chorus; setSampleRate(chorus,fileReader.SampleRate); parameterTuner(chorus)

在音频流循环中:

  1. 在文件中阅读音频框架。

  2. Split the audio into three bands using the crossover filter.

  3. 将动态范围压缩应用于第一和第二频段。

  4. Apply a chorus effect to the third band.

  5. Sum the audio bands.

  6. Write the frame of audio to your audio device for listening.

尽管〜ISDONE(FILEREADER)AUDIOIN = FILEREADER();[b1,b2,b3] = xFilt(audioIn); b1 = cmpr1(b1); b2 = cmpr2(b2); b3 = process(chorus,b3); audioOut = b1+b2+b3; deviceWriter(audioOut); drawnowlimitrate% Process parameterTuner callbacksend

作为最佳实践,请释放一旦完成的对象。

release(fileReader) release(deviceWriter)

创建一个dsp.AudioFileReaderto read in audio frame-by-frame. Create anaudioDeviceWriter将音频写入您的声卡。UseloadAudioPluginto load an equalizer plugin. If you are using a Mac, replace the.dllfile extension with.vst.

filereader = dsp.audiofilereader('Funkydrums-48-Stereo-25secs.mp3');deviceWriter = audioDeviceWriter ('SampleRate',fileReader.mamplater);插件路径= fullfile(matlabroot,'工具箱/音频/示例/parametricequalizer.dll');eq = loadaudioplugin(插件路径);setSamplate(eq,filereader.samplerate);

称呼parametertuner在流中打开UI以调整均衡器的参数。

参数量(EQ)

在音频流循环中:

  1. 在文件中阅读音频框架。

  2. 应用均衡。

  3. Write the frame of audio to your audio device for listening.

尽管〜ISDONE(FILEREADER)AUDIOIN = FILEREADER();audioOut = process(eq,audioIn); deviceWriter(audioOut); drawnowlimitrate% Process parameterTuner callbacksend

作为最佳实践,请释放一旦完成的对象。

release(fileReader) release(deviceWriter)

创建一个dsp.AudioFileReaderto read in audio frame-by-frame. Create anaudioDeviceWriter将音频写入您的声卡。创建一个naudiopluginexample.Flangerto process the audio data and set the sample rate.

filereader = dsp.audiofilereader('Rockguitar-16-96-Stereo-72Secs.flac');deviceWriter = audioDeviceWriter ('SampleRate',fileReader.mamplater);flanger = audiopluginexample.Flanger; setSampleRate(flanger,fileReader.SampleRate);

称呼parametertuner在流中打开一个UI以调整鞭打者的参数。

参数量(鞭毛)

在音频流循环中:

  1. 在文件中阅读音频框架。

  2. 施加法兰。

  3. Write the frame of audio to your audio device for listening.

尽管〜ISDONE(FILEREADER)AUDIOIN = FILEREADER();AudioOut = Process(Franger,Audioin);DeviceWriter(AudioOut);绘制limitrate% Process parameterTuner callbacksend

作为最佳实践,请释放一旦完成的对象。

release(fileReader) release(deviceWriter)

创建一个dsp.AudioFileReaderto read in audio frame-by-frame. Create anaudioDeviceWriter将音频写入您的声卡。创建一个压缩机to process the audio data. Call可视化to plot the static characteristic of the压缩机.

Framelength = 1024;filereader = dsp.audiofilereader('Rockdrums-44p1-stereo-11secs.mp3',...'SamplesPerFrame',FrameLength);deviceWriter = audioDeviceWriter ('SampleRate',fileReader.mamplater);dRC = compressor('SampleRate',fileReader.mamplater);可视化(DRC)

创建一个timescopeto visualize the original and processed audio.

scope = timescope(...'SampleRate',fileReader.mamplater,...'TimeSpanSource','property',...'TimeSpan',1,...“ BufferLength”,filereader.mamplater*4,...'YLimits',[-1,1],...“ timespanoverrunaction”,'滚动',...“ showgrid',true,...'LayoutDimensions',[2,1],...'NumInputPorts',2,...'标题','Original vs. Compressed Audio (top) and Compressor Gain in dB (bottom)');范围。ActiveDisplay= 2;scope.ylimits = [-4,0];范围“获得(DB)”;

称呼parametertuner在流中打开UI以调整压缩机的参数。

parametertuner(dRC)

Figure Audio Parameter Tuner: compressor [dRC] contains an object of type uigridlayout.

在音频流循环中:

  1. 在文件中阅读音频框架。

  2. Apply dynamic range compression.

  3. Write the frame of audio to your audio device for listening.

  4. 可视化原始音频,处理后的音频以及应用的增益。

While streaming, tune parameters of the dynamic range compressor and listen to the effect.

尽管〜ISDONE(FILEREADER)AUDIOIN = FILEREADER();[audioOut,g] = dRC(audioIn); deviceWriter(audioOut); scope([audioIn(:,1),audioOut(:,1)],g(:,1)); drawnowlimitrate更新参数所需的%end

Figure Audio Parameter Tuner: compressor [dRC] contains an object of type uigridlayout.

作为最佳实践,请释放一旦完成的对象。

版本(DeviceWriter)版本(FileReader)版本(DRC)版本(范围)

Input Arguments

全部折叠

Object to tune, specified as an object that inherits fromaudioPluginor one of the following Audio Toolbox™ objects:

Output Arguments

全部折叠

目标人物,返回为Figure目的。

Introduced in R2019a