Mozzi  version v1.1.0
sound synthesis library for Arduino
mozzi_config.h
1 #ifndef MOZZI_CONFIG_H
2 #define MOZZI_CONFIG_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 /** @ingroup core
69 Whether or not to use audio input.
70 Put \#define USE_AUDIO_INPUT true in Mozzi/mozzi_config.h to enable audio input on analog pin AUDIO_INPUT_PIN,
71 otherwise make it false, to save resources.
72 */
73 //#define USE_AUDIO_INPUT true
74 
75 
76 
77 /** @ingroup core
78 This sets which analog input channel to use for audio input, if you have
79 \#define USE_AUDIO_INPUT true
80 in mozz_config.h
81 */
82 #define AUDIO_INPUT_PIN 0
83 
84 //AUDIO_INPUT_CHANNEL = analogPinToChannel(AUDIO_INPUT_PIN)
85 
86 /** @ingroup core
87 This sets an option for stereo output, a hack which requires
88 variables audio_signal_1 and audio_signal_2 to be set in updateAudio(),
89 instead of returning a single audio value as is usual for standard mono.
90 You need to have \#define STEREO_HACK true in mozzi_config.h
91 */
92 #define STEREO_HACK false
93 
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
#define AUDIO_RATE_PLATFORM_DEFAULT