• Welcome to ASR. 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

If you look at the simple case of a point source, when the measurement mic is on a horizontal plane close to the level of the source, the change in the sound pressure with respect to a change in R is large, where as the change with respect to a change in Z (or θ) is much smaller.

The situation reverses when the measurement mic is near the top of the measurement cylinders close to the vertical axis (axis of rotation).

spherical_wave.png
 
Yes you are right. Thank you for the image.

The difference of sensitivity between R and Z is not about the axis only. It is about the sound field property where that axis makes stronger radial vs angular motion.

The Z axis makes stronger radial vs angular motion at caps / poles of cylinder as you said.

R axis makes stronger radial vs angular motion at the side of cylinder.

At the side of cylinder (in front of speaker) we have strong high frequency energy from tweeter

At the caps of cylinder (top and bottom of speaker) we have small high frequency energy because of speaker directivity.

Fit error is about how much the total energy is captured by the model. This means position error in front of speaker (R axis) has larger effect on high frequency fit quality than position error at the top of speaker (Z axis). If the speaker is real monopole this would make R and Z both equal sensitivity.
 
For me the R is special for another reason.

Both z and phi offsets are equivalent to a speaker at a different height and a bit rotated. Nothing special. The z is fixed in the center of expansion search. And the spherical harmonics can fit any source, also a rotated one.

The r offset is different as it is the same in every (phi) direction. It is as if part of space does not exists or a piece of space is magically inserted.
 
Last edited:
  • Like
Reactions: NTK
An intermediate feedback on movement accuracy and repeatability of the scanner:
1780827423282.png


As we (Dimitri, Tom and I) are focusing on accuracy etc no, the physical scanner itself is also checked. Thusfar the movements of the linear axes is covered, still to do is lost motion check with dial indicator and the movement of the rotation around the PHI axis.
In the above graph it is clear that on the ends of the Z-axis stroke there is a deviation. This is because the belt is slightly angled and that angle gets stronger at the stroke ends. The belt from gantry to pulley is also angled for the R-axis but less so than the Z-axis.
 
This is so incredibly exciting to see!

I would like to learnmore about HALS.
Is there a repository or documentation?
 
This is so incredibly exciting to see!

I would like to learnmore about HALS.
Is there a repository or documentation?
Yes. There is one. For the latest actions, please follow the thread at DIYAudio.

 
This is the post processing side. Currently capture and process are seperate repos but we should fix that when something finally seems stable.


Documentation here is detailed but written before gui.
 
Also https://github.com/JanRSmit/HALS-Mechatronics - I was looking at whether Klipper might be beneficial for its accelerometer-based resonance compensation, but it doesn't have a model for the rotary axis in this case.
GrblHAL does support S-curve acceleration (they call it jerk acceleration) but we did not enable it yet. It should help give smoother start and stop for big arm on phi axis.

Resonance input shaping I think will not bring much more, because unlike printer we do not move at many different speed.

Jan found that even the large phi rotating arm has some elasticity, total lost motion in the axis after settle time is really very low - it was about 0.02 degrees. Even 10x that value is good enough when looking at the phi random jitter testing in my graph above.
 
GrblHAL does support S-curve acceleration (they call it jerk acceleration) but we did not enable it yet. It should help give smoother start and stop for big arm on phi axis.

Resonance input shaping I think will not bring much more, because unlike printer we do not move at many different speed.

Jan found that even the large phi rotating arm has some elasticity, total lost motion in the axis after settle time is really very low - it was about 0.02 degrees. Even 10x that value is good enough when looking at the phi random jitter testing in my graph above.
I was thinking more about settling time than absolute error, but it's going to be a 2nd order effect at best, perhaps speeding up scan times by reducing the settling time. My initial thought was that their compensation might not work at the lower frequencies of this arrangement. The problem is at a lower level than that though - they don't have a model for a rotary axis, and mapping steps/mm to steps/degree breaks motion models - moment of inertia varying depending on other axis positions etc.
 
I was thinking more about settling time than absolute error, but it's going to be a 2nd order effect at best, perhaps speeding up scan times by reducing the settling time. My initial thought was that their compensation might not work at the lower frequencies of this arrangement. The problem is at a lower level than that though - they don't have a model for a rotary axis, and mapping steps/mm to steps/degree breaks motion models - moment of inertia varying depending on other axis positions etc.
What i did was watching the start and stop behaviour, especially with the PHI rotation, watching in particular the mic-tip. And adjusted the accelleration settings in grbl. Also the tmc drivers with spreadcycle help .
All to make it start and stop nicely ;-)
 
HALS / HarmonicDrive Near-Field Scanner — Major Update!

