DEPARTMENT OF COMPUTING

AR Envelope

Introduction

This task will add an additional envelope type to the library. All commands that use the envelope factory will be able to create this new envelope type. You will also update the commands that add and edit envelopes to configure the new envelope type.

The waveform type will be called AR. The AR envelope is a subclass of the ADSR type envelope that has attack, sustain, and release phases, but no decay phase. The attack phase ramps from 0.0 to sustain amplitude. The release phase ramps from sustain amplitude to 0.0.

AR-envelope.png

Example Usage

$ ./program-instrument-designer/instrument_designer 
Choice? add-waveform
Waveform name: s
Waveform type: sine
Amplitude: 1.0
Choice? add-envelope 
Envelope name: ar
Envelope type: AR
Maximum amplitude: 1.0
Attack seconds: 0.1
Sustain amplitude: 0.6
Release seconds: 0.2
Choice? add-instrument
Instrument name: sar
Waveform name: s
Envelope name: ar
Choice? configure-audio-track-and-wav-file
Samples/Second: 1000
Seconds: 1.0
Bits/Sample[8,16,24,32]: 16
Choice? record-instrument-note
Instrument name: sar
Frequency: 40.0
WAV filename: ar.wav
Choice? quit

Opening the WAV file with Audacity or other audio editor should show the AR envelope.

ar-audacity.png

Note that the AR envelope needs the attributes Maximum amplitude, Attack seconds, Sustain amplitude, and Release seconds. This will be important when you add or edit an AR envelope.

Programming Requirements

Some files already exist from the homework. Add to them to complete this task. Other files should be created as needed.

Create library-envelope/AREnvelope.{h,cpp}

AREnvelope Class

Publicly inherits from ADSREnvelope.

Data Members:

The AREnvelope class does not define any new data members.

public Methods:

Update library-envelope/EnvelopeFactory.{h,cpp}

public Class Data Members:

public Enumerations:

public Methods:

Update library-commands/instrument_designer_aux.{h,cpp}

Functions:

Grading Instructions

To receive credit for this task:

Last Updated 03/19/2025