Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

Mid_Side.ino 2.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #include <Audio.h>
  2. #include <Wire.h>
  3. #include <SPI.h>
  4. #include <SD.h>
  5. #include <SerialFlash.h>
  6. // GUItool: begin automatically generated code
  7. AudioInputI2S i2s1; //xy=109,157
  8. AudioEffectMidSide ms_enc1; //xy=243,157
  9. AudioFilterBiquad biquad1; //xy=265,246
  10. AudioMixer4 mixer1; //xy=355,73
  11. AudioMixer4 mixer2; //xy=400,268
  12. AudioEffectMidSide ms_dec1; //xy=487,154
  13. AudioOutputI2S i2s2; //xy=637,154
  14. AudioConnection patchCord1(i2s1, 0, ms_enc1, 0);
  15. AudioConnection patchCord2(i2s1, 1, ms_enc1, 1);
  16. AudioConnection patchCord3(ms_enc1, 0, mixer1, 0);
  17. AudioConnection patchCord4(ms_enc1, 1, biquad1, 0);
  18. AudioConnection patchCord5(biquad1, 0, mixer2, 0);
  19. AudioConnection patchCord6(mixer1, 0, ms_dec1, 0);
  20. AudioConnection patchCord7(mixer2, 0, ms_dec1, 1);
  21. AudioConnection patchCord8(ms_dec1, 0, i2s2, 0);
  22. AudioConnection patchCord9(ms_dec1, 1, i2s2, 1);
  23. AudioControlSGTL5000 sgtl5000_1; //xy=119,90
  24. // GUItool: end automatically generated code
  25. const int myInput = AUDIO_INPUT_LINEIN;
  26. // const int myInput = AUDIO_INPUT_MIC;
  27. void setup() {
  28. // The stereo line input is encoded into mid and side components.
  29. // The mid component will be attenuated (mixer1), which leaves some
  30. // headroom for the side component to be increased in volume (mixer2).
  31. // Furthermore, the side component is high-passed (biquad1).
  32. AudioMemory(6);
  33. sgtl5000_1.enable();
  34. sgtl5000_1.inputSelect(myInput);
  35. sgtl5000_1.volume(1.0); // output volume
  36. ms_enc1.encode();
  37. ms_dec1.decode();
  38. // We attenuate the MID channel a little to prevent saturation when increasing the SIDE channel gain
  39. mixer1.gain(0, 0.9);
  40. // We increase the gain of the SIDE channel to increase stereo width
  41. mixer2.gain(0, 2.0);
  42. // But, we remove low frequencies from the side channel. Better for sub and doesn't get your ears twinkling with out-of-phase basses using a headphone
  43. biquad1.setHighpass(0, 200, 0.7);
  44. Serial.begin(9600);
  45. while (!Serial) ;
  46. delay(3000);
  47. Serial.println("Initialized mid-side example");
  48. }
  49. void loop() {
  50. }