Hi all,

The scanner software has had a big overhaul. Under the hood almost the entire (GUI) application was rewritten, but here's what actually matters when you're sitting in front of it and running measurements.

️️ A completely new desktop app
The old browser-based interface is gone; the whole thing is now a proper native desktop application. This was done to improve real time responsiveness and avoid issues with dropped connections. It's organised into clear panes:

Machine Control – move the rig, home, and start scans
Audio Setup – devices, levels, calibration
Live Capture – watch measurements happen in real time
Grid Generator – design your measurement points
Settings – everything configurable in one dialog
There's also an optional auto-hiding side menu so you can give the plots more screen space.

Sessions — your work is saved as a unit
This is a big one. The app now works around Sessions. When you set up a scan, your grid, sweep settings, audio setup and calibration are all saved together into a session folder (default HALS_Projects). Reopen a session later and everything — settings, grid, and results — comes back exactly as you left it, instead of juggling loose config files and CSVs. Measurement output folders are created and cleaned up automatically.

️️ Audio: Real time improvements for fewer glitches, plus proper meters and calibration
Live level meters for input and output, including peak/RMS and clipping indication — as a dedicated panel in Live Capture.

Built-in sine generator you can toggle on/off, and the output level changes instantly while it's playing — handy for setting levels and checking the chain.
Calibration
SPL calibration either by direct spl meter reading or voltage measurments. So your plots can read in real SPL.
Voltage calibration also accounts for your output voltage and amplifier gain so the Audio Setup can shows interface and speaker voltages that correctly scale with the output level.

Live 3D visualisation of the machine axis and the machine position during live measurement progress (using Pyvista). If 3D / GL drivers isn't available on your machine, it falls back automatically to a more basic isometric view (using Matplot).
Improved Frequency Response and Impulse Response plots with adjustable fractional-octave smoothing.
Live Capture panels can be reordered and shown/hidden to taste.

️️ Motion / machine
Live position readout (DRO) that updates continuously, with the option to also show the machine coordinate system (not working just yet) not just the work position.

Improved mock/simulation modes for both motion control and audio. You can use it like a demo mode or debugging.

Grid Generator uses 'waypoints' to define the DUT area and build the measurement grid. This takes priority over the older manual settings for cylinder radius, height, z offset, etc.

In short: it's now a self-contained desktop app with a real usable workflow that goes well beyond just a proof of concept.

Happy to answer questions — and I'll add a couple of screenshots of the new UI and the 3D live view.

Kudos to Dimitri for the design and implementation and Jan for his relentless testing!


Start the program using:
Code:
uv run src/harmonic_drive_qt/main.py

1788381241234.png


1788381189479.png


1788381064142.png
 
I just finished creating the first installer: https://github.com/TomKamphuys/NFS/actions/runs/34155029608/artifacts/10030812253

It's not signed for use on windows, so you'll probably have to click (something like) 'more info' and then 'run anyway'.

