Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2018
1,363
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.91 KB | None | 0 0
  1.  
  2. // Dalek Megaphone effect.
  3. // Add NeoPixel support to match video build when get home
  4. // Use mic input and headphone amp cap coupled into megaphone
  5. // microphone node or line out. No difference.
  6.  
  7. #include <Audio.h>
  8. #include <Wire.h>
  9. #include <SPI.h>
  10. #include <SD.h>
  11. #include <SerialFlash.h>
  12.  
  13. AudioInputI2S i2s2; //xy=1436,440
  14. AudioSynthWaveformSine sine1; //xy=1437,515
  15. AudioAnalyzePeak peak1; //xy=1600.33332824707,363.66666158040357
  16. AudioEffectMultiply multiply1; //xy=1617,482
  17. AudioOutputI2S i2s1; //xy=1788,489
  18. AudioConnection patchCord1(i2s2, 0, multiply1, 0);
  19. AudioConnection patchCord2(i2s2, 0, peak1, 0);
  20. AudioConnection patchCord3(sine1, 0, multiply1, 1);
  21. AudioConnection patchCord4(multiply1, 0, i2s1, 0);
  22. AudioConnection patchCord5(multiply1, 0, i2s1, 1);
  23. AudioControlSGTL5000 sgtl5000_1; //xy=1441,637
  24. // GUItool: end automatically generated code
  25.  
  26.  
  27. float ModulationFreq=30.00;
  28. float ModulationDepth=0.617;
  29. char receivedChar;
  30.  
  31.  
  32. void setup() {
  33. Serial.begin(9600);
  34. Serial.print("Serial Port Configgled!");
  35. AudioMemory(8);
  36. sgtl5000_1.enable();
  37. sgtl5000_1.volume(.5);
  38. sgtl5000_1.inputSelect(AUDIO_INPUT_MIC);
  39. sgtl5000_1.micGain(32);
  40. sine1.frequency(ModulationFreq);
  41. sine1.amplitude(ModulationDepth);
  42. // Waveshape doesn't seem to work yet,
  43. // When it does y'all should use Hans Summer's diode curves and spreadsheets
  44. // To generate arrays of the proper lenght.
  45. // Diode clipping effect now is done by overmodulation. Cheap hack but it sounds ok.
  46. // http://www.hanssummers.com/diodeiv.html
  47. }
  48.  
  49. elapsedMillis msecs;
  50.  
  51. void loop() {
  52.  
  53. if (msecs > 40) {
  54. if (peak1.available()) {
  55. msecs = 0;
  56. float leftNumber = peak1.read();
  57. //Multiply this by 255, and pass it to setStripBrightness
  58.  
  59. }
  60. }
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement