Matlab Audio System Toolbox Documentation pdf download
Matlab Audio System Toolbox Documentation pdf download
download
https://ebookbell.com/product/matlab-audio-system-toolbox-
documentation-6741124
https://ebookbell.com/product/audio-watermark-a-comprehensive-
foundation-using-matlab-1st-edition-yiqing-lin-4931462
https://ebookbell.com/product/audio-and-speech-processing-with-matlab-
hardcover-paul-r-hill-10015582
https://ebookbell.com/product/audio-toolbox-users-guide-matlab-
simulink-1st-edition-mathworks-49474718
https://ebookbell.com/product/applied-speech-and-audio-processing-
with-matlab-examples-ian-mcloughlin-4720720
Hack Audio An Introduction To Computer Programming And Digital Signal
Processing In Matlab Tarr
https://ebookbell.com/product/hack-audio-an-introduction-to-computer-
programming-and-digital-signal-processing-in-matlab-tarr-7161792
https://ebookbell.com/product/introduction-to-audio-analysis-a-matlab-
approach-1st-edition-theodoros-giannakopoulos-and-aggelos-pikrakis-
auth-4674726
https://ebookbell.com/product/fundamentals-of-image-audio-and-video-
processing-using-matlab-with-applications-to-pattern-recognition-
ranjan-parekh-23432828
Some Case Studies On Signal Audio And Image Processing Using Matlab Dr
Hedaya Mahmood Alasooly
https://ebookbell.com/product/some-case-studies-on-signal-audio-and-
image-processing-using-matlab-dr-hedaya-mahmood-alasooly-22135336
https://ebookbell.com/product/speech-and-audio-processing-a-
matlabbased-approach-1st-edition-ian-vince-mcloughlin-5855452
Audio System Toolbox™
Getting Started Guide
R2016a
How to Contact MathWorks
Phone: 508-647-7000
Revision History
March 2016 Online only New for Version 1.0 (Release 2016a)
Contents
Introduction
1
Audio System Toolbox Product Description . . . . . . . . . . . . . 1-2
Key Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-2
Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-3
iii
Audio I/O: Buffering, Latency, and Throughput
4
Audio I/O: Buffering, Latency, and Throughput . . . . . . . . . . 4-2
Input Audio Stream Signal . . . . . . . . . . . . . . . . . . . . . . . . . . 4-2
Output Audio Stream Signal . . . . . . . . . . . . . . . . . . . . . . . . . 4-3
iv Contents
Quick Start System Object Plugin . . . . . . . . . . . . . . . . . . . . 7-15
Quick Start System Object Source Plugin . . . . . . . . . . . . . . 7-17
Audio System Toolbox Extended Terminology . . . . . . . . . . . 7-19
v
1
Introduction
Audio System Toolbox™ provides algorithms and tools for the design, simulation, and
desktop prototyping of audio processing systems. It enables low-latency signal streaming
from and to audio interfaces, interactive parameter tuning, and automatic generation of
audio plugins for digital audio workstations.
Algorithms are available as MATLAB functions, System objects, and Simulink blocks.
Key Features
• VST plugin generation for digital audio workstations
• Interfaces to ASIO, ALSA, CoreAudio, and other low-latency audio drivers
• Interfaces to MIDI controls for real-time tuning of MATLAB and Simulink
simulations
• Audio processing algorithms, sources, and measurements for crossover and
equalization filtering, dynamic range control, reverberation, wavetable synthesis, and
other tasks
• Support for C code generation
1-2
Acknowledgements
Acknowledgements
VST is a trademark and software of Steinberg Media Technologies GmbH.
1-3
2
Audio System Toolbox enables generation of VST plugins from MATLAB source code by
using the generateAudioPlugin function. The generated plugin is compatible with
32-bit and 64-bit Windows, and 64-bit Mac host applications. After you generate a VST
plugin, you can use your generated audio plugin in a digital audio workstation (DAW).
validateAudioPlugin myAudioPlugin
audioTestBench myAudioPlugin
4 Generate your audio plugin using the generateAudioPlugin function.
generateAudioPlugin myAudioPlugin
5 Use your generated audio plugin in a DAW.
• Determines the sample rate and frame size at which a plugin is run, both of which
are variable.
2-2
Export a MATLAB Plugin to a DAW
• Calls the reset function of your plugin at the beginning of each use and if the
sample rate changes.
• Requires a consistent input and output frame size for the plugin’s processing
function.
• Must be synchronized with plugin parameters. Therefore, a plugin must not
modify properties associated with parameters.
• Requires that plugin properties associated with parameters are scalar values.
The audio plugin in the DAW environment interacts primarily through the processing
function, reset function, and interface properties of your plugin.
• The DAW environment calls the reset function of the plugin the first time the plugin
is used, or any time the sample rate of the DAW environment is modified. You can use
the getSampleRate function to query the sample rate of the environment.
Processing
• The DAW environment passes a frame of an audio signal to the plugin. The DAW
determines the frame size. If the audio plugin is a source audio plugin, the DAW does
not pass an input audio signal.
• The processing function of your plugin performs the frame-based audio processing
algorithm you specified, and updates internal plugin properties as needed. Plugins
must not write to properties associated with parameters.
• The processing function of your plugin passes the processed audio signal out to
the DAW environment. The frame size of the output signal must match the frame
size of the input signal. If the audio plugin is a source audio plugin, you must use
getSamplesPerFrame to determine the output frame size. Because the environment
frame rate is variable, you must call getSamplesPerFrame for each output frame.
• Processing is performed iteratively frame by frame on an audio signal.
2-3
2 Export a MATLAB Plugin to a DAW
Tunability
• If you modify a parameter through the plugin dialog box, the synchronized public
property updates at that time. You can use the set method of MATLAB classes to
modify private properties.
More About
• “What Are DAWs, Audio Plugins, and MIDI Controllers?” on page 5-2
• “Design an Audio Plugin” on page 7-2
• “Convert MATLAB Code to an Audio Plugin” on page 9-2
2-4
3
This example shows how to accelerate a real-time audio application using C code
generation with MATLAB Coder™. You must have the MATLAB Coder software
installed to run this example.
Introduction
Replacing parts of your MATLAB code with an automatically generated MATLAB
executable (MEX-function) can speed up simulation. Using MATLAB Coder, you can
generate readable and portable C code and compile it into a MEX-function that replaces
the equivalent section of your MATLAB algorithm.
This example showcases code generation using an audio notch filtering application.
Notch Filtering
A notch filter is used to eliminate a specific frequency from a signal. Typical filter design
parameters for notch filters are the notch center frequency and the 3 dB bandwidth. The
center frequency is the frequency at which the filter has a linear gain of zero. The 3 dB
bandwidth measures the frequency width of the notch of the filter computed at the half-
power or 3 dB attenuation point.
You can visualize the corrupted audio signal using a spectrum analyzer.
scope = dsp.SpectrumAnalyzer('SampleRate',44.1e3,...
'RBWSource','Property','RBW',5,...
'PlotAsTwoSidedSpectrum',false,...
'SpectralAverages',10,...
3-2
Desktop Real-Time Audio Acceleration with MATLAB Coder
3-3
3 Desktop Real-Time Audio Acceleration with MATLAB Coder
an audio file output, you must have write permission in the current directory. To ensure
write access, change directory to your system’s temporary folder.
mydir = pwd; addpath(mydir); cd(tempdir);
tic;
helperAudioToneRemoval;
t1 = toc;
fprintf('MATLAB Simulation Time: %d\n',t1);
codegen helperAudioToneRemoval
Measure the time it takes to execute the MEX-function and calculate the speedup gain
with a compiled function.
tic;
helperAudioToneRemoval_mex
t2 = toc;
fprintf('Code Generation Simulation Time: %d\n',t2);
fprintf('Speedup factor: %6.2f\n',t1/t2);
cd(mydir);
3-4
4
This tutorial describes how MATLAB software implements real-time stream processing.
The tutorial presents key terminology and basic techniques for optimizing your stream
processing algorithm. For more detailed technical descriptions and concepts, see the
documentation for the audio I/O System objects used in this tutorial.
This diagram and the ordered list that follows indicate the data flow when acquiring a
monochannel signal with the audioDeviceReader System object. audioDeviceReader
specifies the driver, the input device (sound card) and its attributes, buffer size, and
provides diagnostic functionality.
1 The microphone picks up the sound and sends a continuous electrical signal to your
sound card.
2 The sound card performs analog-to-digital conversion at a sample rate, buffer size,
and bit depth specified by your audioDeviceReader object.
4-2
Audio I/O: Buffering, Latency, and Throughput
3 The analog-to-digital converter writes audio samples into the sound card buffer. If
the buffer is full, the new samples are dropped.
4 The audioDeviceReader uses the driver to pull the oldest frame from the sound
card buffer iteratively.
• Latency is measured as the time delay between audio entering the sound card to the
frame output by the processing stage. To minimize latency, you can:
• Optimize the processing stage. If your processing stage has reached a peak
algorithmically, consider compiling into C code using MATLAB Coder.
• Decrease the sample rate.
• Decrease the frame size.
• Overrun refers to input signal drops. Input signal drops occur when the processing
stage does not keep pace with the acquisition of samples. The number of
samples overrun is returned when you call the step or record methods of your
audioDeviceReader. To minimize overrun, you can:
A typical workflow includes determining the minimum sample rate for your application,
measuring overrun and latency, and then adjusting your audioDeviceReader
properties. See audioDeviceReader for more information.
This diagram and the ordered list that follows indicate the data flow when playing a
monochannel signal with the audioDeviceWriter System object. audioDeviceWriter
specifies the driver, the output device (sound card) and its attributes, buffer size, and
provides diagnostic functionality.
4-3
4 Audio I/O: Buffering, Latency, and Throughput
• Latency is measured as the time delay between the generation of an audio frame in
MATLAB to the time audio is heard through the speaker. To minimize latency, you
can:
• Optimize the processing stage. If your processing stage has reached a peak
algorithmically, consider compiling into C code using MATLAB Coder.
• Decrease the sample rate.
• Decrease the frame size.
• Underrun refers to output signal silence. Output signal silence occurs when the
buffer is empty when it is time for digital-to-analog conversion. The number of
samples underrun is returned when you call the step or record methods of your
audioDeviceWriter. To minimize underrun, you can:
4-4
Audio I/O: Buffering, Latency, and Throughput
See Also
dsp.AudioFileReader | dsp.AudioFileWriter | audioDeviceReader | audioDeviceWriter
| Audio Device Reader | Audio Device Writer | From Multimedia File | To
Multimedia File
More About
• “Real-Time Audio in MATLAB” on page 6-2
• “Real-Time Audio in Simulink” on page 8-2
4-5
5
In the music industry, DAWs are typically used to acquire and save multiple tracks
of audio recordings, and to mix, equalize, and add audio effects. DAWs generally have
access to libraries of sounds and are used to create electronic music from scratch.
Commercial DAWs, such as those found in recording studios, can be hardware integrated
into computers.
DAWs are also used in the production of radio, television, film, podcasts, games, and
anywhere complex manipulation of audio signals is needed.
DAWs generally support plugins, which are smaller pieces of software with unique
functionality, therefore expanding the abilities of the DAW user.
Audio Plugins
Plugins are self-contained pieces of code that can be “plugged in” to DAWs to enhance
their functionality. Generally, plugins fall into the categories of audio signal processing,
analysis, or sound synthesis. Plugins usually specify a user-interface containing UI
widgets, but the DAW interface might mask it. Typical plugins include equalization,
dynamic range control, reverberation, delay, and virtual instruments.
To process streaming audio data, the DAW calls the plugin, passes in a frame of input
audio data, and receives back a frame of processed output audio data. When a plugin
parameter changes (for example, when you move a control on the plugin’s UI), the DAW
notifies the plugin of the new parameter value. Plugins usually have their own custom
UI, but DAWs also provide a generic UI for all plugins.
5-2
What Are DAWs, Audio Plugins, and MIDI Controllers?
Audio System Toolbox supports code generation to the most common plugin format,
Steinberg’s VST (Virtual Studio Technology).
For a discussion of plugin terminology and usage in the MATLAB environment, see
“Design an Audio Plugin” on page 7-2.
MIDI controllers are devices that send MIDI messages. Common devices include
electronic keyboards or surfaces with sliders, knobs, and buttons. For DAWs, MIDI
controllers can be physical instantiations of functionality present in the DAW. The DAW
user can interact using a keyboard and mouse and MIDI controllers.
References
[1] Wikipedia. Last modified September 1, 2015. https://en.wikipedia.org/wiki/
Digital_audio_workstation.
External Websites
• MIDI Manufacturers Association
5-3
6
In this section...
“Create a Development Test Bench” on page 6-2
“Quick Start Examples” on page 6-11
For information on real-time processing and tips on how to optimize your algorithm, see
“Audio I/O: Buffering, Latency, and Throughput” on page 4-2.
This tutorial describes how you can implement audio stream processing in MATLAB. It
outlines the workflow for creating a development test bench and provides examples for
each stage of the workflow. Begin by inspecting the anatomy of a completed audio stream
processing test bench, then walk through the example for a description of each stage.
6-2
Real-Time Audio in MATLAB
For an overview of how audio stream processing is implemented, inspect the anatomy
of the completed audio stream processing test bench. To create this test bench, walk
through the example for explanations and step-by-step instructions.
6-3
6 Real-Time Audio in MATLAB
'BufferLength',1.5e6,...
'YLimits',[-1 1]);
dRG = noiseGate(...
'SampleRate',fileReader.SampleRate,...
'Threshold',-25,...
'AttackTime',10e-3,...
'ReleaseTime',20e-3,...
'HoldTime',0);
visualize(dRG);
configureMIDI(dRG);
while ~isDone(fileReader)
signal = step(fileReader);
noisySignal = signal + 0.0025*randn(frameLength,1);
processedSignal = step(dRG,noisySignal);
play(deviceWriter,processedSignal);
step(scope,[noisySignal,processedSignal]);
end
release(fileReader);
release(deviceWriter);
release(scope);
release(dRG);
Your audio stream loop can read audio directly from your device or from a file, and can
write to a device or file. In this tutorial, you create an audio stream loop that reads audio
frame by frame from a file, and outputs frame by frame to a device. See “Quick Start
Examples” on page 6-11 for alternative input/output configurations.
6-4
Real-Time Audio in MATLAB
fileReader = dsp.AudioFileReader(...
'Counting-16-44p1-mono-15secs.wav',...
'SamplesPerFrame',frameLength);
deviceWriter = audioDeviceWriter(...
'SampleRate',fileReader.SampleRate);
In this tutorial, the input to the audio stream loop is read from a file. The output from
the audio stream loop writes to a device.
Create Audio Stream Loop with File Input and Device Output
dsp.AudioFileReader uses the step method to read in a single frame of the signal. To
read successive frames, call the step method of your dsp.AudioFileReader System
object in your audio stream loop.
audioDeviceWriter uses the play method to write a single frame of the signal. To
write successive frames, call the play method of your audioDeviceWriter System
object in your audio stream loop. Specify which signal to play as an argument of play.
frameLength = 256;
fileReader = dsp.AudioFileReader(...
'Counting-16-44p1-mono-15secs.wav',...
'SamplesPerFrame',frameLength);
deviceWriter = audioDeviceWriter(...
'SampleRate',fileReader.SampleRate);
release(fileReader); %<---
release(deviceWriter); %<---
6-5
6 Real-Time Audio in MATLAB
All System objects have a release method. As a best practice, release your System
object after use, especially when a System object is communicating with a hardware
device such as your sound card.
3. Add Scopes
There are several scopes available to the Audio System Toolbox user. The two most
common are the dsp.TimeScope and the dsp.SpectrumAnalyzer.
This tutorial uses the dsp.TimeScope System object to visualize the audio signal.
Add Time Scope
dsp.TimeScope uses the step method to update your plot and display the current
frame of a signal. To display your signal in real time, call the step method of your
dsp.TimeScope System object in an audio stream loop. Specify which signals to display
as arguments of your step method call.
while ~isDone(fileReader)
signal = step(fileReader);
play(deviceWriter,signal);
step(scope,signal); %<---
end
release(fileReader);
release(deviceWriter);
release(scope); %<---
6-6
Real-Time Audio in MATLAB
In most applications, you want to process your audio signal in the audio stream loop. The
processing stage can be
In this tutorial, you call the step method of the noiseGate System object to process the
signal in the audio stream loop.
Process Signal with noiseGate
Construct a noiseGate System object. Specify your noiseGate System object sample
rate if the default of 44,100 Hz is not appropriate. As a best practice, use the sample
rate of your input System object. To achieve the aims of your audio processing, specify
necessary noiseGate properties, such as Threshold, AttackTime, ReleaseTime, and
HoldTime.
To process your audio signal, call the step method of your noiseeGate System object in
an audio stream loop.
In this tutorial, you add random Gaussian noise to the audio stream input to show a
possible use case of the noiseGate System object.
6-7
6 Real-Time Audio in MATLAB
'ReleaseTime',20e-3,... %<---
'HoldTime',0); %<---
while ~isDone(fileReader)
signal = step(fileReader);
noisySignal = signal + 0.0025*randn(frameLength,1); %<---
processedSignal = step(dRG,noisySignal); %<---
play(deviceWriter,processedSignal); %<---
step(scope,[noisySignal,processedSignal]); %<---
end
release(fileReader);
release(deviceWriter);
release(scope);
release(dRG); %<---
5. Add Tunability
MATLAB provides several options to interactively tune your algorithm with stream
processing.
Add User Interface
MATLAB provides several user interfaces (UI) to inspect and interact with your code.
You can use:
• The Audio Test Bench, which provides UI-based exercises for audioPlugin classes and
most Audio System Toolbox System objects.
• The built-in methods of Audio System Toolbox System objects for visualizing key
characteristics of your processing algorithms. Then you can tune them in real time
with MIDI controls.
• A custom-built user interface. See GUI Building for a tutorial.
This tutorial uses the visualize method of the noiseGate System object to observe its
static characteristics.
6-8
Real-Time Audio in MATLAB
scope = dsp.TimeScope(...
'SampleRate',fileReader.SampleRate,...
'TimeSpan',16,...
'BufferLength',1.5e6,...
'YLimits',[-1 1]);
dRG = noiseGate(...
'SampleRate',fileReader.SampleRate,...
'Threshold',-25,...
'AttackTime',10e-3,...
'ReleaseTime',20e-3,...
'HoldTime',0);
visualize(dRG); %<---
while ~isDone(fileReader)
signal = step(fileReader);
noisySignal = signal + 0.0025*randn(frameLength,1);
processedSignal = step(dRG,noisySignal);
play(deviceWriter,processedSignal);
step(scope,[noisySignal,processedSignal]);
end
release(fileReader);
release(deviceWriter);
release(scope);
release(dRG);
Many Audio System Toolbox System objects include methods that support MIDI controls.
This tutorial uses the configureMIDI method of the noiseGate System object to
synchronize your System object properties to MIDI controls.
Note: To use MIDI controls with System objects that do not have a configureMIDI
method, see “Musical Instrument Digital Interface (MIDI)”.
To control your noiseGate System object properties with a MIDI controller, connect the
MIDI device to your computer.
6-9
6 Real-Time Audio in MATLAB
Before calling your audio stream loop, call the configureMIDI method on your
noiseGate System object. When you run your script, it does not advance until you have
completed your configuration and closed the user interface. Once the user interface
opens:
The noiseGate property in the drop-down menu and the MIDI control you moved are
now synced. Repeat these steps for all properties you want to synchronize. Then click
OK.
While your audio is stream processing, use your MIDI controller to adjust the
noiseGate parameters in real time. In particular, toggle the MIDI control mapped to
the Threshold property to attenuate the additive Gaussian noise in the signal.
frameLength = 256;
fileReader = dsp.AudioFileReader(...
'Counting-16-44p1-mono-15secs.wav',...
'SamplesPerFrame',frameLength);
deviceWriter = audioDeviceWriter(...
'SampleRate',fileReader.SampleRate);
scope = dsp.TimeScope(...
'SampleRate',fileReader.SampleRate,...
'TimeSpan',16,...
'BufferLength',1.5e6,...
'YLimits',[-1 1]);
dRG = noiseGate(...
'SampleRate',fileReader.SampleRate,...
'Threshold',-25,...
'AttackTime',10e-3,...
'ReleaseTime',20e-3,...
'HoldTime',0);
visualize(dRG);
configureMIDI(dRG); %<---
while ~isDone(fileReader)
signal = step(fileReader);
noisySignal = signal + 0.0025*randn(frameLength,1);
6-10
Real-Time Audio in MATLAB
processedSignal = step(dRG,noisySignal);
play(deviceWriter,processedSignal);
step(scope,[noisySignal,processedSignal]);
end
release(fileReader);
release(deviceWriter);
release(scope);
release(dRG);
Add UDP
You can use the User Datagram Protocol (UDP) within MATLAB for connectionless
transmission, or to receive or transmit datagrams outside MATLAB. Possible
applications include using MATLAB to tune your audio processing algorithm while
playing and visualizing your audio in a third-party environment. See “Communicating
Between a DAW and MATLAB via UDP” for an example application of UDP
communication.
6-11
6 Real-Time Audio in MATLAB
release(deviceReader)
release(deviceWriter)
6-12
Real-Time Audio in MATLAB
release(deviceReader);
release(fileWriter);
6-13
6 Real-Time Audio in MATLAB
while ~isDone(fileReader)
mySignal = step(fileReader);
myProcessedSignal = process(mySignal);
play(deviceWriter, myProcessedSignal);
end
release(fileReader);
release(deviceWriter);
More About
• “Real-Time Audio in Simulink” on page 8-2
• “Audio I/O: Buffering, Latency, and Throughput” on page 4-2
• “Musical Instrument Digital Interface (MIDI)”
• “Use the Audio Test Bench”
6-14
7
For a review of audio plugins as defined outside the MATLAB environment, see “What
Are DAWs, Audio Plugins, and MIDI Controllers?” on page 5-2
7-2
Design an Audio Plugin
• A plugin is any audio plugin that derives from the audioPlugin class or the
audioPluginSource class.
• A basic plugin is an audio plugin that derives from the audioPlugin class.
• A basic source plugin is an audio plugin that derives from the audioPluginSource
class.
Audio plugins can also inherit from matlab.System. Any object that derives from
matlab.System is referred to as a System object. Deriving from matlab.System allows
for additional functionality, including Simulink integration. However, manipulating
System objects requires a more advanced understanding of OOP in the MATLAB
environment.
See “Audio System Toolbox Extended Terminology” on page 7-19 for a detailed
visualization of inheritance and terminology.
1 Define a Basic Plugin Class. Begin with a simple plugin that copies input to
output without modification.
7-3
7 Design an Audio Plugin
myBasicPlugin illustrates the two minimum requirements for audio plugin classes.
They must:
The process method contains the primary frame-based audio processing algorithm.
It is called in an audio stream loop to process an audio signal over time.
By default, both the input to and output from the process method have two
channels (columns). The number of input rows (frame size) passed to process is
determined by the environment in which it is run. The output must have the same
number of rows as the input.
2 Add a Plugin Property. A property can store information in an object. Add a
property, Gain, to your class definition. Modify your process method to multiply
the input by the value specified by the Gain property.
View Code
The first argument of the process method has changed from ~ to plugin. The first
argument of process is reserved for the audio plugin object. If a variable is specified
7-4
Design an Audio Plugin
as the first argument of process, then all myBasicPlugin properties are accessible
in the process method.
3 Add a Plugin Parameter. Plugin parameters are the interface between
plugin properties and the plugin user. The definition of this interface is handled
by audioPluginInterface, which holds audioPluginParameter objects.
To associate a plugin property to a parameter, specify the first argument of
audioPluginParameter as a string entered exactly as the property you want to
associate. The remaining arguments of audioPluginParameter specify optional
additional parameter attributes.
In this example, you specify a mapping between the value of the parameter and
its associated property, as well as the parameter display name as it appears on
a plugin dialog box. By specifying 'Mapping' as {'lin',0,3}, you set a linear
mapping between the Gain property and the associated user-facing parameter, with
an allowable range for the property between 0 and 3.
View Code
View Code
7-5
7 Design an Audio Plugin
properties
Gain = 1.5;
end
properties (Access=private) %<---
CircularBuffer = zeros(192001,2); %<---
BufferIndex = 1; %<---
NSamples = 0; %<---
end %<---
properties (Constant)
PluginInterface = audioPluginInterface(...
audioPluginParameter('Gain',...
'DisplayName','Echo Gain',...
'Mapping',{'lin',0,3}))
end
methods
function out = process(plugin, in)
out = in*plugin.Gain;
end
end
end
5 Add an Echo. In the process method, write to and read from your circular buffer
to create an output that consists of your input and a gain-adjusted echo. The first
line of the process method initializes the output to the size of the input. It is best
practice to initialize your output to avoid errors when generating plugins.
View Code
classdef myBasicPlugin < audioPlugin
properties
Gain = 1.5;
end
properties (Access=private)
CircularBuffer = zeros(192001,2);
BufferIndex = 1;
NSamples = 0;
end
properties (Constant)
PluginInterface = audioPluginInterface(...
audioPluginParameter('Gain',...
'DisplayName','Echo Gain',...
'Mapping',{'lin',0,3}))
end
methods
function out = process(plugin, in)
7-6
Design an Audio Plugin
Add a set method that listens for changes to the Delay property. Use the
getSampleRate method of the audioPlugin base class to return the environment
sample rate. Approximate a delay specified in seconds as a number of samples,
NSamples. If the plugin user modifies the Delay property, set.Delay is called and
the delay in samples (NSamples) is calculated. If the environment sample rate is
above 192,000 Hz, the plugin does not perform as expected.
View Code
7-7
7 Design an Audio Plugin
properties
Gain = 1.5;
Delay = 0.5; %<---
end
properties (Access=private)
CircularBuffer = zeros(192001,2);
BufferIndex = 1;
NSamples = 0;
end
properties (Constant)
PluginInterface = audioPluginInterface(...
audioPluginParameter('Gain',...
'DisplayName','Echo Gain',...
'Mapping',{'lin',0,3}),... %<---
audioPluginParameter('Delay',... %<---
'DisplayName','Echo Delay',... %<---
'Label','seconds')) %<---
end
methods
function out = process(plugin, in)
out = zeros(size(in));
writeIndex = plugin.BufferIndex;
readIndex = writeIndex - plugin.NSamples;
if readIndex <= 0
readIndex = readIndex + 192001;
end
for i = 1:size(in,1)
plugin.CircularBuffer(writeIndex,:) = in(i,:);
echo = plugin.CircularBuffer(readIndex,:);
out(i,:) = in(i,:) + echo*plugin.Gain;
writeIndex = writeIndex + 1;
if writeIndex > 192001
writeIndex = 1;
end
readIndex = readIndex + 1;
if readIndex > 192001
readIndex = 1;
end
end
plugin.BufferIndex = writeIndex;
7-8
Exploring the Variety of Random
Documents with Different Content
commissioners had in the first instance reported unfavourably on the
state of the house[1126].
In February 1538 a courtier wrote to Lord Lisle[1127], ‘the abbeys go
down as fast as they may and are surrendered to the king,’ adding
the pious wish: ‘I pray God send you one among them to your part.’
For the property of religious houses which were appropriated to the
king was now frequently granted to courtiers, or to those who were
quick enough to avail themselves of their opportunities in the
general scramble.
Several of the agents who had previously conducted visitations were
among those who carried on the work of the dissolution. Among
them London († 1543) has been characterised as ‘the most terrible
of all the monastic spoilers’; his letters remain to show in what spirit
he stripped the houses of their property, seized relics and defaced
and destroyed everything he could lay hands on[1128]. There is a
letter extant which Katherine Bulkeley, abbess of Godstow, wrote to
Cromwell complaining of him[1129]. He came down to her house
(Nov. 1537), ostensibly to hold a visitation, but really bent on
securing a surrender.
‘... Dr London, which as your lordship does well know was against
my promotion and has ever since borne me great malice and grudge
like my mortal enemy, is suddenly come unto me with a great rout
with him and here does threaten me and my sisters saying that he
has the king’s commission to suppress my house in spite of my
teeth. And when he saw that I was content that he should do all
things according to his commission and showed him plain that I
would never surrender to his hand being my ancient enemy, now he
begins to entreat me and to inveigle my sisters one by one
otherwise than I ever heard tell that any of the king’s subjects have
been handled, and here tarries and continues to my great cost and
charge, and will not take my answer that I will not surrender till I
know the king’s gracious commandment and your lordship’s ...’ and
more to the same purpose.
London on the following day wrote to Cromwell[1130] asking that the
‘mynchyns’ or nuns of her house, many of whom were aged and
without friends, should be generously dealt with (in the matter of a
pension). Stories were current[1131] at the time about insults to
which the nuns were exposed by the agents. Although it seems
probable that there was no excessive delicacy used in their
treatment, no direct complaints except those of the abbess of
Godstow have been preserved.
The last pages of the history of several of the great abbeys are full
of traits of heroism; one cannot read without sympathy of the way in
which for example the abbot of Glastonbury identified himself with
the system to which he belonged, and perished with it rather than
be divided from it. The staunch faith of the friars no less commands
respect. The heads of women’s houses naturally made less
opposition. However Florence Bannerman, abbess of Amesbury,
refused every attempt to bribe or force her into a surrender. After
considerable delay she was deposed in December 1539, and was
succeeded by Joan Darrell who surrendered the house at the king’s
bidding[1132], and accepted the comparatively high pension of £100.
To some of the heads of houses it seemed incredible that the old
system was passing away for ever, and they surrendered in the
belief that their deprivation was only temporary. Elizabeth Shelley,
abbess of St Mary’s, Winchester, who in 1535 had saved her house,
accepted the surrender but continued to dwell at Winchester with a
number of her nuns, and when she died bequeathed a silver chalice
which she had saved to the college in the city on condition that it
should be given back to St Mary’s if the convent were restored[1133].
The fact that she succeeded in carrying away a chalice appears
exceptional, for the inmates of convents who were expelled seem as
a rule to have taken with them nothing except perhaps their books
of devotion.
The story of the dissolution repeats itself in every convent. The
inventory of the house having been taken, the lead was torn from
the roofs, and sold together with the bells; the relics and pictures
were packed in sacks and sent up to London to be burnt.
The plate and jewels of the house, the amount of which was
considerable in the houses of men and in some of women (for
example in Barking) were also forwarded to London to be broken up
and melted; in a few instances they were sold. The house’s property
in furniture, utensils and vestments was sold there and then. The
superiors and convent inmates were then turned away, and the
buildings that had so long been held in reverence were either
devoted to some profane use or else left to decay.
The inventory taken at the dissolution of the ancient Benedictine
nunnery of Wherwell in Hampshire has been preserved among
others, and shows how such a house was dealt with[1134]. There is a
list of the inmates of the convent and of the pensions granted to
them; the abbess in this case received a yearly pension of £40, and
her nuns’ pensions ranged from £3. 6s. 8d. to £6. We then get a list
of the dwellings of which the settlement was composed. The houses
and buildings ‘assigned to remain’ were as follows: ‘the abbess’
lodging with the houses within the quadrant, as the water leads from
the east side of the cloister to the gate, the farmery, the mill and
millhouse with the slaughter-house adjoining, the brewing and
baking houses with the granaries to the same, the barn and stables
in the outer court.’ The list of dwellings ‘deemed to be superfluous’
follows. ‘The church, choir, and steeple covered with lead, the
cloister covered with tiles and certain gutters of lead, the chapter
house, the refectory (ffrayter), the dormitory, the convent kitchen
and all the old lodgings between the granary and the hall door
covered with tiles.’ Then follow accounts of the lead and bells
remaining, of the jewels, plate and silver ‘reserved for the king’s
use,’ and of the ornaments, goods and chattels which were sold. We
further gather that the debts of the house were paid and that
rewards and wages were given to the chaplain, officers and servants
before they were turned away.
As mentioned above the pensions given differed greatly, and the
heads of wealthy houses were allowed considerable sums. Thus
Elizabeth Souche, abbess of Shaftesbury, the yearly income of which
house was taxed at £1166, received £133 a year and all her nuns to
the number of fifty-five were pensioned. Dorothy Barley, abbess of
Barking, a house taxed at £862, received a yearly pension of £133;
while Elizabeth Shelley, abbess of St Mary’s, Winchester, received
only £26 a year. The prioress of St Andrew’s, Marricks, a small
house, received £5 annually, and her nuns a pension of from twenty
to forty shillings each. Gasquet points out that a large number of
those who were pensioned died during the first few years after the
surrender[1135]. Probably many of them were old, but there is extant
a pension roll of the year 1553 (reign of Philip and Mary) from which
can be gathered that a certain number of pensioned monks and
nuns were then alive and continued to draw their pensions. Gasquet
further remarks that only a few of the nuns who were turned away
are known to have married[1136]; considering that hardly any are
known to have left their convents voluntarily, and that many of the
younger ones were turned away through the act of 1535, this seems
only natural.
Eye-witnesses as well as Cromwell’s agents have left descriptions
which give a striking picture of the brutality of the proceedings[1137].
But the hardships to which the convent inmates were exposed, the
terrible waste of their property, and the senseless destruction of
priceless art treasures, must not blind us to the fact that the
breaking up of the monastic system was but an incident in one of
the most momentous revolutions within historic record. The
dissolution of the monasteries at the time of the Reformation, to be
rightly estimated, must be considered as part of a wider change
which was remoulding society on an altered basis.
It is interesting to compare the view taken of monastic life at the
time of the dissolution with the attitude taken towards convents in
the following period. Some writings, as for example Lindesay in the
play of the Three Estates, acted in the North in 1535[1138], severely
censure the inclinations which are fostered in the convent.
But strong as the feeling against convents and their inmates was in
some instances at the time of the Reformation, when the system
was once removed little antagonism remained towards those who
had represented it. The thought of the nun, fifty years after she had
passed away in England, roused no acrimony. Shakspere had no
prejudice against her, and Milton was so far impressed in her favour
that he represented ‘Melancholy’ under the form of a ‘pensive nun,
devout and pure,—Sober, steadfast and demure.’ It was only at a
much later period that the agitation raised by the fear of returning
‘Popery’ caused men to rake up scandals connected with convents
and to make bugbears out of them.
The losses incurred by the destruction of the convents were not
however slow in making themselves felt; but as indifference towards
women’s intellectual interests had made part of the movement, a
considerable time went by before the loss of the educational
possibilities which the convent had secured to women was deplored.
‘In the convents,’ says Gasquet[1139], ‘the female portion of the
population found their only teachers, the rich as well as the poor,
and the destruction of these religious houses by Henry was the
absolute extinction of any systematic education for women during a
long period.’ While devotion to domestic duties, exclusive of all other
interests, continued to be claimed from women, the loss of their
schools was a matter of indifference to society in general. But in
proportion as shortcomings in women were felt, the thought arose
that these might be due to want of training. The words in which the
divine, Fuller († 1661), expressed such thoughts in the 17th century
are well worth recalling. The vow of celibacy in his eyes remained a
thing of evil, but short of this the convents had not been wholly bad.
‘They were good she schools wherein the girls and maids of the
neighbourhood were taught to read and work; and sometimes a little
Latin was taught them therein. Yea, give me leave to say, if such
feminine foundations had still continued, provided no vow were
obtruded upon them, (virginity is least kept where it is most
constrained,) haply the weaker sex, besides the avoiding modern
inconveniences, might be heightened to a higher perfection than
hitherto hath been attained[1140].’
ebookbell.com