MichaelMeissner
Senior Member+
Note, I built the audio examples on a Fedora 36 system using the Teensy 1.58 beta 2 release laid over the arduino 1.8.19 release.
I was answering a question on the adafruit forum about mixing sounds (where the suggestion was to buy separate audio boards to play two sounds at the same time), so I answered about the Teensy audio system. So I tried Examples -> Audio -> Tutorial -> Part_2_02_Mixers, and it looks like the file no longer has the audio includes:
In going through the examples, it looks like the following also are missing the declarations:
And as I've complained about in the past, all of the examples that reference the SD card should have #ifdef's for Teensy 4.0/4.1. It would be nice if the Teensy 3.5, 3.6, and 4.1 selected the builtin-SD card by default, but at least for the Teensy 4.0/4.1 use the correct CS/SCLK/MOSI for the audio adapters. The examples I noticed are:
For example, with Part_2_07_Filters, it has the lines:
I think it should have:
Alternatively, you could always use the SD card on the audio adapter by default, and indicate the 3.5/3.6/4.1 in the comments:
I was answering a question on the adafruit forum about mixing sounds (where the suggestion was to buy separate audio boards to play two sounds at the same time), so I answered about the Teensy audio system. So I tried Examples -> Audio -> Tutorial -> Part_2_02_Mixers, and it looks like the file no longer has the audio includes:
Code:
Part_2_02_Mixers: In function 'void setup()':
Part_2_02_Mixers:33: error: 'AudioMemory' was not declared in this scope
33 | AudioMemory(8);
| ^~~~~~~~~~~
Part_2_02_Mixers:34: error: 'sgtl5000_1' was not declared in this scope
34 | sgtl5000_1.enable();
| ^~~~~~~~~~
Part_2_02_Mixers:36: error: 'SPI' was not declared in this scope; did you mean 'SPIF'?
36 | SPI.setMOSI(SDCARD_MOSI_PIN);
| ^~~
| SPIF
Part_2_02_Mixers:38: error: 'SD' was not declared in this scope; did you mean 'SS'?
38 | if (!(SD.begin(SDCARD_CS_PIN))) {
| ^~
| SS
Part_2_02_Mixers:45: error: 'mixer1' was not declared in this scope
45 | mixer1.gain(0, 0.5);
| ^~~~~~
Part_2_02_Mixers:47: error: 'mixer2' was not declared in this scope
47 | mixer2.gain(0, 0.5);
| ^~~~~~
Part_2_02_Mixers: In function 'void loop()':
Part_2_02_Mixers:53: error: 'playSdWav1' was not declared in this scope
53 | if (playSdWav1.isPlaying() == false) {
| ^~~~~~~~~~
Part_2_02_Mixers:58: error: 'playSdWav2' was not declared in this scope
58 | if (playSdWav2.isPlaying() == false) {
| ^~~~~~~~~~
'AudioMemory' was not declared in this scope
In going through the examples, it looks like the following also are missing the declarations:
- Part_2_01_First_Design_Tool_use
- Part_2_03_Samples
- Part_2_04_Microphone_Check
- Part_2_05_Simple_Delay
- Part_2_06_Feedback_Delay
- Part_2_07_Filters
- Part_2_08_Oscillators
- Part_3_01_Peak_Detection
- Part_3_02_Fourier_Transform
- Part_3_03_TFT_Display
And as I've complained about in the past, all of the examples that reference the SD card should have #ifdef's for Teensy 4.0/4.1. It would be nice if the Teensy 3.5, 3.6, and 4.1 selected the builtin-SD card by default, but at least for the Teensy 4.0/4.1 use the correct CS/SCLK/MOSI for the audio adapters. The examples I noticed are:
- Part_1_03_Playing_Music
- Part_1_04_Blink_While_Playing
- Part_2_02_Mixers
- Part_1_05_Do_More_While_Playing
- Part_2_07_Filters
- Part_3_01_Peak_Detection
- Part_3_02_Fourier_Transform
- Part_3_03_TFT_Display
For example, with Part_2_07_Filters, it has the lines:
Code:
// Use these with the Teensy Audio Shield
#define SDCARD_CS_PIN 10
#define SDCARD_MOSI_PIN 7
#define SDCARD_SCK_PIN 14
// Use these with the Teensy 3.5 & 3.6 SD card
//#define SDCARD_CS_PIN BUILTIN_SDCARD
//#define SDCARD_MOSI_PIN 11 // not actually used
//#define SDCARD_SCK_PIN 13 // not actually used
// Use these for the SD+Wiz820 or other adaptors
//#define SDCARD_CS_PIN 4
//#define SDCARD_MOSI_PIN 11
//#define SDCARD_SCK_PIN 13
I think it should have:
Code:
// Use these with the Teensy 3.5, 3.6, and 4.1 SD card:
#if defined(PROCESSOR_TEENSY_3_5) || defined(PROCESSOR_TEENSY_3_6) || defined(PROCESSOR_TEENSY_4_1)
#define SDCARD_CS_PIN BUILTIN_SDCARD
#define SDCARD_MOSI_PIN 11 // not actually used
#define SDCARD_SCK_PIN 13 // not actually used
// Use these with the Teensy 4.0 to use the audio adapter SD card
#elif defined(PROCESSOR_TEENSY_4_0)
#define SDCARD_CS_PIN 10
#define SDCARD_MOSI_PIN 11
#define SDCARD_SCK_PIN 13
// Use these with the Teensy 3.2
#else
// Use these with the Teensy Audio Shield
#define SDCARD_CS_PIN 10
#define SDCARD_MOSI_PIN 7
#define SDCARD_SCK_PIN 14
#endif
// Use these for the SD+Wiz820 or other adaptors
//#define SDCARD_CS_PIN 4
//#define SDCARD_MOSI_PIN 11
//#define SDCARD_SCK_PIN 13
Alternatively, you could always use the SD card on the audio adapter by default, and indicate the 3.5/3.6/4.1 in the comments:
Code:
// Use these with the Teensy 4.0/.41 to use the audio adapter SD card
#if defined(PROCESSOR_TEENSY_4_0) || defined(PROCESSOR_TEENSY_4_1)
#define SDCARD_CS_PIN 10
#define SDCARD_MOSI_PIN 11
#define SDCARD_SCK_PIN 13
// Use these with the Teensy 3.2, 3.5, or 3.6
#else
// Use these with the Teensy Audio Shield
#define SDCARD_CS_PIN 10
#define SDCARD_MOSI_PIN 7
#define SDCARD_SCK_PIN 14
#endif
// Use these with the Teensy 3.5, 3.6, and 4.1 SD card:
//#define SDCARD_CS_PIN BUILTIN_SDCARD
//#define SDCARD_MOSI_PIN 11 // not actually used
//#define SDCARD_SCK_PIN 13 // not actually used
// Use these for the SD+Wiz820 or other adaptors
//#define SDCARD_CS_PIN 4
//#define SDCARD_MOSI_PIN 11
//#define SDCARD_SCK_PIN 13