The readme ( https://github.com/TomKamphuys/NFS#-windows-installer-recommended-for-most-users ) already says the exe can be found under 'releases' but that is unfortunately not yet true. Use the link posted above.

Of course everyone will benefit from some documentation, but that's not ready yet: good things will come to those who wait :-) And for those who can't wait: click around and learn by doing. You can select a mock_interface in the settings pop up on the audio tab and MockSimulatedDRO in the Scanner tab under Grbl Streamer Type. All hardware will be mocked, but the software doesn't know and simply receives (fake) measurements.

Have fun!
 
There is now a first proper release of HALS Post, including a Windows .exe installer. Please thanks to Tom for making the installer. Like the other one you will need to tell Windoze to "shut-up and install it".

This means it should no longer be necessary to install Python, dependencies, clone repository etc. Just download the installer from Releases and run HALS Post as a normal Windows application:

https://github.com/dfapinov/lah-scanner/releases

This is still quite experimental software, and documentation is also work in progress, but I think it is at a point where other people can realistically try processing their own measurements.

I would like to include some images but my computer was broken last week and I don't have access to the input data set.
1789123936437.png


Very basic workflow:

Input

HALS Post can point directly to the directory of IR files produced by the HALS capture/control application.

The processing is then divided into 5 stages.

Stage 1 – FDW and complex smoothing

This prepares the measured IR data for the later spherical harmonic processing and is already a first step in removing the effect of environmental reflections.

Frequency Dependent Windowing uses progressive time windows with frequency, allowing us to maximally exclude reflections from the impulse response while maintaining the frequency resolution we want.

Complex smoothing then operates on the complex data (not only magnitude). Apart from smoothing fine comb filtering that makes it easier for the solver to fit the model later, this has a useful property that reflected energy tends to have more rapidly changing phase, and this leads to stronger cancellation than for the phase-coherent direct field.

So Stage 1 is basically cleaning the measured data before asking the SHE solver to describe it.

Stage 2 – acoustic origin optimisation

This finds an optimum acoustic origin independently with frequency.

Important clarification because I think the name "acoustic origin" can cause some confusion: this is primarily a math trick to make the job easier for the solver.

This is NOT establishing a timing reference which you then use for crossover design etc.

HALS records these coordinate translations and reverses them again during Stage 5 extraction.
The physical geometry, propagation delay and relative phase of the reconstructed loudspeaker are therefore fully retained.

Basic why: If a simple source is displaced from the coordinate origin, the math description of that geometry becomes vastly more complex. By temporarily moving the grid origin closer to where the sound appears to originate, the same field can be represented with less complexity.

It is an important step in the processing, but the effect is essentially transparent to the user.

Stage 3 – SHE pre-flight / optimisation

This runs much smaller test solves before committing to the full calculation.

One important job here is finding a sensible maximum harmonic degree, "Order N", supported by the measurement data. Not high enough and we lose detail; too high and we start 'hallucinating'.

The optimiser looks at how well the internal and external fields are separated and searches for the point where increasing N starts making the separation rapidly worse, rather than adding useful spatial information.

I would particularly welcome experiments here with different speakers, measurement radii and grid sizes. This method has worked well in my tests, but probably this is one area which can benefit most from more varied real-world data before deciding how automatic recommendations should eventually behave.

Stage 4 – full SHE solve

This is where the heavy calculation happens.

HALS fits the measured complex pressure field with spherical harmonics and, importantly, separates the solution into an internal field originating inside the measurement surface (the loudspeaker) and an external field originating outside it (room reflections etc.).

The result is therefore not simply interpolation between microphone positions. It is a continuous mathematical description of the measured 3D sound field, with the loudspeaker and room fields separated.

Stage 5 – extraction

Grab your prize! Once coefficients have been calculated, you can put virtual microphones wherever you want and reconstruct the pressure there.

There are currently modes for:

  • CTA-2034 / Spinorama
  • horizontal and vertical arc sweeps
  • custom coordinates
Default is to export only the internal field to get the anechoic response, but external and full reconstructed fields are also available for the curious or for debugging the solve.

FRD can be exported for VituixCAD or other speaker CAD software.

There are several options for Time Of Flight subtraction depending on what reference is useful:

  • manually specified reference/distance
  • automatic IR peak detection
  • best fit to minimum phase
One point I want to make very clear: "best fit to minimum phase" does NOT convert the result to minimum phase.

Minimum phase is only used as a reference to estimate how much linear phase slope belongs to propagation delay. That estimated TOF is subtracted from the original complex response. The original phase information remains, including any real excess / non-minimum-phase behaviour of the loudspeaker.

There is now also a live preview showing magnitude, phase and impulse response, so the effect of moving the microphone and the selected TOF reference can be inspected instantly.

Alternatively HALS can export reconstructed impulse responses as WAV. These retain the full propagation delay (or the IR can be cut before the start of the file) and can be used for signal processing, convolution, or CAD software which accepts IR input.

Documentation:

The documentation for each processing stage is in the repository and explains more of what is going on in the engine bay:

https://github.com/dfapinov/lah-scanner/tree/main/documentation

Some of this documentation needs updating to catch up with recent changes, so please consider it work in progress.

And I really want to add some more about how to actually use the software, not only how it works.

I am very interested now to see results from different loudspeakers and different measurement grids.

If you have some questions please feel free to ask them - It may help me to include more helpful documentation.

And of course bugs are quite possible. :)
 
There is now a first proper release of HALS Post, including a Windows .exe installer. Please thanks to Tom for making the installer. Like the other one you will need to tell Windoze to "shut-up and install it".

This means it should no longer be necessary to install Python, dependencies, clone repository etc. Just download the installer from Releases and run HALS Post as a normal Windows application:

https://github.com/dfapinov/lah-scanner/releases

This is still quite experimental software, and documentation is also work in progress, but I think it is at a point where other people can realistically try processing their own measurements.

I would like to include some images but my computer was broken last week and I don't have access to the input data set.
View attachment 557957

Very basic workflow:

Input

HALS Post can point directly to the directory of IR files produced by the HALS capture/control application.

The processing is then divided into 5 stages.

Stage 1 – FDW and complex smoothing

This prepares the measured IR data for the later spherical harmonic processing and is already a first step in removing the effect of environmental reflections.

