0% found this document useful (0 votes)
4 views

Matlab Audio System Toolbox Documentation pdf download

The document provides an overview of the MATLAB Audio System Toolbox, which includes tools and algorithms for designing and testing audio processing systems. It details features such as VST plugin generation, low-latency audio driver interfaces, and real-time tuning capabilities. Additionally, it outlines the workflow for exporting MATLAB plugins to digital audio workstations (DAWs) and the considerations for plugin development.

Uploaded by

rubyeozunany
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Matlab Audio System Toolbox Documentation pdf download

The document provides an overview of the MATLAB Audio System Toolbox, which includes tools and algorithms for designing and testing audio processing systems. It details features such as VST plugin generation, low-latency audio driver interfaces, and real-time tuning capabilities. Additionally, it outlines the workflow for exporting MATLAB plugins to digital audio workstations (DAWs) and the considerations for plugin development.

Uploaded by

rubyeozunany
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 79

Matlab Audio System Toolbox Documentation

download

https://ebookbell.com/product/matlab-audio-system-toolbox-
documentation-6741124

Explore and download more ebooks at ebookbell.com


Here are some recommended products that we believe you will be
interested in. You can click the link to download.

Audio Watermark A Comprehensive Foundation Using Matlab 1st Edition


Yiqing Lin

https://ebookbell.com/product/audio-watermark-a-comprehensive-
foundation-using-matlab-1st-edition-yiqing-lin-4931462

Audio And Speech Processing With Matlab Hardcover Paul R Hill

https://ebookbell.com/product/audio-and-speech-processing-with-matlab-
hardcover-paul-r-hill-10015582

Audio Toolbox Users Guide Matlab Simulink 1st Edition Mathworks

https://ebookbell.com/product/audio-toolbox-users-guide-matlab-
simulink-1st-edition-mathworks-49474718

Applied Speech And Audio Processing With Matlab Examples Ian


Mcloughlin

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

Introduction To Audio Analysis A Matlab Approach 1st Edition Theodoros


Giannakopoulos And Aggelos Pikrakis Auth

https://ebookbell.com/product/introduction-to-audio-analysis-a-matlab-
approach-1st-edition-theodoros-giannakopoulos-and-aggelos-pikrakis-
auth-4674726

Fundamentals Of Image Audio And Video Processing Using Matlab With


Applications To Pattern Recognition Ranjan Parekh

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

Speech And Audio Processing A Matlabbased Approach 1st Edition Ian


Vince Mcloughlin

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

Latest news: www.mathworks.com

Sales and services: www.mathworks.com/sales_and_services

User community: www.mathworks.com/matlabcentral

Technical support: www.mathworks.com/support/contact_us

Phone: 508-647-7000

The MathWorks, Inc.


3 Apple Hill Drive
Natick, MA 01760-2098
Audio System Toolbox™ Getting Started Guide
© COPYRIGHT 2016 by MathWorks, Inc.
The software described in this document is furnished under a license agreement. The software may be used
or copied only under the terms of the license agreement. No part of this manual may be photocopied or
reproduced in any form without prior written consent from The MathWorks, Inc.
FEDERAL ACQUISITION: This provision applies to all acquisitions of the Program and Documentation
by, for, or through the federal government of the United States. By accepting delivery of the Program
or Documentation, the government hereby agrees that this software or documentation qualifies as
commercial computer software or commercial computer software documentation as such terms are used
or defined in FAR 12.212, DFARS Part 227.72, and DFARS 252.227-7014. Accordingly, the terms and
conditions of this Agreement and only those rights specified in this Agreement, shall pertain to and
govern the use, modification, reproduction, release, performance, display, and disclosure of the Program
and Documentation by the federal government (or other entity acquiring for or through the federal
government) and shall supersede any conflicting contractual terms or conditions. If this License fails
to meet the government's needs or is inconsistent in any respect with federal procurement law, the
government agrees to return the Program and Documentation, unused, to The MathWorks, Inc.
Trademarks
MATLAB and Simulink are registered trademarks of The MathWorks, Inc. See
www.mathworks.com/trademarks for a list of additional trademarks. Other product or brand
names may be trademarks or registered trademarks of their respective holders.
Patents
MathWorks products are protected by one or more U.S. patents. Please see
www.mathworks.com/patents for more information.

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

Export a MATLAB Plugin to a DAW


2
Export a MATLAB Plugin to a DAW . . . . . . . . . . . . . . . . . . . . 2-2
Plugin Development Workflow . . . . . . . . . . . . . . . . . . . . . . . 2-2
Considerations When Generating Audio Plugins . . . . . . . . . . 2-2
How Audio Plugins Interact with the DAW Environment . . . 2-3

Desktop Real-Time Audio Acceleration with


MATLAB Coder
3
Desktop Real-Time Audio Acceleration with MATLAB
Coder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-2
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-2
Notch Filtering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-2
C Code Generation Speedup . . . . . . . . . . . . . . . . . . . . . . . . . 3-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

What Are DAWs, Audio Plugins, and MIDI


Controllers?
5
What Are DAWs, Audio Plugins, and MIDI Controllers? . . . . 5-2
Digital Audio Workstation (DAW) . . . . . . . . . . . . . . . . . . . . . 5-2
Audio Plugins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-2
Musical Instrument Digital Interface (MIDI) . . . . . . . . . . . . 5-3

Real-Time Audio in MATLAB


6
Real-Time Audio in MATLAB . . . . . . . . . . . . . . . . . . . . . . . . . . 6-2
Create a Development Test Bench . . . . . . . . . . . . . . . . . . . . 6-2
Quick Start Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-11

Design an Audio Plugin


7
Design an Audio Plugin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-2
Role of Audio Plugins in Audio System Toolbox . . . . . . . . . . . 7-2
Defining Audio Plugins in the MATLAB Environment . . . . . 7-2
Design a Basic Plugin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-3
Design a System Object Plugin . . . . . . . . . . . . . . . . . . . . . . 7-10
Quick Start Basic Plugin . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-12
Quick Start Basic Source Plugin . . . . . . . . . . . . . . . . . . . . . 7-14

iv Contents
Quick Start System Object Plugin . . . . . . . . . . . . . . . . . . . . 7-15
Quick Start System Object Source Plugin . . . . . . . . . . . . . . 7-17
Audio System Toolbox Extended Terminology . . . . . . . . . . . 7-19

Real-Time Audio in Simulink


8
Real-Time Audio in Simulink . . . . . . . . . . . . . . . . . . . . . . . . . . 8-2
Create Model Using Audio System Toolbox Simulink Model
Templates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-2
Add Audio System Toolbox Blocks to Model . . . . . . . . . . . . . 8-3
Recommended Settings for Audio Signal Processing . . . . . . . 8-7

Convert MATLAB Code to an Audio Plugin


9
Convert MATLAB Code to an Audio Plugin . . . . . . . . . . . . . . 9-2
Inspect Existing MATLAB Script . . . . . . . . . . . . . . . . . . . . . 9-2
Convert MATLAB Script to Plugin Class . . . . . . . . . . . . . . . 9-4

Convert Audio Plugin System Objects to Simulink


