pierreaubert / spinorama

A library to display and compare spinorama (speakers measurements) graphs.
GNU General Public License v3.0
119 stars 12 forks source link

Bugs in global optimiser #239

Open pierreaubert opened 1 year ago

pierreaubert commented 1 year ago

Key issues:

Smaller issues:

ehfd commented 1 year ago

Why is it that in quite a lot of speakers, the on-axis response is seemingly even more obstructed after EQ to create a quite obscure response?

image to after EQ image

In such cases, it seems that the slope of the estimated in-room response becomes very steep.

image to after EQ image

This is not the adequate -4 to -6 dB from 100 Hz to 20 kHz.

pierreaubert commented 1 year ago

Hello,

I have 2 questions:

The optimiser try to optimise the Harmann score. That usually degrade a bit the on axis and flatten the PIR. The optimiser can also optimise for a flat LW is that's what you want.

In this case, that doesn't sound reasonable and I will have a look.

P.

ehfd commented 1 year ago

Do you have a reference to "-4 to -6 dB from 100 Hz to 20 kHz"?

Mostly a preference of -6 dB approximately (from Harman?). What I'm trying to say is that we all know that there are extreme slopings which do not make sense, whatever the norm for the slopes people debate about, especially when the on-axis becomes that strange...

https://audiosciencereview.com/forum/index.php?threads/estimated-in-room-response-trendline-slope.24059/post-811720 https://audiosciencereview.com/forum/index.php?threads/estimated-in-room-response-trendline-slope.24059/post-811738

The optimiser can also optimise for a flat LW is that's what you want.

I believe I can run this if I use Python?

pierreaubert commented 1 year ago

I rerun the optimiser (more recent version):

image

and that's significantly better.

You can of course run it yourself and optimise as you want.

Preamp: -3.0 dB

Filter 1: ON LS Fc 88 Hz Gain +3.00 dB Q 2.57 Filter 2: ON PK Fc 4986 Hz Gain -1.64 dB Q 1.83 Filter 3: ON PK Fc 241 Hz Gain -1.05 dB Q 1.19 Filter 4: ON PK Fc 2011 Hz Gain +0.76 dB Q 2.12 Filter 5: ON PK Fc 13485 Hz Gain +1.88 dB Q 2.98 Filter 6: ON PK Fc 961 Hz Gain +0.76 dB Q 2.99 Filter 7: ON PK Fc 3605 Hz Gain -0.76 dB Q 2.94 Filter 8: ON PK Fc 10090 Hz Gain -0.75 dB Q 2.98



