How to monitor microphone volume level?
I've found a solution that doesn't work by me:
audio - Monitoring the microphone level with a command line tool in Linux - Super User
https://superuser.com/questions/306701/monitoring-the-microphone-level-with-a-command-line-tool-in-linux
The problem is that they are using Maximum amplitude to detect sound. However its value is always the same by me, no matter whether the recorded audio contains only silence or some sounds. For example:
10 sec of silence (Can be downloaded here: http://denis-aristov.ucoz.com/en/test-mic-silence.wav ):
$ arecord -f S16_LE -D hw:2,0 -d 10 /tmp/test-mic-silence.wav
$ sox -t .wav /tmp/test-mic-silence.wav -n stat
Samples read: 80000
Length (seconds): 10.000000
Scaled by: 2147483647.0
Maximum amplitude: 0.999969
Minimum amplitude: -1.000000
Midline amplitude: -0.000015
Mean norm: 0.202792
Mean amplitude: 0.009146
RMS amplitude: 0.349978
Maximum delta: 0.913849
Minimum delta: 0.000000
Mean delta: 0.001061
RMS delta: 0.005564
Rough frequency: 20
Volume adjustment: 1.000
10 sec with some sounds (Can be downloaded here: http://denis-aristov.ucoz.com/en/test-mic-sounds.wav ):
$ arecord -f S16_LE -D hw:2,0 -d 10 /tmp/test-mic-sounds.wav
$ sox -t .wav /tmp/test-mic-sounds.wav -n stat
Samples read: 80000
Length (seconds): 10.000000
Scaled by: 2147483647.0
Maximum amplitude: 0.999969
Minimum amplitude: -1.000000
Midline amplitude: -0.000015
Mean norm: 0.185012
Mean amplitude: 0.010225
RMS amplitude: 0.334286
Maximum delta: 1.999969
Minimum delta: 0.000000
Mean delta: 0.006213
RMS delta: 0.057844
Rough frequency: 220
Volume adjustment: 1.000
What is the difference? What values to use for sound detection? Or do I have to set something up because something works wrong?
I've just used another computer (a notebook with a built-in microphone). I've recorded two WMA files (with and without sounds) using Windows "Sound Recorder". Converted them to WAV files using audacity
and got the following outputs. Maximum amplitudes differ this time:
With sounds:
$ sox -t .wav /tmp/mic-sounds.wav -n stat
Samples read: 581632
Length (seconds): 6.594467
Scaled by: 2147483647.0
Maximum amplitude: 0.999969
Minimum amplitude: -1.000000
Midline amplitude: -0.000015
Mean norm: 0.013987
Mean amplitude: 0.000062
RMS amplitude: 0.065573
Maximum delta: 1.999969
Minimum delta: 0.000000
Mean delta: 0.011242
RMS delta: 0.047009
Rough frequency: 5031
Volume adjustment: 1.000
Without sounds:
$ sox -t .wav /tmp/mic-silence.wav -n stat
Samples read: 372736
Length (seconds): 4.226032
Scaled by: 2147483647.0
Maximum amplitude: 0.029022
Minimum amplitude: -0.029114
Midline amplitude: -0.000046
Mean norm: 0.005082
Mean amplitude: -0.000053
RMS amplitude: 0.006480
Maximum delta: 0.030487
Minimum delta: 0.000000
Mean delta: 0.005815
RMS delta: 0.007285
Rough frequency: 7891
Volume adjustment: 34.348
May it be an indication that there are some problems with the microphone on another computer?
sox microphone
|
show 9 more comments
I've found a solution that doesn't work by me:
audio - Monitoring the microphone level with a command line tool in Linux - Super User
https://superuser.com/questions/306701/monitoring-the-microphone-level-with-a-command-line-tool-in-linux
The problem is that they are using Maximum amplitude to detect sound. However its value is always the same by me, no matter whether the recorded audio contains only silence or some sounds. For example:
10 sec of silence (Can be downloaded here: http://denis-aristov.ucoz.com/en/test-mic-silence.wav ):
$ arecord -f S16_LE -D hw:2,0 -d 10 /tmp/test-mic-silence.wav
$ sox -t .wav /tmp/test-mic-silence.wav -n stat
Samples read: 80000
Length (seconds): 10.000000
Scaled by: 2147483647.0
Maximum amplitude: 0.999969
Minimum amplitude: -1.000000
Midline amplitude: -0.000015
Mean norm: 0.202792
Mean amplitude: 0.009146
RMS amplitude: 0.349978
Maximum delta: 0.913849
Minimum delta: 0.000000
Mean delta: 0.001061
RMS delta: 0.005564
Rough frequency: 20
Volume adjustment: 1.000
10 sec with some sounds (Can be downloaded here: http://denis-aristov.ucoz.com/en/test-mic-sounds.wav ):
$ arecord -f S16_LE -D hw:2,0 -d 10 /tmp/test-mic-sounds.wav
$ sox -t .wav /tmp/test-mic-sounds.wav -n stat
Samples read: 80000
Length (seconds): 10.000000
Scaled by: 2147483647.0
Maximum amplitude: 0.999969
Minimum amplitude: -1.000000
Midline amplitude: -0.000015
Mean norm: 0.185012
Mean amplitude: 0.010225
RMS amplitude: 0.334286
Maximum delta: 1.999969
Minimum delta: 0.000000
Mean delta: 0.006213
RMS delta: 0.057844
Rough frequency: 220
Volume adjustment: 1.000
What is the difference? What values to use for sound detection? Or do I have to set something up because something works wrong?
I've just used another computer (a notebook with a built-in microphone). I've recorded two WMA files (with and without sounds) using Windows "Sound Recorder". Converted them to WAV files using audacity
and got the following outputs. Maximum amplitudes differ this time:
With sounds:
$ sox -t .wav /tmp/mic-sounds.wav -n stat
Samples read: 581632
Length (seconds): 6.594467
Scaled by: 2147483647.0
Maximum amplitude: 0.999969
Minimum amplitude: -1.000000
Midline amplitude: -0.000015
Mean norm: 0.013987
Mean amplitude: 0.000062
RMS amplitude: 0.065573
Maximum delta: 1.999969
Minimum delta: 0.000000
Mean delta: 0.011242
RMS delta: 0.047009
Rough frequency: 5031
Volume adjustment: 1.000
Without sounds:
$ sox -t .wav /tmp/mic-silence.wav -n stat
Samples read: 372736
Length (seconds): 4.226032
Scaled by: 2147483647.0
Maximum amplitude: 0.029022
Minimum amplitude: -0.029114
Midline amplitude: -0.000046
Mean norm: 0.005082
Mean amplitude: -0.000053
RMS amplitude: 0.006480
Maximum delta: 0.030487
Minimum delta: 0.000000
Mean delta: 0.005815
RMS delta: 0.007285
Rough frequency: 7891
Volume adjustment: 34.348
May it be an indication that there are some problems with the microphone on another computer?
sox microphone
Looks like something is wrong. Have you tried to listen to the recordings of silence? Aren't they just pure noise?
– Michal Polovka
May 14 '17 at 8:45
Of course I heard them after recording. The second one contained the sounds.
– ka3ak
May 14 '17 at 9:09
Look at the first recording ("10 secs of silence") in an audio editor, e.g.audacity
. You'll see a DC (very low frequency) component when the level goes from 1 at 0 secs to -1 at 1 secs to 0.5 at 1.5 secs, and then falls down to near zero near the end. Did you plug in the mic during that time? If yes, you need to wait ca. 10 seconds before the amplitude settles, then measure. If not, you need to filter out the DC component somehow.sox
has several filters you can try.
– dirkt
May 14 '17 at 17:57
@dirkt I should have mentioned that I want to differ between an audio with some sounds and an audio without them by using a shell script only. The microphone was plugged in all the time. What is DC?
– ka3ak
May 16 '17 at 8:24
You can use thesox
filters from a shell script without problems. Try e.g.highpass 100
, that filters out most of it except for the initial jump. DC = direct current. If the mic was plugged in all the time, something strange is going on, or it recorded the final keypress or something. Try to record, say, 3x 10-sec samples of silence one after the other, first directly, then from a single script, and see in which ones you get this effect (or upload them so I can have a look).
– dirkt
May 16 '17 at 9:14
|
show 9 more comments
I've found a solution that doesn't work by me:
audio - Monitoring the microphone level with a command line tool in Linux - Super User
https://superuser.com/questions/306701/monitoring-the-microphone-level-with-a-command-line-tool-in-linux
The problem is that they are using Maximum amplitude to detect sound. However its value is always the same by me, no matter whether the recorded audio contains only silence or some sounds. For example:
10 sec of silence (Can be downloaded here: http://denis-aristov.ucoz.com/en/test-mic-silence.wav ):
$ arecord -f S16_LE -D hw:2,0 -d 10 /tmp/test-mic-silence.wav
$ sox -t .wav /tmp/test-mic-silence.wav -n stat
Samples read: 80000
Length (seconds): 10.000000
Scaled by: 2147483647.0
Maximum amplitude: 0.999969
Minimum amplitude: -1.000000
Midline amplitude: -0.000015
Mean norm: 0.202792
Mean amplitude: 0.009146
RMS amplitude: 0.349978
Maximum delta: 0.913849
Minimum delta: 0.000000
Mean delta: 0.001061
RMS delta: 0.005564
Rough frequency: 20
Volume adjustment: 1.000
10 sec with some sounds (Can be downloaded here: http://denis-aristov.ucoz.com/en/test-mic-sounds.wav ):
$ arecord -f S16_LE -D hw:2,0 -d 10 /tmp/test-mic-sounds.wav
$ sox -t .wav /tmp/test-mic-sounds.wav -n stat
Samples read: 80000
Length (seconds): 10.000000
Scaled by: 2147483647.0
Maximum amplitude: 0.999969
Minimum amplitude: -1.000000
Midline amplitude: -0.000015
Mean norm: 0.185012
Mean amplitude: 0.010225
RMS amplitude: 0.334286
Maximum delta: 1.999969
Minimum delta: 0.000000
Mean delta: 0.006213
RMS delta: 0.057844
Rough frequency: 220
Volume adjustment: 1.000
What is the difference? What values to use for sound detection? Or do I have to set something up because something works wrong?
I've just used another computer (a notebook with a built-in microphone). I've recorded two WMA files (with and without sounds) using Windows "Sound Recorder". Converted them to WAV files using audacity
and got the following outputs. Maximum amplitudes differ this time:
With sounds:
$ sox -t .wav /tmp/mic-sounds.wav -n stat
Samples read: 581632
Length (seconds): 6.594467
Scaled by: 2147483647.0
Maximum amplitude: 0.999969
Minimum amplitude: -1.000000
Midline amplitude: -0.000015
Mean norm: 0.013987
Mean amplitude: 0.000062
RMS amplitude: 0.065573
Maximum delta: 1.999969
Minimum delta: 0.000000
Mean delta: 0.011242
RMS delta: 0.047009
Rough frequency: 5031
Volume adjustment: 1.000
Without sounds:
$ sox -t .wav /tmp/mic-silence.wav -n stat
Samples read: 372736
Length (seconds): 4.226032
Scaled by: 2147483647.0
Maximum amplitude: 0.029022
Minimum amplitude: -0.029114
Midline amplitude: -0.000046
Mean norm: 0.005082
Mean amplitude: -0.000053
RMS amplitude: 0.006480
Maximum delta: 0.030487
Minimum delta: 0.000000
Mean delta: 0.005815
RMS delta: 0.007285
Rough frequency: 7891
Volume adjustment: 34.348
May it be an indication that there are some problems with the microphone on another computer?
sox microphone
I've found a solution that doesn't work by me:
audio - Monitoring the microphone level with a command line tool in Linux - Super User
https://superuser.com/questions/306701/monitoring-the-microphone-level-with-a-command-line-tool-in-linux
The problem is that they are using Maximum amplitude to detect sound. However its value is always the same by me, no matter whether the recorded audio contains only silence or some sounds. For example:
10 sec of silence (Can be downloaded here: http://denis-aristov.ucoz.com/en/test-mic-silence.wav ):
$ arecord -f S16_LE -D hw:2,0 -d 10 /tmp/test-mic-silence.wav
$ sox -t .wav /tmp/test-mic-silence.wav -n stat
Samples read: 80000
Length (seconds): 10.000000
Scaled by: 2147483647.0
Maximum amplitude: 0.999969
Minimum amplitude: -1.000000
Midline amplitude: -0.000015
Mean norm: 0.202792
Mean amplitude: 0.009146
RMS amplitude: 0.349978
Maximum delta: 0.913849
Minimum delta: 0.000000
Mean delta: 0.001061
RMS delta: 0.005564
Rough frequency: 20
Volume adjustment: 1.000
10 sec with some sounds (Can be downloaded here: http://denis-aristov.ucoz.com/en/test-mic-sounds.wav ):
$ arecord -f S16_LE -D hw:2,0 -d 10 /tmp/test-mic-sounds.wav
$ sox -t .wav /tmp/test-mic-sounds.wav -n stat
Samples read: 80000
Length (seconds): 10.000000
Scaled by: 2147483647.0
Maximum amplitude: 0.999969
Minimum amplitude: -1.000000
Midline amplitude: -0.000015
Mean norm: 0.185012
Mean amplitude: 0.010225
RMS amplitude: 0.334286
Maximum delta: 1.999969
Minimum delta: 0.000000
Mean delta: 0.006213
RMS delta: 0.057844
Rough frequency: 220
Volume adjustment: 1.000
What is the difference? What values to use for sound detection? Or do I have to set something up because something works wrong?
I've just used another computer (a notebook with a built-in microphone). I've recorded two WMA files (with and without sounds) using Windows "Sound Recorder". Converted them to WAV files using audacity
and got the following outputs. Maximum amplitudes differ this time:
With sounds:
$ sox -t .wav /tmp/mic-sounds.wav -n stat
Samples read: 581632
Length (seconds): 6.594467
Scaled by: 2147483647.0
Maximum amplitude: 0.999969
Minimum amplitude: -1.000000
Midline amplitude: -0.000015
Mean norm: 0.013987
Mean amplitude: 0.000062
RMS amplitude: 0.065573
Maximum delta: 1.999969
Minimum delta: 0.000000
Mean delta: 0.011242
RMS delta: 0.047009
Rough frequency: 5031
Volume adjustment: 1.000
Without sounds:
$ sox -t .wav /tmp/mic-silence.wav -n stat
Samples read: 372736
Length (seconds): 4.226032
Scaled by: 2147483647.0
Maximum amplitude: 0.029022
Minimum amplitude: -0.029114
Midline amplitude: -0.000046
Mean norm: 0.005082
Mean amplitude: -0.000053
RMS amplitude: 0.006480
Maximum delta: 0.030487
Minimum delta: 0.000000
Mean delta: 0.005815
RMS delta: 0.007285
Rough frequency: 7891
Volume adjustment: 34.348
May it be an indication that there are some problems with the microphone on another computer?
sox microphone
sox microphone
edited May 16 '17 at 12:16
ka3ak
asked May 14 '17 at 8:26
ka3akka3ak
571518
571518
Looks like something is wrong. Have you tried to listen to the recordings of silence? Aren't they just pure noise?
– Michal Polovka
May 14 '17 at 8:45
Of course I heard them after recording. The second one contained the sounds.
– ka3ak
May 14 '17 at 9:09
Look at the first recording ("10 secs of silence") in an audio editor, e.g.audacity
. You'll see a DC (very low frequency) component when the level goes from 1 at 0 secs to -1 at 1 secs to 0.5 at 1.5 secs, and then falls down to near zero near the end. Did you plug in the mic during that time? If yes, you need to wait ca. 10 seconds before the amplitude settles, then measure. If not, you need to filter out the DC component somehow.sox
has several filters you can try.
– dirkt
May 14 '17 at 17:57
@dirkt I should have mentioned that I want to differ between an audio with some sounds and an audio without them by using a shell script only. The microphone was plugged in all the time. What is DC?
– ka3ak
May 16 '17 at 8:24
You can use thesox
filters from a shell script without problems. Try e.g.highpass 100
, that filters out most of it except for the initial jump. DC = direct current. If the mic was plugged in all the time, something strange is going on, or it recorded the final keypress or something. Try to record, say, 3x 10-sec samples of silence one after the other, first directly, then from a single script, and see in which ones you get this effect (or upload them so I can have a look).
– dirkt
May 16 '17 at 9:14
|
show 9 more comments
Looks like something is wrong. Have you tried to listen to the recordings of silence? Aren't they just pure noise?
– Michal Polovka
May 14 '17 at 8:45
Of course I heard them after recording. The second one contained the sounds.
– ka3ak
May 14 '17 at 9:09
Look at the first recording ("10 secs of silence") in an audio editor, e.g.audacity
. You'll see a DC (very low frequency) component when the level goes from 1 at 0 secs to -1 at 1 secs to 0.5 at 1.5 secs, and then falls down to near zero near the end. Did you plug in the mic during that time? If yes, you need to wait ca. 10 seconds before the amplitude settles, then measure. If not, you need to filter out the DC component somehow.sox
has several filters you can try.
– dirkt
May 14 '17 at 17:57
@dirkt I should have mentioned that I want to differ between an audio with some sounds and an audio without them by using a shell script only. The microphone was plugged in all the time. What is DC?
– ka3ak
May 16 '17 at 8:24
You can use thesox
filters from a shell script without problems. Try e.g.highpass 100
, that filters out most of it except for the initial jump. DC = direct current. If the mic was plugged in all the time, something strange is going on, or it recorded the final keypress or something. Try to record, say, 3x 10-sec samples of silence one after the other, first directly, then from a single script, and see in which ones you get this effect (or upload them so I can have a look).
– dirkt
May 16 '17 at 9:14
Looks like something is wrong. Have you tried to listen to the recordings of silence? Aren't they just pure noise?
– Michal Polovka
May 14 '17 at 8:45
Looks like something is wrong. Have you tried to listen to the recordings of silence? Aren't they just pure noise?
– Michal Polovka
May 14 '17 at 8:45
Of course I heard them after recording. The second one contained the sounds.
– ka3ak
May 14 '17 at 9:09
Of course I heard them after recording. The second one contained the sounds.
– ka3ak
May 14 '17 at 9:09
Look at the first recording ("10 secs of silence") in an audio editor, e.g.
audacity
. You'll see a DC (very low frequency) component when the level goes from 1 at 0 secs to -1 at 1 secs to 0.5 at 1.5 secs, and then falls down to near zero near the end. Did you plug in the mic during that time? If yes, you need to wait ca. 10 seconds before the amplitude settles, then measure. If not, you need to filter out the DC component somehow. sox
has several filters you can try.– dirkt
May 14 '17 at 17:57
Look at the first recording ("10 secs of silence") in an audio editor, e.g.
audacity
. You'll see a DC (very low frequency) component when the level goes from 1 at 0 secs to -1 at 1 secs to 0.5 at 1.5 secs, and then falls down to near zero near the end. Did you plug in the mic during that time? If yes, you need to wait ca. 10 seconds before the amplitude settles, then measure. If not, you need to filter out the DC component somehow. sox
has several filters you can try.– dirkt
May 14 '17 at 17:57
@dirkt I should have mentioned that I want to differ between an audio with some sounds and an audio without them by using a shell script only. The microphone was plugged in all the time. What is DC?
– ka3ak
May 16 '17 at 8:24
@dirkt I should have mentioned that I want to differ between an audio with some sounds and an audio without them by using a shell script only. The microphone was plugged in all the time. What is DC?
– ka3ak
May 16 '17 at 8:24
You can use the
sox
filters from a shell script without problems. Try e.g. highpass 100
, that filters out most of it except for the initial jump. DC = direct current. If the mic was plugged in all the time, something strange is going on, or it recorded the final keypress or something. Try to record, say, 3x 10-sec samples of silence one after the other, first directly, then from a single script, and see in which ones you get this effect (or upload them so I can have a look).– dirkt
May 16 '17 at 9:14
You can use the
sox
filters from a shell script without problems. Try e.g. highpass 100
, that filters out most of it except for the initial jump. DC = direct current. If the mic was plugged in all the time, something strange is going on, or it recorded the final keypress or something. Try to record, say, 3x 10-sec samples of silence one after the other, first directly, then from a single script, and see in which ones you get this effect (or upload them so I can have a look).– dirkt
May 16 '17 at 9:14
|
show 9 more comments
1 Answer
1
active
oldest
votes
(Answer based on various comments, as this method seems to be acceptable, and comments are not guaranteed to stay.)
Look at the first recording ("10 secs of silence") in an audio editor, e.g. audacity
. You'll see a DC (very low frequency) component when the level goes from 1 at 0 secs to -1 at 1 secs to 0.5 at 1.5 secs, and then falls down to near zero near the end. Did you plug in the mic during that time? If yes, you need to wait ca. 10 seconds before the amplitude settles, then measure. If not, you need to filter out the DC (direct current, that is constant voltage offset) component somehow. sox
has several filters you can try.
You can use the sox
filters from a shell script without problems. Try e.g. highpass 100
, that filters out most of it except for the initial jump.
If filtering out DC components is too much effort, you can also ignore the initial part, and use the remaining part as it is.
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f364943%2fhow-to-monitor-microphone-volume-level%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
(Answer based on various comments, as this method seems to be acceptable, and comments are not guaranteed to stay.)
Look at the first recording ("10 secs of silence") in an audio editor, e.g. audacity
. You'll see a DC (very low frequency) component when the level goes from 1 at 0 secs to -1 at 1 secs to 0.5 at 1.5 secs, and then falls down to near zero near the end. Did you plug in the mic during that time? If yes, you need to wait ca. 10 seconds before the amplitude settles, then measure. If not, you need to filter out the DC (direct current, that is constant voltage offset) component somehow. sox
has several filters you can try.
You can use the sox
filters from a shell script without problems. Try e.g. highpass 100
, that filters out most of it except for the initial jump.
If filtering out DC components is too much effort, you can also ignore the initial part, and use the remaining part as it is.
add a comment |
(Answer based on various comments, as this method seems to be acceptable, and comments are not guaranteed to stay.)
Look at the first recording ("10 secs of silence") in an audio editor, e.g. audacity
. You'll see a DC (very low frequency) component when the level goes from 1 at 0 secs to -1 at 1 secs to 0.5 at 1.5 secs, and then falls down to near zero near the end. Did you plug in the mic during that time? If yes, you need to wait ca. 10 seconds before the amplitude settles, then measure. If not, you need to filter out the DC (direct current, that is constant voltage offset) component somehow. sox
has several filters you can try.
You can use the sox
filters from a shell script without problems. Try e.g. highpass 100
, that filters out most of it except for the initial jump.
If filtering out DC components is too much effort, you can also ignore the initial part, and use the remaining part as it is.
add a comment |
(Answer based on various comments, as this method seems to be acceptable, and comments are not guaranteed to stay.)
Look at the first recording ("10 secs of silence") in an audio editor, e.g. audacity
. You'll see a DC (very low frequency) component when the level goes from 1 at 0 secs to -1 at 1 secs to 0.5 at 1.5 secs, and then falls down to near zero near the end. Did you plug in the mic during that time? If yes, you need to wait ca. 10 seconds before the amplitude settles, then measure. If not, you need to filter out the DC (direct current, that is constant voltage offset) component somehow. sox
has several filters you can try.
You can use the sox
filters from a shell script without problems. Try e.g. highpass 100
, that filters out most of it except for the initial jump.
If filtering out DC components is too much effort, you can also ignore the initial part, and use the remaining part as it is.
(Answer based on various comments, as this method seems to be acceptable, and comments are not guaranteed to stay.)
Look at the first recording ("10 secs of silence") in an audio editor, e.g. audacity
. You'll see a DC (very low frequency) component when the level goes from 1 at 0 secs to -1 at 1 secs to 0.5 at 1.5 secs, and then falls down to near zero near the end. Did you plug in the mic during that time? If yes, you need to wait ca. 10 seconds before the amplitude settles, then measure. If not, you need to filter out the DC (direct current, that is constant voltage offset) component somehow. sox
has several filters you can try.
You can use the sox
filters from a shell script without problems. Try e.g. highpass 100
, that filters out most of it except for the initial jump.
If filtering out DC components is too much effort, you can also ignore the initial part, and use the remaining part as it is.
answered 13 mins ago
dirktdirkt
16.9k21336
16.9k21336
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f364943%2fhow-to-monitor-microphone-volume-level%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Looks like something is wrong. Have you tried to listen to the recordings of silence? Aren't they just pure noise?
– Michal Polovka
May 14 '17 at 8:45
Of course I heard them after recording. The second one contained the sounds.
– ka3ak
May 14 '17 at 9:09
Look at the first recording ("10 secs of silence") in an audio editor, e.g.
audacity
. You'll see a DC (very low frequency) component when the level goes from 1 at 0 secs to -1 at 1 secs to 0.5 at 1.5 secs, and then falls down to near zero near the end. Did you plug in the mic during that time? If yes, you need to wait ca. 10 seconds before the amplitude settles, then measure. If not, you need to filter out the DC component somehow.sox
has several filters you can try.– dirkt
May 14 '17 at 17:57
@dirkt I should have mentioned that I want to differ between an audio with some sounds and an audio without them by using a shell script only. The microphone was plugged in all the time. What is DC?
– ka3ak
May 16 '17 at 8:24
You can use the
sox
filters from a shell script without problems. Try e.g.highpass 100
, that filters out most of it except for the initial jump. DC = direct current. If the mic was plugged in all the time, something strange is going on, or it recorded the final keypress or something. Try to record, say, 3x 10-sec samples of silence one after the other, first directly, then from a single script, and see in which ones you get this effect (or upload them so I can have a look).– dirkt
May 16 '17 at 9:14