Hornresp Update 5130-210207
Hi Everyone,
BUG FIX 1
The bug inadvertently introduced in the last update has now been fixed. Post #11619 refers.
BUG FIX 2
The bug documented in Post #11605 has now been fixed. My thanks to newracer for reporting the problem and for subsequently identifying the changes that needed to be made to prevent it from occurring.
BUG FIX 3
The bug documented in Post #11614 has now been fixed. My thanks to John (Red Five) for reporting the problem.
Kind regards,
David
Hi Everyone,
BUG FIX 1
The bug inadvertently introduced in the last update has now been fixed. Post #11619 refers.
BUG FIX 2
The bug documented in Post #11605 has now been fixed. My thanks to newracer for reporting the problem and for subsequently identifying the changes that needed to be made to prevent it from occurring.
BUG FIX 3
The bug documented in Post #11614 has now been fixed. My thanks to John (Red Five) for reporting the problem.
Kind regards,
David
After having had a closer look, I simply cannot justify the amount of work required to add the requested new feature - too many things would need to be changed.
Another one for AKABAK...
Was worth a try.... 😉 I run a team of software developers myself so I totally understand the position you are in.
David McBean A common problem with apps that tend to grow in complexity over the years is that sometimes the elegance is lost, and then it gets harder to maintain. Like building a house, then adding a couple of rooms every year. IMHO it might be worth the trouble just to sit back and take an overview of what's going on.
A few (dozen) pages ago you mentioned that there was already too much going on with the sliders in the loudspeaker wizard. Unless I misunderstood you completely, that is not the best way to go about things. There should be just one computational routine, and all that the sliders should be doing is setting the value of the variable they are associated with, and then calling the main computational routine. Setting limits to the values that can be entered there is fine, but the sliders themselves should not be doing much else.
A few (dozen) pages ago you mentioned that there was already too much going on with the sliders in the loudspeaker wizard. Unless I misunderstood you completely, that is not the best way to go about things. There should be just one computational routine, and all that the sliders should be doing is setting the value of the variable they are associated with, and then calling the main computational routine. Setting limits to the values that can be entered there is fine, but the sliders themselves should not be doing much else.
all that the sliders should be doing is setting the value of the variable they are associated with, and then calling the main computational routine.
That's the way they work now. The tricky bit is controlling the interactions between the area sliders when Auto is selected, and the interactions between the length sliders depending upon the selected option. Also, the sliders "wrap around", which introduces a further level of complexity.
I would not normally do this, but to give you some idea of what is involved, listed below is a copy of the actual source code for the Change event associated with the L45 horizontal scroll bar in the Hornresp Tapped Horn Loudspeaker Wizard (IF and SELECT CASE statement indents have been automatically removed by diyAudio).
The main computational routine called is subDrawOutput. It is the final statement in the listing before exiting. subDrawOutput calls many other various routines depending upon what output is being calculated, and other requirements - for example, if absorbent filling material is specified then a whole suite of additional complex calculations need to be undertaken. Everything is context-sensitive.
Depending upon the circumstances, the only other routine that may be directly called from the Change event is subCalculate.
In addition to the Change event, the tapped horn L45 slider also has code associated with the GotFocus, KeyDown, KeyPress, LostFocus and Scroll events.
The tapped horn wizard has a total of 35 sliders and the standard loudspeaker wizard has 46 sliders, all with significant coding requirements. The band pass and multiple entry wizards have yet more sliders, and then there is also the filter wizard. It is not possible to rationalise the code in the tapped horn and standard wizards by using indexed control arrays for the length and area sliders because the functionality of individual sliders is different in most cases. The band pass, multiple entry and filter wizards do however make use of indexed slider arrays wherever possible.
When you have a year or two to spare, have a go yourself at exactly replicating the complete Hornresp Loudspeaker Wizard user interface functionality for all loudspeaker types, and you will quickly discover that things are not as easy to implement as they may first seem 🙂.
Hornresp has tens of thousands of lines of code in total...
////////////////////////////////////////////////
Private Sub hsbL45_Change()
If FormLoad Then Exit Sub
If DirectInput = False Then
Number = ""
If lblL45.ForeColor = PINK Then lblL45.ForeColor = RED
If lblL45.ForeColor <> RED Then DoEvents ' Set red colour flag.
If lblL45.ForeColor <> RED Then Exit Sub
Dim AbsIncr, Incr, L34Old, L45Old
If TH1Flag = True Then ' TH1 (hsbL34).
If L45 < 0.1 Then hsbL45.Min = 0 Else hsbL45.Min = -1
If L45 > 99999.9 Then hsbL45.Max = 999 Else hsbL45.Max = 1001
hsbL45_Scroll
If hsbL45 < 0 Then
L45Hundreds = L45Hundreds - 100
FormLoad = True
hsbL45 = 999
FormLoad = False
End If
If hsbL45 > 999 Then
L45Hundreds = L45Hundreds + 100
FormLoad = True
hsbL45 = 0
FormLoad = False
End If
If Not IncrFlag Then
subDrawOutput
End If
IncrFlag = False
Else
If FourSegments Then
L45Old = L45
L45 = hsbL45 / 10
Incr = Format(L45 - L45Old, "0.00")
AbsIncr = Abs(Incr)
If AbsIncr > 0.1 And AbsIncr < 0.2 Then
FormLoad = True
hsbL45 = hsbL45 - Sgn(Incr)
FormLoad = False
End If
Else
L34Old = L34
L34 = hsbL34 / 10
Incr = Format(L34 - L34Old, "0.00")
AbsIncr = Abs(Incr)
If AbsIncr > 0.1 And AbsIncr < 0.2 Then
FormLoad = True
hsbL34 = hsbL34 - Sgn(Incr)
FormLoad = False
End If
End If
End If
End If
DirectInput = False
FormLoad = True
Select Case cboInteraction
Case "L23 Variable"
L23 = TotalLength1 - L12 - L34
If L23 < 0.1 Then
L23 = 0.1
L34 = TotalLength1 - L12 - L23
hsbL34 = L34 * 10
End If
If L23 * 10 > hsbL23.Max Then hsbL23.Max = L23 * 10
hsbL23 = L23 * 10
lblL23 = Format(L23, "0.00")
Case "L23 Fixed"
L12 = TotalLength1 - L23 - L34
If L12 < 0.1 Then
L12 = 0.1
L34 = TotalLength1 - L12 - L23
hsbL34 = L34 * 10
End If
hsbL12 = L12 * 10
lblL12 = Format(L12, "0.00")
Case "L12 & L34 Linked"
If L34 < L34Min Then L34 = L34Min
If L34 > L34Max Then L34 = L34Max
L12 = L12Ref + (L34 - L34Ref)
L23 = TotalLength1 - L12 - L34
hsbL12 = L12 * 10
hsbL34 = L34 * 10
lblL12 = Format(L12, "0.00")
lblL23 = Format(L23, "0.00")
lblL34 = Format(L34, "0.00")
Case "L23 + L34 Variable"
L34 = TotalLength2 - L45
If L34 < 0.1 Then
L34 = 0.1
L45 = TotalLength2 - L34
End If
If L34 * 10 > hsbL34.Max Then hsbL34.Max = L34 * 10
hsbL34 = L34 * 10
lblL34 = Format(L34, "0.00")
Case "L23 + L34 Fixed"
If L45 < L45Min Then L45 = L45Min
If L45 > L45Max Then L45 = L45Max
L12 = TotalLength1 + TotalLength2 - (L23Ref + L34Ref) - L45
L23 = TotalLength1 - L12
L34 = TotalLength2 - L45
hsbL12 = L12 * 10
lblL12 = Format(L12, "0.00")
lblL23 = Format(L23, "0.00")
lblL34 = Format(L34, "0.00")
Case "L12 & L45 Linked"
If L45 < L45Min Then L45 = L45Min
If L45 > L45Max Then L45 = L45Max
L12 = L12Ref + (L45 - L45Ref)
L23 = TotalLength1 - L12
L34 = TotalLength2 - L45
hsbL12 = L12 * 10
lblL12 = Format(L12, "0.00")
lblL23 = Format(L23, "0.00")
lblL34 = Format(L34, "0.00")
End Select
hsbL45 = L45 * 10
lblL45.ForeColor = RED
lblL45 = Format(L45, "0.00")
FormLoad = False
lblL45_Change
If AutoThroatFlag Or AutoMouthFlag Then subCalculate
lblS2 = Format(A2, "0.00")
lblS2S = Format(A2, "0.00")
If FourSegments Then
lblS4 = Format(A4, "0.00")
lblS4S = Format(A4, "0.00")
Else
lblS3 = Format(A3, "0.00")
lblS3S = Format(A3, "0.00")
End If
subDrawOutput
End Sub
////////////////////////////////////////////////
Last edited:
I last used Visual Basic some 15 years ago and am pleasantly surprised to find that I can still read the code. 🙂
Yes, that's some complicated code in there. I'm not as prolific a coder as you are - in your place I'd have just loaded a different form for the different cases.
If I did have the time (which, sadly, I don't) I'd like to take a crack at expanding the UI so I can see up to 4 graphs simultaneously. Most people have full HD monitors nowadays, and a lot of that screen real-estate is being un-utilised. Many times I tweak something in a design, only to find out much later that it has broken something else. Would be nice to be able to eyeball several graphs at once.
Yes, that's some complicated code in there. I'm not as prolific a coder as you are - in your place I'd have just loaded a different form for the different cases.
If I did have the time (which, sadly, I don't) I'd like to take a crack at expanding the UI so I can see up to 4 graphs simultaneously. Most people have full HD monitors nowadays, and a lot of that screen real-estate is being un-utilised. Many times I tweak something in a design, only to find out much later that it has broken something else. Would be nice to be able to eyeball several graphs at once.
in your place I'd have just loaded a different form for the different cases.
If you are referring to the loudspeaker wizards, then Hornresp uses four different forms - the names are highlighted in the attachment.
The filter wizard also has its own form - frmFilter (Horn_14.frm).
Attachments
Yep. Easy like making a watch.
I made a watch once. It was only correct twice a day though... the rest of the ‘time’ it was out of phase by up to 180 degrees😀
I made a watch once. It was only correct twice a day though... the rest of the ‘time’ it was out of phase by up to 180 degrees

I am really sorry for hijacking the thread, but I got a question in a thread of my own, which I cannot answer satisfactory. So I am hoping that maybe one of the experts dwelling in this thread might help out. Just anser in my thread, avoiding even more spam. https://www.diyaudio.com/forums/subwoofers/365629-return-jbl-2226h-parabolic-horn-3.html#post6528101
An issue that I ran into - when you go over 999.9 on the Filling value, the weight of the total filling is no longer displayed.
when you go over 999.9 on the Filling value, the weight of the total filling is no longer displayed.
This is intentional. The 'equivalent weight in Polyfill' model starts to become inaccurate once the 1000 mks rayls/m threshold value is exceeded.
Post #11358 also refers: https://www.diyaudio.com/forums/subwoofers/119854-hornresp-1136.html#post6454784
Attachments
Hello,
I just started playing with Hornresp and I find it a great and powerful simulation software, congratulations David, very well done !
I tried simulating the Cobra2 BL horn cabinet, but it has a chamber with an additional absorber chamber with a small vent.
Here are some more pics.
Does anyone have an idea how to simulate this additional absorber chamber ?
So far I've incorporated the volume of the absorber chamber in the normal chamber.
Regards,
Danny
I just started playing with Hornresp and I find it a great and powerful simulation software, congratulations David, very well done !
I tried simulating the Cobra2 BL horn cabinet, but it has a chamber with an additional absorber chamber with a small vent.
Here are some more pics.
Does anyone have an idea how to simulate this additional absorber chamber ?
So far I've incorporated the volume of the absorber chamber in the normal chamber.
Regards,
Danny
Attachments
Last edited:
Horn equations
I am hoping someone can shed some light on a problem I am have understanding the equations for horn shapes. I am using grasshopper for rhino to generate the curve profile and using the exponential equation
St*(e^(x*m)) and the hyperbolic equation St*(cosh(x)+m*sinh(x))^2 to compare the 2 equations. When I set m = to 1 I expected
the two curves would agree but they do not, what am I missing.Is the exponential equation only valid for value of 1 for m.
I am hoping someone can shed some light on a problem I am have understanding the equations for horn shapes. I am using grasshopper for rhino to generate the curve profile and using the exponential equation
St*(e^(x*m)) and the hyperbolic equation St*(cosh(x)+m*sinh(x))^2 to compare the 2 equations. When I set m = to 1 I expected
the two curves would agree but they do not, what am I missing.Is the exponential equation only valid for value of 1 for m.
This is intentional. The 'equivalent weight in Polyfill' model starts to become inaccurate once the 1000 mks rayls/m threshold value is exceeded.
Post #11358 also refers: https://www.diyaudio.com/forums/subwoofers/119854-hornresp-1136.html#post6454784
Okay, good to know - thanks, David.
Does anyone have an idea how to simulate this additional absorber chamber ?
Hi Danny,
The attached design should get you reasonably close (not to scale).
Read the Stubbed Horn section in the Help file for further details.
(Stubbed horn systems can be specified using the Input Wizard).
Kind regards,
David
Attachments
what am I missing.
Exponential horn equation: S(x) = St * Exp(2 * m * x)
Hyperbolic-exponential horn equation: S(x) = St * (Cosh(m * x) + T * Sinh (m * x)) ^ 2
Where:
m = 2 * Pi * fc / c
T = shape parameter
Set T = 1 for exponential horn
Thanks David !
That's very helpful, you really have made a powerful program !
I already had moved the chamber to the params Vtc and Atc,
but the Stubbed Horn was a bridge too far, although I see now that "absorber chamber" is mentioned in the help section of Stubbed Horns.
But it's nice to have some screenshots 🙂
One proposal for the GUI of Hornresp:
it would be great to have multiple Hornresp windows open at the same time like in the example below.
now I find myself constantly switching between the windows.
That's very helpful, you really have made a powerful program !
I already had moved the chamber to the params Vtc and Atc,
but the Stubbed Horn was a bridge too far, although I see now that "absorber chamber" is mentioned in the help section of Stubbed Horns.
But it's nice to have some screenshots 🙂
One proposal for the GUI of Hornresp:
it would be great to have multiple Hornresp windows open at the same time like in the example below.
now I find myself constantly switching between the windows.
Attachments
Last edited:
- Home
- Loudspeakers
- Subwoofers
- Hornresp