Pictures of the EQ and results of EQ are in ./docs/speakers/$SPEAKER/*

There are plenty of parameters on the command line. Feedback is welcome since I am the only user ATM. I am sure you will find plenty of bugs.

![filters_eq](https://github.com/pierreaubert/spinorama/assets/1709343/b4043f63-b83e-408e-a3e2-7b16911f1ecd)

Since there is a directivity error, you cannot have both a flat LW and a flat PIR. For nearfield I use flat LW; for farfield, that's debatable. 

I find the histogram useful to see if the EQ is degrading or improving the speaker and if the midrange is impacted. I care more about the midrange that the treble. Bass in any case are room dependant.
ehfd commented 1 year ago

Thank you!

ehfd commented 1 year ago
./generate_peqs.py --speaker='Genelec S360' --force --verbose --optimisation=global --curves=LW,PIR

image

Hmm... doesn't find any speaker. Tried the example Genelec S360.

./generate_graphs.py --speaker='Genelec S360' works fine.

pierreaubert commented 1 year ago

please try first:

./generate_graphs.py --speaker='MTG Designs AlTi DIY' --update-cache

./generate_peqs.py is reading from the cache.

I will update the doc to make it clearer.

On Tue, Jun 6, 2023 at 5:16 PM Seungmin Kim @.***> wrote:

./generate_peqs.py --speaker='MTG Designs AlTi DIY' --force --verbose --optimisation=global --curves=LW,PIR

[image: image] https://user-images.githubusercontent.com/8457324/243742451-530359a6-84b3-4dbd-8ff0-f27ffc6c9791.png

Hmm... doesn't find any speaker. Tried the example Genelec S360 too.

./generate_graphs.py --speaker='MTG Designs AlTi DIY' works fine.

— Reply to this email directly, view it on GitHub https://github.com/pierreaubert/spinorama/issues/239#issuecomment-1578961224, or unsubscribe https://github.com/notifications/unsubscribe-auth/AANBKH55T2OOPRYOHTJTRETXJ5CTXANCNFSM6AAAAAAYURJ4AI . You are receiving this because you were assigned.Message ID: @.***>

--

PfA

pierreaubert commented 1 year ago

what error msg do you get?

On Tue, Jun 6, 2023 at 6:34 PM Seungmin Kim @.***> wrote:

Still not it...

— Reply to this email directly, view it on GitHub https://github.com/pierreaubert/spinorama/issues/239#issuecomment-1579098739, or unsubscribe https://github.com/notifications/unsubscribe-auth/AANBKH4JJIR4FUMPQZKAZPLXJ5L25ANCNFSM6AAAAAAYURJ4AI . You are receiving this because you were assigned.Message ID: @.***>

--

PfA

ehfd commented 1 year ago

Still:

pierreaubert commented 1 year ago

Can you add a —log-level=DEBUG to the command line? Run it and copy paste the verbose output somewhere? Logs are also generated in a file at the top level.

On Wed, 7 Jun 2023 at 01:45, Seungmin Kim @.***> wrote:

Still:

https://user-images.githubusercontent.com/8457324/243742451-530359a6-84b3-4dbd-8ff0-f27ffc6c9791.png

— Reply to this email directly, view it on GitHub https://github.com/pierreaubert/spinorama/issues/239#issuecomment-1579606453, or unsubscribe https://github.com/notifications/unsubscribe-auth/AANBKH2ZIY75YMLAMX46P5TXJ66JRANCNFSM6AAAAAAYURJ4AI . You are receiving this because you were assigned.Message ID: @.***>

--

PfA

ehfd commented 1 year ago

./generate_graphs.py --speaker='Genelec S360' --update-cache --force --log-level=DEBUG

log_graphs.txt

./generate_peqs.py --speaker='Genelec S360' --force --log-level=DEBUG --optimisation=global --curves='LW,PIR'

log_eq.txt

ehfd commented 1 year ago

@pierreaubert

So far what I did:

First, initialize a clean repository and clean virtualenv:

sudo apt-get update
sudo apt-get install -y imagemagick npm build-essential
git clone -b develop https://github.com/pierreaubert/spinorama.git
cd spinorama
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r requirements-dev.txt
pip install -r requirements-test.txt
pip install flake8
# flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics --exclude spinorama-venv
export PYTHONPATH=src
cd src/spinorama && python setup.py build_ext --inplace && ln -s c_compute_scores.cpython-*.so c_compute_scores.so
cd ../..
pip install pytest
# pytest
npm install --save-dev pyright w3c-html-validator standard flow flow-remove-types
./check_meta.py
./update_pictures.sh
./generate_graphs.py --help

export SPEAKER='Genelec S360'
./generate_graphs.py --speaker="$SPEAKER" --update-cache --force
./generate_meta.py

Note: should fix ./update_picture.sh to ./update_pictures.sh, and ./generate_statistics.py to ./generate_stats.py in the docs.

Works until ./generate_graphs.py --speaker="$SPEAKER" --update-cache --force where it shows Queued 843 speakers 2 measurements

But with ./generate_meta.py:

(queued 0 files)
(loaded 0 speakers)
info: spl continuous [1000, 0]
info: spl       peak [1000, 0]
 3.23s start->ray init
 0.00s ray init->loaded
 0.00s loaded->quality
 0.00s quality->scores
 0.00s scores->eq
 0.00s eq->near
 0.02s near->dump

No file is queried.

./generate_radar.py
2023-06-26 11:10:26,308 - generate_radar.py:main:170 - WARNING - Data ./docs/assets/metadata.json loaded (821 speakers)!
./generate_stats.py
2023-06-26 11:09:55,556 - generate_stats.py:main:166 - WARNING - Data ./docs/assets/metadata.json loaded (821 speakers)!
export SPEAKER='Genelec S360'
rm -f docs/speakers/"$SPEAKER"/*/filters_eq.png
./generate_peqs.py --speaker="$SPEAKER" --force --verbose

Reading cache ... (queued 0 files)
2023-06-26 11:13:21,765 INFO worker.py:1627 -- Started a local Ray instance. View the dashboard at 127.0.0.1:8265 
(loaded 0 speakers)

