• WANTED: Happy members who like to discuss audio and other topics related to our interest. Desire to learn and share knowledge of science required. There are many reviews of audio hardware and expert members to help answer your questions. Click here to have your audio equipment measured for free!

DIY 3D Speaker Scanner - the Mathematics and Everything Else

OP
NTK

NTK

Major Contributor
Forum Donor
Joined
Aug 11, 2019
Messages
2,656
Likes
5,819
Location
US East
You have been a little busy! ...
Wish I got the productivity to show o_O

Completed the script 'sim_measurements.m' to simulate measurement data. Five different types of measurement grids are available.
  • 'planar' is planar measurement grids of parallel surfaces to the YZ plane. The number of planes and distances are user specified. Distances (variable 'x_list') can include both positive and negative values for two sided measurements.
  • 'full_cyl' and 'half_cyl' are cylindrical grids of concentric full cylindrical or half cylindrical surfaces, centered to the z-axis.
  • 'full_sph' and 'half_sph' are spherical grids of concentric full spherical or half spherical surfaces, centered to the origin of the coordinate system. The grid points are equi-distance from each other on the spherical surface. The same angular coordinates are used for all surfaces.
  • The script 'sim_measurements.m' generates the 'frequencies.csv', 'coordinates.csv' and 'measurements.csv' files. The script can also generate plots of the acoustic pressure fields, which are useful for comparisons to the reconstruction results.
  • Note that the simulated pressure amplitudes are in arbitrary units. Actual measurements should be acoustic pressures in Pascals.
  • 'main.m' is the script for testing the 3D sound field reconstruction from the simulated measurements
  • 'step_0.m' specifies which frequency to reconstruct and other parameters.
Next steps:
  • Reconstruction with sound field separation.
  • Detection of the optimal expansion order. If the order is too low, the spherical wave expansion functions will [Edit] not be able to accurately fit complicated radiation/directivity patterns. If the order is too high, we can overfit and reconstructions at points not in the original 'training set' will be inaccurate.
  • More realistic simulated measurements with sources that are not point sources.
  • [Edit] Forgot to mention. For the specific cases of concentric spherical measurements ('full_sph' and 'half_sph'), there is a better method to compute for the expansion coefficients. This method is incompatible with the other measurement grids. I am adding it to my list of things to do.
Please let me know of any questions and/or comments.
 

Attachments

  • MATLAB_release_2021_04_23.zip
    22 KB · Views: 119
Last edited:

Kessito

Member
Joined
May 18, 2020
Messages
54
Likes
99
Excellent progress NTK!
I am still extremely busy, but wil try to make time in the coming week to thoroughly test it.
Is the code compatible with matlab 2016?
Grretings,
Kees
 
OP
NTK

NTK

Major Contributor
Forum Donor
Joined
Aug 11, 2019
Messages
2,656
Likes
5,819
Location
US East
Is the code compatible with matlab 2016?
My version is R2018a. I think the only command I used that is not compatible with 2016 is in 'lstsq_solve.m', lines 9 - 11:
Code:
dA = decomposition(A, 'CheckCondition', false);

x = dA \ b;
I use the 'decomposition' function to turn-off the ill-conditioned matrix warning. Those two lines can be replaced with a single line:
Code:
x = A \ b;

I also have a version for Octave that kind of work (it works with MATLAB too). My version is 6.2.0 running on Ubuntu 20 in VMware Workstation Player 15. The computations seem fine. The only problems are the plots came out a bit screwy. I blame them on Octave and not on my code ;)
 

Attachments

  • octave_release_2021_04_24.zip
    21.9 KB · Views: 112

mwmkravchenko

Active Member
Joined
Nov 20, 2018
Messages
180
Likes
187
Location
Perth Ontario
My version is R2018a. I think the only command I used that is not compatible with 2016 is in 'lstsq_solve.m', lines 9 - 11:
Code:
dA = decomposition(A, 'CheckCondition', false);

x = dA \ b;
I use the 'decomposition' function to turn-off the ill-conditioned matrix warning. Those two lines can be replaced with a single line:
Code:
x = A \ b;

I also have a version for Octave that kind of work (it works with MATLAB too). My version is 6.2.0 running on Ubuntu 20 in VMware Workstation Player 15. The computations seem fine. The only problems are the plots came out a bit screwy. I blame them on Octave and not on my code ;)


I'm exposing my total ineptitude with either Octave or Matlab. But I'll give Octave a shot. If I can get it going I'm pretty sure anybody could :)

I might be back with questions!
 

mwmkravchenko

Active Member
Joined
Nov 20, 2018
Messages
180
Likes
187
Location
Perth Ontario
I definitely look forward to yours and anybody else's feedback :)


Like you I am busy. Bathroom reno I am working on. Last of the plumbing. Loudspeakers to test when I have time in between. Talking with my crossover guru. No end of the fun and madness.
 
