Sound Recording and Java Mixer Settings

I am using the javax.sound.sampled package in a radio mode decoding program. To use the program, the user feeds an audio signal from his radio into his PC line input. The user must also use his mixer program to select a line as an input record. The problem is that some users do not know how to do this, and also sometimes other programs change the record input setting. So my question is, how can my program determine if a string is set as an input record? Is it also possible that my program will change the record input setting if it detects that it is incorrect?

Thank you for your time.

Yang

+4
source share
1 answer

To answer your first question, you can check if the Line.Info object matches the Port.Info.LINE_IN entry as follows:

public static boolean isLineIn(Line.Info lineInfo) { Line.Info[] detected = AudioSystem.getSourceLineInfo(Port.Info.LINE_IN); for (Line.Info lineIn : detected) { if (lineIn.matches(lineInfo)) { return true; } } return false; } 

However, this does not work with operating systems or sound card driver APIs that do not provide the type of each mixer channel available. Therefore, when I test it on Windows, it works, but not on Linux or Mac. For more information and recommendations, see this FAQ .

As for the second question, you can try changing the recording input settings using the Control class. In particular, see FloatControl.Type for some general settings. Keep in mind that the availability of these controls depends on the operating system and sound card drivers, as well as for input detection.

+2
source

Source: https://habr.com/ru/post/1276673/


All Articles