Can i get the microphone output volume, only the volume without a library? Arys
Hi @Aryszin,
You can use the java audio (Mixer Controls) if you not want to use any further library:
Cheers
— mnse
can you mabye make an example?
Hi @Aryszin,
Actually that’s not really a processing topic, but I don’t want to be too picky.
Below you find a code that should print out all available mixers for your system and their corresponding controls for it and the possible values the control can have.
(you are looking for s.th … like Master Gain/Float)
For detailed information about the meaning of the possible values look at the AudioSystem reference above.
Hope that helps…
Cheers
— mnse
import javax.sound.sampled.*;
import javax.sound.sampled.Control.*;
void setup() {
getSurface().setVisible(false);
for (Mixer.Info mi : AudioSystem.getMixerInfo()) {
println("_".repeat(80));
println("> [Mixer]: " + mi);
Mixer mixer = AudioSystem.getMixer(mi);
Line.Info[] srclineInfo = mixer.getSourceLineInfo();
if (srclineInfo.length > 0) {
for (Line.Info li : srclineInfo) {
handleLine(mixer, li, "SourceLine");
}
} else {
println(">> [SourceLine]: No SourceLine(s) provided");
}
println("");
Line.Info[] tgtlineInfo = mixer.getTargetLineInfo();
if (tgtlineInfo.length > 0) {
for (Line.Info li : tgtlineInfo) {
handleLine(mixer, li, "TargetLine");
}
} else {
println(">> [TargetLine]: No TargetLine(s) provided");
}
}
exit();
}
void handleLine(Mixer mixer, Line.Info lineInfo, String addonInfo) {
try {
println(">> ["+addonInfo+"]: " + lineInfo);
Line l = mixer.getLine(lineInfo);
try {
l.open();
Control[] ctrls = l.getControls();
if (ctrls.length > 0) {
for (Control ctrl : ctrls) {
handleControl(ctrl, 3);
}
} else {
println(">> ["+addonInfo+"]: No Controls(s) provided");
}
l.close();
}
catch(Exception e) {
println(">> ["+addonInfo+"]: No Controls(s) provided");
}
}
catch(Exception e) {
println(">> ["+addonInfo+"]: no acces to Line:" + e);
}
}
void handleControl(Control c, int d) {
String prefix = ">".repeat(d);
if (c instanceof BooleanControl) {
BooleanControl b = (BooleanControl)c;
println(prefix + " ["+b.getType()+"/Boolean]: " + b);
} else if (c instanceof EnumControl) {
EnumControl e = (EnumControl)c;
println(prefix + " ["+e.getType()+"/Enum]: " + e);
} else if (c instanceof FloatControl) {
FloatControl f = (FloatControl)c;
println(prefix + " ["+f.getType()+"/Float]: " + f);
} else if (c instanceof CompoundControl) {
CompoundControl cc = (CompoundControl)c;
println(prefix + " ["+cc.getType()+"/Compound]: " + cc);
for (Control ctrl : cc.getMemberControls()) {
handleControl(ctrl, 4);
}
} else
println(prefix + " [UnknownControl]: " + c);
}
Should print out s.th like the below …
________________________________________________________________________________
> [Mixer]: Port Lautsprecher (XXXXX SOUND CARD), version 10.0
>> [SourceLine]: No SourceLine(s) provided
>> [TargetLine]: SPEAKER target port
>>> [Mute/Boolean]: Mute control with current value: false
>>> [Volume/Float]: Volume control with current value: 1.0 (range: 0.0 - 1.0)
>>> [CD-Audio/Compound]: CD-Audio control containing [Mute, Volume] controls
>>>> [Mute/Boolean]: Mute control with current value: false
>>>> [Volume/Float]: Volume control with current value: 1.0 (range: 0.0 - 1.0)
>>> [Master Volume/Compound]: Master Volume control containing [Mute, Volume] controls
>>>> [Mute/Boolean]: Mute control with current value: false
>>>> [Volume/Float]: Volume control with current value: 1.0 (range: 0.0 - 1.0)
________________________________________________________________________________
> [Mixer]: Port G27F (XXXXXX High Definition Au, version 10.0
>> [SourceLine]: No SourceLine(s) provided
>> [TargetLine]: Master Volume target port
>>> [Mute/Boolean]: Mute control with current value: false
>>> [Volume/Float]: Volume control with current value: 1.0 (range: 0.0 - 1.0)
>>> [CD-Audio/Compound]: CD-Audio control containing [Mute, Volume] controls
>>>> [Mute/Boolean]: Mute control with current value: false
>>>> [Volume/Float]: Volume control with current value: 1.0 (range: 0.0 - 1.0)
>>> [Master Volume/Compound]: Master Volume control containing [Mute, Volume] controls
>>>> [Mute/Boolean]: Mute control with current value: false
>>>> [Volume/Float]: Volume control with current value: 1.0 (range: 0.0 - 1.0)
________________________________________________________________________________
> [Mixer]: Port G27F (XXXXXX High Definition Au, version 10.0
>> [SourceLine]: No SourceLine(s) provided
>> [TargetLine]: Master Volume target port
>>> [Mute/Boolean]: Mute control with current value: false
>>> [Volume/Float]: Volume control with current value: 1.0 (range: 0.0 - 1.0)
>>> [CD-Audio/Compound]: CD-Audio control containing [Mute, Volume] controls
>>>> [Mute/Boolean]: Mute control with current value: false
>>>> [Volume/Float]: Volume control with current value: 1.0 (range: 0.0 - 1.0)
>>> [Master Volume/Compound]: Master Volume control containing [Mute, Volume] controls
>>>> [Mute/Boolean]: Mute control with current value: false
>>>> [Volume/Float]: Volume control with current value: 1.0 (range: 0.0 - 1.0)
________________________________________________________________________________
> [Mixer]: Port SPDIF Out (XXXXX SOUND CARD), version 10.0
>> [SourceLine]: No SourceLine(s) provided
>> [TargetLine]: Master Volume target port
>>> [Mute/Boolean]: Mute control with current value: false
>>> [Volume/Float]: Volume control with current value: 1.0 (range: 0.0 - 1.0)
>>> [CD-Audio/Compound]: CD-Audio control containing [Mute, Volume] controls
>>>> [Mute/Boolean]: Mute control with current value: false
>>>> [Volume/Float]: Volume control with current value: 1.0 (range: 0.0 - 1.0)
>>> [Master Volume/Compound]: Master Volume control containing [Mute, Volume] controls
>>>> [Mute/Boolean]: Mute control with current value: false
>>>> [Volume/Float]: Volume control with current value: 1.0 (range: 0.0 - 1.0)
________________________________________________________________________________
> [Mixer]: Port Lautsprecher (XXXXX Wireless, version 118.87
>> [SourceLine]: No SourceLine(s) provided
>> [TargetLine]: SPEAKER target port
>>> [Mute/Boolean]: Mute control with current value: false
>>> [Volume/Float]: Volume control with current value: 1.0 (range: 0.0 - 1.0)
>>> [CD-Audio/Compound]: CD-Audio control containing [Mute, Volume] controls
>>>> [Mute/Boolean]: Mute control with current value: false
>>>> [Volume/Float]: Volume control with current value: 1.0 (range: 0.0 - 1.0)
>>> [Master Volume/Compound]: Master Volume control containing [Mute, Volume] controls
>>>> [Mute/Boolean]: Mute control with current value: false
>>>> [Volume/Float]: Volume control with current value: 1.0 (range: 0.0 - 1.0)
________________________________________________________________________________
> [Mixer]: Port Mikrofon (XXXXX SOUND CARD), version 10.0
>> [SourceLine]: MICROPHONE source port
>>> [Master Volume/Compound]: Master Volume control containing [Mute, Volume] controls
>>>> [Mute/Boolean]: Mute control with current value: false
>>>> [Volume/Float]: Volume control with current value: 1.0 (range: 0.0 - 1.0)
>> [TargetLine]: Master Volume target port
>>> [Mute/Boolean]: Mute control with current value: false
>>> [Volume/Float]: Volume control with current value: 1.0 (range: 0.0 - 1.0)
>>> [Master Volume/Compound]: Master Volume control containing [Mute, Volume] controls
>>>> [Mute/Boolean]: Mute control with current value: false
>>>> [Volume/Float]: Volume control with current value: 1.0 (range: 0.0 - 1.0)
________________________________________________________________________________
> [Mixer]: Port Mikrofon (XXXXX Wireless Hea, version 118.87
>> [SourceLine]: MICROPHONE source port
>>> [Master Volume/Compound]: Master Volume control containing [Mute, Volume] controls
>>>> [Mute/Boolean]: Mute control with current value: false
>>>> [Volume/Float]: Volume control with current value: 0.8235294 (range: 0.0 - 1.0)
>> [TargetLine]: Master Volume target port
>>> [Mute/Boolean]: Mute control with current value: false
>>> [Volume/Float]: Volume control with current value: 0.8235294 (range: 0.0 - 1.0)
>>> [Master Volume/Compound]: Master Volume control containing [Mute, Volume] controls
>>>> [Mute/Boolean]: Mute control with current value: false
>>>> [Volume/Float]: Volume control with current value: 0.8235294 (range: 0.0 - 1.0)
________________________________________________________________________________
> [Mixer]: Port Line (XXXXX SOUND CARD), version 10.0
>> [SourceLine]: LINE_IN source port
>>> [Master Volume/Compound]: Master Volume control containing [Mute, Volume] controls
>>>> [Mute/Boolean]: Mute control with current value: false
>>>> [Volume/Float]: Volume control with current value: 1.0 (range: 0.0 - 1.0)
>> [TargetLine]: Master Volume target port
>>> [Mute/Boolean]: Mute control with current value: false
>>> [Volume/Float]: Volume control with current value: 1.0 (range: 0.0 - 1.0)
>>> [Master Volume/Compound]: Master Volume control containing [Mute, Volume] controls
>>>> [Mute/Boolean]: Mute control with current value: false
>>>> [Volume/Float]: Volume control with current value: 1.0 (range: 0.0 - 1.0)
________________________________________________________________________________
> [Mixer]: Port Mikrofon (XXXXX Webcam), version 3.23
>> [SourceLine]: MICROPHONE source port
>>> [Master Volume/Compound]: Master Volume control containing [Mute, Volume] controls
>>>> [Mute/Boolean]: Mute control with current value: false
>>>> [Volume/Float]: Volume control with current value: 0.76469064 (range: 0.0 - 1.0)
>> [TargetLine]: Master Volume target port
>>> [Mute/Boolean]: Mute control with current value: false
>>> [Volume/Float]: Volume control with current value: 0.76469064 (range: 0.0 - 1.0)
>>> [Master Volume/Compound]: Master Volume control containing [Mute, Volume] controls
>>>> [Mute/Boolean]: Mute control with current value: false
>>>> [Volume/Float]: Volume control with current value: 0.76469064 (range: 0.0 - 1.0)
________________________________________________________________________________
> [Mixer]: Primärer Soundtreiber, version Unknown Version
>> [SourceLine]: interface SourceDataLine supporting 8 audio formats, and buffers of at least 32 bytes
>>> [Master Gain/Float]: Master Gain control with current value: 0.0 dB (range: -80.0 - 6.0206)
>>> [Mute/Boolean]: Mute control with current value: False
>>> [Balance/Float]: Balance control with current value: 0.0 (range: -1.0 - 1.0)
>>> [Pan/Float]: Pan control with current value: 0.0 (range: -1.0 - 1.0)
>> [SourceLine]: interface Clip supporting 8 audio formats, and buffers of at least 32 bytes
>> [SourceLine]: No Controls(s) provided
>> [TargetLine]: No TargetLine(s) provided
________________________________________________________________________________
> [Mixer]: Lautsprecher (XXXXX SOUND CARD), version Unknown Version
>> [SourceLine]: interface SourceDataLine supporting 8 audio formats, and buffers of at least 32 bytes
>>> [Master Gain/Float]: Master Gain control with current value: 0.0 dB (range: -80.0 - 6.0206)
>>> [Mute/Boolean]: Mute control with current value: False
>>> [Balance/Float]: Balance control with current value: 0.0 (range: -1.0 - 1.0)
>>> [Pan/Float]: Pan control with current value: 0.0 (range: -1.0 - 1.0)
>> [SourceLine]: interface Clip supporting 8 audio formats, and buffers of at least 32 bytes
>> [SourceLine]: No Controls(s) provided
>> [TargetLine]: No TargetLine(s) provided
________________________________________________________________________________
> [Mixer]: G27F (XXXXXX High Definition Audio), version Unknown Version
>> [SourceLine]: interface SourceDataLine supporting 8 audio formats, and buffers of at least 32 bytes
>>> [Master Gain/Float]: Master Gain control with current value: 0.0 dB (range: -80.0 - 6.0206)
>>> [Mute/Boolean]: Mute control with current value: False
>>> [Balance/Float]: Balance control with current value: 0.0 (range: -1.0 - 1.0)
>>> [Pan/Float]: Pan control with current value: 0.0 (range: -1.0 - 1.0)
>> [SourceLine]: interface Clip supporting 8 audio formats, and buffers of at least 32 bytes
>> [SourceLine]: No Controls(s) provided
>> [TargetLine]: No TargetLine(s) provided
________________________________________________________________________________
> [Mixer]: G27F (XXXXXX High Definition Audio), version Unknown Version
>> [SourceLine]: interface SourceDataLine supporting 8 audio formats, and buffers of at least 32 bytes
>>> [Master Gain/Float]: Master Gain control with current value: 0.0 dB (range: -80.0 - 6.0206)
>>> [Mute/Boolean]: Mute control with current value: False
>>> [Balance/Float]: Balance control with current value: 0.0 (range: -1.0 - 1.0)
>>> [Pan/Float]: Pan control with current value: 0.0 (range: -1.0 - 1.0)
>> [SourceLine]: interface Clip supporting 8 audio formats, and buffers of at least 32 bytes
>> [SourceLine]: No Controls(s) provided
>> [TargetLine]: No TargetLine(s) provided
________________________________________________________________________________
> [Mixer]: SPDIF Out (XXXXX SOUND CARD), version Unknown Version
>> [SourceLine]: interface SourceDataLine supporting 8 audio formats, and buffers of at least 32 bytes
>>> [Master Gain/Float]: Master Gain control with current value: 0.0 dB (range: -80.0 - 6.0206)
>>> [Mute/Boolean]: Mute control with current value: False
>>> [Balance/Float]: Balance control with current value: 0.0 (range: -1.0 - 1.0)
>>> [Pan/Float]: Pan control with current value: 0.0 (range: -1.0 - 1.0)
>> [SourceLine]: interface Clip supporting 8 audio formats, and buffers of at least 32 bytes
>> [SourceLine]: No Controls(s) provided
>> [TargetLine]: No TargetLine(s) provided
________________________________________________________________________________
> [Mixer]: Lautsprecher (XXXXX Wireless Headset), version Unknown Version
>> [SourceLine]: interface SourceDataLine supporting 8 audio formats, and buffers of at least 32 bytes
>>> [Master Gain/Float]: Master Gain control with current value: 0.0 dB (range: -80.0 - 6.0206)
>>> [Mute/Boolean]: Mute control with current value: False
>>> [Balance/Float]: Balance control with current value: 0.0 (range: -1.0 - 1.0)
>>> [Pan/Float]: Pan control with current value: 0.0 (range: -1.0 - 1.0)
>> [SourceLine]: interface Clip supporting 8 audio formats, and buffers of at least 32 bytes
>> [SourceLine]: No Controls(s) provided
>> [TargetLine]: No TargetLine(s) provided
________________________________________________________________________________
> [Mixer]: Primary sound recording driver, version Unknown Version
>> [SourceLine]: No SourceLine(s) provided
>> [TargetLine]: interface TargetDataLine supporting 8 audio formats, and buffers of at least 32 bytes
>> [TargetLine]: No Controls(s) provided
________________________________________________________________________________
> [Mixer]: Mikrofon (XXXXX Webcam), version Unknown Version
>> [SourceLine]: No SourceLine(s) provided
>> [TargetLine]: interface TargetDataLine supporting 8 audio formats, and buffers of at least 32 bytes
>> [TargetLine]: No Controls(s) provided
________________________________________________________________________________
> [Mixer]: Mikrofon (XXXXX SOUND CARD), version Unknown Version
>> [SourceLine]: No SourceLine(s) provided
>> [TargetLine]: interface TargetDataLine supporting 8 audio formats, and buffers of at least 32 bytes
>> [TargetLine]: No Controls(s) provided
________________________________________________________________________________
> [Mixer]: Mikrofon (XXXXX Wireless Hea, version Unknown Version
>> [SourceLine]: No SourceLine(s) provided
>> [TargetLine]: interface TargetDataLine supporting 8 audio formats, and buffers of at least 32 bytes
>> [TargetLine]: No Controls(s) provided
________________________________________________________________________________
> [Mixer]: Line (XXXXX SOUND CARD), version Unknown Version
>> [SourceLine]: No SourceLine(s) provided
>> [TargetLine]: interface TargetDataLine supporting 8 audio formats, and buffers of at least 32 bytes
>> [TargetLine]: No Controls(s) provided
@mnse great work
Hi
Can you point or provide same but for microphone frequency reading ??
Thanks in advance
Hi @jafal,
don’t want to work out but you can check here … (FFT you need to apply for yourself)
Cheers
— mnse
@mnse thanks Alot Sir