OP
NTK

NTK

Major Contributor
Forum Donor
Joined
Aug 11, 2019
Messages
2,656
Likes
5,819
Location
US East
Like you I am busy. Bathroom reno I am working on. Last of the plumbing. Loudspeakers to test when I have time in between. Talking with my crossover guru. No end of the fun and madness.
The priority is definitely get the bathroom working first!
 

mwmkravchenko

Active Member
Joined
Nov 20, 2018
Messages
180
Likes
187
Location
Perth Ontario
The priority is definitely get the bathroom working first!
It's only a shower. But still. I have over 30 plus years renovated well over 30 bathrooms and yet mine takes forever! Stuff I do when consulting slows down!
 
  • Like
Reactions: NTK
OP
NTK

NTK

Major Contributor
Forum Donor
Joined
Aug 11, 2019
Messages
2,656
Likes
5,819
Location
US East
The paper describes a method to improve the accuracy of numerical modeling the scattering of sound by an object. (They used a prototype submarine as one of their test cases.) I don't believe it is relevant to the problem we have here.
 
OP
NTK

NTK

Major Contributor
Forum Donor
Joined
Aug 11, 2019
Messages
2,656
Likes
5,819
Location
US East
I'm sorry to bother you.
No worries :) There are much much more (money spent on) acoustic research activities on submarine detection and preventing submarine detection than on audio speakers. In fact, the technology used by the Klippel NFS, nearfield acoustic holography, came from the US Naval Research Lab.
 

Kessito

Member
Joined
May 18, 2020
Messages
54
Likes
99
I finally have some time to start testing, one thing I notice: in string building you use some syntax which is not supported by my version of matlab with the use of double quotes (2016b, windows)
For now I m just going through the code to manually change it, which is fine because I want to read the code anyway, but for the future when I may add code this might become tedious.

An example; iin line 77 of sim_measurements you wrote:

error("'grid_type' is not a valid measurement grid type.");

And my Matlab wants to have that written as:

error('%s is not a valid measurement',grid_type);



another example: in line 28 of cart_disc_grid:

error("Invalid number of input parameters.");

And my Matlab wants to have that written as:

error('Invalid number of input parameters.');

I guess it might be a linux thing

I will upload my modified code so you can try if that also works on your side.



Edit; for the rest: EXCELLENT CODE! compliments, I feel very motivated to spend some time on it this week :)
 
Last edited:
OP
NTK

NTK

Major Contributor
Forum Donor
Joined
Aug 11, 2019
Messages
2,656
Likes
5,819
Location
US East
@Kessito Thanks for the feedback :)

I am new to MATLAB, and coming from Python where the double quote " and single quote ' are interchangeable, had no idea of their differences in MATLAB. I'll try to make sure my future code will work with MATLAB 2016 or later and Octave.

I think I'm beginning to see light at the end of the tunnel. I am going to change my focus to produce working prototypes of the "final product". What I mean is to come up with a "usable" version that will read the measurement data files, does its computations, and spits out spinorama plots and the fitting coefficients (so that we can use them to reconstruct at any arbitrary points in 3D later) when the program finishes. I will then revisit to optimize for speed, detect optimal expansion order, numerical robustness, and add new features, etc.

I am hoping I can get a first prototype out in a couple or weeks, but my time estimates had a history of being way off :facepalm:
 

mwmkravchenko

Active Member
Joined
Nov 20, 2018
Messages
180
Likes
187
Location
Perth Ontario
I just did a days worth of anechoic measurements in the world largest anechoic chamber.

Yep, my yard.

In between rain and cold all week. So yes I can get high quality measurements. But oh would it be nice to be able to do this in my cabinet shop or even two car garage. Yes I have a complete Cabinet Shop. That is how this guy started out his working life. A Cabinet Maker that taught himself how to design loudspeakers. To poor to buy the good stuff. And after all I could build the enclosures! Oh and then the drivers starting in 1997. :)
 

Kessito

Member
Joined
May 18, 2020
Messages
54
Likes
99
@Kessito Thanks for the feedback :)

I am new to MATLAB, and coming from Python where the double quote " and single quote ' are interchangeable, had no idea of their differences in MATLAB. I'll try to make sure my future code will work with MATLAB 2016 or later and Octave.

I think I'm beginning to see light at the end of the tunnel. I am going to change my focus to produce working prototypes of the "final product". What I mean is to come up with a "usable" version that will read the measurement data files, does its computations, and spits out spinorama plots and the fitting coefficients (so that we can use them to reconstruct at any arbitrary points in 3D later) when the program finishes. I will then revisit to optimize for speed, detect optimal expansion order, numerical robustness, and add new features, etc.

I am hoping I can get a first prototype out in a couple or weeks, but my time estimates had a history of being way off :facepalm:

