• WANTED: Happy members who like to discuss audio and other topics related to our interest. Desire to learn and share knowledge of science required as is 20 years of participation in forums (not all true). There are daily reviews of audio hardware and expert members to help answer your questions. Click here to have your audio equipment measured for free!

Room correction - Linux

dasdoing

Major Contributor
Joined
May 20, 2020
Messages
2,945
Likes
1,694
Location
Salvador-Bahia-Brasil
Interesting. I always had this enabled. I can hear a difference with it off, however since I've tuned my curve with this on, obvisously I prefer it. The differences are not huge. With it off, I have less bass and more highs than with it on.

It's actualy a pretty good algo imo, so if one tunes the result by ear I would totaly recomend doing it with it on (personaly I don't tune the result, but make the PTT "dig even deeper" by tuning PTPeakDetectionStrength).
now if you want to have a specific house curve you need to turn it off
 

nhs

Active Member
Joined
Apr 16, 2021
Messages
144
Likes
70
....
The arguments it takes are the impulse response as a stereo wav file (I use REW to measure it), the name your filter will have, and the name of the drc-fir "preset" (one of: erb, minimal, soft, normal, strong, extreme, insane).
Hi @Daverz,
did you measure both left+right speakers at once together and exported the impulse response as stereo wave file?
I think the left and right speaker has to be measured separately and exported as mono file. Am I wrong?
 
OP
Lilith

Lilith

Active Member
Joined
Mar 28, 2021
Messages
245
Likes
67
Hi @Daverz,
did you measure both left+right speakers at once together and exported the impulse response as stereo wave file?
I think the left and right speaker has to be measured separately and exported as mono file. Am I wrong?
Left and right separately to two mono files.
 
  • Like
Reactions: nhs

Daverz

Major Contributor
Joined
Mar 17, 2019
Messages
1,155
Likes
1,252
Hi @Daverz,
did you measure both left+right speakers at once together and exported the impulse response as stereo wave file?
I think the left and right speaker has to be measured separately and exported as mono file. Am I wrong?

I did separate left and right measurements. You can select 2 measurements and export them as the the channels of a stereo wav file for convenience. I then had a bash script that would use sox to split the stereo file into two raw files. Or you could just export 2 mono wav files and convert those.
 

nhs

Active Member
Joined
Apr 16, 2021
Messages
144
Likes
70
I did separate left and right measurements. You can select 2 measurements and export them as the the channels of a stereo wav file for convenience. I then had a bash script that would use sox to split the stereo file into two raw files. Or you could just export 2 mono wav files and convert those.
Thank you for the clue, I didn't know that 2 measurements let be exported to one stereo wave file. That is much more convenient than 2 mono files. Yes I have read your script and seen your stereo impulse response as input.
 

buscon

Member
Joined
Jan 27, 2022
Messages
65
Likes
28
Dear all,

thanks for this thread. I do use Linux for music production too and I would like to have an alternative to sonarworks (which I bought already) for Linux.

I am thinking to do room correction in the following way:
1. create an impulse response of my room and speakers using REW (I have a measurement microphone)
2. "revert" the impulse response
3. use the reverted impulse response in LSP Stereo Convolver

Can someone confirm or comment my plan?
Any recommended tutorials about such procedure?
 

mkultr4

