0

AdaFruit Audio Library doesn't support Metro M4 Airlift?
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

AdaFruit Audio Library doesn't support Metro M4 Airlift?

by jluros on Sun Jun 13, 2021 8:14 pm

I'm trying to get the Adafruit audio library working with my Metro M4 Express Airlift Lite. In two examples I've tried, WavFilePlayer and sketch_jun13a, I'm getting the same error:

Code: Select all | TOGGLE FULL SIZE
Audio_-_Adafruit_Fork/input_adcs.cpp:161:2: error: #error The Adafruit audio library is compatible with M4 parts only
  161 | #error The Adafruit audio library is compatible with M4 parts only


Beginning on Line 122 in input_adcs.cpp, the compiler goes through if/elif/else statements to detect the board variant (_VARIANT_ITSYBITSY_M4_, _VARIANT_FEATHER_M4_, etc.), and gets to the end without matching any of the supported boards.

I think the board variant for the Metro M4 Express Airlift Lite is "ADAFRUIT_METRO_M4_AIRLIFT_LITE", but the compiler obviously doesn't think that _VARIANT_METRO_M4 on line 138-143 is true, otherwise the following would be called and the error "The Adafruit audio library is compatible with M4 parts only" on line 161 wouldn't get triggered:

Code: Select all | TOGGLE FULL SIZE
#elif defined(_VARIANT_METRO_M4_)
   switch (pin1)
   {
      case PIN_A4: ADC1Channel = ADC_Channel0; break;
      case PIN_A5: ADC1Channel = ADC_Channel1; break;
   }


Any help would be greatly appreciated.

jluros
 
Posts: 3
Joined: Thu May 13, 2021 1:24 pm

Re: AdaFruit Audio Library doesn't support Metro M4 Airlift?

by dastels on Sun Jun 13, 2021 9:23 pm

Right. It's not a Metro M4. You should add the Metro M4 Airlift variant to the conditional and, assuming it works (I don't see why it wouldn't), submit a pull request.

Dave

dastels
 
Posts: 6862
Joined: Tue Oct 20, 2015 3:22 pm

Re: AdaFruit Audio Library doesn't support Metro M4 Airlift?

by jluros on Mon Jun 14, 2021 2:52 am

Ok, so I think I got it working (at least, I got a sine wave playing out of A0). I added:

Code: Select all | TOGGLE FULL SIZE
#elif defined(_VARIANT_METRO_M4_WIFI_)
   switch (pin1)
   {
      case PIN_A4: ADC1Channel = ADC_Channel0; break;
      case PIN_A5: ADC1Channel = ADC_Channel1; break;
   }
to input_adcs.cpp

I still don't totally understand how to access the DAC output programmatically and output a wav file to A0. I know it's wired right, because it works in CircuitPython, but I want to figure out how to do it in C.

jluros
 
Posts: 3
Joined: Thu May 13, 2021 1:24 pm

Re: AdaFruit Audio Library doesn't support Metro M4 Airlift?

by dastels on Mon Jun 14, 2021 9:52 am

Good stuff!

Dave

dastels
 
Posts: 6862
Joined: Tue Oct 20, 2015 3:22 pm

Re: AdaFruit Audio Library doesn't support Metro M4 Airlift?

by jluros on Mon Jun 14, 2021 1:20 pm

I still haven't been able to get a WAV file to play on A0 using C code (Arduino IDE). Do you know if the Adafruit fork of the Teensy Audio library supports the Metro M4 Express (SAMD51) platform?

jluros
 
Posts: 3
Joined: Thu May 13, 2021 1:24 pm

Re: AdaFruit Audio Library doesn't support Metro M4 Airlift?

by dastels on Mon Jun 14, 2021 2:28 pm

It works on the NeoTrellis M4 (https://learn.adafruit.com/synthesizer-design-tool) so I expect it would work on the Metro M4 Airlift.

Dave

dastels
 
Posts: 6862
Joined: Tue Oct 20, 2015 3:22 pm

Please be positive and constructive with your questions and comments.