Seems like the files they are supposed to read are not read.

pierreaubert commented 1 year ago

Thanks for the debugging. I will spin an empty vm and try to reproduce it. Which OS, distrib are you using?

On Mon, Jun 26, 2023 at 4:15 AM Seungmin Kim @.***> wrote:

@pierreaubert https://github.com/pierreaubert

So far what I did:

First, initialize a clean repository and clean virtualenv:

sudo apt-get update sudo apt-get install -y imagemagick npm build-essential git clone -b develop https://github.com/pierreaubert/spinorama.git cd spinorama python -m pip install --upgrade pip pip install -r requirements.txt pip install -r requirements-dev.txt pip install -r requirements-test.txt pip install flake8 flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics --exclude spinorama-venv export PYTHONPATH=src python3 ./check_meta.py cd src/spinorama && python setup.py build_ext --inplace && ln -s c_compute_scores.cpython-*.so c_compute_scores.so cd ../.. pip install pytest pytest npm install --save-dev pyright w3c-html-validator standard flow flow-remove-types ./check_meta.py ./update_pictures.sh ./generate_graphs.py --help

export SPEAKER='Genelec S360' ./generate_graphs.py --speaker="$SPEAKER" ./generate_meta.py

Note: should fix ./update_picture.sh to ./update_pictures.sh, and ./generate_statistics.py to ./generate_stats.py in the docs.

Works until ./generate_graphs.py --speaker="$SPEAKER" where it shows Queued 843 speakers 2 measurements

But with ./generate_meta.py:

(queued 0 files) (loaded 0 speakers) info: spl continuous [1000, 0] info: spl peak [1000, 0] 3.23s start->ray init 0.00s ray init->loaded 0.00s loaded->quality 0.00s quality->scores 0.00s scores->eq 0.00s eq->near 0.02s near->dump

No file is queried.

./generate_radar.py 2023-06-26 11:10:26,308 - generate_radar.py:main:170 - WARNING - Data ./docs/assets/metadata.json loaded (821 speakers)! ./generate_stats.py 2023-06-26 11:09:55,556 - generate_stats.py:main:166 - WARNING - Data ./docs/assets/metadata.json loaded (821 speakers)!

export SPEAKER='Genelec S360' ./generate_peqs.py --speaker="$SPEAKER" --force --verbose Reading cache ... (queued 0 files) 2023-06-26 11:13:21,765 INFO worker.py:1627 -- Started a local Ray instance. View the dashboard at 127.0.0.1:8265 (loaded 0 speakers)

Seems like the files they are supposed to read are not read.

— Reply to this email directly, view it on GitHub https://github.com/pierreaubert/spinorama/issues/239#issuecomment-1606437531, or unsubscribe https://github.com/notifications/unsubscribe-auth/AANBKH3OKIZSSY5YCXJEIW3XNDWC7ANCNFSM6AAAAAAYURJ4AI . You are receiving this because you were mentioned.Message ID: @.***>

--

PfA

pierreaubert commented 1 year ago

I found an obvious bug and it should works now (the cache directory was not always created).

git pull export SPEAKER='Genelec S360' ./generate_graphs.py --speaker="$SPEAKER" --update-cache

check that there is a directory called .cache with at least 1 file inside

./generate_meta.py

you should see at least 1 loaded

pierreaubert commented 1 year ago

Here are 2 EQs for the same speaker (Focal ST6 Solo6)

  1. no eq (score 4.7)
  2. optimise for flat LW (score 5.4, cost -2.4 dB preamp)
  3. optimise for score (score 6.3, cost -2.3dB preamp)

EQ flat:

command: note the fitness=Flat ./generate_peqs.py --speaker="$SPEAKER" --verbose --force --fitness=Flat --optimisation=global --max-iter=2500 --max-Q=4

results:

EQ for Focal ST6 Solo6 computed from ASR data
Preference Score 4.71 with EQ 5.43
Generated from http://github.com/pierreaubert/spinorama/generate_peqs.py v0.22
Dated: 2023-06-26-15:13:42

Preamp: -2.4 dB