Blocks
10
Convert Audio Plugin System Objects to Simulink Blocks . 10-2
Open the Basic Audio Player Template in Simulink . . . . . . 10-2
Import Audio Plugin Functionality . . . . . . . . . . . . . . . . . . . 10-2
Create an Audio Plugin Block Interface . . . . . . . . . . . . . . . 10-3
Add a Time Scope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-6
Run the Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-8

v
1

Introduction

• “Audio System Toolbox Product Description” on page 1-2


• “Acknowledgements” on page 1-3
1 Introduction

Audio System Toolbox Product Description


Design and test audio processing systems

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.

Audio System Toolbox includes libraries of audio processing algorithms (such as


filtering, equalization, dynamic range control, and reverberation), sources (such as audio
oscillators and wavetable synthesizers), and measurements (such as A- and C-weighting).
Interfaces to external MIDI controls and low-latency audio drivers such as ASIO™,
ALSA, and CoreAudio enable you to validate multichannel audio designs in MATLAB®
or Simulink®. You can generate VST plugins from MATLAB code. For simulation
acceleration or desktop prototyping, the toolbox supports C/C++ code generation.

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.

ASIO is a trademark and software of Steinberg Media Technologies GmbH.

1-3
2

Export a MATLAB Plugin to a DAW


2 Export a MATLAB Plugin to a DAW

Export a MATLAB Plugin to a DAW


In this section...
“Plugin Development Workflow” on page 2-2
“Considerations When Generating Audio Plugins” on page 2-2
“How Audio Plugins Interact with the DAW Environment” on page 2-3

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).

Plugin Development Workflow


1 Design an audio plugin. For a tutorial on audio plugin architecture and design in the
MATLAB environment, See “Design an Audio Plugin” on page 7-2.
2 Validate your audio plugin using the validateAudioPlugin function.

validateAudioPlugin myAudioPlugin

3 Test your audio plugin using Audio Test Bench.

audioTestBench myAudioPlugin
4 Generate your audio plugin using the generateAudioPlugin function.

generateAudioPlugin myAudioPlugin
5 Use your generated audio plugin in a DAW.

Considerations When Generating Audio Plugins


• Your plugin must be compatible with MATLAB code generation. See “MATLAB
Programming for Code Generation” for more information.
• Your generated plugin must be compatible with DAW environments. The DAW
environment:

• 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.

Use the validateAudioPlugin, Audio Test Bench, and generateAudioPlugin


tools to guide your audio plugin into a valid form capable of generation.

How Audio Plugins Interact with the DAW Environment


After you generate your plugin, plug it into a DAW environment. See documentation on
your specific DAW for details on adding plugins.

The audio plugin in the DAW environment interacts primarily through the processing
function, reset function, and interface properties of your plugin.

Initialization and Reset

• 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

Desktop Real-Time Audio Acceleration


with MATLAB Coder
3 Desktop Real-Time Audio Acceleration with MATLAB Coder

Desktop Real-Time Audio Acceleration with MATLAB Coder


In this section...
“Introduction” on page 3-2
“Notch Filtering” on page 3-2
“C Code Generation Speedup” on page 3-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.

The helper function used in this example is helperAudioToneRemoval. The


function reads an audio signal corrupted by a 250 Hz sinusoidal tone from a file.
helperAudioToneRemoval uses a notch filter to remove the interfering tone and writes
the filtered signal to a file.

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

'FrequencySpan','Start and stop frequencies',...


'StartFrequency',20,...
'StopFrequency',1000,...
'Title','Audio signal corrupted by 250 Hz tone');
reader = dsp.AudioFileReader('guitar_plus_tone.ogg');
while ~isDone(reader)
audio = step(reader);
step(scope,audio(:,1));
end

C Code Generation Speedup


Measure the time it takes to read the audio file, filter out the interfering tone, and write
the filtered output using MATLAB code. Because helperAudioToneRemoval writes

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);

Next, generate a MEX-function from helperAudioToneRemoval using the MATLAB


Coder function, codegen.

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

Audio I/O: Buffering, Latency, and


Throughput
4 Audio I/O: Buffering, Latency, and Throughput

Audio I/O: Buffering, Latency, and Throughput


Audio System Toolbox is optimized for real-time stream processing. Its input and output
System objects are efficient, low-latency, and they control all necessary parameters so
that you can trade off between throughput and latency.

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.

Input Audio Stream Signal


To acquire an audio stream from a file, use the dsp.AudioFileReader System object™. To
acquire an audio stream from a device, use the audioDeviceReader System object.

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.

Terminology and Techniques to Optimize Your audioDeviceReader

• 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:

• Optimize the processing stage.


• Decrease the sample rate.
• Increase the frame size.

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.

Output Audio Stream Signal


To send an audio stream to a file, use the dsp.AudioFileWriter System object. To send an
audio stream to a device, use the audioDeviceWriter System object.

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

1 The processing stage passes a frame of variable length to the audioDeviceWriter


System object.
2 audioDeviceWriter sends the frame to the sound card’s buffer. Your
audioDeviceWriter object specifies the sample rate, bit depth, and buffer size of
the sound card.
3 The sound card pulls the oldest frame from the buffer and performs analog-to-digital
conversion. The sound card sends the analog chunk to the speaker. If the buffer is
empty when the sound card tries to pull from it, the sound card outputs a region of
silence.

Terminology and Techniques to Optimize Your audioDeviceWriter

• 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:

• Optimize the processing stage.

4-4
Audio I/O: Buffering, Latency, and Throughput

• Decrease the sample rate.


• Increase the frame size.
• Increase the buffer size. This approach applies only for audio signals with variable
frame length.

See audioDeviceWriter for more information.

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

What Are DAWs, Audio Plugins, and


MIDI Controllers?
5 What Are DAWs, Audio Plugins, and MIDI Controllers?

What Are DAWs, Audio Plugins, and MIDI Controllers?


In this section...
“Digital Audio Workstation (DAW)” on page 5-2
“Audio Plugins” on page 5-2
“Musical Instrument Digital Interface (MIDI)” on page 5-3

Digital Audio Workstation (DAW)


A digital audio workstation (DAW) is an electronic device or software application used
to record, edit, and produce sound files. DAWs are controlled with a user interface. Most
DAWs allow MIDI controls to tune parameters during live editing.

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.

Musical Instrument Digital Interface (MIDI)


Musical Instrument Digital Interface (MIDI) is a technical standard for communication
between electronic instruments, computers, and related devices. MIDI carries event
messages specific to audio signals, such as pitch and velocity, as well as control signals
for parameters such as volume, vibrato, panning, cues, and clock signals to synchronize
tempo.

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

Real-Time Audio in MATLAB


6 Real-Time Audio in MATLAB

Real-Time Audio in MATLAB

In this section...
“Create a Development Test Bench” on page 6-2
“Quick Start Examples” on page 6-11

Audio System Toolbox is optimized for real-time audio processing. audioDeviceReader,


audioDeviceWriter, dsp.AudioFileReader, and dsp.AudioFileWriter are designed for
streaming multichannel audio, and they provide all necessary parameters so that you
can trade off between throughput and latency.

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.

Create a Development Test Bench


