diff --git a/.gitignore b/.gitignore index 53aa516..5296a64 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,9 @@ Thumbs.db ehthumbs.db +#Gnumeric source file, used locally +OpenAudioLibraryStatus.gnumeric + # Folder config file Desktop.ini diff --git a/OpenAudio_ArduinoLibrary.h b/OpenAudio_ArduinoLibrary.h index 5d04266..d4638ed 100644 --- a/OpenAudio_ArduinoLibrary.h +++ b/OpenAudio_ArduinoLibrary.h @@ -18,7 +18,7 @@ #include "AudioMultiply_F32.h" #include "AudioSettings_F32.h" //#include "input_i2s_f32.h" -//#include "output_i2s_OA_f32.h" +#include "output_i2s_OA_f32.h" #include "play_queue_f32.h" #include "record_queue_f32.h" #include "synth_pinknoise_f32.h" diff --git a/examples/ReceiverPart2/ReceiverPart2.ino b/examples/ReceiverPart2/ReceiverPart2.ino index db6586f..ce21015 100644 --- a/examples/ReceiverPart2/ReceiverPart2.ino +++ b/examples/ReceiverPart2/ReceiverPart2.ino @@ -45,7 +45,7 @@ #include "Audio.h" #include -// ********* Mini Control Panel ************ +// *********** Mini Control Panel ************ // Set mode and gain here and re-compile // Here is the mode switch @@ -54,9 +54,8 @@ #define NBFM 3 uint16_t mode = LSB; // <--Select mode -int gainControlDB = 0; // <--Set SSB gain in dB. 0 dB is a gain of 1.0 - -// ****************************************************** +int gainControlDB = 0; // <--Set SSB gain in dB. +// ********************************************************* // To work with T4.0 the I2S routine outputs 16-bit integer (I16). Then // use Audette I16 to F32 convert. Same below for output, in reverse. diff --git a/examples/TestOutput_float/TestOutput_float.ino b/examples/TestOutput_float/TestOutput_float.ino index 644ca07..8ee7194 100644 --- a/examples/TestOutput_float/TestOutput_float.ino +++ b/examples/TestOutput_float/TestOutput_float.ino @@ -1,77 +1,28 @@ /* TestOutput_float.ino Bob Larkin 3 July 2020 - * - * Test for #define USE_F32_IO either 0 or 1, all OK on T3.6 * */ #include #include -// NOT WORKING for USE_F32_IO 1 <<<<<<<<<<<<<<< -#define ALL_TEENSY_AUDIO 0 -#define USE_F32_IO 1 - -#if ALL_TEENSY_AUDIO - -AudioSynthWaveformSine sine1; -AudioOutputI2S i2sOut; -AudioConnection patchCord1(sine1, 0, i2sOut, 0); -AudioConnection patchCord2(sine1, 0, i2sOut, 1); -AudioControlSGTL5000 sgtl5000_1; - -void setup(void) { - Serial.begin(1); delay(1000); - Serial.println("Teensy Audio, No F32"); - - AudioMemory(10); - sgtl5000_1.enable(); - sine1.frequency(300.0); - sine1.amplitude(0.005f); -} - -void loop() { -} -// ================================================ - -#else // OpenAudio F32 -#if USE_F32_IO AudioSynthWaveformSine_F32 sine1; AudioOutputI2S_OA_F32 i2sOut; AudioConnection_F32 patchCord1(sine1, 0, i2sOut, 0); -AudioConnection_F32 patchCord2(sine1, 0, i2sOut, 1); - -#else // Use F32toI16 convert and I16 out -AudioSynthWaveformSine_F32 sine1; -AudioConvert_F32toI16 float2Int1, float2Int2; -AudioOutputI2S i2sOut; -AudioConnection_F32 patchCord5(sine1, 0, float2Int1, 0); -AudioConnection_F32 patchCord6(sine1, 0, float2Int2, 0); -AudioConnection patchCord7(float2Int1, 0, i2sOut, 0); -AudioConnection patchCord8(float2Int2, 0, i2sOut, 1); -#endif AudioControlSGTL5000 sgtl5000_1; void setup(void) { - Serial.begin(1); delay(1000); -#if USE_F32_IO + Serial.begin(9600); delay(1000); Serial.println("Open Audio: Test direct F32 Output"); -#else - Serial.println("Open Audio: Test Convert to Teensy Audio I16 Output"); -#endif AudioMemory(10); AudioMemory_F32(10); -//delay(1); Serial.println("Start i2s_f32 out"); -//i2sOut.begin(); -//delay(1); Serial.println("Start codec"); - + // Next line, moved from constructor, allows Loader to operate without crash + i2sOut.begin(); // Uncomment here and comment out in constructor for AudioOutputI2S_OA_F32 + sgtl5000_1.enable(); - sine1.frequency(300.0); - sine1.amplitude(0.005f); + sine1.frequency(300.0); sine1.amplitude(0.005f); sine1.begin(); } void loop() { } - -#endif // ALL_TEENSY_AUDIO diff --git a/examples/TestOutput_float/TestOutput_float.ino.sav15July.xxx b/examples/TestOutput_float/TestOutput_float.ino.sav15July.xxx new file mode 100644 index 0000000..aa3569e --- /dev/null +++ b/examples/TestOutput_float/TestOutput_float.ino.sav15July.xxx @@ -0,0 +1,79 @@ +/* TestOutput_float.ino Bob Larkin 3 July 2020 + * + * Test for #define USE_F32_IO either 0 or 1, all OK on T3.6 + * + */ +#include +#include + +// NOT WORKING for USE_F32_IO 1 <<<<<<<<<<<<<<< +#define ALL_TEENSY_AUDIO 0 +#define USE_F32_IO 1 + +#if ALL_TEENSY_AUDIO + +AudioSynthWaveformSine sine1; +AudioOutputI2S i2sOut; +AudioConnection patchCord1(sine1, 0, i2sOut, 0); +AudioConnection patchCord2(sine1, 0, i2sOut, 1); +AudioControlSGTL5000 sgtl5000_1; + +void setup(void) { + Serial.begin(1); delay(1000); + Serial.println("Teensy Audio, No F32"); + + AudioMemory(10); + sgtl5000_1.enable(); + sine1.frequency(300.0); + sine1.amplitude(0.005f); +} + +void loop() { +} +// ================================================ + +#else // OpenAudio F32 +#if USE_F32_IO +AudioSynthWaveformSine_F32 sine1; +AudioOutputI2S_OA_F32 i2sOut; +AudioConnection_F32 patchCord1(sine1, 0, i2sOut, 0); +AudioConnection_F32 patchCord2(sine1, 0, i2sOut, 1); + +#else // Use F32toI16 convert and I16 out +AudioSynthWaveformSine_F32 sine1; +AudioConvert_F32toI16 float2Int1, float2Int2; +AudioOutputI2S i2sOut; +AudioConnection_F32 patchCord5(sine1, 0, float2Int1, 0); +AudioConnection_F32 patchCord6(sine1, 0, float2Int2, 0); +AudioConnection patchCord7(float2Int1, 0, i2sOut, 0); +AudioConnection patchCord8(float2Int2, 0, i2sOut, 1); +#endif +AudioControlSGTL5000 sgtl5000_1; + +void setup(void) { + Serial.begin(1); delay(1000); +#if USE_F32_IO + Serial.println("Open Audio: Test direct F32 Output"); +#else + Serial.println("Open Audio: Test Convert to Teensy Audio I16 Output"); +#endif + AudioMemory(10); + AudioMemory_F32(10); + +delay(1); Serial.println("Start i2s_f32 out"); +//i2sOut.begin(); +delay(1); Serial.println("Start codec"); + + sgtl5000_1.enable(); + + sine1.frequency(300.0); + sine1.amplitude(0.005f); + sine1.begin(); + + +} + +void loop() { +} + +#endif // ALL_TEENSY_AUDIO diff --git a/output_i2s_OA_F32.cpp.xxx b/output_i2s_OA_F32.cpp similarity index 98% rename from output_i2s_OA_F32.cpp.xxx rename to output_i2s_OA_F32.cpp index 2a240d6..a472d68 100644 --- a/output_i2s_OA_F32.cpp.xxx +++ b/output_i2s_OA_F32.cpp @@ -78,7 +78,7 @@ void AudioOutputI2S_OA_F32::begin(void) #elif defined(__IMXRT1062__) CORE_PIN7_CONFIG = 3; //1:TX_DATA0 - dma.TCD->SADDR = i2s_tx_buffer; + dma.TCD->SADDR = i2s_tx_buffer; // Serial.println("A1062 begin"); dma.TCD->SOFF = 2; dma.TCD->ATTR = DMA_TCD_ATTR_SSIZE(1) | DMA_TCD_ATTR_DSIZE(1); dma.TCD->NBYTES_MLNO = 2; @@ -96,7 +96,9 @@ void AudioOutputI2S_OA_F32::begin(void) I2S1_TCSR = I2S_TCSR_TE | I2S_TCSR_BCE | I2S_TCSR_FRDE; #endif update_responsibility = update_setup(); + //Serial.println("BBB"); dma.attachInterrupt(isr); + //Serial.println("CCC"); } // end begin() void AudioOutputI2S_OA_F32::isr(void) diff --git a/output_i2s_OA_f32.h.xxx b/output_i2s_OA_f32.h similarity index 95% rename from output_i2s_OA_f32.h.xxx rename to output_i2s_OA_f32.h index 8cf3cb9..da414fd 100644 --- a/output_i2s_OA_f32.h.xxx +++ b/output_i2s_OA_f32.h @@ -49,12 +49,7 @@ class AudioOutputI2S_OA_F32 : public AudioStream_F32 //GUI: inputs:2, outputs:0 //this line used for automatic generation of GUI node public: AudioOutputI2S_OA_F32(void) : AudioStream_F32(2, inputQueueArray) { - // Add 2 delays as experimental fix for possible Teensy Loader issue. - uint32_t ii; - uint32_t xx = 0; - for (ii=0; ii<1000; ii++) xx += ii; - begin(); - for (ii=0; ii<1000; ii++) xx += ii; + // begin(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< } /* This long form needs to be added <<<<<<<<<<<<<<<< diff --git a/readme.md b/readme.md index 52893f4..496ce00 100644 --- a/readme.md +++ b/readme.md @@ -77,3 +77,40 @@ This library extends the functionality of the [Teensy Audio Library](http://www. The floating-point processing takes advantage of the DSP acceleration afforded by the ARM M4F core inside the Teensy 3.5/3.6 processor. Therefore, it uses `arm_math.h`. This dependencies is installed automatically when you install the Teensy Audio Library, so you don't need to take any extra steps. It's there already. +Status +------ + +The following table summarizes the status, as of 24 November 2020. I will try to keep this up-to-date as work continues, but tere will be lags. +Thus there may be more T4.x compatibility than shown here. A blank entry for status does not indicate a problem, but rather a lack +ofverification. Further rexamples will come to test some of these objects. +![Open Audio F32 Status](OA_LibraryStatus.gif) +The example files (from the Examples directory) are + +1 AudioTestAnalyzePhase_F32 +2 AudioTestPeakRMS +3 AudioTestSinCos +4 BasicCompressor_Float +5 BasicGain_Float +6 FineFreqShift_OA +7 FormantShifter_FD_OA +8 FrequencyShifter_FD_OA +9 LowpassFilter_FD_OA +10 MixStereoToMono_Float +11 MyAudioEffect_Float +12 OscillatorWithPitchmod_Float +13 ReceiverFM +14 ReceiverPart1 +15 ReceiverPart2 +16 Repair audio mixer_F32 +17 SignalNoise_float +18 Switches_float +19 TestEqualizer1 +20 TestEqualizer1Audio +21 TestFIRGeneral3 +22 TestFIRGeneralLarge4 +23 TestFIRGeneralLarge5 +24 TestInputOutput_float +25 TestLoader +26 TestLoader2 +27 TestOutput_float +28 Tympan_TLV320AIC3206