Filter  1: ON PK Fc    68 Hz Gain -2.98 dB Q 2.70
Filter  2: ON PK Fc   179 Hz Gain +1.55 dB Q 0.26
Filter  3: ON PK Fc   527 Hz Gain +0.13 dB Q 0.79
Filter  4: ON PK Fc   686 Hz Gain -1.95 dB Q 1.76
Filter  5: ON PK Fc   817 Hz Gain +1.51 dB Q 3.89
Filter  6: ON PK Fc  1645 Hz Gain +0.26 dB Q 2.74
Filter  7: ON PK Fc  2863 Hz Gain +1.15 dB Q 3.37
Filter  8: ON PK Fc  7071 Hz Gain -2.88 dB Q 1.84
Filter  9: ON PK Fc 11952 Hz Gain +2.64 dB Q 0.53

filters_eq

For a better score (and less good LW since the directivity is not great): command: note the fitness=Score ./generate_peqs.py --speaker="$SPEAKER" --verbose --force --fitness=Score --optimisation=global --max-iter=2500 --max-Q=4

eq:

EQ for Focal ST6 Solo6 computed from ASR data
Preference Score 4.71 with EQ 6.30
Generated from http://github.com/pierreaubert/spinorama/generate_peqs.py v0.23
Dated: 2023-06-26-15:46:12

Preamp: -2.7 dB

Filter  1: ON LS Fc    46 Hz Gain +2.80 dB Q 1.18
Filter  2: ON PK Fc   153 Hz Gain +1.15 dB Q 0.97
Filter  3: ON PK Fc   221 Hz Gain +1.10 dB Q 1.11
Filter  4: ON PK Fc   354 Hz Gain +0.72 dB Q 3.45
Filter  5: ON PK Fc   903 Hz Gain +0.93 dB Q 1.70
Filter  6: ON PK Fc  1648 Hz Gain +0.26 dB Q 1.80
Filter  7: ON PK Fc  2909 Hz Gain +1.23 dB Q 2.81
Filter  8: ON PK Fc  4064 Hz Gain -0.03 dB Q 1.42
Filter  9: ON PK Fc  6489 Hz Gain -2.93 dB Q 1.57

filters_eq

ehfd commented 1 year ago

@pierreaubert

Which OS, distrib are you using?

Ubuntu 22.04, both Docker & Bare Metal.

export SPEAKER='Genelec S360'
./generate_graphs.py --speaker="$SPEAKER" --update-cache
./generate_meta.py
Queued 843 speakers 2 measurements
Updating cache  (queued 0 files)
(loaded 0 speakers)
(updated +4)  (saved).
(queued 0 files)
(loaded 0 speakers)
info: spl continuous [1000, 0]
info: spl       peak [1000, 0]
 3.20s start->ray init
 0.00s ray init->loaded
 0.00s loaded->quality
 0.00s quality->scores
 0.00s scores->eq
 0.00s eq->near
 0.02s near->dump
./generate_radar.py
2023-06-27 01:09:39,854 - generate_radar.py:main:170 - WARNING - Data ./docs/assets/metadata.json loaded (821 speakers)!
./generate_stats.py
2023-06-27 01:09:47,140 - generate_stats.py:main:166 - WARNING - Data ./docs/assets/metadata.json loaded (821 speakers)!
export SPEAKER='Genelec S360'
rm -f docs/speakers/"$SPEAKER"/*/filters_eq.png
./generate_peqs.py --speaker="$SPEAKER" --force --verbose
Reading cache ... (queued 0 files)
2023-06-27 01:09:57,838 INFO worker.py:1627 -- Started a local Ray instance. View the dashboard at 127.0.0.1:8265 
(loaded 0 speakers)

Issue is NOT resolved...

pierreaubert commented 1 year ago

Grrr. do you see a .cache directory with files in m5 format inside? Please, check that you get the last version too (git pull). And/or a mkdir .cache

ehfd commented 1 year ago

Please, check that you get the last version too (git pull).

I always clone a new repository; and I validated git pull as already up to date.

This is inside .cache:

ls -la
total 36484
drwxr-xr-x  2 user user       19 Jun 27 09:08 .
drwxr-xr-x 19 user user     4096 Jun 27 09:08 ..
-rw-r--r--  1 user user 37354424 Jun 27 09:10 b7.h5
pierreaubert commented 1 year ago

I added a Dockerfile to debug the issue, still building it. Fix welcome if you have knowledge @ehfd

Ref: 67b9b01ee52226b53f0aa833b59e331daa39706b