You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This addon is a leightweight manager for Adam Carlucci's excellent [ofxAudioUnit](https://github.com/admsyn/ofxAudioUnit).
3
+
This addon is a leightweight manager for Adam Carlucci's excellent [ofxAudioUnit](https://github.com/admsyn/ofxAudioUnit). It allows you to manage chains of Audio Units and sets of presets with your keyboard at runtime, and to design new chains with just a few lines of code.
4
4
5
-

5
+

6
6
7
-
You can show and hide the control panel above by hitting 'v', allowing you to use this addon neatly with other addons and your own code.
7
+
You can show and hide the control panel above by hitting 'v'.
8
8
9
-
Why not just use ofxAudioUnit?
10
-
------------------------------
11
-
ofxAudioUnit does a fantastic job of bridging [openFrameworks](http://openframeworks.cc/) and [Audio Units](http://logic-pro-expert.com/logic-pro-blog/2011/10/11/another-38-free-audio-unit-plugins-worth-checking-out.html). There are a number of ways of using it, but it's common to want to:
9
+
What is this addon for?
10
+
-----------------------
11
+
The purpose of this addon is to make it easy to experiment with sound design in your apps.
12
12
13
-
1. Send MIDI to a synth or sound-generating unit
14
-
2. Plug the output from the synth through a chain of effects and processors
15
-
3. At the end of that chain, plug the output to a mixer which goes to your sound card
13
+
To do this, the addon automates tasks associated with using `ofxAudioUnit` that are not related to sound design. It then puts in place a helpful interface allowing you to experiment, save and experiment more, often without recompiling.
16
14
17
-
While using ofxAudioUnit for [projects](https://vimeo.com/112347647), I found a typical workflow to be:
15
+
How to design a chain
16
+
---------------------
17
+
Declare the manager and the units you would like to use in the header file. The classes below are all bundled with `ofxAudioUnitManager`, each wrapping `ofxAudioUnit` classes to simplify their usage:
18
18
19
-
1. Experiment with different combinations of synths and effects until you establish a suitable 'chain' of units
20
-
2. Experiment with that chain and discover it's potential with different parameters and MIDI sequences
21
-
3. Establish more chains and experiment with mixing them together
19
+
```cpp
20
+
ofxAudioUnitManager manager;
21
+
AudioUnitChain chain;
22
+
TALNoiseMaker noiseMaker;
23
+
LowPassFilter filter;
24
+
Reverb reverb;
25
+
```
22
26
23
-
The problem is that with ofxAudioUnit alone, that workflow involves a lot of programming, recompiling, running and more programming. In other words, you have to keep switching between sound design and engineering mindsets every few minutes.
27
+
Over in the `cpp` file you can declare and initialise a chain in three easy steps. First, have the manager set up the chain with a name and a colour:
24
28
25
-
What you really want to do is focus on sound design.
29
+
```cpp
30
+
manager.add(&chain, "tal-one", ofColor::blue);
31
+
```
26
32
27
-
How ofxAudioUnitManager helps
28
-
-----------------------------
33
+
Then, load the units into the chain, in the order you would like them connected:
29
34
30
-
This addon wraps up most of the engineering either via the computer keyboard-controlled UI or by letting you extend [base](https://github.com/microcosm/ofxAudioUnitManager/blob/master/src/AudioUnits/AudioUnitBase.cpp)[classes](https://github.com/microcosm/ofxAudioUnitManager/blob/master/src/AudioUnitChains/AudioUnitChain.cpp) which do most of the work.
35
+
```cpp
36
+
chain1.link(&noiseMaker)
37
+
.to(&filter)
38
+
.to(&reverb)
39
+
.toMixer();
40
+
```
31
41
32
-
What ofxAudioUnitManager does is allow you to:
42
+
Finally, now that the units are loaded you can read presets from disk:
33
43
34
-
1. Create new units and unit chains with very little code, and in a repeatable fashion
35
-
2. Use your computer keyboard to manage (play, save, rename, and delete) presets across entire chains at runtime
36
-
3. Use a hassle-free template for composing programmatic real-time MIDI behaviour using [ofxMidi](https://github.com/danomatika/ofxMidi) and [ofxBpm](https://github.com/mirrorboy714/ofxBpm)
44
+
```cpp
45
+
manager.loadPresets(&chain1);
46
+
```
37
47
38
-
This allows you to focus on sound design, leaving you with only minor engineering tasks which you can accomplish by copying established patterns.
48
+
That's all you need to do. This code will give you the blue chain shown in the image above.
49
+
50
+
Managing presets
51
+
----------------
52
+
Use the `left` and `right` arrow keys at runtime to select different chains. Use the `up` and `down` arrow keys to switch between presets on a chain.
53
+
54
+
On the disk, presets are saved in `bin/data` in a directory named `AudioUnitPresets`:
55
+
56
+

57
+
58
+
Inside `AudioUnitPresets` each chain has a folder (named when you initialise the chain in your code). Inside each chain folder are directories for each of the presets. These you save and name from the `ofxAudioUnitManager` user interface.
59
+
60
+
Inside each preset folder are the individual preset files, one for each unit in the chain.
61
+
62
+
Changing the unit order
63
+
-----------------------
64
+
You are free to experiment with the order of your chain without losing your presets. For example let's imagine you start off with this chain, and save a selection of presets:
65
+
66
+
```cpp
67
+
chain1.link(&noiseMaker)
68
+
.to(&filter) //presets saved as ../preset-name/LowPassFilter.aupreset
69
+
.to(&reverb) //presets saved as ../preset-name/Reverb.aupreset
70
+
.toMixer();
71
+
```
72
+
73
+
Later you decide to switch the filter and reverb:
74
+
75
+
```cpp
76
+
chain1.link(&noiseMaker)
77
+
.to(&reverb) //presets saved as ../preset-name/Reverb.aupreset
78
+
.to(&filter) //presets saved as ../preset-name/LowPassFilter.aupreset
79
+
.toMixer();
80
+
```
81
+
82
+
The presets you originally created will still apply to the correct units as they are named after the class name of the unit.
83
+
84
+
Naming your units
85
+
-----------------
86
+
The only complication with the storage technique described above is if you want to chain two units of the same type. In this scenario it is best to name the units:
87
+
88
+
```cpp
89
+
chain2.link(&noiseMaker)
90
+
.to(&filter1, "filter1") //presets saved as ../preset-name/filter1_Reverb.aupreset
91
+
.to(&filter2, "filter2") //presets saved as ../preset-name/filter1_Reverb.aupreset
92
+
.to(&reverb)
93
+
.toMixer();
94
+
```
95
+
96
+
This will prevent naming conflicts when the manager attempts to load and save presets.
97
+
98
+
If you decide to add or change a unit's name after you have already been using it, remember to go into the preset folders and update the names there too. Otherwise the manager will generate new preset files the next time you run it.
99
+
100
+
In this circumstance, the new and old preset files will sit alongside each other on the disk. However only the new preset files will be used by the manager.
101
+
102
+
Sending MIDI to your chains
103
+
---------------------------
104
+
This addon uses [ofxBpm](https://github.com/mirrorboy714/ofxBpm) and [ofxMidi](https://github.com/danomatika/ofxMidi) to allow you to send MIDI sequences at timed intervals.
Each chain sets up an `ofxMidi` instance and provides access for you to manipulate it.
117
+
118
+
Adding new units
119
+
----------------
120
+
Each time you want to work with new Audio Units in `ofxAudioUnitManager`, you will have to create a new class. However, all of the hard work is taken care of in the base class `AudioUnitBase`, and your class only need contain a few lines:
121
+
122
+
```cpp
123
+
void TALNoiseMaker::setup() {
124
+
unit = ofxAudioUnit('aumu', 'ncut', 'TOGU');
125
+
type = AU_TYPE_SYNTH;
126
+
className = "TALNoiseMaker";
127
+
AudioUnitBase::setup();
128
+
}
129
+
```
130
+
131
+
The header file is similarly sparse. As a convention the supported parameter list for each unit is listed as `const`s in the header:
132
+
133
+
```cpp
134
+
classTALNoiseMaker : publicAudioUnitBase {
135
+
public:
136
+
void setup();
137
+
};
138
+
139
+
const static int TALNoiseMaker_volume = 1;
140
+
const static int TALNoiseMaker_filtertype = 2;
141
+
const static int TALNoiseMaker_cutoff = 3;
142
+
//.. etc for all parameters
143
+
```
144
+
145
+
This enables you to quickly find and set parameters in your general code:
noiseMaker.set(TALNoiseMaker_cutoff, cutoff); //Automate the parameter
150
+
```
151
+
152
+
In practice only takes a moment to create these classes, using the existing classes as a template.
153
+
154
+
Obviously there's a world of Audio Units out there and this addon only has a small subset. If you would like to contribute, you can send pull requests with additional units that you use.
39
155
40
156
How to try out this addon
41
157
-------------------------
@@ -44,15 +160,11 @@ How to try out this addon
44
160
3. Install the [TAL NoiseMaker](http://kunz.corrupt.ch/products/tal-noisemaker) audio unit. The example project in this repo uses this synth. The 32bit version seems to work with openFrameworks
45
161
3. Launch the example project and try out the key controls listed on the screen
0 commit comments