From: Jan Stary <hans@stare.cz>
To: sox-users@lists.sourceforge.net
Subject: Re: How to use microphone calibration file
Date: Wed, 17 Dec 2014 14:54:42 +0100 [thread overview]
Message-ID: <20141217135442.GA18379@www.stare.cz> (raw)
In-Reply-To: <5490CE34.3030501@users.sourceforge.net>
On Dec 17 01:28:36, pander@users.sourceforge.net wrote:
> On 12/16/2014 07:52 AM, Jan Stary wrote:
> > On Dec 15 13:24:04, pander@users.sourceforge.net wrote:
> >> Hi all,
> >>
> >> I have an UMIK-1 (a calibrated USB microphone) and use rec from sox for
> >> recording. I use a Raspberry Pi and try to get the most out of it in
> >> terms of quality. I am using the following commands:
> >>
> >> export AUDIODEV=hw:1,0
> >> export AUDIODRIVER=alsa
> >> rec -q -r 48000 -c 1 -b 24 --buffer 16384 test.wav trim 0 300
> >>
> >> 1) Should I worry about the following message?
> >>
> >> rec WARN formats: can't set 1 channels; using 2
> >>
> >> because the recording results in
> >>
> >> file test.wav
> >> test.wav: RIFF (little-endian) data, WAVE audio, mono 48000 Hz
> >
> > Record with 'rec -V' instead and show us the output.
>
> rec -V -r 48000 -c 1 -b 24 test.wav trim 0 10
> rec: SoX v14.4.0
> rec WARN formats: can't set 1 channels; using 2
>
> Input File : 'hw:1,0' (alsa)
> Channels : 2
> Sample Rate : 48000
> Precision : 24-bit
> Sample Encoding: 24-bit Signed Integer PCM
> Endian Type : little
> Reverse Nibbles: no
> Reverse Bits : no
>
>
> Output File : 'test.wav'
> Channels : 1
> Sample Rate : 48000
> Precision : 24-bit
> Sample Encoding: 24-bit Signed Integer PCM
> Endian Type : little
> Reverse Nibbles: no
> Reverse Bits : no
> Comment : 'Processed by SoX'
>
> rec INFO sox: effects chain: input 48000Hz 2 channels
> rec INFO sox: effects chain: trim 48000Hz 2 channels
> rec INFO sox: effects chain: channels 48000Hz 1 channels
> rec INFO sox: effects chain: output 48000Hz 1 channels
> In:0.00% 00:00:10.07 [00:00:00.00] Out:480k [ | ]
> Clip:0
> Done.
>
> > The run soxi on the recorded file and show us the output.
>
> Channels : 1
> Sample Rate : 48000
> Precision : 24-bit
> Duration : 00:59:00.00 = 169920000 samples ~ 265500 CDDA sectors
> File Size : 510M
> Bit Rate : 1.15M
> Sample Encoding: 24-bit Signed Integer PCM
>
> >> and Audacity reports
> >>
> >> Mono, 96000Hz
> >> 32-bit float
>
> So answer to 1) is no.
Eh, and plain old file(1) is actually more acurate
about audio file formats than Audacity.
>
> >> 2) I doubled the buffer size but sometimes I get
> >>
> >> rec WARN alsa: over-run
> >>
> >> but that seems to be independent of the doubling of the buffer size and
> >> only occurs on start up. What is smart to do here?
> >
> > Record without messing with the buffer first, and see if it is happening.
> > Do you have any 'sound daemon' running, such as alsad? In other words,
> > is SoX recording directly from the device, or is there a middleman?
>
> $ dpkg -l|grep alsa|awk '{print $2" "$3}'
> alsa-base 1.0.25+3~deb7u1
> alsa-utils 1.0.25-4
> gstreamer1.0-alsa:armhf 1.2.0-1co1rpi3
> libsox-fmt-alsa 14.4.0-3
>
> $ ps -aef|grep alsa
> does not report anything, also no OSS or pulse
>
> >> 3) How do I use the microphone calibration file? I can download it from
> >>
> >> http://www.minidsp.com/products/acoustic-measurement/umik-1
> >>
> >> and looks like
> >>
> >> Sens Factor =.27710dB, SERNO: 7007***
> >> 10.054 -5.3961
> >> 10.179 -5.2292
> >> 10.306 -5.0655
> >> ...
> >> 19527.604 -0.7159
> >> 19770.697 -0.7462
> >> 20016.816 -0.7772
> >>
> >> A simple line plot of the entire files reveals as
> >>
> >> https://i.imgur.com/ISO0WHh.png
> >
> > How do you suppose the calibration file should be "used"
> > and what do you picture as an output of such usage?
>
> I suppose that a convolution will do the needed correction.
> Is there a common procedure for this?
What "needed correction" of what? You have a wav file.
The 'spectrogram' effect of SoX will make you a spectrogram.
There is no way to tell SoX "this file was recorded with
this microphone which has this freq response, so make the
spectrogram a bit different". It that's what you are asking.
> Is this best done while recording or better done in post-processing?
> I have no idea yet what to do with the sens factor and the fact that the
> mic is reporting gain of 18 dB.
>
> $ arecord -l
> **** List of CAPTURE Hardware Devices ****
> card 1: U18dB [Umik-1 Gain: 18dB], device 0: USB Audio [USB Audio]
> Subdevices: 0/1
> Subdevice #0: subdevice #0
>
> I understand the theoretical part but have no experience with this yet
> in a practical way. Since it is a calibrated microphone, I would like to
> use the best toolchain to get the maximum resolution and the loudness in
> dB as correct as possible.
>
> >> 4) Are there more ways to optimise recording in this way?
> >
> > What "this way"? You have a microphone. How do you suppose
> > to "optimize" recording with it using a calibration measurement?
>
> I was wondering if other parameters for rec were needed.
No.
> >> 5) As next step, I am using this command to create a spectrogram
> >>
> >> sox test.wav -n remix - rate .25k spectrogram -x 1776 -y 512 -c 125Hz
> >
> > First of all, this command makes my 14.4.1 segfault.
> > Without the -x argument to the spectrogram effect, it works.
> > Without running 'rate' first, it works.
>
> The remix is when a stereo recording is being used but that is not the
> case here. The rate works here with 14.4.0-3
Can you please try with 14.4.1 to see if it's a bug
introduced in 14.4.1?
> sox test.wav -n remix - rate .25k spectrogram -x 1776 -y 512 -c test
>
> > Why are you changing the rate (and why to .25k)
> > before running the spectrogram effect? Are you trying to make
> > a spectrogram of a low frequency band only? Why?
>
> Yes, I am monitoring low frequency noise 24/7 with a Raspberry Pi.
Why don't you get a microphone much more suitable for that band then?
Why are you recording low frequency noise at 48kHz?
> >> Could the latter command also be optimised or should calibration
> >> correction take place here?
> >
> > What would be an "optimized" spectrogram?
> >
> >> 6) When calibration is used,
> >
> > How do you think "calibration is used" here?
>
> Here is an example https://i.imgur.com/sw4rbAx.png of one of the
> measurements. I am trying to get from https://en.wikipedia.org/wiki/DBFS
> to https://en.wikipedia.org/wiki/Decibel hence the previous questions on
> sox.
I have no idea what you are talking about.
What is the ultimate goal of all this?
You record some low freq noise, and make a spectorgram of it.
Then what?
------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
next prev parent reply other threads:[~2014-12-17 13:55 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-15 12:24 How to use microphone calibration file Pander
2014-12-16 6:52 ` Jan Stary
2014-12-17 0:28 ` Pander
2014-12-17 13:54 ` Jan Stary [this message]
2014-12-17 14:24 ` Erich Eckner
2014-12-17 19:15 ` New effect - was: " fmiser
2014-12-18 15:57 ` Pander
2014-12-18 16:27 ` Jan Stary
2014-12-18 16:15 ` Pander
2015-01-01 19:59 ` Jan Stary
2014-12-20 16:48 ` Pander
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://lists.sourceforge.net/lists/listinfo/sox-users
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20141217135442.GA18379@www.stare.cz \
--to=sox-users@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/sox.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).