Frequency Dependent Windowing uses progressive time windows with frequency, allowing us to maximally exclude reflections from the impulse response while maintaining the frequency resolution we want.

Complex smoothing then operates on the complex data (not only magnitude). Apart from smoothing fine comb filtering that makes it easier for the solver to fit the model later, this has a useful property that reflected energy tends to have more rapidly changing phase, and this leads to stronger cancellation than for the phase-coherent direct field.

So Stage 1 is basically cleaning the measured data before asking the SHE solver to describe it.

Stage 2 – acoustic origin optimisation

This finds an optimum acoustic origin independently with frequency.

Important clarification because I think the name "acoustic origin" can cause some confusion: this is primarily a math trick to make the job easier for the solver.

This is NOT establishing a timing reference which you then use for crossover design etc.

HALS records these coordinate translations and reverses them again during Stage 5 extraction.
The physical geometry, propagation delay and relative phase of the reconstructed loudspeaker are therefore fully retained.

Basic why: If a simple source is displaced from the coordinate origin, the math description of that geometry becomes vastly more complex. By temporarily moving the grid origin closer to where the sound appears to originate, the same field can be represented with less complexity.

It is an important step in the processing, but the effect is essentially transparent to the user.

Stage 3 – SHE pre-flight / optimisation

This runs much smaller test solves before committing to the full calculation.

One important job here is finding a sensible maximum harmonic degree, "Order N", supported by the measurement data. Not high enough and we lose detail; too high and we start 'hallucinating'.

The optimiser looks at how well the internal and external fields are separated and searches for the point where increasing N starts making the separation rapidly worse, rather than adding useful spatial information.

I would particularly welcome experiments here with different speakers, measurement radii and grid sizes. This method has worked well in my tests, but probably this is one area which can benefit most from more varied real-world data before deciding how automatic recommendations should eventually behave.

Stage 4 – full SHE solve

This is where the heavy calculation happens.

HALS fits the measured complex pressure field with spherical harmonics and, importantly, separates the solution into an internal field originating inside the measurement surface (the loudspeaker) and an external field originating outside it (room reflections etc.).

The result is therefore not simply interpolation between microphone positions. It is a continuous mathematical description of the measured 3D sound field, with the loudspeaker and room fields separated.

Stage 5 – extraction

Grab your prize! Once coefficients have been calculated, you can put virtual microphones wherever you want and reconstruct the pressure there.

There are currently modes for:

  • CTA-2034 / Spinorama
  • horizontal and vertical arc sweeps
  • custom coordinates
Default is to export only the internal field to get the anechoic response, but external and full reconstructed fields are also available for the curious or for debugging the solve.

FRD can be exported for VituixCAD or other speaker CAD software.

There are several options for Time Of Flight subtraction depending on what reference is useful:

  • manually specified reference/distance
  • automatic IR peak detection
  • best fit to minimum phase
One point I want to make very clear: "best fit to minimum phase" does NOT convert the result to minimum phase.

Minimum phase is only used as a reference to estimate how much linear phase slope belongs to propagation delay. That estimated TOF is subtracted from the original complex response. The original phase information remains, including any real excess / non-minimum-phase behaviour of the loudspeaker.

There is now also a live preview showing magnitude, phase and impulse response, so the effect of moving the microphone and the selected TOF reference can be inspected instantly.

Alternatively HALS can export reconstructed impulse responses as WAV. These retain the full propagation delay (or the IR can be cut before the start of the file) and can be used for signal processing, convolution, or CAD software which accepts IR input.

Documentation:

The documentation for each processing stage is in the repository and explains more of what is going on in the engine bay:

https://github.com/dfapinov/lah-scanner/tree/main/documentation

Some of this documentation needs updating to catch up with recent changes, so please consider it work in progress.

And I really want to add some more about how to actually use the software, not only how it works.

I am very interested now to see results from different loudspeakers and different measurement grids.

If you have some questions please feel free to ask them - It may help me to include more helpful documentation.

And of course bugs are quite possible. :)
I tried to follow along, but a little confused. Can you confirm the following:

1) The robotic arm hardware is not ready as an open source yet.
2) This software will work independently of the robotic arm by taking your manual measurements to perform the algorithm to produce anechoic data.
3) Does this software have the robotic arm control software?
 
You will need all 3 parts.

1) Robot

2) 'Harmonic Drive' app (aka HALS Control) to drive the robot and make IR files on the cylinder measurment grid.

3) HALS Post (processing) to digest the IR files and make a virtual model of the sound field.

Jan has shared a lot about the robot, including full 3D model I think, you could start to build it now if you have some experiance with stepper motor, pulley, belt etc.. but full documentation is not ready.
 
Back
Top Bottom