Audio board 44.1 to 96Khz

pd0lew

Well-known member
Hi all,

For my new CW decoder I need 96Khz sample rate instead of 44.1 KHz.

I use the newest audio board and a Teensy 4.1 is this possible.

I looked at this forum but I can not find anything about this..... perhaps not possible.?

Best,
Johan
 
There are posts about altering the default 44.1 KHz rate.
Search for AUDIO_SAMPLE_RATE_EXACT on forum and code and see what else may be involved.
 
Cores search shows this and forum search points out the AUDIO_SAMPLE_RATE_EXACT can be added as a BUILD -Define given the "#ifndef"

Code:
...\arduino-1.8.19\hardware\teensy\avr\cores\teensy4\AudioStream.h:
     57: #ifndef AUDIO_SAMPLE_RATE_EXACT
   58: #define AUDIO_SAMPLE_RATE_EXACT 44100.0f
   59  #endif
   60 
   61: #define AUDIO_SAMPLE_RATE      AUDIO_SAMPLE_RATE_EXACT
   62
 
Thank you for coming back on my question!

But this gives not much info... did you mean we can go to 96KHz with only #define AUDIO_SAMPLE_RATE_EXACT 96000.0f ?

I looked more in detail and tested yesterday code below it turns out that I can go max 88.2 KHz measured with my scope on Pin 2
Today I get a new audio board and than I can test this in real.

I am really confused that there is not a clear answer if this is possible....

Best,
Johan



Code:
extern "C" void set_audioClock(uint32_t inputClock, uint32_t sampleRate) {
  CCM_CCGR5 |= CCM_CCGR5_SAI2(CCM_CCGR_ON); 

  CCM_CSCMR1 = (CCM_CSCMR1 & ~CCM_CSCMR1_SAI2_CLK_SEL_MASK)
             | CCM_CSCMR1_SAI2_CLK_SEL(2); 
 
  CCM_CS2CDR = (CCM_CS2CDR & ~(CCM_CS2CDR_SAI2_CLK_PRED_MASK | CCM_CS2CDR_SAI2_CLK_PODF_MASK))
             | CCM_CS2CDR_SAI2_CLK_PRED(0)
             | CCM_CS2CDR_SAI2_CLK_PODF(0);
 
  IOMUXC_GPR_GPR1 = (IOMUXC_GPR_GPR1 & ~IOMUXC_GPR_GPR1_SAI2_MCLK3_SEL_MASK)
                  | IOMUXC_GPR_GPR1_SAI2_MCLK3_SEL(0)
                  | IOMUXC_GPR_GPR1_SAI2_MCLK_DIR;
}
 
gives not much info
Not personally worked with this at all. Just seen it posted and that seems the common thread - and that was the keyword to look for a fitting example - unless an experienced member chimes in.

44.1KHz was chosen for a reason and optimized for that. Others have changed it for their purposes - and forum search finds many hits and one may have a complete answer that fits the need? Some may have history of notes from PJRC about PRO and CON of such a change.
 
Aha that make sense, I tested a wm8731 and that works perfectly.
Forget the PRJC audio board for my question.


Thanks for helping T.
Best,
Johan
 
Back
Top