Resampling I2S slave inputs at the T4/ T4.1

Status
Not open for further replies.

alex6679

Well-known member
Hi,

I tried to write a class that allows to resample the input data from the i2s slave inputs to the audio sample of the T4/ T4.1. The resampling class is a template class and the template argument is the audio input that gets resampled. I tested it with the AudioInputI2Sslave and tried to make as few changes as possible to the I2S input. The main modification is that the input writes the incoming samples not into an audio block, but into the buffer of the resampling class. In addition to that I extended the interface of the I2S input so that information like the number of input channels, the current write index in the buffer and the input frequency is accessible to the resampling class.
The resampling is already working and I would be glad if somebody of the audio library experts (maybe Frank B or Paul?) could have a look at it. If you think it is worth adding it to the audio library, I would continue working on it and test it for the 4,6 and 8 channel I2S input. I tried to keep it as simple as possible, but I am not sure if the added complexity to the audio library is it worth.

You can find all needed files here: (the adopted I2S input, the resampling class and a small example)
https://github.com/alex6679/teensy-4-async-inputs

I would be happy about some feedback.

Best regards
Alex
 
Resampling for inputs is a good thing.

Have measured how long it takes? (cpu usage)
How much memory does it need?
Would it work if I set the sampling rate of the library to 48k (or perhaps 96k) ?

Could the code be used - for example - for files from SD (wave, etc), too?
 
Regarding the cpu usage:
It depends on the configuration (constructor arguments) of the class. The class has the same arguments as the AsyncAudioInputSPDIF3.
I just made some test to determine the typical range of of cpu use:
With a input frequency of 192kHz, the interpolation filter has its maximum length (181 samples long) and the cpu usage is at 15% (stereo)
The lowest cpu usage of about 2% can be achieved by setting the maximum filter length to 3 (maxHalfFilterLength=1). But then the quality is really bad. Especially due to the aliasing at input frequencies larger than 44.1kHz.

At a typical situation (48kHz input frequency + default constructor parameters) the processor usage is at around 7-8%.
Dither and noise shaping was deactivated at all the tests.

Regarding the memory usage: Unfortunately it is quite high. There is the Resampler class (already part of the Audio library). It contains the implemation of resampling algorithm and it stores a large look up table to speed up the computation of sinc- interpolation filter. Although this filter 'covers' only for example 3-181 input samples, its coefficients needs to be computed for each new interpolated sample. (The details can be found here: https://www.dsprelated.com/freebooks/pasp/Windowed_Sinc_Interpolation.html) Anyway this table is currently 163844 bytes large. It could be reduced at the cost of less accurate evaluation of the sinc filter coefficients. Then there are three 1025 sample long double arrays needed for the Kaiser window computation. They could maybe be moved from the DTCM ram to the slower ram, since they are only needed at the configuration of the resampler.

Different Audio library sample rate: I use the same algorithm with a version of the Audio library that runs at 48kHz. So I am sure that it will work. 96kHz: I haven't tested it.

It is also possible to resample arbitrary data: Here you would probably directly use the Resampler class and not that AsyncAudioInput-template class that connects I2S input + Resampler + Audio pipline.
I already committed an example that shows the usage of the Resampler: https://github.com/alex6679/teensy-4-spdifIn/blob/master/examples/example_resampler.cpp
In this example one single input array is resampled. I assume that it is not possible to resample a complete audio file at once due to the memory restrictions. I will write another example that shows how a large array can be processed in small chunks.
 
Could you put a block schematic for the DSP used in the README file, and it needs high-level comments
and API spec. - this all goes in gui/index.html ultimately of course.
 
@Frank: I added an example of the resampler class, that shows how to resample data that is too large for a single array: https://github.com/alex6679/teensy-4-spdifIn/blob/master/examples/example_resampler_chunks.cpp. I am not sure if that is what you asked for or if you asked if the AsyncAudioInput class can be used in combination with AudioPlaySdWav.

@Mark I added a description of the functions and of the constructor arguments of AsyncAudioInput to the README file. The class has nearly the same interface as AsyncAudioInputSPDIF3. So I copied most of its description. I am not sure what you mean by 'block schemantic for the DSP used'? Do you mean of block schemantic of the audio design tool?
 
Schematic of the DSP ought to be clear - an overview of how it all connects together as orientation - its hard work
just reading code from cold.
 
Ok, I understand. I will make a block diagram of the classes and a short description of their main tasks.
Also the extension that I implemented for the original i2s slave class is really not a nice solution (although it works): AudioInputI2Sslave is an Audiostream object, but the Audiostream functions are suppressed, when it is used im combination with the AsyncAudioInput and the class is misused. I'll come up with a better suggestion.
 
No, thats not really what I meant. The schematic of some DSP follows the signal, as in "signal processing", showing the
flow of information through functional blocks (a schematic or high-level signal flow graph) ie "what its doing", not "how
its doing it".
 
For me each of the main classes (Resampler, FrequencyMeasurement, AsyncAudioInput, the i2s input ) is a functional block and by describing what their tasks are, I meant describing "what they are doing". So I think, I understood what you meant. But maybe I should first draw an initial diagram, that we can use as a starting point for further discussions.
 
Ok, I added a block diagram of the most important blocks of the AsyncAudioInput class. Does this help at understanding how the class works?
Independently of the description that I wrote, I should make more clear what my idea behind the class was: I wrote the AsyncAudioInputSPDIF3 class of the audio library and I noticed that the same resampling concept can be applied to all the i2s slave inputs. AsyncAudioInputSPDIF3 could be copied and all the spdif spesific code could be replaced by the i2s equivalent. But then there would a lot of redundant code. So I moved all the reusable code to AsyncAudioInput and made a template function out of it. Initially I thought that some minor extensions to the already existing i2s slave classes would be sufficient. But now I think it's better to implement an additional small class (TInput in the README file) for each i2s input that provides the data to AsyncAudioInput. What do think about the concept of a generic template resampling class together with smaller input specific classes?
 
No, because "resampler" is still an opaque black box. I'd just like a map of the processing (sample rates,
bit widths, individual steps like "downsample", "LPF (fir N taps, halfband)" etc) and how it relates to actual classes,
methods and variables in the code - as I said I never relish diving into reading code without an overview,
and it makes it much more efficient for people to come upto speed.
 
