1

I'm trying to set my Logitech C-170 as a default mixer. I followed this guide: Unable to set default input and output audio device on Raspberry jessie but it didn't help me. My webcam is recognized by the system, but in application nothing works.

What I have now:

$ cat /proc/asound/cards

gives output

 0 [ALSA           ]: bcm2835 - bcm2835 ALSA
                      bcm2835 ALSA
 1 [C170           ]: USB-Audio - Webcam C170
                      Webcam C170 at usb-3f980000.usb-1.2, high speed

my ~/.asoundrc:

pcm.!default {
    type hw
    card 1
}

ctl.!default {
    type hw
    card 1
}

in /usr/share/alsa/alsa.conf I have lines

defaults.ctl.card 1
defaults.pcm.card 1

aplay -l gives this output:

    card 0: ALSA [bcm2835 ALSA], device 0: bcm2835 ALSA [bcm2835 ALSA]
      Subdevices: 8/8
      Subdevice #0: subdevice #0
      Subdevice #1: subdevice #1
      Subdevice #2: subdevice #2
      Subdevice #3: subdevice #3
      Subdevice #4: subdevice #4
      Subdevice #5: subdevice #5
      Subdevice #6: subdevice #6
      Subdevice #7: subdevice #7
    card 0: ALSA [bcm2835 ALSA], device 1: bcm2835 ALSA [bcm2835 IEC958/HDMI]
      Subdevices: 1/1
      Subdevice #0: subdevice #0

In my Java application I start capturing audio using code

AudioFormat format = new AudioFormat(16000, 16, 1, true,false);
        DataLine.Info info = new DataLine.Info(TargetDataLine.class, format);
        final TargetDataLine line = (TargetDataLine) AudioSystem.getLine(info);
        line.open();
        line.start();

Need your help a lot.

1 Answers1

1

I've solved this trouble. It turned that there was a need to choose specific microphone. I did it by code

 Mixer.Info[] mixerInfo=AudioSystem.getMixerInfo();
        Mixer.Info finalMixerInfo = null;
        for (Mixer.Info aMixerInfo : mixerInfo) {
            if (aMixerInfo.getName().contains("C170")&&!aMixerInfo.getName().contains("Port")) finalMixerInfo=aMixerInfo;
        };

And then opened a line by

Mixer mixer=AudioSystem.getMixer(finalMixerInfo);
        final TargetDataLine line = (TargetDataLine) mixer.getLine(info);
        line.open();
        line.start();