Skip to content

bradhowes/SimplyTremolo

Repository files navigation

CI Swift 5.5 AUv3 License: MIT

About SimplyTremolo

This is a simple audio plugin that generates a tremolo effect on iOS and macOS platforms. It uses the Apple Accelerate routine to perform phased attenuation for all frames in one shot.

The code was developed in Xcode 12.4 on macOS 11.2.1. I have tested on both macOS and iOS devices primarily in GarageBand, but also using test hosts on both devices as well as the excellent AUM app on iOS.

Quick Guide

  • Rate -- controls the low-frequency oscillator (LFO) that changes the amplitude of the input signal. The higher the number, the faster the oscillation.
  • Depth -- controls how much of the signal is attenuated by the LFO. At its minimum value, there is no perceptible change. Going all the way to 100% means the volume will drop to zero when the LFO is at its largest value.
  • Square -- normally LFO shape is a triangle wave, linearly rising and falling betwen -1.0 and 1.0. When this switch is enabled, the shape changes to something that just does -1.0 and 1.0 without any intermediate values. Odd and often noisy but might just be the effect you are after.
  • Dry -- the amount of original signal that is used in the output signal.
  • Wet -- the amount of the modified signal that is used in the output signal.
  • Odd 90° -- oscillate all 'odd' channels with an LFO that is out-of-phase (for stereo, left is even and right is odd).

The row of buttons at the top of the host demonstration app let you play a prerecorded sample throught the effect and try out different pre-installed or "factory" presets. Note that these controls are not present in the audio unit itself, but the factory presets are available from within other AUv3 hosts such as GarageBand -- as are user presets if the host supports them.

AUv3 Compliance

This audio unit passes all auval tests, so it should work in your AUv3-compatible host application:

% auval -v aufx trlo BRay

Building

To successfully compile you will need to edit Configuration/Common.xcconfig and change DEVELOPMENT_TEAM to hold your own Apple developer account ID so you can sign the binaries. You should also adjust other settings as well to properly identify you and/or your company if you desire.

⚠️ You are free to use the code according to LICENSE.md, but you must not replicate someone's UI, icons, samples, or any other assets if you are going to distribute your effect on the App Store.

There are additional values in this file that you really should change, especially to remove any risk of collision with other AUv3 effects you may have on your system.

The script newRelease.sh automates generating new archive versions of both the macOS and iOS apps and uploads them to the App Store if everything checks out. It uses the DEVELOPMENT_TEAM setting in the Common.xcconfig to handle the authentication and signing.

The Python script bumpVersions.py maniuplates the various versions attributes of the app that follow the semantic versioning model: major, minor, patch. There is also a "project version" that consists of a timestamp. The App Store demands that this version be unique for each submission.

App Targets

The macOS and iOS apps are simple AUv3 hosts that demonstrate the functionality of the AUv3 component. In the AUv3 world, an app serves as a delivery mechanism for an app extension like AUv3. When the app is installed, the operating system will also install and register any app extensions found in the app.

The apps attempt to instantiate the AUv3 component and wire it up to an audio file player and the output speaker. When it runs, you can play the sample file and manipulate the effects settings in the components UI.

Code Layout

Each OS (macOS and iOS) have the same code layout:

  • App -- code and configuration for the application that hosts the AUv3 app extension
  • Extension -- code and configuration for the extension itself. It also contains the OS-specific UI layout definitions.

The common code, including the audio kernel, exists as a collection of Swift packages:

  • Kernel -- contains the C++ AudioUnit kernel that renders audio samples
  • KernelBridge -- Objective-C / Swift interface into the Kernel
  • ParameterAddress -- enumeration to be used for the AUParameter address value. These are the runtime controls for the effect.
  • Parameters -- holds the collection of AUParameter instances created from ParameterAddress definitions that become the basis for the AUParameterTree of the audio unit. Also holds the colletion of factory presets.

The links above point to additional details about each package.