45 líneas
1.3KB

  1. #include <Audio.h>
  2. AsyncAudioInputSPDIF3 spdifIn(false, false, 100, 20, 80); //dither = true, noiseshaping = true, anti-aliasing attenuation=100dB, minimum half resampling filter length=20, maximum half resampling filter length=80
  3. AudioOutputSPDIF3 spdifOut;
  4. AudioConnection patchCord1(spdifIn, 0, spdifOut, 0);
  5. AudioConnection patchCord2(spdifIn, 1, spdifOut, 1);
  6. void setup() {
  7. AudioMemory(12);
  8. Serial.begin(57600);
  9. while (!Serial);
  10. }
  11. void loop() {
  12. double bufferedTime=spdifIn.getBufferedTime();
  13. Serial.print("buffered time [micro seconds]: ");
  14. Serial.println(bufferedTime*1e6,2);
  15. Serial.print("locked: ");
  16. Serial.println(spdifIn.isLocked());
  17. Serial.print("input frequency: ");
  18. double inputFrequency=spdifIn.getInputFrequency();
  19. Serial.println(inputFrequency);
  20. Serial.print("anti-aliasing attenuation: ");
  21. Serial.println(spdifIn.getAttenuation());
  22. Serial.print("resampling goup delay [milli seconds]: ");
  23. Serial.println(spdifIn.getHalfFilterLength()/inputFrequency*1e3,2);
  24. Serial.print("half filter length: ");
  25. Serial.println(spdifIn.getHalfFilterLength());
  26. double pUsageIn=spdifIn.processorUsage();
  27. Serial.print("processor usage [%]: ");
  28. Serial.println(pUsageIn);
  29. Serial.print("max number of used blocks: ");
  30. Serial.println(AudioMemoryUsageMax());
  31. delay(500);
  32. }