This tutorial creates a development test bench in five steps. You begin by constructing
objects to input an audio signal to your test bench and output an audio signal from your
test bench. You then create an audio stream loop that performs frame-based processing
on your audio signal. To gain insight about your audio processing, you add scopes to
visualize the input to and output from the audio stream loop. You then develop your
audio processing algorithm. In the final stage, you make your processing algorithm
tunable in real time.

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.

Completed Test Bench Code


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,...

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);

1. Construct Input/Output System Objects

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.

Construct a dsp.AudioFileReader System object and specify a file. To reduce latency,


specify a small frame size as a property of the dsp.AudioFileReader System object.

Also construct an audioDeviceWriter System object. Specify your


audioDeviceWriter sample rate if the default of 44,100 Hz is not appropriate. If you do
not modify the sample rate between input and output to your audio stream loop, use the
sample rate of your input System object.

View Example Code


frameLength = 256;

6-4
Real-Time Audio in MATLAB

fileReader = dsp.AudioFileReader(...
'Counting-16-44p1-mono-15secs.wav',...
'SamplesPerFrame',frameLength);
deviceWriter = audioDeviceWriter(...
'SampleRate',fileReader.SampleRate);

2. Create Audio Stream Loop

An audio stream loop refers to a programming loop that iteratively:

• Reads a frame of an audio signal


• Processes the audio signal frame
• Writes the audio signal frame

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.

View Example Code

frameLength = 256;
fileReader = dsp.AudioFileReader(...
'Counting-16-44p1-mono-15secs.wav',...
'SamplesPerFrame',frameLength);
deviceWriter = audioDeviceWriter(...
'SampleRate',fileReader.SampleRate);

while ~isDone(fileReader) %<---


signal = step(fileReader); %<---
play(deviceWriter,signal); %<---
end %<---

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

To display an audio signal in the time domain, construct a dsp.TimeScope System


object. To aid visualization, specify necessary dsp.TimeScope properties, such as
TimeSpan, BufferLength, and YLimits.

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.

View Example Code


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]); %<---

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

4. Develop Processing Algorithm

In most applications, you want to process your audio signal in the audio stream loop. The
processing stage can be

• An inline script in the audio stream loop


• A separate function called in the audio stream loop
• A System object with a method called in the audio stream loop

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.

View Example Code


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,... %<---

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.

View Example Code


frameLength = 256;
fileReader = dsp.AudioFileReader(...
'Counting-16-44p1-mono-15secs.wav',...
'SamplesPerFrame',frameLength);
deviceWriter = audioDeviceWriter(...
'SampleRate',fileReader.SampleRate);

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);

Add MIDI Controller

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.

The configureMIDI method enables you to synchronize properties to MIDI controls


using a user interface or a script. This example synchronizes properties to a MIDI
controller using a user interface.

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:

1 Select a property to synchronize by choosing it from the drop-down menu.


2 Move a MIDI control.

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.

View Example Code

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.

Quick Start Examples


Audio Stream from Device to Device

This example uses the audioDeviceReader and audioDeviceWriter System objects


to perform real-time I/O stream processing. The processing is limited to adding a gain.

%% Real-Time Audio Stream Processing


%
% The Audio System Toolbox provides real-time, low-latency processing of
% audio signals using the System objects audioDeviceReader and
% audioDeviceWriter.
%
% This example shows how to acquire an audio signal using your microphone,
% perform basic signal processing, and play back your processed
% signal.
%

%% Create input and output objects


deviceReader = audioDeviceReader;
deviceWriter = audioDeviceWriter('SampleRate',deviceReader.SampleRate);

%% Specify an audio processing algorithm


% For simplicity, only add gain.

6-11
6 Real-Time Audio in MATLAB

process = @(x) x.*5;

%% Code for stream processing


% Place the following steps in a while loop for continuous stream
% processing:
% 1. Use the record method of your audio device reader to acquire one input frame.
% 2. Perform your signal processing operation on the input frame.
% 3. Use the play method of your audio device writer to listen to your processed fram

disp('Begin Signal Input...')


tic
while toc<5
mySignal = record(deviceReader);
myProcessedSignal = process(mySignal);
play(deviceWriter, myProcessedSignal);
end
disp('End Signal Input')

release(deviceReader)
release(deviceWriter)

Audio Stream from Device to File

This example uses the audioDeviceReader and dsp.AudioFileWriter System


objects to perform real-time I/O stream processing. The processing is limited to adding a
gain.
%% Real-Time Audio Stream Processing
%
% The Audio System Toolbox provides real-time, low-latency processing of
% audio signals using the System objects audioDeviceReader and
% dsp.audioFileWriter.
%
% This example shows how to acquire an audio signal using your microphone,
% perform basic signal processing, and write your signal to a file.
%

%% Construct input and output objects


% Use the sample rate of your input as the sample rate of your output.
deviceReader = audioDeviceReader;
fileWriter = dsp.AudioFileWriter('SampleRate',deviceReader.SampleRate);

%% Specify an audio procesing algorithm


% For simplicity, only add gain.
process = @(x) x.*5;

6-12
Real-Time Audio in MATLAB

%% Code for stream processing


% Place the following steps in a while loop for continuous stream
% processing:
% 1. Use the record method of your deviceReader to acquire one input frame.
% 2. Perform your signal processing operation on the input frame.
% 3. Use the step method of fileWriter to write your processed frame to a file.
% Note: The file is named 'output.wav' and written to current folder by default.

disp('Begin Signal Input...')


tic
while toc<5
mySignal = record(deviceReader);
myProcessedSignal = process(mySignal);
step(fileWriter, myProcessedSignal);
end
disp('End Signal Input')

release(deviceReader);
release(fileWriter);

Audio Stream from File to Device

This example uses the dsp.AudioFileReader and audioDeviceWriter System


objects to perform real-time I/O stream processing. The processing is limited to adding a
gain.
%% Real-Time Audio Stream Processing
%
% The Audio System Toolbox provides real-time, low-latency processing of
% audio signals using the System objects dsp.audioFileReader and
% audioDeviceWriter.
%
% This example shows how to acquire an audio signal using dsp.AudioFileReader,
% perform basic signal processing, and play your processed
% signal using audioDeviceWriter.
%

%% Construct input and output objects


% Use the sample rate of your input as the sample rate of your output.
fileReader = dsp.AudioFileReader('speech_dft.mp3');
deviceWriter = audioDeviceWriter('SampleRate',fileReader.SampleRate);

%% Specify an audio processing algorithm


% For simplicity, only add gain.

6-13
6 Real-Time Audio in MATLAB

process = @(x) x.*5;

%% Code for stream processing


% Place the following steps in a while loop for continuous stream
% processing until dsp.AudioFileReader is done reading the file:
% 1. Use the step method of your audio file reader to read one input frame.
% 2. Perform your signal processing operation on the input frame.
% 3. Use the play method of your audio device writer to listen to your processed fram

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

Design an Audio Plugin


7 Design an Audio Plugin

Design an Audio Plugin


