forked from sensorium/Mozzi
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmozzi_config.h
executable file
·94 lines (72 loc) · 3.4 KB
/
mozzi_config.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#ifndef MOZZI_CONFIG_H
#define MOZZI_CONFIG_H
/*
Edit this file if you want to choose your own configuration options.
*/
//
// If using Syinsi.com EuroArdCore module
//
#define USE_MCPxxxx true
#define STEREO_HACK true
/** @ingroup core
AUDIO_MODE holds the audio mode setting.
Select STANDARD or HIFI audio output mode in the Mozzi/mozzi_config.h file with
\#define AUDIO_MODE STANDARD or \#define AUDIO_MODE HIFI.
In Mozzi/config.h, comment one of these options in and the other out to set the audio mode.
In STANDARD mode the sample resolution is 488,
which provides some headroom above the 8 bit table resolution currently used by
the oscillators. You can look at utility/TimerOne library for more info about how
interrupt rate and pwm resolution relate.
HIFI audio mode enables much higher quality output by combining signals from pins 9 and 10.
For HIFI mode, edit Mozzi/mozzi_config.h to contain \#define AUDIO_MODE HIFI,
and comment out \#define AUDIO_MODE STANDARD.
@note Teensy 3.1 plays 12 bit audio in STANDARD or STANDARD_PLUS modes, and has no HIFI mode.
*/
//#define AUDIO_MODE STANDARD
#define AUDIO_MODE STANDARD_PLUS
//#define AUDIO_MODE HIFI
/** @ingroup core
Holds the audio rate setting.
AUDIO_RATE can be \#defined as 16384 or 32768 Hertz in Mozzi/mozzi_config.h.
Mozzi's original audio mode, now called STANDARD, uses 16384 Hz, chosen as a
compromise between the sample rate (interrupt rate) and sample bitdepth (pwm
width), which are interdependent due to the way pulse wave modulation is used to
generate the sound output.
An AUDIO_RATE of 32768 Hz works in STANDARD_PLUS and HIFI modes.
Of course, doubling the sample rate halves the amount of time available to calculate the each sample, so it
may only be useful for relatively simple sketches. The increased frequency response can also make
unwanted artefacts of low resolution synthesis calculations more apparent, so it's not always a bonus.
Another factor which is important for Mozzi's operation is that with AUDIO_RATE
being a power of two, some internal calculations can be highly optimised for
speed.
In STANDARD and STANDARD_PLUS modes, the sample resolution is 488,
which provides some headroom above the 8 bit table resolution currently used by
the oscillators. You can look at the TimerOne library for more info about how
interrupt rate and pwm resolution relate.
HIFI audio mode enables much higher quality output by combining signals from pins 9 and 10.
For HIFI mode, edit Mozzi/mozzi_config.h to contain \#define AUDIO_MODE HIFI,
and comment out \#define AUDIO_MODE STANDARD and \#define AUDIO_MODE STANDARD_PLUS.
@todo Possible option for output to R/2R DAC circuit, like
http://blog.makezine.com/2008/05/29/makeit-protodac-shield-fo/ .
Mozzi-users list has a thread on this.
*/
//#define AUDIO_RATE 16384
#define AUDIO_RATE 32768
/** @ingroup core
Whether or not to use audio input.
Put \#define USE_AUDIO_INPUT false in Mozzi/mozzi_config.h to enable audio input on analog pin AUDIO_INPUT_PIN,
otherwise make it false, to save resources.
*/
#define USE_AUDIO_INPUT false
/** @ingroup core
This sets which analog input channel to use for audio input, if you have
\#define USE_AUDIO_INPUT true
in mozz_config.h
*/
#if defined(__MK20DX128__) || defined(__MK20DX256__) // teensy 3, 3.1
#define AUDIO_INPUT_PIN 0
#else
#define AUDIO_INPUT_PIN 0
#endif
//AUDIO_INPUT_CHANNEL = analogPinToChannel(AUDIO_INPUT_PIN)
#endif // #ifndef MOZZI_CONFIG_H