I am using the latest Raspbian I just downloaded this morning.
I bought this USB audio adapter, https://www.sossolutions.nl/usb-audio-adapter-works-with-raspberry-pi. And then I followed tutorial here, https://learn.adafruit.com/usb-audio-cards-with-a-raspberry-pi/instructions.
The tutorial basically just to add ~/.asoundrc
into this.
pcm.!default {
type hw card 1
}
ctl.!default {
type hw card 1
}
I checked alsamixer
, it detects both my microphone and earphone. I use a phone earphone that I usually use to answer call and listen to music with my phone. I attached this mic-earphone into the mic slot of the USB audio adapter.
Then I change sudo nano /usr/share/alsa/alsa.conf
lines into these.
defaults.ctl.card 1
defaults.pcm.card 1
However, changing sudo nano /usr/share/alsa/alsa.conf
does not listed as something to do in the Adafruit tutorial I mentioned before.
I have a code to detect pitch and volume with PyAudio from microphone. I tried to run that, but it gives me error of.
OSError: [Errrno -9996] Invalid input device (no default output device)
The error is in this line.
self.mic = pA.open(format=self.FORMAT, channels=self.CHANNELS, rate=self.SAMPLE_RATE, input=True,
frames_per_buffer=self.PERIOD_SIZE_IN_FRAME)
My goal is to have pitch and volume detection using PyAudio via microphone. How can I solve this problem?
EDIT - 1, I have checked via https*//www*onlinemictest*com, my microphone does not work. But it is detected in alsamixer
as "mic".