sox-users@lists.sourceforge.net unofficial mirror
 help / color / mirror / code / Atom feed
* How to use microphone calibration file
@ 2014-12-15 12:24 Pander
  2014-12-16  6:52 ` Jan Stary
  0 siblings, 1 reply; 11+ messages in thread
From: Pander @ 2014-12-15 12:24 UTC (permalink / raw)
  To: sox-users

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

and Audacity reports

  Mono, 96000Hz
  32-bit float

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?

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

4) Are there more ways to optimise recording in this way?

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

Could the latter command also be optimised or should calibration
correction take place here?

6) When calibration is used, does the spectrogram reflect dB properly or
is more processing needed?

Thanks,

Pander

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: How to use microphone calibration file
  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
  0 siblings, 1 reply; 11+ messages in thread
From: Jan Stary @ 2014-12-16  6:52 UTC (permalink / raw)
  To: sox-users

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.
The run soxi on the recorded file and show us the output.

> and Audacity reports
> 
>   Mono, 96000Hz
>   32-bit float
> 
> 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?

> 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?

> 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?

> 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.

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?

> 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?

> does the spectrogram reflect dB properly or
> is more processing needed?

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: How to use microphone calibration file
  2014-12-16  6:52 ` Jan Stary
@ 2014-12-17  0:28   ` Pander
  2014-12-17 13:54     ` Jan Stary
  2014-12-20 16:48     ` Pander
  0 siblings, 2 replies; 11+ messages in thread
From: Pander @ 2014-12-17  0:28 UTC (permalink / raw)
  To: sox-users

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.

>> 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?

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.

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

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.

>> 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.

>> does the spectrogram reflect dB properly or
>> is more processing needed?
> 
> ------------------------------------------------------------------------------
> 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
> _______________________________________________
> Sox-users mailing list
> Sox-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/sox-users
> 


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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: How to use microphone calibration file
  2014-12-17  0:28   ` Pander
@ 2014-12-17 13:54     ` Jan Stary
  2014-12-17 14:24       ` Erich Eckner
  2014-12-18 16:15       ` Pander
  2014-12-20 16:48     ` Pander
  1 sibling, 2 replies; 11+ messages in thread
From: Jan Stary @ 2014-12-17 13:54 UTC (permalink / raw)
  To: sox-users

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: How to use microphone calibration file
  2014-12-17 13:54     ` Jan Stary
@ 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:15       ` Pander
  1 sibling, 2 replies; 11+ messages in thread
From: Erich Eckner @ 2014-12-17 14:24 UTC (permalink / raw)
  To: sox-users


[-- Attachment #1.1: Type: text/plain, Size: 1356 bytes --]

Hi Pander,

to me it sounds like you would like to correct for the frequency
response of your microphone.
I don't know an effect, which does this with one invocation (like a
graphical 32-band equalizer), but take a look at the following effects:
equalizer, bass, treble

@community: Wouldn't it be nice to have some multi-band-equalizer
effect? E.g. "graphical-equalizer {frequency[k] gain}"

It looks to me, like you need to combine
1x "bass", 1x "treble" and (n-1)x "equalizer"
to represent a calibration file with n points.
Preferably, you should calculate the parameters in a script, otherwise
you would end up with a quite long command line.

However, I don't see a simple way to test the combined "microphone
correction" effect chain. As far as I see, you need to generate white
noise (with synth), send it through your chain, and look at the
spectrogram afterwards.
A different approach to test the "microphone correction" effect chain,
was to invoke "--plot" on each part and afterwards combine the graphs
somehow :-/

@community: Another dream of me: Why not have a --plot equivalent, which
gives the transfer function of the whole effect chain (I mean the parts,
which support "--plot" right now, combined)? This might be obsolete, if
there is some graphical-equalizer effect. Or vice versa.

Greetings,
Erich



[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 834 bytes --]

