Script to calculate sound radiation patterns

Status
This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.
Hi everyone! I have made a little script to calculate the sound radiation pattern from sources of different shapes. I think this could be of interest to more people.
In short, it's a Matlab/Octave script that calculates the sound pressure from a threedimensional source. The source is approximated by an array of either monopoles or dipoles.

You can download it from Github:
https://github.com/HEnquist/RadiationPatternCalculator

To run it you need either Matlab or Octave. It runs fine in both. Matlab is a bit faster, while Octave is open source. Get it from here: https://www.gnu.org/software/octave/

Put all the .m-files in the same folder and run "radpatt_main.m".

What the script does:
- calculates the sound radiation pattern from a user defined source in three planes (horizontal, vertical and at back wall).
- calculates the frequency response at a user defined sweetspot.
- if enabled, shows the interference and channel balance between the left and right speakers

Just to avoid confusion I'll also mention what it doesn't do:
- it doesn't handle reflections from walls, floor, ceiling or speaker baffle.
- for dipoles it doesn't handle the path length around the baffle.
- it doesn't take cone break up into account.

The attached example is the output for a 300x20mm dipole at 5 kHz.

There are a few more examples in the thread Yet another DIY AMT by solhaga.

Thanks to solhaga for valuable input and help in testing!

I have tried to write enough comments in the script to explain how to use it. If it's not enough, ask! Also please write if you find any errors or have ideas for improvements :)
 

Attachments

  • radpatt.png
    radpatt.png
    144.7 KB · Views: 232
  • Like
Reactions: 1 user
Is it possible to make a cone stand up? Like you would stand a midrange cone driver on its magnet on a table. It would radiate horizontally in 360 deg. How to set params?

//
To make the source stand up I need to add another rotation. That's something I'm planning to include in the next version. But for now, if you rotate it sideways instead you get essentially the same result. It's then flipped to the side instead of up, so you just have to imagine that the picture of the vertical pattern shows the horizontal pattern, and vice versa.

Try this source:
Code:
source.Lz=200e-3;
source.Ly=200e-3;
source.radius=50e-3;
source.radcurv=100;
source.conedepth=20e-3;
source.dir=[1;0;0];
source.dipole = false;
source.xpos = 0;
source.zpos = 0;
source.ypos = 0;
source.rotz = 90;
source.stereo=false;

Keep in mind that any interference you would get from reflections off the basket, motor and table won't be included!
 
Very interesting. This I will have to look into.

If anyone has any ideas about doing breakup modes in a woofer cone I would also be very happy to see that.
You'll need some FEM software to do that. I have access to Comsol at work and have played a little bit. I put up a few pictures here (via google translate from swedish..):
https://translate.google.com/translate?sl=sv&tl=en&js=y&prev=_t&hl=en&ie=UTF-8&u=http%3A%2F%2Fwww.faktiskt.se%2FphpBB3%2Fviewtopic.php%3Ff%3D10%26t%3D63389&edit-text=&act=url

Another option is FINECone which is a specialized FEM software for speakers: FINECone - Speaker Design software - Professional Products - loudsoft

I haven't searched so I don't know if there are any good open source FEM packages that could do this. The commercial programs are quite expensive.
 
Z88 and Calculix are the two open source FEA programs that we are working with.

Calculix has the benefit of using the ANSYS naming methods.



By "we" I mean my programming friend and me in the advisory position of let's see if it makes sense side of things. I'm really not that capable of a programmer any more.

My high level language was Turbo PASCAL 30 plus years ago.

The programming fluency has disappeared with my hair!

We have done some successful comparisons with COMSOL and OPERA as well as Vector Fields with a combination of the two open source FEA programs and FEMM for the magnetics.

ELMER is being looked at as it will do full 3D FEA in magnetics.

I discussed this method and concept of combining Open Source programs with Peter Larsen a few weeks ago when I was at the Loudspeaker Sourcing Show in Nansha China. He is great gentleman to talk to. And willing to share insights as to what worked well and what ended up being a dead end.

He took 6 years to refine and get Fine Cone working. We have been plugging away at it for 6 months. The FEA field is very much different than it was years ago.

Very nice link!

And greatly appreciated.

And that is almost exactly what we are trying to accomplish.

Taking a concept loudspeaker and working within one interface to do a complete magnetics and structural analysis.

Using all opensource programs.

ca2.png

ca6.png

ca8.png

I have the test equipment to do this sort of verification. Laser range finder and the whole suite of goodies.

And once we have ironed out the problems I will have the fun of making verification tests. Not programming. But one does not work without the other!
 
Hi,

Any modelling that ignores cone break up is going to be wrong.
It really is that simple regarding off axis response of real drivers.

rgds, sreten.

There is not a more true statement possible.

And I agree most whole heartedly.

I'm what I call a simulation Agnostic.

Show me, and prove it and I'm interested. Hence the rigorous testing that will be done.

The bridge between simulation and reality can be rather short. As in quite close to reality. Hornresp is a great example of a fairly light weight program that does acoustical calculations with quite a good degree of accuracy.

So I take all of this with a wait and see how close I can get attitude.

At the very least we get mechanical movement simulations that are accurate enough. That is a step in the right direction.

Cone analysis is the next nut to crack.
 
Hi Mark,

While Hornresp might seem fairly light weight on the outside, trust me when I say that with more than 100,000 lines of source code, it's pretty heavy weight on the inside :).

Kind regards,

David

I never meant the light weight comment to be a description of what you have accomplished David.

The comparison of the FEA programs to Horn response was poorly developed by me.

Writing a little more about what was being thought about .

Every FEA program I have used takes quite some time to get a person from point a to point b. Hor respond works quite a lot faster.

That was the basis for my statement. Simply time between calculations and results.

And my ignorance of the internal workings of the program are a little less ignorant now!
 
I never meant the light weight comment to be a description of what you have accomplished David.

Hi Mark,

I know you didn't, I just couldn't resist posting - "the devil made me do it" :).

The current Hornresp source program contains 85 separate files, each file having numerous sub-procedures and custom functions - it gets quite complex in places! What bothers me is the total amount of time that I must have spent developing, writing and testing those more than 100,000 lines of code. It just doesn't bear thinking about...

Kind regards,

David
 
I just pushed a new version to github.

The main difference is that it's now possible to have several sources active at the same time. The idea is to be able to play with for example double woofers or what happens around the crossover frequency. Each source has a level and phase setting.

Another change is that I added a parameter to set the wave speed in the source. This will give more realistic results for cones by letting the outer parts lag behind the center. It's a bit untested so please report back if you find any strange behavior.
 
Status
This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.