Last edited:
There is no layer below the Resampler class. There are no further classes or blocks or a processing pipeline inside the Resampler. The Resampler has a resampling function that implements the bandlimited interpolation by means of a windowed sinc- function. I just implemented the algorithm described here: https://ccrma.stanford.edu/~jos/resample/resample.pdf. I can describe the members and functions of the Resampler (e.g. how the parameters of the Kaiser window are determined), but this would then be the opposite of what you wished above, i.e. how the Resampler works in detail. I did not expect that anybody would be interested in this details. However, if you want, we can go into the details.
 
Alex, GCC10 shows notes about some double promotions:
Code:
C:\Arduino\hardware\teensy\avr\libraries\Audio\Quantizer.cpp: In member function 'void Quantizer::quantize(float*, int16_t*, uint16_t)':
C:\Arduino\hardware\teensy\avr\libraries\Audio\Quantizer.cpp:31:65: warning: implicit conversion from 'float' to 'double' to match other operand of binary expression [-Wdouble-promotion]
   31 | #define SAMPLEINVALID(sample) (!isfinite(sample) || abs(sample) >= 1.2) //use only for floating point samples (\in [-1.,1.])
C:\Arduino\hardware\teensy\avr\libraries\Audio\Quantizer.cpp:119:13: note: in expansion of macro 'SAMPLEINVALID'
  119 |         xn= SAMPLEINVALID(*input) ? 0. : *input*_factor; //-_fOutputLastIt0 according to paper
      |             ^~~~~~~~~~~~~
C:\Arduino\hardware\teensy\avr\libraries\Audio\Quantizer.cpp:119:35: warning: implicit conversion from 'float' to 'double' to match other result of conditional [-Wdouble-promotion]
  119 |         xn= SAMPLEINVALID(*input) ? 0. : *input*_factor; //-_fOutputLastIt0 according to paper
      |                                   ^
C:\Arduino\hardware\teensy\avr\libraries\Audio\Quantizer.cpp: In member function 'void Quantizer::quantize(float*, float*, int32_t*, uint16_t)':
C:\Arduino\hardware\teensy\avr\libraries\Audio\Quantizer.cpp:31:65: warning: implicit conversion from 'float' to 'double' to match other operand of binary expression [-Wdouble-promotion]
   31 | #define SAMPLEINVALID(sample) (!isfinite(sample) || abs(sample) >= 1.2) //use only for floating point samples (\in [-1.,1.])
C:\Arduino\hardware\teensy\avr\libraries\Audio\Quantizer.cpp:177:14: note: in expansion of macro 'SAMPLEINVALID'
  177 |         xn0= SAMPLEINVALID(*input0) ? 0. : *input0*_factor; //-_fOutputLastIt0 according to paper
      |              ^~~~~~~~~~~~~
