Would be great if some users test it
Hallo Frank, sorry for stepping late into the party...
Freshly installed Arduino 1.8.15 & Teensyduino 1.54 on Windows 10 Home. Did not yet copy the modified files from
https://github.com/FrankBoesing/cores/tree/USBAudio-samplerates.
Using a PCM5102 board and a Teensy 4.0 [don't have a T4.1].
Ran this sketch on the setup:
Code:
// PCM5102 bd Teensy 3.x Teensy 4.x
// VCC Vin Vin 5V
// GND GND GND
// LRCK 23 20 [ 3] 44.1 KHz
// DATA 22 7 [ 2] [xx] for secondary I2S bus
// BCK 9 21 [ 4] 2.8224 MHz = 64.LRCK
// -- 11 23 [33] MCLK 11.29 MHz
// set Tools > USB Type to Audio
#include <Audio.h>
AudioInputUSB usb1;
AudioOutputI2S i2s1;
AudioConnection patchCord1(usb1, 0, i2s1, 1);
AudioConnection patchCord2(usb1, 0, i2s1, 0);
void setup() {
AudioMemory(12);
}
void loop() {
}
Using an sine-generator program running on the PC showed a nice 1kHz sine on the scope.
Then copied the teensy4 directory from Franks GitHub link into C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores, to overwrite with the 5 modified files.
Recompiled the same sketch leaving the samplerate at 44.1kHz. Sine wave looked OK again on the scope.
Then modified audiostream.h line 58 to "#define AUDIO_SAMPLE_RATE_EXACT 48000.0f" and recompiled/uploaded.
Two observations:
1. the Sound control panel looked like this:
Notice that the "Default Format" still shows "2 channel, 16 bit,
44100 Hz (CD Quality)". I expected 48000 Hz.
2. The sine wave is now corrupted:
Is this perhaps caused by what Jonr mentioned in his
post above?
Please let me know what you want me to test next.
Gruesse,
Paul