In this section...
“Role of Audio Plugins in Audio System Toolbox” on page 7-2
“Defining Audio Plugins in the MATLAB Environment” on page 7-2
“Design a Basic Plugin” on page 7-3
“Design a System Object Plugin” on page 7-10
“Quick Start Basic Plugin” on page 7-12
“Quick Start Basic Source Plugin” on page 7-14
“Quick Start System Object Plugin” on page 7-15
“Quick Start System Object Source Plugin” on page 7-17
“Audio System Toolbox Extended Terminology” on page 7-19

Role of Audio Plugins in Audio System Toolbox


The audio plugin is the suggested paradigm for developing your audio processing
algorithm in Audio System Toolbox. Once designed, the audio plugin can be validated,
generated, and deployed to a third-party digital audio workstation (DAW).

Additional benefits of developing your audio processing as an audio plugin include:

• Rapid prototyping using the Audio Test Bench


• Integration with MIDI devices
• Code reuse

Some understanding of object-oriented programming (OOP) in the MATLAB


environment is required to optimize your use of the audio plugin paradigm. If you are
unfamiliar with these concepts, see “Why Use Object-Oriented Design”.

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

Defining Audio Plugins in the MATLAB Environment


In the MATLAB environment, an audio plugin refers to a class derived from the
audioPlugin base class or the audioPluginSource base class.

7-2
Design an Audio Plugin

Audio System Toolbox documentation uses the following terminology:

• 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.

Design a Basic Plugin


In this example, you create a simple plugin, and then gradually increase complexity.
Your final plugin uses a circular buffer to add an echo effect to an input audio signal. For
additional considerations for generating a plugin, see “Export a MATLAB Plugin to a
DAW” on page 2-2.

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

classdef myBasicPlugin < audioPlugin


methods
function out = process(~, in)
out = in;
end
end
end

myBasicPlugin illustrates the two minimum requirements for audio plugin classes.
They must:

• Inherit from audioPlugin class


• Have a process method

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

classdef myBasicPlugin < audioPlugin


properties %<---
Gain = 1.5; %<---
end %<---
methods
function out = process(plugin, in) %<---
out = in*plugin.Gain; %<---
end
end
end

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

classdef myBasicPlugin < audioPlugin


properties
Gain = 1.5;
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
4 Add Private Properties. Add properties to store a circular buffer, a buffer index,
and the N-sample delay of your echo. Because the plugin user does not need to see
them, make CircularBuffer, BufferIndex, and NSamples private properties. It
is best practice to initialize properties to their type and size.

View Code

classdef myBasicPlugin < audioPlugin

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

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; %<---
end
end
end
6 Make the Echo Delay Tunable. To allow the user to modify the NSamples delay
of the echo, define a public property, Delay, and associate it with a parameter. Use
the default audioPluginParameter mapping to allow the user to set the echo delay
between 0 and 1 seconds.

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

classdef myBasicPlugin < audioPlugin

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].’

§ 2. The Memoir of Charitas Pirckheimer.