[-- Attachment #2: Type: text/plain, Size: 441 bytes --]

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

[-- Attachment #3: Type: text/plain, Size: 158 bytes --]

_______________________________________________
Sox-users mailing list
Sox-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sox-users

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: New effect - was: How to use microphone calibration file
  2014-12-17 14:24       ` Erich Eckner
@ 2014-12-17 19:15         ` fmiser
  2014-12-18 15:57         ` Pander
  1 sibling, 0 replies; 11+ messages in thread
From: fmiser @ 2014-12-17 19:15 UTC (permalink / raw)
  To: sox-users

> Erich wrote:
> 
> @community: Wouldn't it be nice to have some multi-band-equalizer
> effect? E.g. "graphical-equalizer {frequency[k] gain}"

I think the existing equalizer effect does just fine.  What would
"graphical-equalizer" do that the existing doesn't?  The only thing
I see is it would have a fixed Q/bandwidth.  I'm failing to see and
advantage in that...  You could just set the Q at 2 for all of them.

> However, I don't see a simple way to test the combined "microphone
> correction" effect chain. As far as I see, you need to generate
> white noise (with synth), send it through your chain, and look at
> the spectrogram afterwards.

White noise requires time for the random nature to settle on an
average of flat.  A frequency sweep can be quicker and more
accurate.

For viewing, I often use baudline, a powerful signal viewing tool.

> @community: Another dream of me: Why not have a --plot
> equivalent, which gives the transfer function of the whole effect
> chain (I mean the parts, which support "--plot" right now,
> combined)? This might be obsolete, if there is some
> graphical-equalizer effect. Or vice versa.

Yeah,  I'd like to have a plot of all the steps in the chain.  I
don't see how your proposed "graphical-equalizer" effect would make
it obsolete, though.  Oh - unless as a single effect it takes
multiple frequency/gain pairs.

--  Philip

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: How to use microphone calibration file
  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
  1 sibling, 1 reply; 11+ messages in thread
From: Pander @ 2014-12-18 15:57 UTC (permalink / raw)
  To: sox-users

On 12/17/2014 03:24 PM, Erich Eckner wrote:
> Hi Pander,
> 
> to me it sounds like you would like to correct for the frequency
> response of your microphone.
> I don't know an effect, which does this with one invocation (like a
> graphical 32-band equalizer), but take a look at the following effects:
> equalizer, bass, treble
> 
> @community: Wouldn't it be nice to have some multi-band-equalizer
> effect? E.g. "graphical-equalizer {frequency[k] gain}"
> 
> It looks to me, like you need to combine
> 1x "bass", 1x "treble" and (n-1)x "equalizer"
> to represent a calibration file with n points.
> Preferably, you should calculate the parameters in a script, otherwise
> you would end up with a quite long command line.

The calibration file has 615 bands. Is this approach feasible?

> However, I don't see a simple way to test the combined "microphone
> correction" effect chain. As far as I see, you need to generate white
> noise (with synth), send it through your chain, and look at the
> spectrogram afterwards.
> A different approach to test the "microphone correction" effect chain,
> was to invoke "--plot" on each part and afterwards combine the graphs
> somehow :-/

The alternative is to use e.g. NumPy, brutefir or jconvolver on the WAV
file. NumPy could make the spectrogram then directly.

> @community: Another dream of me: Why not have a --plot equivalent, which
> gives the transfer function of the whole effect chain (I mean the parts,
> which support "--plot" right now, combined)? This might be obsolete, if
> there is some graphical-equalizer effect. Or vice versa.

I am not afraid to help out in C to help add a filtering step in the
frequency domain directly after the FFT. This shouldn't be too hard.

The calibration file, which is a smooth curve, needs to be made
continuous with interpolation (linear interpolation would suffice). Then
the signal in the frequency domain needs simply to be multiplied for
each value by looking up the factor based on the frequency.

With some mentoring, I am willing to implement this. Most important part
will be implementing checks and how to deal with extreme values.



Another thing on recording with rec is the following; I am getting some
repetitions in the frequency domain. It also shows up when I create
spectrogram with audacity. (all is 24-bit but also shows in 16-bit)

sample freq --- sox --- audacity
 8000 https://i.imgur.com/8yNNAH0.png
11025 https://i.imgur.com/9eqbXOv.png
16000 https://i.imgur.com/bfZZyRy.png https://i.imgur.com/YGqOHV2.png
44100 https://i.imgur.com/bhM44L0.png
48000 https://i.imgur.com/mtojMgF.png https://i.imgur.com/qt4u1p4.png

Here it are lines but with realistic recoding I see also complete
signals repeated. How can I fix this?

Regards,

Pander

> Greetings,
> Erich
> 
> 
> 
> 
> ------------------------------------------------------------------------------
> 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
> 
> 
> 
> _______________________________________________
> Sox-users mailing list
> Sox-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/sox-users
> 


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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: How to use microphone calibration file
  2014-12-17 13:54     ` Jan Stary
  2014-12-17 14:24       ` Erich Eckner
@ 2014-12-18 16:15       ` Pander
  2015-01-01 19:59         ` Jan Stary
  1 sibling, 1 reply; 11+ messages in thread
From: Pander @ 2014-12-18 16:15 UTC (permalink / raw)
  To: sox-users

On 12/17/2014 02:54 PM, Jan Stary wrote:
> 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:
...
>>>> 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?

It works fine on 14.4.1-4 on Ubuntu. Perhaps there went something wrong
with the test. I also had a few times but the recording was probably too
short. Does that reproduce it?

>> 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?

The application can also be to monitor higher sounds. I choose a general
purpose measuring calibrated microphone. What woudl you recommend for LF
domain?

>>>> 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?

0 dBFS is maximum of recording amplitude. The spectrogram plots all
below that level. I want to be able to map those dBFS values to acoustic
dB values https://en.wikipedia.org/wiki/Decibel#Acoustics

Since the microphone is calibrated and all specs are available, that
should be possible. If this is outside the domain of this mailing list
could anyone tell me what is a better location to discuss this.

Regards,

Pander

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: How to use microphone calibration file
  2014-12-18 15:57         ` Pander
@ 2014-12-18 16:27           ` Jan Stary
  0 siblings, 0 replies; 11+ messages in thread
From: Jan Stary @ 2014-12-18 16:27 UTC (permalink / raw)
  To: sox-users

On Dec 18 16:57:24, pander@users.sourceforge.net wrote:
> The calibration file has 615 bands. Is this approach feasible?

A much more feasible approach is to get a microphone
with a flat response in the band you are recording
and be done with it.

> > However, I don't see a simple way to test the combined "microphone
> > correction" effect chain. As far as I see, you need to generate white
> > noise (with synth), send it through your chain, and look at the
> > spectrogram afterwards.
> > A different approach to test the "microphone correction" effect chain,
> > was to invoke "--plot" on each part and afterwards combine the graphs
> > somehow :-/
> 
> The alternative is to use e.g. NumPy, brutefir or jconvolver on the WAV
> file. NumPy could make the spectrogram then directly.

SoX could make the spectrogram then directly, from the "corrected" file.
What you are asking for is an envelope; that would be interesting to have.

> The calibration file, which is a smooth curve, needs to be made
> continuous with interpolation (linear interpolation would suffice).

It's not a smooth curve,
and a smooth curve does not need to be made continuous.

> Then the signal in the frequency domain needs simply to be multiplied for
> each value by looking up the factor based on the frequency.

Yes. That's finitely many discrete values though,
not a smooth curve.

> Another thing on recording with rec is the following; I am getting some
> repetitions in the frequency domain. It also shows up when I create
> spectrogram with audacity. (all is 24-bit but also shows in 16-bit)
> 
> sample freq --- sox --- audacity
>  8000 https://i.imgur.com/8yNNAH0.png
> 11025 https://i.imgur.com/9eqbXOv.png
> 16000 https://i.imgur.com/bfZZyRy.png https://i.imgur.com/YGqOHV2.png
> 44100 https://i.imgur.com/bhM44L0.png
> 48000 https://i.imgur.com/mtojMgF.png https://i.imgur.com/qt4u1p4.png

These are harmonic overtones. What about them?

> Here it are lines but with realistic recoding I see also complete
> signals repeated.

Can you show us an example?
And what are the above (if they are not "realistic recordings")?

	Jan


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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: How to use microphone calibration file
  2014-12-17  0:28   ` Pander
  2014-12-17 13:54     ` Jan Stary
@ 2014-12-20 16:48     ` Pander
  1 sibling, 0 replies; 11+ messages in thread
From: Pander @ 2014-12-20 16:48 UTC (permalink / raw)
  To: sox-users

I could reproduce the segfault with rate parameter on Ubuntu with sox
14.4.1-4 but there is no segfault on Raspbian with sox 14.4.0-3. Does
this mean a bug was introduced between those two versions? Could somone
investigate this please?

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: How to use microphone calibration file
  2014-12-18 16:15       ` Pander
@ 2015-01-01 19:59         ` Jan Stary
  0 siblings, 0 replies; 11+ messages in thread
From: Jan Stary @ 2015-01-01 19:59 UTC (permalink / raw)
  To: sox-users

> >>>>  ox 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.

> I also had a few times but the recording was probably too short.
> Does that reproduce it?

Yes, that was exactly it. Thanks.
I am about to send a separate mail about that.


------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2015-01-01 20:00 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

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