C:\Arduino\hardware\teensy\avr\libraries\Audio\Quantizer.cpp:177:37: warning: implicit conversion from 'float' to 'double' to match other result of conditional [-Wdouble-promotion]
  177 |         xn0= SAMPLEINVALID(*input0) ? 0. : *input0*_factor; //-_fOutputLastIt0 according to paper
      |                                     ^
C:\Arduino\hardware\teensy\avr\libraries\Audio\Quantizer.cpp:31:65: warning: implicit conversion from 'float' to 'double' to match other operand of binary expression [-Wdouble-promotion]
   31 | #define SAMPLEINVALID(sample) (!isfinite(sample) || abs(sample) >= 1.2) //use only for floating point samples (\in [-1.,1.])
C:\Arduino\hardware\teensy\avr\libraries\Audio\Quantizer.cpp:179:14: note: in expansion of macro 'SAMPLEINVALID'
  179 |         xn1= SAMPLEINVALID(*input1) ? 0. : *input1*_factor; //-_fOutputLastIt0 according to paper
      |              ^~~~~~~~~~~~~
C:\Arduino\hardware\teensy\avr\libraries\Audio\Quantizer.cpp:179:37: warning: implicit conversion from 'float' to 'double' to match other result of conditional [-Wdouble-promotion]
  179 |         xn1= SAMPLEINVALID(*input1) ? 0. : *input1*_factor; //-_fOutputLastIt0 according to paper
      |                                     ^
C:\Arduino\hardware\teensy\avr\libraries\Audio\Resampler.cpp: In member function 'void Resampler::getKaiserExact(float)':
C:\Arduino\hardware\teensy\avr\libraries\Audio\Resampler.cpp:58:38: warning: implicit conversion from 'float' to 'double' to match other operand of binary expression [-Wdouble-promotion]
   58 |     const double halfBetaSq=beta*beta/4.;
      |                             ~~~~~~~~~^~~
C:\Arduino\hardware\teensy\avr\libraries\Audio\Resampler.cpp: In member function 'void Resampler::setKaiserWindow(float, int32_t)':
C:\Arduino\hardware\teensy\avr\libraries\Audio\Resampler.cpp:91:52: warning: implicit conversion from 'float' to 'double' to match other operand of binary expression [-Wdouble-promotion]
   91 |     double step=(float)(NO_EXACT_KAISER_SAMPLES-1.)/(noSamples-1.);
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
C:\Arduino\hardware\teensy\avr\libraries\Audio\Resampler.cpp: In member function 'void Resampler::setFilter(int32_t, int32_t, float, float)':
C:\Arduino\hardware\teensy\avr\libraries\Audio\Resampler.cpp:125:23: warning: implicit conversion from 'float' to 'double' to match other operand of binary expression [-Wdouble-promotion]
  125 |     double factor=M_PI*cutOffFrequ;
      |                       ^
