Mozzi  version v1.1.0
sound synthesis library for Arduino
AudioConfigRP2040.h
1 #ifndef AUDIOCONFIGRP2040_H
2 #define AUDIOCONFIGRP2040_H
3 
4 #if not IS_RP2040()
5 #error This header should be included for RP2040, only
6 #endif
7 
8 
9 // AUDIO output modes
10 #define PWM_VIA_BARE_CHIP 1 // output using one of the gpio of the board
11 #define EXTERNAL_DAC_VIA_I2S 2 // output via external DAC connected to I2S (PT8211 or similar)
12 
13 //******* BEGIN: These are the defines you may want to change. Best not to touch anything outside this range. ************/
14 #define RP2040_AUDIO_OUT_MODE PWM_VIA_BARE_CHIP
15 //******* END: These are the defines you may want to change. Best not to touch anything outside this range. ************/
16 
17 
19 #define AUDIO_CHANNEL_1_PIN 0
20 #if (AUDIO_CHANNELS > 1)
21 // Audio channel pins for stereo or HIFI must be on the same PWM slice (which is the case for the pairs (0,1), (2,3), (4,5), etc.
22 #define AUDIO_CHANNEL_2_PIN 1
23 #endif
24 
25 // The more audio bits you use, the slower the carrier frequency of the PWM signal. 11 bits yields ~ 60kHz on a 133Mhz CPU (which appears to be a reasonable compromise)
26 #define AUDIO_BITS 11
27 #endif
28 
30 // ****** BEGIN: These are define you may want to change. Best not to touch anything outside this range. ************/
31 #define BCLK_PIN 20
32 #define WS_PIN (pBCLK+1) // CANNOT BE CHANGED, HAS TO BE NEXT TO pBCLK
33 #define DOUT_PIN 22
34 #define LSBJ_FORMAT false // some DAC, like the PT8211, use a variant of I2S data format called LSBJ
35  // set this to true to use this kind of DAC or false for plain I2S.
36 #define AUDIO_BITS 16 // available values are 8, 16, 24 (LEFT ALIGN in 32 bits type!!) and 32 bits
37 // ****** END: These are define you may want to change. Best not to touch anything outside this range. ************/
38 
39 #define BYPASS_MOZZI_OUTPUT_BUFFER true
40 
41 // Configuration of the I2S port, especially DMA. Set in stone here as default of the library when this was written.
42 // Probably do not change if you are not sure of what you are doing
43 #define BUFFERS 8 // number of DMA buffers used
44 #define BUFFER_SIZE 256 // total size of the buffer, in samples
45 #endif
46 
47 
48 #define AUDIO_BITS_PER_CHANNEL AUDIO_BITS
49 
50 #define AUDIO_BIAS ((uint16_t) 1<<(AUDIO_BITS-1))
51 
52 #endif // #ifndef AUDIOCONFIGRP2040_H
#define PWM_VIA_BARE_CHIP
#define AUDIO_BITS
Definition: MozziGuts.h:228
#define RP2040_AUDIO_OUT_MODE
#define EXTERNAL_DAC_VIA_I2S