That is is great, although I would suggest the following, since I have already done a lot the things you describe;
-atm I am playing around with an expansion of your cylindrical model, I have added top and bottom straight "caps", since this is how I would like to build te hardware. like this:
1620115944656.png


I will also spend some time to generate frequency /phase plots on arbitrary point with your current code to get a feeling of the needed meas points
I will also try to generate some data frome actual measurement data sets I have

-I have all code working for doing the measurements and controlling a motor for rotation.
-I have working code for automatic time gating and arbitrary octave smoothing etc.
-I have the electronic schematics for the mems mic pre-conditioning desgined by a highly regarded audio electronics designer friend finished
- I have asked a skilled pcb designer friend to draw the pcb's
( all this only cost me I-owe-you credits so far )
- I have a worked out infra for the the cabling with cat6 cabling (cheap) for the conection of multiple mics

See picture for the concept I am working on (4 mics integrated on a pcb with integrated preamp/buffering so the signals are line level out and thus easily connected to any semi-decent audio interface:
1620116360412.png


These can then be connected back-to-back to get the 2 layers, and connected to a frame to get a complete array, all with flexibillity to change the domensions:

1620116494758.png


To finally create this:

1620117497563.png



Maybe it is a good idea that I focus on making this part of the code ready for distrubution and that you focus (for now) on making the soundfield seperarion part ready so we can test that?

Cheers
 

Attachments

  • 1620117415829.png
    1620117415829.png
    49.1 KB · Views: 76
Last edited:

Kessito

Member
Joined
May 18, 2020
Messages
54
Likes
99
some results with a cardioid:
cool stuff!

what I do notice is extreme sesitivity for non-zero position of acoustic center, so I wil try to fit in the TDOA algorithm
1620120385444.png
 
Last edited:
OP
NTK

NTK

Major Contributor
Forum Donor
Joined
Aug 11, 2019
Messages
2,656
Likes
5,819
Location
US East
Maybe it is a good idea that I focus on making this part of the code ready for distrubution and that you focus (for now) on making the soundfield seperarion part ready so we can test that?
Yes. I will make it my priority to get the sound field separation code out ASAP.
 

mwmkravchenko

Active Member
Joined
Nov 20, 2018
Messages
180
Likes
187
Location
Perth Ontario
That is is great, although I would suggest the following, since I have already done a lot the things you describe;
-atm I am playing around with an expansion of you cylindrical model, I have added yop and booton straight "caps", since this is how I would like to build te hardware. like this:
View attachment 127872

I will also spend some time to generate frequency /phase plots on arbitrary point with you r current code to get a feeeling of the needed meas points
I will also try to generate some data frome actual measurement data set I have

-I have all code woking for doing the measurements and controlling a motor for rotation.
-I have working code for automatic time gating and arbitrary octave smoothing etc.
-I have the electronic shematics for the mems mic pre-conditioning desgined by a highly regarded audio electronics designer friend finished
- I have asked a skilled pcb designer friend to draw the pcb's
- I have a worked out infra for the the cabling with cat6 cabling (cheap) foor the conection of multiple mics

See picture for the concept I am working on (4 mics integrated on a pcb with integrated pream/buffering so the signals are line level out and thus easily connected to any semi-decent audio interface:
View attachment 127873

These can then be connected back-to-back to get the 2 layers, and connected to a frame to get a complete array, all with flexibillity to change the domensions:

View attachment 127874

To finally create this:

View attachment 127877


Maybe it is a good idea that I focus on making this part of the code ready for distrubution and that you focus (for now) on making the soundfield seperarion part ready so we can test that?

Cheers

I have little to offer in the programming end of things. I am sorry about this. Because when this is ready I am going to be building this for sure.
I do have a few questions. And maybe some suggestions. But only when I fully understand what you are proposing can I make useful suggestions.

This appears to be a fixed C frame. Variable spacing towards and away from the DUT.

Awesome that you have modular mic PCB's. As they are inexpensive having multiple mics is not a problem.
So will this work if you have limited channels for measurement and have a means to switch in between the 4 mic sections?

I have one other thought. Maybe it is erroneous way of thinking.

In order to test a taller speaker I am looking at requiring a greater amount of channels? or the ability to raise and lower the Test mics? If this same C frame system had long drawers slides that would allow easy placement of the microphones At whatever position was required. Because in my work I deal with speakers as small as 200 mm tall to over 2500mm tall. That's what is in the design book at the moment!
 

Kessito

Member
Joined
May 18, 2020
Messages
54
Likes
99
I have sucesfully implemented a positions offset correction algorithm by means of multilateration,
below the effect of a single source which is offset by 0.4meter within a cylinder of 1m,
left=original, middle=reconstruction without correction, right= reconstruction with correction

1620149242927.png
 
Last edited:
Top Bottom