C:\Arduino\hardware\teensy\avr\libraries\Audio\Resampler.cpp: In member function 'void Resampler::configure(float, float)':
C:\Arduino\hardware\teensy\avr\libraries\Audio\Resampler.cpp:147:11: warning: implicit conversion from 'float' to 'double' to match other operand of binary expression [-Wdouble-promotion]
  147 |     if (fs<=0. || newFs <=0.){
      |         ~~^~~~
C:\Arduino\hardware\teensy\avr\libraries\Audio\Resampler.cpp:147:25: warning: implicit conversion from 'float' to 'double' to match other operand of binary expression [-Wdouble-promotion]
  147 |     if (fs<=0. || newFs <=0.){
      |                   ~~~~~~^~~~
C:\Arduino\hardware\teensy\avr\libraries\Audio\Resampler.cpp:154:21: warning: implicit conversion from 'float' to 'double' to match other operand of binary expression [-Wdouble-promotion]
  154 |     _step=(double)fs/newFs;
      |           ~~~~~~~~~~^~~~~~
C:\Arduino\hardware\teensy\avr\libraries\Audio\Resampler.cpp:174:25: warning: implicit conversion from 'float' to 'double' to match other operand of binary expression [-Wdouble-promotion]
  174 |         double b=2.*(0.5*newFs-20000)/fs;   //this transition band width causes aliasing. However the generated frequencies are above 20kHz
      |                      ~~~^~~~~~
C:\Arduino\hardware\teensy\avr\libraries\Audio\Resampler.cpp:174:38: warning: implicit conversion from 'float' to 'double' to match other operand of binary expression [-Wdouble-promotion]
  174 |         double b=2.*(0.5*newFs-20000)/fs;   //this transition band width causes aliasing. However the generated frequencies are above 20kHz
      |                  ~~~~~~~~~~~~~~~~~~~~^~~
C:\Arduino\hardware\teensy\avr\libraries\Audio\Resampler.cpp:195:30: warning: implicit conversion from 'float' to 'double' to match other operand of binary expression [-Wdouble-promotion]
  195 |             kaiserBeta=0.5842*(float)pow(_attenuation-21.,0.4)+0.07886*(_attenuation-21.);
      |                        ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Arduino\hardware\teensy\avr\libraries\Audio\Resampler.cpp: In member function 'void Resampler::resample(float*, float*, uint16_t, uint16_t&, float*, float*, uint16_t, uint16_t&)':
C:\Arduino\hardware\teensy\avr\libraries\Audio\Resampler.cpp:296:26: warning: implicit conversion from 'float' to 'double' to match other operand of binary expression [-Wdouble-promotion]
  296 |         const float w1=1.-w0;
      |                        ~~^~~
C:\Arduino\hardware\teensy\avr\libraries\Audio\analyze_rms.cpp: In member function 'float AudioAnalyzeRMS::read()':
C:\Arduino\hardware\teensy\avr\libraries\Audio\analyze_rms.cpp:80:23: warning: implicit conversion from 'float' to 'double' to match other operand of binary expression [-Wdouble-promotion]
   80 |  return sqrtf(meansq) / 32767.0;
      |         ~~~~~~~~~~~~~~^~~~~~~~~
"C:\\Arduino\\hardware\\teensy/../tools/arm10/bin/arm-none-eabi-g++" -c -Os --specs=nano.specs -g -Wall -Wdouble-promotion -ffunction-sections -fdata-sections -nostdlib -MMD -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=154 -DLOG_LEVEL=-1 -DARDUINO=10813 -DARDUINO_TEENSY41 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH "@C:\\Users\\Frank\\Documents\\Arduino\\sketch_mar09a\\build/sketch/defs.h" "-IC:\\Users\\Frank\\Documents\\Arduino\\sketch_mar09a\\build/pch" "-IC:\\Arduino\\hardware\\teensy\\avr\\cores\\teensy4" "-IC:\\Arduino\\hardware\\teensy\\avr\\libraries\\Audio" "-IC:\\Arduino\\hardware\\teensy\\avr\\libraries\\SPI" "-IC:\\Arduino\\hardware\\teensy\\avr\\libraries\\SD\\src" "-IC:\\Arduino\\hardware\\teensy\\avr\\libraries\\SdFat\\src" "-IC:\\Arduino\\hardware\\teensy\\avr\\libraries\\SerialFlash" "-IC:\\Arduino\\hardware\\teensy\\avr\\libraries\\Wire" "-IC:\\Arduino\\hardware\\teensy\\avr\\libraries\\Audio\\utility" "C:\\Arduino\\hardware\\teensy\\avr\\libraries\\Audio\\analyze_tonedetect.cpp" -o "C:\\Users\\Frank\\Documents\\Arduino\\sketch_mar09a\\build\\libraries\\Audio\\analyze_tonedetect.cpp.o"
"C:\\Arduino\\hardware\\teensy/../tools/arm10/bin/arm-none-eabi-g++" -c -Os --specs=nano.specs -g -Wall -Wdouble-promotion -ffunction-sections -fdata-sections -nostdlib -MMD -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=154 -DLOG_LEVEL=-1 -DARDUINO=10813 -DARDUINO_TEENSY41 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH "@C:\\Users\\Frank\\Documents\\Arduino\\sketch_mar09a\\build/sketch/defs.h" "-IC:\\Users\\Frank\\Documents\\Arduino\\sketch_mar09a\\build/pch" "-IC:\\Arduino\\hardware\\teensy\\avr\\cores\\teensy4" "-IC:\\Arduino\\hardware\\teensy\\avr\\libraries\\Audio" "-IC:\\Arduino\\hardware\\teensy\\avr\\libraries\\SPI" "-IC:\\Arduino\\hardware\\teensy\\avr\\libraries\\SD\\src" "-IC:\\Arduino\\hardware\\teensy\\avr\\libraries\\SdFat\\src" "-IC:\\Arduino\\hardware\\teensy\\avr\\libraries\\SerialFlash" "-IC:\\Arduino\\hardware\\teensy\\avr\\libraries\\Wire" "-IC:\\Arduino\\hardware\\teensy\\avr\\libraries\\Audio\\utility" "C:\\Arduino\\hardware\\teensy\\avr\\libraries\\Audio\\async_input_spdif3.cpp" -o "C:\\Users\\Frank\\Documents\\Arduino\\sketch_mar09a\\build\\libraries\\Audio\\async_input_spdif3.cpp.o"
"C:\\Arduino\\hardware\\teensy/../tools/arm10/bin/arm-none-eabi-g++" -c -Os --specs=nano.specs -g -Wall -Wdouble-promotion -ffunction-sections -fdata-sections -nostdlib -MMD -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=154 -DLOG_LEVEL=-1 -DARDUINO=10813 -DARDUINO_TEENSY41 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH "@C:\\Users\\Frank\\Documents\\Arduino\\sketch_mar09a\\build/sketch/defs.h" "-IC:\\Users\\Frank\\Documents\\Arduino\\sketch_mar09a\\build/pch" "-IC:\\Arduino\\hardware\\teensy\\avr\\cores\\teensy4" "-IC:\\Arduino\\hardware\\teensy\\avr\\libraries\\Audio" "-IC:\\Arduino\\hardware\\teensy\\avr\\libraries\\SPI" "-IC:\\Arduino\\hardware\\teensy\\avr\\libraries\\SD\\src" "-IC:\\Arduino\\hardware\\teensy\\avr\\libraries\\SdFat\\src" "-IC:\\Arduino\\hardware\\teensy\\avr\\libraries\\SerialFlash" "-IC:\\Arduino\\hardware\\teensy\\avr\\libraries\\Wire" "-IC:\\Arduino\\hardware\\teensy\\avr\\libraries\\Audio\\utility" "C:\\Arduino\\hardware\\teensy\\avr\\libraries\\Audio\\control_ak4558.cpp" -o "C:\\Users\\Frank\\Documents\\Arduino\\sketch_mar09a\\build\\libraries\\Audio\\control_ak4558.cpp.o"
"C:\\Arduino\\hardware\\teensy/../tools/arm10/bin/arm-none-eabi-g++" -c -Os --specs=nano.specs -g -Wall -Wdouble-promotion -ffunction-sections -fdata-sections -nostdlib -MMD -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=154 -DLOG_LEVEL=-1 -DARDUINO=10813 -DARDUINO_TEENSY41 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH "@C:\\Users\\Frank\\Documents\\Arduino\\sketch_mar09a\\build/sketch/defs.h" "-IC:\\Users\\Frank\\Documents\\Arduino\\sketch_mar09a\\build/pch" "-IC:\\Arduino\\hardware\\teensy\\avr\\cores\\teensy4" "-IC:\\Arduino\\hardware\\teensy\\avr\\libraries\\Audio" "-IC:\\Arduino\\hardware\\teensy\\avr\\libraries\\SPI" "-IC:\\Arduino\\hardware\\teensy\\avr\\libraries\\SD\\src" "-IC:\\Arduino\\hardware\\teensy\\avr\\libraries\\SdFat\\src" "-IC:\\Arduino\\hardware\\teensy\\avr\\libraries\\SerialFlash" "-IC:\\Arduino\\hardware\\teensy\\avr\\libraries\\Wire" "-IC:\\Arduino\\hardware\\teensy\\avr\\libraries\\Audio\\utility" "C:\\Arduino\\hardware\\teensy\\avr\\libraries\\Audio\\control_cs42448.cpp" -o "C:\\Users\\Frank\\Documents\\Arduino\\sketch_mar09a\\build\\libraries\\Audio\\control_cs42448.cpp.o"
"C:\\Arduino\\hardware\\teensy/../tools/arm10/bin/arm-none-eabi-g++" -c -Os --specs=nano.specs -g -Wall -Wdouble-promotion -ffunction-sections -fdata-sections -nostdlib -MMD -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=154 -DLOG_LEVEL=-1 -DARDUINO=10813 -DARDUINO_TEENSY41 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH "@C:\\Users\\Frank\\Documents\\Arduino\\sketch_mar09a\\build/sketch/defs.h" "-IC:\\Users\\Frank\\Documents\\Arduino\\sketch_mar09a\\build/pch" "-IC:\\Arduino\\hardware\\teensy\\avr\\cores\\teensy4" "-IC:\\Arduino\\hardware\\teensy\\avr\\libraries\\Audio" "-IC:\\Arduino\\hardware\\teensy\\avr\\libraries\\SPI" "-IC:\\Arduino\\hardware\\teensy\\avr\\libraries\\SD\\src" "-IC:\\Arduino\\hardware\\teensy\\avr\\libraries\\SdFat\\src" "-IC:\\Arduino\\hardware\\teensy\\avr\\libraries\\SerialFlash" "-IC:\\Arduino\\hardware\\teensy\\avr\\libraries\\Wire" "-IC:\\Arduino\\hardware\\teensy\\avr\\libraries\\Audio\\utility" "C:\\Arduino\\hardware\\teensy\\avr\\libraries\\Audio\\control_cs4272.cpp" -o "C:\\Users\\Frank\\Documents\\Arduino\\sketch_mar09a\\build\\libraries\\Audio\\control_cs4272.cpp.o"
"C:\\Arduino\\hardware\\teensy/../tools/arm10/bin/arm-none-eabi-g++" -c -Os --specs=nano.specs -g -Wall -Wdouble-promotion -ffunction-sections -fdata-sections -nostdlib -MMD -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=154 -DLOG_LEVEL=-1 -DARDUINO=10813 -DARDUINO_TEENSY41 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH "@C:\\Users\\Frank\\Documents\\Arduino\\sketch_mar09a\\build/sketch/defs.h" "-IC:\\Users\\Frank\\Documents\\Arduino\\sketch_mar09a\\build/pch" "-IC:\\Arduino\\hardware\\teensy\\avr\\cores\\teensy4" "-IC:\\Arduino\\hardware\\teensy\\avr\\libraries\\Audio" "-IC:\\Arduino\\hardware\\teensy\\avr\\libraries\\SPI" "-IC:\\Arduino\\hardware\\teensy\\avr\\libraries\\SD\\src" "-IC:\\Arduino\\hardware\\teensy\\avr\\libraries\\SdFat\\src" "-IC:\\Arduino\\hardware\\teensy\\avr\\libraries\\SerialFlash" "-IC:\\Arduino\\hardware\\teensy\\avr\\libraries\\Wire" "-IC:\\Arduino\\hardware\\teensy\\avr\\libraries\\Audio\\utility" "C:\\Arduino\\hardware\\teensy\\avr\\libraries\\Audio\\control_sgtl5000.cpp" -o "C:\\Users\\Frank\\Documents\\Arduino\\sketch_mar09a\\build\\libraries\\Audio\\control_sgtl5000.cpp.o"
"C:\\Arduino\\hardware\\teensy/../tools/arm10/bin/arm-none-eabi-g++" -c -Os --specs=nano.specs -g -Wall -Wdouble-promotion -ffunction-sections -fdata-sections -nostdlib -MMD -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=154 -DLOG_LEVEL=-1 -DARDUINO=10813 -DARDUINO_TEENSY41 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH "@C:\\Users\\Frank\\Documents\\Arduino\\sketch_mar09a\\build/sketch/defs.h" "-IC:\\Users\\Frank\\Documents\\Arduino\\sketch_mar09a\\build/pch" "-IC:\\Arduino\\hardware\\teensy\\avr\\cores\\teensy4" "-IC:\\Arduino\\hardware\\teensy\\avr\\libraries\\Audio" "-IC:\\Arduino\\hardware\\teensy\\avr\\libraries\\SPI" "-IC:\\Arduino\\hardware\\teensy\\avr\\libraries\\SD\\src" "-IC:\\Arduino\\hardware\\teensy\\avr\\libraries\\SdFat\\src" "-IC:\\Arduino\\hardware\\teensy\\avr\\libraries\\SerialFlash" "-IC:\\Arduino\\hardware\\teensy\\avr\\libraries\\Wire" "-IC:\\Arduino\\hardware\\teensy\\avr\\libraries\\Audio\\utility" "C:\\Arduino\\hardware\\teensy\\avr\\libraries\\Audio\\control_tlv320aic3206.cpp" -o "C:\\Users\\Frank\\Documents\\Arduino\\sketch_mar09a\\build\\libraries\\Audio\\control_tlv320aic3206.cpp.o"
"C:\\Arduino\\hardware\\teensy/../tools/arm10/bin/arm-none-eabi-g++" -c -Os --specs=nano.specs -g -Wall -Wdouble-promotion -ffunction-sections -fdata-sections -nostdlib -MMD -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=154 -DLOG_LEVEL=-1 -DARDUINO=10813 -DARDUINO_TEENSY41 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH "@C:\\Users\\Frank\\Documents\\Arduino\\sketch_mar09a\\build/sketch/defs.h" "-IC:\\Users\\Frank\\Documents\\Arduino\\sketch_mar09a\\build/pch" "-IC:\\Arduino\\hardware\\teensy\\avr\\cores\\teensy4" "-IC:\\Arduino\\hardware\\teensy\\avr\\libraries\\Audio" "-IC:\\Arduino\\hardware\\teensy\\avr\\libraries\\SPI" "-IC:\\Arduino\\hardware\\teensy\\avr\\libraries\\SD\\src" "-IC:\\Arduino\\hardware\\teensy\\avr\\libraries\\SdFat\\src" "-IC:\\Arduino\\hardware\\teensy\\avr\\libraries\\SerialFlash" "-IC:\\Arduino\\hardware\\teensy\\avr\\libraries\\Wire" "-IC:\\Arduino\\hardware\\teensy\\avr\\libraries\\Audio\\utility" "C:\\Arduino\\hardware\\teensy\\avr\\libraries\\Audio\\control_wm8731.cpp" -o "C:\\Users\\Frank\\Documents\\Arduino\\sketch_mar09a\\build\\libraries\\Audio\\control_wm8731.cpp.o"
C:\Arduino\hardware\teensy\avr\libraries\Audio\async_input_spdif3.cpp:41:31: warning: implicit conversion from 'float' to 'double' to match other operand of binary expression [-Wdouble-promotion]
   41 |  const float toFloatAudio= 1.f/pow(2., 23.);
      |                            ~~~^~~~~~~~~~~~~
C:\Arduino\hardware\teensy\avr\libraries\Audio\control_cs4272.cpp: In member function 'bool AudioControlCS4272::volume(float, float)':
C:\Arduino\hardware\teensy\avr\libraries\Audio\control_cs4272.cpp:144:21: warning: implicit conversion from 'float' to 'double' to match other operand of binary expression [-Wdouble-promotion]
  144 |  leftInt = left*127 + 0.499;
      |            ~~~~~~~~~^~~~~~~
C:\Arduino\hardware\teensy\avr\libraries\Audio\control_cs4272.cpp:145:23: warning: implicit conversion from 'float' to 'double' to match other operand of binary expression [-Wdouble-promotion]
  145 |  rightInt = right*127 + 0.499;
      |             ~~~~~~~~~~^~~~~~~
C:\Arduino\hardware\teensy\avr\libraries\Audio\async_input_spdif3.cpp: In member function 'double AsyncAudioInputSPDIF3::getNewValidInputFrequ()':
C:\Arduino\hardware\teensy\avr\libraries\Audio\async_input_spdif3.cpp:205:37: warning: implicit conversion from 'float' to 'double' to match other operand of binary expression [-Wdouble-promotion]
  205 |   const double f=(float)F_BUS_ACTUAL/(1024.*1024.*AudioOutputSPDIF3::dpll_Gain()*128.);// bit clock = 128 * sampling frequency
      |                  ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from C:\Arduino\hardware\teensy\avr\libraries\Audio\async_input_spdif3.cpp:34:
C:\Arduino\hardware\teensy\avr\libraries\Audio\biquad.h: In instantiation of 'void biquad_cascade_df2T(const BIQUAD*, T*, T*, uint32_t) [with T = double; BIQUAD = arm_biquad_cascade_df2T_instance_f32; BTYPE = float; uint32_t = long unsigned int]':
C:\Arduino\hardware\teensy\avr\libraries\Audio\async_input_spdif3.cpp:280:108:   required from here
C:\Arduino\hardware\teensy\avr\libraries\Audio\biquad.h:146:26: warning: implicit conversion from 'float' to 'double' to match other operand of binary expression [-Wdouble-promotion]
  146 |                 yn = *b0 * *pSrc + *state;
      |                      ~~~~^~~~~~~
C:\Arduino\hardware\teensy\avr\libraries\Audio\biquad.h:146:34: warning: implicit conversion from 'float' to 'double' to match other operand of binary expression [-Wdouble-promotion]
  146 |                 yn = *b0 * *pSrc + *state;
      |                      ~~~~~~~~~~~~^~~~~~~~
C:\Arduino\hardware\teensy\avr\libraries\Audio\biquad.h:147:30: warning: implicit conversion from 'float' to 'double' to match other operand of binary expression [-Wdouble-promotion]
  147 |                 *state = *b1 * *pSrc + *a1Neg * yn + *(state+1);
      |                          ~~~~^~~~~~~
C:\Arduino\hardware\teensy\avr\libraries\Audio\biquad.h:147:38: warning: implicit conversion from 'float' to 'double' to match other operand of binary expression [-Wdouble-promotion]
  147 |                 *state = *b1 * *pSrc + *a1Neg * yn + *(state+1);
      |                          ~~~~~~~~~~~~^~~~~~~~~~~~~
C:\Arduino\hardware\teensy\avr\libraries\Audio\biquad.h:147:52: warning: implicit conversion from 'float' to 'double' to match other operand of binary expression [-Wdouble-promotion]
  147 |                 *state = *b1 * *pSrc + *a1Neg * yn + *(state+1);
      |                          ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
C:\Arduino\hardware\teensy\avr\libraries\Audio\biquad.h:148:34: warning: implicit conversion from 'float' to 'double' to match other operand of binary expression [-Wdouble-promotion]
  148 |                 *(state+1) = *b2 * *pSrc++ + *a2Neg * yn;
      |                              ~~~~^~~~~~~~~
C:\Arduino\hardware\teensy\avr\libraries\Audio\biquad.h:148:44: warning: implicit conversion from 'float' to 'double' to match other operand of binary expression [-Wdouble-promotion]
  148 |                 *(state+1) = *b2 * *pSrc++ + *a2Neg * yn;
      |                              ~~~~~~~~~~~~~~^~~~~~~~~~~~~
C:\Arduino\hardware\teensy\avr\libraries\Audio\biquad.h:157:31: warning: implicit conversion from 'float' to 'double' to match other operand of binary expression [-Wdouble-promotion]
  157 |                 *pDstDP = *b0 * *pSrc + *state;
      |                           ~~~~^~~~~~~
C:\Arduino\hardware\teensy\avr\libraries\Audio\biquad.h:157:39: warning: implicit conversion from 'float' to 'double' to match other operand of binary expression [-Wdouble-promotion]
  157 |                 *pDstDP = *b0 * *pSrc + *state;
      |                           ~~~~~~~~~~~~^~~~~~~~
C:\Arduino\hardware\teensy\avr\libraries\Audio\biquad.h:158:30: warning: implicit conversion from 'float' to 'double' to match other operand of binary expression [-Wdouble-promotion]
  158 |                 *state = *b1 * *pSrc + *a1Neg * *pDstDP + *(state+1);
      |                          ~~~~^~~~~~~
C:\Arduino\hardware\teensy\avr\libraries\Audio\biquad.h:158:38: warning: implicit conversion from 'float' to 'double' to match other operand of binary expression [-Wdouble-promotion]
  158 |                 *state = *b1 * *pSrc + *a1Neg * *pDstDP + *(state+1);
      |                          ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
C:\Arduino\hardware\teensy\avr\libraries\Audio\biquad.h:158:57: warning: implicit conversion from 'float' to 'double' to match other operand of binary expression [-Wdouble-promotion]
  158 |                 *state = *b1 * *pSrc + *a1Neg * *pDstDP + *(state+1);
      |                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
C:\Arduino\hardware\teensy\avr\libraries\Audio\biquad.h:159:34: warning: implicit conversion from 'float' to 'double' to match other operand of binary expression [-Wdouble-promotion]
  159 |                 *(state+1) = *b2 * *pSrc++ + *a2Neg * *pDstDP++;
      |                              ~~~~^~~~~~~~~
C:\Arduino\hardware\teensy\avr\libraries\Audio\biquad.h:159:44: warning: implicit conversion from 'float' to 'double' to match other operand of binary expression [-Wdouble-promotion]
  159 |                 *(state+1) = *b2 * *pSrc++ + *a2Neg * *pDstDP++;
      |                              ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
C:\Arduino\hardware\teensy\avr\libraries\Audio\biquad.h: In instantiation of 'void preload(const B*, double) [with B = arm_biquad_cascade_df2T_instance_f32]':
C:\Arduino\hardware\teensy\avr\libraries\Audio\async_input_spdif3.cpp:320:33:   required from here
C:\Arduino\hardware\teensy\avr\libraries\Audio\biquad.h:200:62: warning: implicit conversion from 'float32_t' {aka 'float'} to 'double' to match other operand of binary expression [-Wdouble-promotion]
  200 |         *(S->pState+1) = (*(S->pCoeffs+2) + *(S->pCoeffs+4)) * val;
      |                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
C:\Arduino\hardware\teensy\avr\libraries\Audio\biquad.h:201:55: warning: implicit conversion from 'float32_t' {aka 'float'} to 'double' to match other operand of binary expression [-Wdouble-promotion]
  201 |   *(S->pState) = (*(S->pCoeffs+1)  + *(S->pCoeffs+3)) * val + *(S->pState+1);
      |                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
C:\Arduino\hardware\teensy\avr\libraries\Audio\biquad.h:201:61: warning: implicit conversion from 'float32_t' {aka 'float'} to 'double' to match other operand of binary expression [-Wdouble-promotion]
  201 |   *(S->pState) = (*(S->pCoeffs+1)  + *(S->pCoeffs+3)) * val + *(S->pState+1);
      |                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~

There are many other in the audio library - i did a first pass of fixing them some time ago.
Will do a 2nd pass in the next days.. )
 
Status
Not open for further replies.
Back
Top