Skip to Main Content

Java APIs

JAVAX - AudioSystem.isLineSupported FAILS with USB MIC

narraccinoOct 12 2017 — edited Oct 12 2017


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) {



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

Post Details
Locked on Nov 9 2017
Added on Oct 12 2017