A memoir is extant from the pen of the abbess of a convent at
Nürnberg. It was written (1524-28) during the stormy period
following upon the outbreak of the Lutheran agitation, and it helps
us to realize the effect which the rupture with Rome had on a
convent of nuns. Charitas Pirckheimer, the author of this memoir,
was the sister of Wilibald Pirckheimer ( † 1530), a well-known
humanist, and through him she was in touch with some of the
leading representatives of learning and art of her day. She was well
advanced in life and had many years of active influence behind her
when the troubles began of which she has left a graphic description.
An examination of the contents of her memoir must stand as a
specimen of the effects which the Reformation had on women’s
convent life on the Continent, effects which varied in almost every
town and every province. For the breaking up of the monastic
system abroad had none of the continuity and completeness it had
in England. The absence of centralised temporal and spiritual
authority left the separate townships and principalities free to accept
or reject the change of faith as they chose. The towns were ruled by
councils on which the decision in the first place depended, and in the
principalities the change depended on the attitude of prince and
magnate, so that the succession of the prince of a different faith, or
the conquest of one province by another, repeatedly led to a change
of religion. In some districts the first stormy outbreak was followed
by a reaction in favour of Rome, and convents which had disbanded
were restored on a narrowed basis; in others the monastic system
which had received a severe shock continued prostrate for many
years. But even in those districts where the change of faith was
permanently accepted, its influence on conventual establishments
was so varied that an account of the way in which it put an end to
nunneries lies beyond the scope of this work. It must suffice to point
out that some convents, chiefly unreformed ones, disbanded or
surrendered under the general feeling of restlessness; and that
others were attacked and destroyed during the atrocities of the
Peasants’ War. The heads of others again, with a clearsightedness
one cannot but admire, rejected Romish usages and beliefs in favour
of the Lutheran faith, and their houses have continued to this day as
homes for unmarried women of the aristocracy. Others were
suffered to remain under the condition that no new members should
be admitted, but that the old ones should be left in possession of
their house till they died. To this latter class belonged the convent of
St Clara at Nürnberg which we are about to discuss.
The convent dated its existence from the year 1279, in which several
nuns from Söflingen, near Ulm, joined a number of religious women
who were living together at Nürnberg, and prevailed upon them to
adopt the rule of St Clara and place themselves under the
guardianship of the Franciscan friars who had settled in Nürnberg in
1226[1141]. It has been mentioned above that the nuns of this order,
usually designated as Poor Clares, did not themselves manage that
property of theirs which lay outside the precincts; they observed
strict seclusion and were chiefly absorbed by devotional pursuits.
Under the influence of the movement of monastic reform described
in a previous chapter, Clara Gundelfingen (1450-1460), abbess of the
house at Nürnberg, had greatly improved its discipline, and nuns
were despatched from thence to convents at Brixen, Bamberg and
other places to effect similar changes. There was another convent of
nuns at Nürnberg dedicated to St Katherine which was under the
supervision of the Dominican friars, but the convent of St Clara was
the more important one and seems to have been largely recruited
from members of wealthy burgher families. In 1476 it secured a bull
from the Pope by which its use was altogether reserved to women
who were born in Nürnberg.
Charitas Pirckheimer came to live in the house (1478) at the age of
twelve. She was one of a family of seven sisters and one brother; all
the sisters entered convents, excepting one who married, and they
were in time joined by three of the five daughters of their
brother[1142]. These facts show that the women of most cultivated
and influential families still felt convent life congenial. The Dominican
writer Nider († 1438), speaking of convent life in the districts about
Nürnberg, remarks that he had nowhere else found so many
virtuous, chaste and industrious virgins[1143]. Of the members of the
Pirckheimer family who became nuns, Clara ( † 1533) joined her
sister Charitas and acted as secretary to her for many years; her
letters show her to have been of a lively and sanguine
disposition[1144]. Walpurg, another sister, lived as a nun in the
convent of St Clara at Münich; Katharina became prioress at
Geisenfeld, and Sabina and Euphemia entered the ancient
Benedictine settlement of Bergen near Neuburg, of which they
successively became abbesses. Sabina (1521-29), like her sister
Charitas, was a great admirer of Albrecht Dürer, whom she consulted
on the subject of illuminations done at her house[1145]. A number of
her letters remain to show that she held opinions of her own on
some points of doctrine and watched the progress of affairs at
Nürnberg with interest[1146]. Her sister Euphemia (1529-47), who
succeeded her, experienced even greater hardships than Charitas,
for when Palgrave, Otto Heinrich of Neuburg, accepted the
Protestant faith (1544), she and her nuns were expelled from their
convent, and spent several years staying first at one place then at
another, till the victory which the emperor Karl V won at Mühlberg
(1547) made it possible for them to return to Bergen.
Charitas on entering the house at Nürnberg found herself among the
daughters of family friends and relations. She contracted a lasting
friendship with Apollonia Tucher, who was afterwards elected to the
office of prioress, which she held for many years. Apollonia was
nearly related to Anton Tucher († 1524), one of the wealthiest and
most influential men of the town, and to Sixtus Tucher († 1507), a
learned divine who was made provost of the church of St Lorenz,
and in this capacity instructed the nuns of St Clara and provided
them with religious literature. Scheurl ( † 1542), a nephew of
Apollonia and a distinguished jurist, who came to settle at Nürnberg,
greatly admired Charitas. We shall return to him later on.
Felicitas Grundherrin, another nun, who was made portress in 1503,
wrote letters to her father which throw an additional light on the
conduct and the experiences of the nuns during the period of
religious contention. There were sixty inmates at that time, and
among them we find the chief families of the town represented.
We are not informed at what age Charitas made profession. In 1494
she was joined by her sister Clara, and a few years later, when we
first hear of her and her sister in connection with their brother, she
was engaged in teaching the novices.
The career of Wilibald Pirckheimer, a man of considerable literary
ability, is interesting, as it forms the centre of the intellectual and
artistic life of Nürnberg, which at that time was achieving some of its
greatest triumphs. The friend of Albrecht Dürer and of the leading
humanists, he was himself full of enthusiasm for the revived interest
in classic culture, and filled with that liberal appreciation of merit
regardless of origin and nationality which is one of the attractive
traits of the movement. In compliance with the taste of his age he
had studied in Italy, and shortly after his return to Nürnberg, on the
occasion of their father’s death (1501), he lent his sisters, Charitas
and Clara, a copy of the hymns of the Christian poet Prudentius, and
an unnamed portion of Jerome’s works, for their comfort and
perusal; Charitas thanked him for the loan in a Latin letter in which
we get our first glimpse of her[1147]. She says that she has been
interested to find among the hymns some which are habitually sung
in the choir and the authorship of which was unknown to her, and
she begs she may keep Jerome’s writings for some time longer, as
they afford her so much delight. She refers to the frequent loans of
books from her brother and assures him how much she depends on
him for her education, begging him to visit and further instruct her.
She has some knowledge of scripture, she says, but barely enough
to instruct the novices.
In the year 1487 Celtes ( † 1508), a celebrated Latin scholar and
poet, was crowned poet laureate by the Emperor Friedrich III at
Nürnberg, and received at his hands the doctor’s degree and a laurel
wreath. Afterwards he travelled about in Germany, rousing interest
in the revival of classical studies wherever he went, and encouraging
those who were interested in learning to band together in societies
(sodalitates) for the purpose of editing and publishing the classics.
During a stay at a monastery in Regensburg (1501) he had come
across the forgotten dramas of the nun Hrotsvith. They seemed to
him so worthy of attention that he had them published at Nürnberg
in a beautiful illustrated edition. We do not know if he was previously
acquainted with Charitas; but he sent her a copy of the dramas, and
she wrote a grateful reply[1148]. She begins by deploring the news
she has heard that Celtes has been attacked and plundered by
robbers. ‘A few days ago,’ she writes, ‘I received the interesting
writings of the learned virgin Hrotsvith, sent to me by you for no
merits of my own, for which I express and owe you eternal
gratitude. I rejoice that He who bestows powers of mind (largitor
ingenii) and grants wisdom to men who are great and learned in the
law, should not have denied to the frail and humbler sex some of the
crumbs from the tables of wisdom. In this learned virgin the words
of the apostle are verified that God chooses the humble to confound
the strong....’
Celtes was charmed by this letter, and was inspired to compose a
Latin ode[1149] in praise of Charitas. In it he addressed her as the
crown and star of womanhood, praised her for her knowledge of
Latin, in which she worthily followed in the steps of a learned father
and a learned brother, and enlarged on the pleasure her letter had
brought. With the ode he sent a copy of a work on the city of
Nürnberg lately published by him, and Charitas in reply sent a long
letter which is most instructive in regard to the light it throws on her
general attitude towards humanist culture[1150]. While delighted by
the gifts and the attentions of so distinguished a man as Celtes, she
felt critical towards the heathen element in him, which seemed to
her incompatible with the claims of a higher morality. The letter is
too long to reproduce in full, but the following are some of its most
noteworthy passages. ‘I am your unworthy pupil, but a great
admirer of yours and a well-wisher for your salvation, and as such I
would earnestly and with all my heart entreat you not indeed to give
up the pursuit of worldly wisdom, but to put it to higher uses, that is
to pass from heathen writings to holy scripture, from what is earthly
to what is divine, from the created to the Creator.... Indeed neither
knowledge nor any subject of investigation which is from God is to
be contemned, but mystic theology and a good virtuous life must be
ranked highest. For human understanding is weak and may fail us,
but true faith and a good conscience never can. I therefore put
before you, most learned doctor, when you have enquired into all
under the sun, that the wisest of men said, Vanity of vanities.... In
the same friendly spirit I would beg you to give up celebrating the
unseemly tales of Jupiter, Venus, Diana, and other heathen beings
whose souls are burning in Gehenna and who are condemned by
right-minded men as detestable and deserving of oblivion; make the
saints of God your friends by honouring their names and their
memory, that they may guide you to the eternal home when you
leave this earth.’
At the end of her letter she begged to be excused writing in this
strain in words which suggest that her brother had urged her to
speak out her mind, and a further letter of hers addressed to
Wilibald says that she is forwarding to him a copy of her letter to
Celtes[1151]. She begs he will not bring him to the grating without
sending her word previously, and expresses the belief that Celtes will
not take umbrage.
We hear no more of their intercourse. Celtes soon afterwards left
Nürnberg, and when Helena Meichnerin, abbess of the convent,
resigned on account of some complaints of the town council,
Charitas was chosen abbess (1503). Her acceptance of the post was
made conditional by the Franciscan friars on her giving up her Latin
correspondence[1152], and there can be no doubt that this prohibition
was primarily aimed at her intercourse with men like Celtes, who
was known to be very lax in his morality, and whose sympathies in
regard to learning were in direct opposition to the narrow religious
views of the friars. Charitas conformed, but Wilibald’s anger was
roused, and he wrote to Celtes: ‘You know that my sister Charitas
has been chosen abbess. Imagine, those soft-footed men
(χυλόποδες) have forbidden her to write Latin for the future.
Observe their caution, not to say roguery[1153].’
Charitas apparently wrote no more Latin letters, but her brother’s
friends continued to take an interest in her. Wilibald had a sincere
regard for her abilities and frequently wrote of her to his friends.
Other members of the humanist circle sought her out. Scheurl, the
young jurist mentioned above, sent her from Bologna a copy of his
‘Uses of the mass’ (Utilitates missae) with a flattering letter which
was presented to her by the provost Tucher (1506)[1154]. It is
overflowing with youthful enthusiasm, and says that of all the
women he has met there are only two who are distinguished by
abilities and intellect, knowledge and wealth, virtue and beauty, and
are comparable to the daughters of Laelius and Hortensius and to
Cornelia, mother of the Gracchi; the one is Cassandra (Fedele,
poetess[1155]) in Venice, the other is Charitas in Nürnberg. He
expatiates on the merits of the Pirckheimer family generally, and
says Charitas is following the example of her relatives in preferring a
book to wool, a pen to the distaff, a stilus to a needle. At a later
stage of his career (1515) Scheurl wrote that it was usual for men
who were distinguished in mind and power to admire and respect
the abilities, learning and moral excellence of this abbess[1156].
In 1513 Wilibald published an edition of Plutarch’s essay ‘On
retribution’ which he had translated from Greek into Latin, and
dedicated it to his sister Charitas in a long and flattering epistle[1157].
Mindful no doubt of the influences about her and referring to
difficulties in his own career, he spoke in the highest terms of the
Stoic philosophers and of the help their writings afforded. ‘Accept
this gift on paper which, if I judge rightly, will not be displeasing to
you,’ he says, ‘and carefully peruse the writings of this pagan author
(gentilis). And you will soon see that the philosophers of antiquity
did not stray far from the truth.’ Charitas was able to appreciate this
point of view and admitted in her reply that he had sent her a jewel
more precious than gold and silver[1158]. Speaking of Plutarch she
confessed that ‘he writes not like an unbelieving heathen but like a
learned divine and imitator of Christian perfection. It is a wonderful
circumstance which has filled me with joy and surprise.’ But she
thought her brother’s praise of her excessive. ‘I am not learned
myself, only the friend of those who are learned; I am no writer, I
only enjoy reading the writings of others; I am unworthy of so
precious a gift, though in truth you have done well and wisely in
placing the word Charitas at the head of your work. For Charity is
the virtue which makes all good things to be shared, and that
Charity which is the Divine Spirit itself will reward you here and in
the life to come, where honest efforts will be fully requited.’
A short time afterwards Pirckheimer dedicated to his sister Clara,
who was now teaching the novices, a ‘Collection of the Moral
Sentences of Nilus.’ It was a translation from Greek and Latin, and
the title was ornamented with a design by Dürer[1159]. He sent it ‘to
prevent her feeling any jealousy of her sister.’ Clara shared her
sister’s tastes and was herself an ardent reader. When the New
Testament edited by Erasmus appeared, Pirckheimer wrote to him
that his sisters, who zealously read his writings, took great delight in
this book also, and he says that they had greater insight into it than
many men who were proud of their learning. They would have
written themselves, he adds, if they had not felt shy of so great a
man. Erasmus on one occasion compared the daughters of Sir
Thomas More to the sisters of Wilibald Pirckheimer. Some writings of
the humanist Reuchlin were also perused by them[1160].
Wilibald further dedicated to Charitas his edition of the works of
Fulgentius (1519), in a long preface in which he describes the
difficulty he had had in procuring the manuscript from the library of
his friend Tritheim, how he had despaired of deciphering it till the
learned Cochlaeus came to his rescue, and how sure he felt that his
sister would look upon the book as a treasure[1161]. The translation
of the sermons of Gregorius Nazianzenus, an important undertaking,
he also accomplished mainly for the use of his sisters[1162].
Besides their devotional and intellectual interests, the nuns at St
Clara made their own clothes, and seem to have had some ability in
sewing, for when the imperial robes which were kept at Nürnberg
were to be carried to Aachen for the coronation of the Emperor Karl
V, they were first given into the hands of the nuns to be looked over
and mended[1163].
An interesting light is thrown on the less serious side of the
character of Charitas by an amusing German letter which she wrote
to Dürer and two envoys of Nürnberg who were staying at Augsburg
in 1518 on the occasion of the Imperial Diet. From there they had
sent her a missive penned in a jovial hour, and Charitas in reply
wrote[1164]: ‘I received your friendly letter with special delight and
read it with such attention that my eyes were often brim full, but
more from laughing than any other emotion. Many thanks to you
that in spite of your great business and your amusements you
should have taken the trouble to give directions to this little nun
about cloister-life, of which you have a clear mirror before you at
present....’ And she begs the envoy Spengler to study accounts with
a view to advising her how to waste everything till nothing remains,
and begs Dürer, ‘who is such a draughtsman and genius,’ to give his
attention to the buildings, so that when she has the choir rebuilt he
may help and advise her how to introduce larger windows so that
the nuns’ eyes may be less dim.
From these various notices we conclude that time passed not
unpleasantly or unprofitably with the abbess of St Clara before those
contentions began which followed upon the attack made on the
established religion by Luther. In Nürnberg, as in most other cities,
the feeling was general that the life of the prelacy was degenerate
and that the Papacy was a hotbed of abuse. Luther’s opposition to
the Pope was therefore greeted with acclamation both by the
enlightened men of the town, who felt that the tyranny of the
Church was a stumblingblock in the way of progress, and by the
people, who readily seized the idea that the means were now given
them to break through class tyranny. Wilibald Pirckheimer was
among those who without hesitation sided with the Lutheran
agitation, but Charitas thought otherwise. The abbess of the convent
of St Clara at Eger forwarded to her some of the fierce attacks on
Luther from the pen of Emser ( † 1527), and Charitas was so
delighted with them that she had them read out aloud to the nuns
during meals, and was prompted to write a letter to their
author[1165].
This letter became a source of great annoyance to her. It fell into the
hands of Emser’s enemies, and was published with an abusive
running comment on Charitas[1166]. Even Wilibald was annoyed and
declared she would have done better not to have written it. He
strongly supported the Lutheran agitation at the time, and Eck, who
suspected him of having written the attack on himself, entitled
‘Eccius Dedolatus,’ for personal reasons inscribed Wilibald’s name on
the Papal ban. There is extant from Wilibald’s pen a fragment in
which he expresses doubts as to the rightfulness of convent life
generally[1167], but he gradually modified his views. The violence and
narrowness of the representatives of the party of progress in
Nürnberg were little to his taste. On the plea of ill-health he
withdrew from the council, and took no part in the stormy
discussions of 1523, when the rupture with Rome was declared
complete and decisions arrived at, momentous for the future of the
new faith not only in Nürnberg, but in Germany generally.
At this juncture the memoir of Charitas[1168] begins. She describes
the effect of the Lutheran teaching; how ceremonies are being
abolished, rules and vows declared vain, so that many monks and
nuns are leaving their cloisters, putting off convent garb and
marrying and otherwise doing as they choose.
‘These various reasons brought us many troubles and difficulties,’
she writes (p. 2), ‘for many powerful and evil-minded persons came
to see the friends they had in our cloister, and argued with them and
told them of the new teaching, how the religious profession was a
thing of evil and temptation in which it was not possible to keep
holy, and that we were all of the devil. Some would take their
children, sisters and relatives out of the cloister by force and by the
help of admonitions and promises of which they doubtless would not
have kept half. This arguing and disputing went on for a long time
and was often accompanied by great anger and abuse. But since
none of the nuns by God’s grace was moved to go, the fault was laid
on the Franciscans, and everyone said they encouraged us, so that it
would be impossible to convince us of the new belief while we had
them as preachers and confessors.’
The friars had long been odious for their determined class feeling,
religious intolerance, and encouragement of superstitions; it was
obvious that the advocates of change would direct their attacks
against them. Charitas, fully aware of the emergency, assembled the
nuns and put before them the danger of being given over to ‘wild
priests and apostate monks,’ and with their consent decided to hand
in a ‘supplication’ to the town council. This council was presided over
by three leading men (triumviri), of whom one named Nützel was
the so-called representative (pfleger) of the convent, another named
Ebner had a daughter among the nuns, and the third, Geuder, was
the brother-in-law of Charitas. She consulted Wilibald on the matter
of the supplication, but forthwith wrote and despatched a letter to
each of these three men, begging and claiming the protection of her
privileges.
The supplication itself (p. 12) was carefully worded, and requested
that the connection between the Franciscans and the nuns might not
be severed, contradicting the charges which were brought against
the former. They do not forbid the nuns to read the Evangels and
other books, Charitas says,—‘if they did so we should not obey
them.’ The nuns have the Old and the New Testament in daily use in
the German and the Latin versions. Charitas denies despising the
married state or retaining nuns by force. ‘But as we compel no one,
so too we claim not to be compelled, and to remain free in mind as
well as in body. But this cannot be if we are given over to strange
priests, which would be destruction to our community ...,’ and more
to a like purpose.
The supplication was handed in at the beginning of 1524, but after
considerable delay the councillors postponed giving a definite reply
to it. In the meantime Charitas was much annoyed by the mother of
one of her nuns who tried to persuade her daughter to leave the
convent, and finding her words of no avail, appealed to the town
council (p. 19) for an order to take her ‘out of this prison’ as she
called it, into which she had sent her nine years before at the age of
fourteen. Charitas also sent in a statement of the case (p. 28), but
again no reply was vouchsafed her.
The letters which Clara wrote to her brother about this time help us
to realise the situation. All her letters are undated, but in one she
thanks Wilibald for his advice about the supplication, and says that if
divine service should really be abolished she means to devote herself
more to reading, for ‘the dear beloved old writers surely were no
fools[1169].’ In another she thanks him for the loan of books and says
a work of Erasmus (probably De libero arbitrio) has pleased the
sisters by its moderation. As to Charitas ‘she finds great comfort in
her beloved old Cyprian, in whose writings she reads day and night.
She sends greetings and the message that she prefers Cyprian to all
these new evangelists who strut about in cut garments and golden
chains[1170].’
Though Clara did not lose her cheerfulness, Charitas, who saw
further, was full of apprehension. From what her sister says she
regretted the severe tone of her letter to Geuder[1171]. On other
occasions also she was led to indignant utterances which she
afterwards regretted[1172].
A gap occurs at this period in her memoir which she resumed writing
in March 1525, after the religious disputation had taken place at
Nürnberg. After many stormy scenes, ‘the preachers of the Evangel,’
as they called themselves, decided to carry out their intentions
without waiting for the decision of a Church Council. The immediate
result of the decision was an attack on all religious houses. But in
the convent of St Clara the determined and reckless energy of the
reformers was matched by indignant protest and unyielding
opposition on the part of the abbess.
Charitas has described in full (p. 33) how a deputation from the
town council asked to be admitted into her house, and how they
informed her and the assembled nuns that their connection with the
Franciscans was at an end; a ‘reformed’ preacher had been
appointed to preach in the church of the nuns, and they were left
the choice among several men who would act to them as confessors.
Much argument followed, but Charitas maintained that her house
and the Franciscans had always been closely connected. ‘If we yield
it is only to force and we turn to God,’ she said, ‘and before Him we
lodge a protest and declare that we are forced against our will, and
that we reject and discountenance all your proposals.’ The
assembled nuns rose to their feet to shew their approval of her
speech, and the deputation in vain tried the effect of persuasion.
Charitas scorned the idea of having anything to do with apostate
monks; and the deputation retired after blaming the women for
behaving in a most ungrateful manner. A second visit led to similar
results; Charitas abode by her decision, the nuns wept, and the
deputation retired after venting their indignation in threats.
The hopes of the convent now centred in Nützel, their representative
in the town council, and Charitas with her brother’s approval wrote
to him (p. 41) begging him to come to her. But the first words Nützel
spoke dispelled every hope of assistance from that quarter; he
blamed the nuns for opposing the council, and urged the advisability
of their giving way. Charitas was most indignant and declared she
was well aware that it was intended to force them to this new belief,
but that they were agreed that neither in life nor in death would
they listen to what the Church had not previously countenanced. She
called upon the prioress to read out a second petition to the council
asking to have their father confessor back or else to be left without
one. She wanted Nützel to take charge of this petition, but he was
only angered, and taking Charitas aside, represented to her that her
opposition was a serious matter; her example was encouraging other
women’s convents to opposition, which would relent if she did. He
said that by resigning and disbanding the convent bloodshed would
be averted, and he spoke in praise of the new preacher. But Charitas
remained unmoved. As he was leaving the house his daughter and
the other nuns, whose fathers were members of the town council,
went down on their knees to him imploring protection. He refused to
listen, but was so far impressed that he never slept all the following
night, as his wife afterwards told the nuns (p. 54).
The convent’s opposition to their plans was a source not only of
annoyance but of apprehension to the town authorities. The
peasants’ rising was spreading in the direction of Nürnberg, and as
popular feeling was against religious houses the argument that
dissolving the house might help to avert a danger was not altogether
unfounded. Nützel in a long expostulation (p. 55) shortly afterwards
tried to impress this view on the abbess, but Charitas urged (p. 59)
that other reasons besides hatred of the friars had roused the
peasants to rebellion, and complained that the ill-feeling against her
house was largely due to the reformed preachers, who declared they
would not rest till they had driven monks and nuns out of the town
(p. 62). Rightly or wrongly she held that Poliander, the reformed
preacher who was now preaching in the convent church, had been
promised a reward if he persuaded her or her nuns to leave the
convent (p. 67), and that his want of success aggravated his hatred
of them. It was in vain that Nützel wrote in praise of him (p. 67).
Charitas now looked upon Nützel as a dangerous enemy, and her
sister Clara wrote to Wilibald[1173] begging him to advise the convent
how to get rid of the man. In another letter[1174] she said that
Charitas was seriously afraid of him.
In place of the Franciscans a number of reformed preachers now
preached before the nuns and the people in the convent church.
Among them was Osiander, formerly a Carthusian, whose violence at
a later period was censured and resented by his Protestant brethren;
and the nuns were obliged to attend and to listen to a torrent of
abuse and imprecation by him and others. ‘I cannot and will not
detail,’ says Charitas in her memoir (p. 70), ‘how they perverted Holy
Writ to a strange meaning, how they cast down the doctrines of the
Church and discarded all ceremonies; how they abused and reviled
all religious orders and classes, and respected neither Pope nor
Emperor, whom they openly called tyrant, devil, and Antichrist; how
roughly and in what an unchristian-like spirit and against all
brotherly love they abused us and charged us with great
wickedness, for the purpose of rousing the people, whom they
persuaded that an ungodly set like ourselves should be destroyed,
our cloister broken open, ourselves dragged out by force, since we
represented a despicable class, heretics, idolatrous and blasphemous
people, who were eternally of the devil.’
One might be tempted to look upon this description as an
exaggeration were it not for a letter from Wilibald Pirckheimer to
Melanchthon, in which he describes the outrages to which the nuns
were exposed in similar terms. ‘The preachers scream, swear, and
storm, and do everything in their power to rouse the hatred of the
masses against the poor nuns; they openly say that as words were
of no avail, recourse should be had to force,’ and he wonders the
cloister has not yet been attacked[1175].
Under the pressure of popular opinion and increasing restlessness
the Austin monks gave over their house, and they were followed by
the Carmelites, the Benedictines, and the Carthusians. The
Dominicans hesitated; the Franciscans refused to go. Charitas
expresses wonder that the ‘spiritual poison,’ as she calls it, which the
preachers several times a week tried to infuse into the nuns, took no
effect, and that none of them expressed a desire to leave the
convent (p. 85).
Things had now come to such a pass that convents outside the city
disbanded before the peasants’ rising; and nuns from Pillenreuth and
Engelthal sought refuge in the town with the nuns of St Clara (p.
86). These lived in daily fear of their house being stormed, for the
people shouted and swore at them from below, threw stones into
the choir, smashed the church windows, and sang insulting songs in
the churchyard outside. But the nuns, nothing daunted, continued to
keep the hours and to ring the bells, though they were every
moment prepared for the worst. Clara in a letter to Wilibald
described her own and her sister’s fears in eloquent terms[1176]; and
the nun Felicitas Grundherrin wrote to her father entreating him to
abide by the old faith[1177]. In these days the nuns seem to have
read a good deal of pamphlet literature, but they failed to see
anything beyond an encouragement to violence and disorder in the
whole Lutheran movement.
A further attempt was made by the council to coerce the convent. A
number of injunctions were sent to the abbess which were to be
carried out within a month (p. 88). The first of these commanded
her to absolve the nuns from their vow that they might enjoy
‘Christian freedom’; another that she should send the young nuns
home though they refused, ‘since children should obey their parents.’
The deputies who laid these injunctions before the abbess assured
her that the council was prepared to restore to the nuns what they
had brought to the convent; that they would give money to those
who had brought nothing, and provide a dower for those who
married. To these arguments Charitas replied that the nuns had
made a vow not before her but before God, that it was not in her
power to dispense them from it and that she would not urge them to
disobedience. With a touch of bitterness she added that their
mothers were continually at the convent grating urging them to go
(p. 87). For the matrons of the town especially sided with the
reformed preachers and cried shame on convent life. ‘If it were not
for the women and the preachers things would not be so bad,’ Clara
wrote on one occasion to Wilibald[1178], and on another she spoke of
the sharp tongues and violent behaviour of the women.
The deputation further claimed that the nuns should take off their
convent clothes (p. 93), the sight of which they said gave umbrage.
‘We are continually told,’ Charitas replied, ‘that our vows and our
clothes threaten to cause a rising, but it is your preachers, to whom
we are forced to listen, who try to provoke one by abusing and
condemning us from the pulpit and charging us with vices and
impurity to humour the people.’ The command was also given to do
away with the convent grating; and it was backed by the threat that
if Charitas failed to comply with it the town authorities would throw
open the house to all visitors. The heaviness of this blow was such
that after the deputation had left Charitas summoned the nuns and
asked their intentions severally. In the eyes of the whole convent
throwing open the house involved turning it into a public resort of
bad character. They felt they must yield or leave the house
altogether, but they promised to abide by the decision of Charitas if
she would stay and advise them. The intrepid abbess decided to do
away with the grating at one window, declaring that they acted
against the rule under protest and only temporarily. On the other
points she sought the advice of learned men outside, but they
advised compromise, for, to give her own words (p. 95), ‘they said
all chance was gone of gaining anything by opposition; we must
yield if we did not want the house to go to ruin. People now did
things by main force regardless of justice or equity, fearful neither of
Pope nor Emperor, nor even of God except in word; things were such
that these people said, What we will must be done, thus and not
otherwise, declaring themselves more powerful than the Pope
himself.’
In the meantime the feelings against the nunnery were by no means
unanimous. Geuder, the brother-in-law of Charitas, was emphatic at
the council meeting in denouncing the throwing open of convents,
which in his eyes also meant turning them into disreputable
houses[1179]. But no amount of opposition made by him and others
could prevent a scene from being enacted in the convent chapel,
which was afterwards looked upon as disgraceful, not only by those
who provoked it, but by outsiders whether partisans of the Lutheran
movement or not. The repeated attempts to persuade the nuns to
leave having failed and Charitas refusing to bid them go, two of the
chief councillors, one of them Nützel, the representative of the
convent’s interests, and the widow of a councillor who had long
clamoured for her daughter’s release, repaired to the convent with a
number of other persons, claimed to be admitted, and declared they
had come to fetch their daughters away. The three nuns, who were
between nineteen and twenty-three years of age, tried to hide, but
Charitas bade them come forth, and they then sought refuge with
her in the convent chapel. She has described in full how the young
women besought her to protect them, how their parents and others
abused and reviled them, and how in spite of their protests, their
indignation and their tears, their relations at last resorted to
violence. Four persons seized each nun and dragged and pushed her
out of the chapel, while the women present shouted approval, and
once outside their convent clothes were torn off and others
substituted in their stead. After a scuffle and a scramble in which
one nun was knocked over and her foot injured, they were carried to
a chariot waiting outside and conveyed away.
Charitas remained behind in grief and despair. ‘I and all my nuns are
so distressed at all this,’ she wrote a few days later[1180], ‘that I have
almost wept out my eyes.... Nothing ever so went to my heart.’
Indignation at the violence of the act became general in the town
and spread beyond its confines. ‘I never could have imagined
women acting in such a cruel manner,’ Sabina, the abbess of Bergen,
wrote to Wilibald; and in another letter, apprehending the
destruction of the convent at Nürnberg, she proposed that Charitas
and her nuns should seek refuge with her[1181].
But Charitas persisted in holding her ground, though with an aching
heart. When the men who had fetched away their daughters sent
word offering to pay for their maintenance during the time they had
lived with her, she refused. Her trials in one direction had reached
their climax,—the councillor Nützel, who admitted that things had
gone too far, henceforth acted in a conciliatory spirit, and some
Welcome to our website – the perfect destination for book lovers and
knowledge seekers. We believe that every book holds a new world,
offering opportunities for learning, discovery, and personal growth.
That’s why we are dedicated to bringing you a diverse collection of
books, ranging from classic literature and specialized publications to
self-development guides and children's books.

More than just a book-buying platform, we strive to be a bridge


connecting you with timeless cultural and intellectual values. With an
elegant, user-friendly interface and a smart search system, you can
quickly find the books that best suit your interests. Additionally,
our special promotions and home delivery services help you save time
and fully enjoy the joy of reading.

Join us on a journey of knowledge exploration, passion nurturing, and


personal growth every day!

ebookbell.com

You might also like