Tune object parameters while streaming
parametertuner
使您能够以图形方式调整多个对象的参数。在此示例中,您使用交叉过滤器将信号分为多个子带,然后对子带应用不同的效果。
创建一个dsp.AudioFileReader
to read in audio frame-by-frame. Create anaudioDeviceWriter
将音频写入您的声卡。
filereader = dsp.audiofilereader('Funkydrums-48-Stereo-25secs.mp3',...'PlayCount',2);deviceWriter = audioDeviceWriter ('SampleRate',fileReader.mamplater);
创建一个跨界式滤波器
有两个分频器将音频分为三个频段。称呼可视化
绘制过滤器的频率响应。称呼parametertuner
to 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. Callparametertuner
to 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)
在音频流循环中:
在文件中阅读音频框架。
Split the audio into three bands using the crossover filter.
将动态范围压缩应用于第一和第二频段。
Apply a chorus effect to the third band.
Sum the audio bands.
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.AudioFileReader
to read in audio frame-by-frame. Create anaudioDeviceWriter
将音频写入您的声卡。UseloadAudioPlugin
to load an equalizer plugin. If you are using a Mac, replace the.dll
file 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)
在音频流循环中:
在文件中阅读音频框架。
应用均衡。
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.AudioFileReader
to read in audio frame-by-frame. Create anaudioDeviceWriter
将音频写入您的声卡。创建一个naudiopluginexample.Flanger
to 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以调整鞭打者的参数。
参数量(鞭毛)
在音频流循环中:
在文件中阅读音频框架。
施加法兰。
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.AudioFileReader
to 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)
创建一个timescope
to 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)
在音频流循环中:
在文件中阅读音频框架。
Apply dynamic range compression.
Write the frame of audio to your audio device for listening.
可视化原始音频,处理后的音频以及应用的增益。
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
作为最佳实践,请释放一旦完成的对象。
版本(DeviceWriter)版本(FileReader)版本(DRC)版本(范围)
obj
—Object to tuneaudioPlugin
object|压缩机
|expander
|限制器
|Noisegate
|octaveFilter
|跨界式滤波器
|多体参数
|Graphiceq
|audioOscillator
|Wavetablesynthesizer
|reverberator
Object to tune, specified as an object that inherits fromaudioPlugin
or one of the following Audio Toolbox™ objects:
H
- 目标图Figure
object目标人物,返回为Figure
目的。
You have a modified version of this example. Do you want to open this example with your edits?
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select:.
Selectweb site您还可以从以下列表中选择一个网站:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.