Skip to content

Commit 3d25df0

Browse files
committed
Taking comments on new examples
1 parent e1c88eb commit 3d25df0

File tree

2 files changed

+12
-16
lines changed

2 files changed

+12
-16
lines changed

examples/06.Synthesis/RingModulator/RingModulator.ino

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
/* Example of Ring Modulation synthesis,
1+
/* Example of Self Modulation synthesis,
22
using Mozzi sonification library.
33
4-
Demonstrates the use of Oscil::phMod to modulate an Oscillator by itself: a ring modulator.
5-
Ring Modulation is a part of frequency modulation synthesis (FM).
4+
Demonstrates the use of Oscil::phMod to modulate an Oscillator by itself.
5+
Self Modulation is a part of frequency modulation synthesis (FM).
66
Compared to "standard" FM where one oscillator modulates another
7-
in Ring Modulation the output of one oscillator is used to modulate
7+
in Self Modulation the output of one oscillator is used to modulate
88
itself, directly, of after further modulation, or to modulate one of its
99
modulator (looking at the DX7 diagram is probably clearer).
1010
11-
Here we demonstrate the simple case of RM, one oscillator modulating himself.
11+
Here we demonstrate the simple case of Self Modulation, one oscillator modulating himself.
1212
The equivalent diagram is:
1313
1414
_____
@@ -33,7 +33,7 @@
3333
Mozzi is licensed under the GNU Lesser General Public Licence (LGPL) Version 2.1 or later.
3434
*/
3535

36-
#define MOZZI_CONTROL_RATE 64 // Hz, powers of 2 are most reliable; 64 Hz is actually the default, but shown here, for clarity
36+
3737
#include <Mozzi.h>
3838
#include <Oscil.h> // oscillator template
3939
#include <tables/sin2048_int8.h> // sine table for oscillator
@@ -47,10 +47,10 @@ EventDelay kChangeNoteDelay; // to change the base note
4747
Smooth<uint8_t> kSmoothModulation(0.99f);
4848
Oscil<SIN2048_NUM_CELLS, MOZZI_AUDIO_RATE> aSin(SIN2048_DATA);
4949

50-
uint8_t ring_mod_amount, smoothed_ring_mod_amount;
50+
uint8_t self_mod_amount, smoothed_self_mod_amount;
5151

52-
UFix<8, 0> notes[4] = { 40 - 12, 52 - 12, 28 - 12, 30 - 12 }; // note played. Because of the ringModulation the oscillator is called *two times*
53-
// hence produces a note which an octave to high, so we compensate for that here (12 midi notes makes an octave).
52+
UFix<8, 0> notes[4] = { 40 - 12, 52 - 12, 28 - 12, 30 - 12 }; // note played. Because of the Modulation the oscillator is called *two times*
53+
// hence produces a note is which an octave to high, so we compensate for that here (12 midi notes makes an octave).
5454

5555

5656
void setup() {
@@ -63,10 +63,10 @@ void setup() {
6363

6464
void updateControl() {
6565
if (kModulationChangeDelay.ready()) {
66-
ring_mod_amount = rand(255); // next target value of modulation
66+
self_mod_amount = rand(255); // next target value of modulation
6767
kModulationChangeDelay.start();
6868
}
69-
smoothed_ring_mod_amount = kSmoothModulation(ring_mod_amount); // smoothing of the modulation
69+
smoothed_self_mod_amount = kSmoothModulation(self_mod_amount); // smoothing of the modulation
7070

7171
if (kChangeNoteDelay.ready()) {
7272
aSin.setFreq(mtof(notes[rand(4)]));
@@ -76,7 +76,7 @@ void updateControl() {
7676

7777

7878
AudioOutput updateAudio() {
79-
return MonoOutput::from8Bit(aSin.phMod((int32_t(aSin.next()) * smoothed_ring_mod_amount) << 4));
79+
return MonoOutput::from8Bit(aSin.phMod((int32_t(aSin.next()) * smoothed_self_mod_amount) << 4));
8080
}
8181

8282

examples/07.Envelopes/Filter_Envelope/Filter_Envelope.ino

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,6 @@ LowPassFilter lpf;
3939

4040

4141
void setup() {
42-
//Serial.begin(9600); // for Teensy 3.1, beware printout can cause glitches
43-
Serial.begin(115200);
4442
randSeed(); // fresh random
4543
envelope.setADLevels(128, 64);
4644
envelope.setTimes(2000, 1500, 250, 1250); // always the same envelope times
@@ -50,8 +48,6 @@ void setup() {
5048
}
5149

5250

53-
unsigned int duration, attack, decay, sustain, release_ms;
54-
5551
void updateControl() {
5652
if (noteDelay.ready()) {
5753
envelope.noteOn(true);

0 commit comments

Comments
 (0)