Forum Stats

  • 3,853,824 Users
  • 2,264,280 Discussions
  • 7,905,459 Comments

Discussions

JAVAX - AudioSystem.isLineSupported FAILS with USB MIC

Hi,

i'm using an USB MIC on a Raspberry and i'm developing with the JAVA SOUND API

but the Line is Not Supported, why?

I've executed this code on a normal PC with Linux and it works (the Line is supported and the Mic works)

What is missing? how can is get Line Supported?

the cose is this:

import javax.sound.sampled.AudioFormat;

import javax.sound.sampled.AudioSystem;

import javax.sound.sampled.DataLine;

import javax.sound.sampled.LineUnavailableException;

import javax.sound.sampled.Mixer;

import javax.sound.sampled.Port;

import javax.sound.sampled.TargetDataLine;

public class TestAudio {

public static void main(String[] args) throws LineUnavailableException {

Mixer.Info minfo[] = AudioSystem.getMixerInfo();

for (Mixer.Info minfo1 : minfo) {

System.out.println(minfo1);

}

if (AudioSystem.isLineSupported(Port.Info.MICROPHONE)) {

System.out.println("++ LINE IS SUPPORTED ++");

} else {

System.out.println("Line is NOT supported");

}

}

The output is this:

ALSA [default], version 4.9.54-v7+

ALSA [plughw:0,0], version 4.9.54-v7+

ALSA [plughw:0,1], version 4.9.54-v7+

Device [plughw:1,0], version 4.9.54-v7+

Port ALSA [hw:0], version 4.9.54-v7+

Port Device [hw:1], version 4.9.54-v7+

Line is NOT supported

This discussion has been closed.