Mozzi
version v1.1.0
sound synthesis library for Arduino
mozzi_config.h
1
#
ifndef
MOZZI_CONFIG_H
2
#
define
MOZZI_CONFIG_H
3
#
include
"hardware_defines.h"
4
5
/*
6
Edit this file if you want to choose your own configuration options.
7
*/
8
9
10
/** @ingroup core
11
AUDIO_MODE holds the audio mode setting.
12
Select STANDARD (deprecated), STANDARD_PLUS or HIFI audio output mode in the Mozzi/mozzi_config.h file with
13
\#define AUDIO_MODE STANDARD_PLUS or \#define AUDIO_MODE HIFI.
14
In Mozzi/config.h, comment one of these options in and the others out to set the audio mode.
15
16
In STANDARD_PLUS mode the sample resolution is 488,
17
which provides some headroom above the 8 bit table resolution currently used by
18
the oscillators. You can look at utility/TimerOne library for more info about how
19
interrupt rate and pwm resolution relate.
20
21
HIFI audio mode enables much higher quality output by combining signals from pins 9 and 10.
22
For HIFI mode, edit Mozzi/mozzi_config.h to contain \#define AUDIO_MODE HIFI,
23
and comment out \#define AUDIO_MODE STANDARD and \#define AUDIO_MODE STANDARD_PLUS.
24
25
@note Teensy 3.* plays 12 bit audio in STANDARD or STANDARD_PLUS modes, and has no HIFI mode.
26
*/
27
//#define AUDIO_MODE STANDARD
28
#
define
AUDIO_MODE
STANDARD_PLUS
29
//#define AUDIO_MODE HIFI
30
31
32
/** @ingroup core
33
Holds the audio rate setting.
34
AUDIO_RATE can be \#defined as 16384 or 32768 Hertz in Mozzi/mozzi_config.h.
35
36
Mozzi's original audio mode, now called STANDARD, uses 16384 Hz, chosen as a
37
compromise between the sample rate (interrupt rate) and sample bitdepth (pwm
38
width), which are interdependent due to the way pulse wave modulation is used to
39
generate the sound output.
40
An AUDIO_RATE of 32768 Hz works in STANDARD_PLUS and HIFI modes.
41
Of course, doubling the sample rate halves the amount of time available to calculate the each sample, so it
42
may only be useful for relatively simple sketches. The increased frequency response can also make
43
unwanted artefacts of low resolution synthesis calculations more apparent, so it's not always a bonus.
44
45
Another factor which is important for Mozzi's operation is that with AUDIO_RATE
46
being a power of two, some internal calculations can be highly optimised for
47
speed.
48
49
In STANDARD and STANDARD_PLUS modes, the sample resolution is 488,
50
which provides some headroom above the 8 bit table resolution currently used by
51
the oscillators. You can look at the TimerOne library for more info about how
52
interrupt rate and pwm resolution relate.
53
54
HIFI audio mode enables much higher quality output by combining signals from pins 9 and 10.
55
For HIFI mode, edit Mozzi/mozzi_config.h to contain \#define AUDIO_MODE HIFI,
56
and comment out \#define AUDIO_MODE STANDARD and \#define AUDIO_MODE STANDARD_PLUS.
57
58
@todo Possible option for output to R/2R DAC circuit, like
59
http://blog.makezine.com/2008/05/29/makeit-protodac-shield-fo/ .
60
Mozzi-users list has a thread on this.
61
*/
62
#
define
AUDIO_RATE
AUDIO_RATE_PLATFORM_DEFAULT
63
//#define AUDIO_RATE 16384 // default on AVR / classic Arduino
64
//#define AUDIO_RATE 32768 // default on most other platforms
65
//#define AUDIO_RATE 65536 // try on Teensy3/3.1 or other strong cpus
66
67
68
//#define USE_AUDIO_INPUT true
69
70
/** @ingroup core
71
This sets which analog input channel to use for audio input, if you have uncommented
72
\#define USE_AUDIO_INPUT true
73
in mozz_config.h
74
@note You may have to call setupFastAnalogReads(FASTEST_ADC) after setupMozzi(), when using this.
75
*/
76
#
define
AUDIO_INPUT_PIN
0
77
78
79
/** @ingroup core
80
This sets allows to change from a single/mono audio output channel to
81
stereo output. To actually generate two channels, your updateAudio()-function
82
should return a StereoOutput(). Sketches returning a MonoOutput() in a stereo
83
config, or vice versa will continue to work, but will generate a warning a
84
compile time.
85
86
@note This option superseeds the earlier STEREO_HACK, which is still available at
87
the time of this writing, but should not be used in new sketches.
88
89
@note At the time of this writing, only MONO and STEREO are supported. The value of
90
MONO is 1 and the value of STEREO is 2, so future extensions are also expected
91
to set this to the number of available channels. */
92
#
define
AUDIO_CHANNELS
MONO
93
//#define AUDIO_CHANNELS STEREO
94
95
/** @ingroup core
96
Defining this option as true in mozzi_config.h allows to completely customize the audio output, e.g. for connecting to external DACs.
97
For more detail, @see AudioOuput .
98
*/
99
#
define
EXTERNAL_AUDIO_OUTPUT
false
100
//#define EXTERNAL_AUDIO_OUTPUT true
101
102
/** @ingroup core
103
Only used when EXTERNAL_AUDIO_OUTPUT is set to true: The resolution to use for audio samples, internally. You will usually set this to match the
104
output resolution of your DAC. 16 is the default value, here. Note that 16 bits is also the maximum currently supported on AVR. */
105
//#define EXTERNAL_AUDIO_BITS 16
106
107
#
endif
// #ifndef MOZZI_CONFIG_H
AUDIO_RATE_PLATFORM_DEFAULT
#define AUDIO_RATE_PLATFORM_DEFAULT
Definition:
hardware_defines.h:38
mozzi_config.h
Generated on Thu Mar 16 2023 14:01:35 for Mozzi by
1.8.14