New Member
Joined
Apr 22, 2022
Messages
3
Likes
2
Ok, i just registered to give you a very simple and 100% accurate solution to your problem.
On a windows machine, just run a dirac delta impulse through sonarworks and record the output. It will be a very short click. (Essentially it's just one sample at 0dB). Save the output to a 32 bit wav file. Then on your linux machine, use this file in a convolution plugin of your choice and you will get 100% the same result as with sonarworks before.
 

buscon

Member
Joined
Jan 27, 2022
Messages
65
Likes
28
Ok, i just registered to give you a very simple and 100% accurate solution to your problem.
On a windows machine, just run a dirac delta impulse through sonarworks and record the output. It will be a very short click. (Essentially it's just one sample at 0dB). Save the output to a 32 bit wav file. Then on your linux machine, use this file in a convolution plugin of your choice and you will get 100% the same result as with sonarworks before.
thanks for your answer, that sounds pretty simple and smart.
only one question: where do I find a dirac delta impulse or how can I generate it?
 

dasdoing

Major Contributor
Joined
May 20, 2020
Messages
2,945
Likes
1,694
Location
Salvador-Bahia-Brasil

buscon

Member
Joined
Jan 27, 2022
Messages
65
Likes
28
ok, but you can't simply cut the silence like this. you need to leave taps, else you compromise the LF correction
do you mean he should not cut the silence after the impulse? I agree with that, some extra silence after the impulse should be left.
 

dasdoing

Major Contributor
Joined
May 20, 2020
Messages
2,945
Likes
1,694
Location
Salvador-Bahia-Brasil
do you mean he should not cut the silence after the impulse? I agree with that, some extra silence after the impulse should be left.

normaly the impulse peak would be centered; equal silence before and after. how much to leave is another question. note this is only necessary for a FIR correction. a IIR filter can start at the first sample
 

buscon

Member
Joined
Jan 27, 2022
Messages
65
Likes
28
normaly the impulse peak would be centered; equal silence before and after. how much to leave is another question. note this is only necessary for a FIR correction. a IIR filter can start at the first sample
thanks for the explanation. I am familiar with IIR samples, they always start at the first sample and have some silence at the end.

Then I get to the other question: how much silence should be left before and after the impulse?
And also: will the convolution software "understand" this silence?
 
Last edited:

dasdoing

Major Contributor
Joined
May 20, 2020
Messages
2,945
Likes
1,694
Location
Salvador-Bahia-Brasil
thanks for the explanation. I am familiar with IIR samples, they always start at the first sample and have some silence at the end.

Then I get to the other question: how much silence should be left before and after the impulse?
And also: will the convolution software will "understand" this silence?

the lenght of the IR should match the one used in the software you used to create it. only than you can ensure the desired effect. not sure if this is public information for the software you are using. it is probably possible to guesstimate when looking at the latency the original software produces
 

mkultr4

New Member
Joined
Apr 22, 2022
Messages
3
Likes
2
ok, but you can't simply cut the silence like this. you need to leave taps, else you compromise the LF correction
No you can for sure cut the complete silence, you just got to leave everything even if it's -120 dB in, your signal gets folded with the impulse response. If the IR is = 0 there is nothing to fold. You can also test this if you want but i am pretty sure you can cut every sample that says 0 on both channels. You can also see that I zoomed in to make sure to leave even that last bit that is at about -98 dB in. The peak in the IR is only centered if you use linear phase FIR filters, if you use linear phase mode in sonarworks that would be the case and the IR should be symmetric but if you are using zero latency then it wont look like that, the waveform in my case looks assymetric but also has pre-ringing is because i use both linear phase filters and IIR filters and i suppose DIRAC uses different algorythms internally too. I also attached a picture showing 1. Unfiltered Impulse 2. IIR Filter 3. Linear Phase Filter with markings what you would have to keep.
 

Attachments

  • Screenshot 2022-05-03 065843.jpg
    Screenshot 2022-05-03 065843.jpg
    130.2 KB · Views: 36
  • Screenshot 2022-05-03 072431.jpg
    Screenshot 2022-05-03 072431.jpg
    99.3 KB · Views: 29
Last edited:
OP
Lilith

Lilith

Active Member
Joined
Mar 28, 2021
Messages
245
Likes
67
I was trying to plot the generated filter files from DRC as described here: http://drc-fir.sourceforge.net/doc/drc.html#sec237 using Octave.
First I installed the plot and signal package in octave: with pkg install -forge plot and pkg install -forge signal and loading them: pkg load signal, pkg load plot.

The scripts for plotting are located in the DRC tarball and I linked to them with: addpath ("/home/marco/octave/DRC/octave/"). However when trying to plot the pcm file with e.g.

rc = loadpcm('filter_48_left_220319.pcm')
createdrcplots(rc,-1,"R Corrected","/home/marco/tmp/","R");

I get this error:

createdrcplots(rc,-1,"R Corrected","/home/marco/tmp/","R");
error: invalid conversion from string to real N-D array
error: called from
hilbert at line 112 column 6
createdrcplots at line 54 column 8

Seems to be more tricky to solve this after googling a bit. Was anyone successful with plotting the filter or is there any alternative way?

edit: Now I think I got it... will reply later :)
 
OP
Lilith

Lilith

Active Member
Joined
Mar 28, 2021
Messages
245
Likes
67
The createdrcplots obviously doesn't work with one file. It wants to have two files as input. I can plot all plots from the uncorrected pcm file, but not from the corrected pcm file.

It's stuck after plotting the "Time response, 200 Hz brickwall"

>> createdrcplots(u,-1,"R Uncorrected",c,-1,"R Corrected","/home/marco/tmp/","R",".png","-dpng");
IR1 impulse center: 48001, max: 1.002315, RMS: 1.368236
IR2 impulse center: 1107, max: 0.502743, RMS: 0.700000
Impulse response upsampling...
Step response...
Time response, full range...
Time response, 2 kHz brickwall...
Time response, 200 Hz brickwall...
error: ir2(-7713): subscripts must be either integers 1 to (2^63)-1 or logical
error: called from
createdrcplots at line 465 column 8
>>

What I find strange: My pcm file which I get from from REW with sox is 512 kb large (rew_ir_48_right_220319.pcm ), while the filter file is ony 256 kb large (filter_48_left_220319.pcm).

I generated the files with this script:

#!/bin/bash sox rew_ir_left_220319.wav -t f32 -r 48000 -c 1 rew_ir_48_left_220319.pcm sox rew_ir_right_220319.wav -t f32 -r 48000 -c 1 rew_ir_48_right_220319.pcm drc --BCInFile=/home/marco/DRC_room_correction/rew_ir_48_left_220319.pcm --PSOutFile=/home/marco/DRC_room_correction/filter_48_left_220319.pcm --PSPointsFile="/usr/share/drc/target/48.0 kHz/pa-48.0.txt" --MCFilterType=M --MCPointsFile=/home/marco/DRC_room_correction/35R586_cal_0degree.txt --PLMaxGain=1.2 --PSNormFactor=0.7 "/usr/share/drc/config/48.0 kHz/erb-48.0.drc" drc --BCInFile=/home/marco/DRC_room_correction/rew_ir_48_right_220319.pcm --PSOutFile=/home/marco/DRC_room_correction/filter_48_right_220319.pcm --PSPointsFile="/usr/share/drc/target/48.0 kHz/pa-48.0.txt" --MCFilterType=M --MCPointsFile=/home/marco/DRC_room_correction/35R586_cal_0degree.txt --PLMaxGain=1.2 --PSNormFactor=0.7 "/usr/share/drc/config/48.0 kHz/erb-48.0.drc" sox -t f32 -r 48000 -c 1 filter_48_left_220319.pcm filter_48_left_220319.wav sox -t f32 -r 48000 -c 1 filter_48_right_220319.pcm filter_48_right_220319.wav

When I load them in octave with the pcmload command from DRC they look like this in the variable explorer:

OgzIg3o.png

c ist the corrected file (=filter_48_right_220319.pcm) and the variable u is (rew_ir_48_right_220319.pcm). I wonder why the order of magnitude of the number are so different and if it's a problem that the variable size is different. If someone can help I also can upload my IR files.
 
Top Bottom