alex6679 / teensy-4-usbAudio

Extension of the Teensy 4 and 4.1 USB audio input and output.
13 stars 2 forks source link

strange alternating sound with laser guitar pickup #4

Open tzenn opened 2 hours ago

tzenn commented 2 hours ago

Hey! I tried to reach out on the forum but its been a week and I'm still waiting for admin approval to get in so I'll just post it here for now.

Video footage of the issue: https://youtu.be/x1HCdltNRwA

Environment:

Hardware Setup:

Code Being Used:

#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>

const int STRING_COUNT = 6;
const int photodiodePins[STRING_COUNT] = {A0, A1, A2, A3, A4, A5};

AudioInputAnalog         adc1(photodiodePins[0]);  // String 1 (high E)
AudioInputAnalog         adc2(photodiodePins[1]);  // String 2 (B)
AudioInputAnalog         adc3(photodiodePins[2]);  // String 3 (G)
AudioInputAnalog         adc4(photodiodePins[3]);  // String 4 (D)
AudioInputAnalog         adc5(photodiodePins[4]);  // String 5 (A)
AudioInputAnalog         adc6(photodiodePins[5]);  // String 6 (low E)

AudioOutputUSB           usb1;

AudioConnection          patchCord1(adc1, 0, usb1, 0);
AudioConnection          patchCord2(adc2, 0, usb1, 1);
AudioConnection          patchCord3(adc3, 0, usb1, 2);
AudioConnection          patchCord4(adc4, 0, usb1, 3);
AudioConnection          patchCord5(adc5, 0, usb1, 4);
AudioConnection          patchCord6(adc6, 0, usb1, 5);

void setup() {
  AudioMemory(24);
  Serial.begin(115200);
}

void loop() {
  for(int i = 0; i < STRING_COUNT; i++) {
    int rawAmplitude = analogRead(photodiodePins[i]);
    Serial.print("String ");
    Serial.print(i + 1);
    Serial.print(": ");
    Serial.println(rawAmplitude);
  }
  delay(10);
}

Issue Description:

  1. First analog input (A0) outputs no sound at all
  2. The remaining channels (A1-A5) output a strange buzzing noise that alternates between channels
  3. This occurs despite the serial monitor showing correct photodiode response to laser interruption
  4. The alternating buzzing noise persists regardless of laser/photodiode state

Additional Context:

Questions:

  1. Is there a known issue with the first channel (A0) in multi-channel configurations?
  2. What might cause the alternating buzzing between channels despite correct sensor readings?
  3. Are there any specific initialization requirements for multi-channel audio that might be missing?

Thanks for your time!

h4yn0nnym0u5e commented 2 hours ago

Fairly sure the Audio library doesn't support multiple instances of AudioInputAnalog - if you try to place two in the Design Tool, you get the yellow warning triangle signalling a hardware clash.