Scimpy: open-source speaker design, impedance measurements, & book (Win/Mac/Linux)

maqifrnswa

Member
2016-03-06 2:46 am
Scimpy: open-source speaker design, impedance measurements, & book (Win/Mac/Linux)

Scimpy Speaker Design Tool:

Sound Card Based Impedance Measurements in Python

I've been working on an open-source speaker impedance testing tool using your soundcard as an ADC/DAC; extracts electrical, mechanical and acoustic component values; design and model speaker performance from T/S values; closed and vented-box optimization; and cross-over/impedance matching design. At the same time, the manual for the software has turned in to quite a stand-alone book in which some might be interested; the book is open-source as well.

Screen shot:
scimpy-screenshot.png


Book (work in progress! comments welcom):
https://github.com/maqifrnswa/scimpy/blob/master/doc/scimpy.pdf

Code Repository:
https://github.com/maqifrnswa/scimpy

Feedback:
https://github.com/maqifrnswa/scimpy/issues

What Works:
  • Finds system T/S from component values, and visa versa
  • Modeling infinite baffle performance from T/S
  • Modeling closed-box performance from T/S
  • Calculate & model optimum B2 closed box from T/S
  • Cross-platform soundcard control for impedance measurements, swept frequency output input and frequency analysis (no impedance measuring set up yet)
  • Book has detailed description and derivation of all T/S parameters, pretty much covering all topics except large-signal analysis and far field diffraction from a baffle.

Tech details:
  • Python, PortAudio, and Qt for cross-platform support with easy learning curve for contributors.
  • Book is latex. I'm thinking of uploading it to a print-on-demand site and "selling" it at-cost if people want a physical version of the book. I might, actually!

Plan:
  • Finish vented box modeling and optimization (QB3-B4-C4 alignment)
  • Cross-over design
  • Take data from impedance measurement and extract T/S parameters.
  • Windows & Mac binaries. It runs on all platforms, but you need to install Python and supporting libraries at the moment. Once it's further along we can offer a single file that just runs. I'm on Linux, so I just haven't had the time to build binaries on Windows (and I don't have a Mac, so I'd need someone with one to volunteer to build it!)
  • Clean up code, some of it is not great software engineering, but i'm just trying to get it all working at the moment.

License: code is GPL3, book is CC-BY-SA 4.0.

Feedback welcome, fork it and pull request if you're interested as well! Book contributions/edits/corrections/discussion is welcome as well.

EDIT:
I went over to windows and test it out, it works the same as Linux. Box modeling works perfectly; in the impedance tester, some warnings might pop-up if you try to verify sound card compatibility, but if you ignore those warnings it actually works as intended. Below is a screen shot of the same speaker as the above screen shot, just modeled in an infinite baffle while the top screen shot was modeled in an ideal B2 closed box.
scimpy-windows-screenshot.png
 
Last edited:
I'm on Linux, so I just haven't had the time to build binaries on Windows (and I don't have a Mac,

:)

Whatever version of Linux you are using stole a bunch of menubar icons from Mac OS X,

I'll see if i can try it out on my Mac. I can also compare results to S+L WooferTester 2 and how the sims do against John Murphy's MacSpeakerz sim sw.

Build? I might need help with that.

dave
 

Ron E

Member
2002-06-27 10:41 pm
USA, MN
Your PDF won't load using Chrome or MS Edge on win10, can view in browser on github but unusably slow. Just looking to see what your approach is before I bother to investigate further.

With reference to Q=0.383 you appear to be planning on doing undamped vented alignments?

Real speaker inductive impedance is closer to an inductor in series with a resistor/Inductor in parallel

Good luck!
 

maqifrnswa

Member
2016-03-06 2:46 am
Your PDF won't load using Chrome or MS Edge on win10, can view in browser on github but unusably slow. Just looking to see what your approach is before I bother to investigate further.

With reference to Q=0.383 you appear to be planning on doing undamped vented alignments?

Real speaker inductive impedance is closer to an inductor in series with a resistor/Inductor in parallel

Good luck!

Thanks for checking it out!
Here's a link to the file for download, maybe acrobat or adobe reader can open it.

https://github.com/maqifrnswa/scimpy/raw/master/doc/scimpy.pdf

For the most part my approach is just a rehashing of Thiele and Small's original papers, but with more explicit derivations and a little more discussion as to strategy.

The default closed box is perfectly damped, but the user can set to over or underdamped as desired. Same will happen for the closed box. Default will be QB3-B4-C4 ideal alignment, but the user can override and tune as they wish.

Qt=.383 was for the B4 alignment for a driver that also happened to exactly have Qts=0.383. After discussing that, I say how it's pretty unlikely to be used, so instead will use quasi-butterworth and Chebyshev alignments to get a continiuum of possible Qts. One of the figure towards the end shows the response curves of a bunch of different Qts, ranging from under- to over-damped. The code will follow that: for Qts<.0383 will be a QB3 alignment, > 0.383 will be a C4 alignment. But that is just the first implementation, anyone can implement any strategy they like - in fact, in the end I'll probably just have a global optimization function where you just give the sepcs of the drivers (multiway) and desired cross over frequencies, and it will find the box design that optimizes the whole system.

You're right about the inductor model. In your opinion, how useful is it to include that shunt resistor in speaker design and modeling? Essential, nice to have, or not-really-needed? Figure 4.8 in the text shows the complete model, which is the end goal I'm aiming for. Drivers don't give that shunt resistance value, but we can find it during impedance testing. Same thing with acoustic filling. I think I call it "Reb" in the text, but for now I'm leaving it out to get a proof-of-concept implementation working.

Whatever version of Linux you are using stole a bunch of menubar icons from Mac OS X,

I'll see if i can try it out on my Mac. I can also compare results to S+L WooferTester 2 and how the sims do against John Murphy's MacSpeakerz sim sw.

Build? I might need help with that.

dave

;-) people all the time ask me how i got MacOS to run on a thinkpad! It's a base ubuntu install, that's what they do (include close/minimize being in the top left like macs). Yes, please check and compare. I've been comparing against online data I can find. Some of the math gets hairy, and if we implement automated multi-way cabinet and cross-over design, it will only get more complicated. Complicated = powerful, but potential for bugs.

I see it is super-easy to edit and develop on Linux, but windows had a couple extra steps since getting compilers and libraries up and running. I know people use homebrew on OSX, so difficulty might be somewhere in between windows and linux.
 
so instead will use quasi-butterworth and Chebyshev alignments to get a continiuum of possible Qts.

I'd suggest forget about the classical alignments cribbed from filter analogies & a lack of computing power. One should be able to work in the entire space possible.

;-) people all the time ask me how i got MacOS to run on a thinkpad!

They should just buy a MacBook Pro… the best hardware.

I see it is super-easy to edit and develop on Linux...I know people use homebrew on OSX, so difficulty might be somewhere in between windows and linux.

OSX is FreeBSD with a Mach kernel and then proprietary software on top for graphics, UI etc. A lot closer to Linux than to Windows -- especially if you are comfortable with using terminal (not me).

dave
dave
 
How to get it to come up on a mac...

Note, if you've never fired up the Terminal.app, this may be a rough exercise for you. You're about to venture into Unix territory.

There are two major open source package managers out there for mac, macports and homebrew. For reasons I can't remember, I went with macports. I've never really had a problem with it and it has a darn good selection of packages. You first must install Xcode from the app store (so macports can compile programs). It's a big package. See instructions here.

I already had python3.4, matplotlib, and numpy installed previously via macports for other things. I needed two more things, so I installed them. I include some of the other packages I'd already installed which you'll need:
sudo port install python34 py34-pyaudio py34-pyqt4 py34-matplotlib py34-numpy
You might need more that I had already installed. After that you can download the code:
git clone https://github.com/maqifrnswa/scimpy.git
And run it:
cd scimpy
python3.4 scimpy.py


The sound card handling could be improved. I plugged in a Dayton WT3, which behaves as a USB sound card. It appears twice. The input and output appeared separately in the sound card list. Perhaps it's a Mac thing that the inputs and outputs appear separately. So it would be nice to select an input and an output, or coalesce both 'USB Audio CODEC' entries (the WT3) into one unit to select. I get a weird error message when doing the test. I presume that's since that selection has no input channels (but the one below it does)
scimpy-soundcard.png


Hmm, actually I just plugged in a Behringer UMC202HD and it's inputs and outputs appear under a single entry and no error message when doing the test.

Once you're able to select the sound card I'll give it another whirl.
 
Thanx for that. I am not unfamiliar with Terminal, but only to copy & paste stuff into.

If i use my FireWire ADC/DAC then choose it in the Sound Control Panel?

I've had a number of USB and Firewire ADC/DACs connected and they all show up as a single device.

Aside: WT3 is not a worthwhile device IMO. I've had quite a few people contact me with issues, and i think it underhanded that PE/Dayton stole Smith + Larson's product name for a much less capable device.

dave
 
If i use my FireWire ADC/DAC then choose it in the Sound Control Panel?

Right now it looks like the code uses the 1st sound card that is in that dialog box. If your firewire box happens to be the 1st item, you're golden, if not then you need to wait for code fixes.

However I just modified the code to use the selected sound card. That was easy enough, but I'm going to see how much more work it is to separately select input and output.....
 
Yes - the sound card part just selects the default for now, even though it shows you all the possible options. A small tweak to the code will let your selections be honored (someone posted they tried that). So far the functionality you are seeing just confirms that we actually could poll sound card capabilities and output/input from system defaults.

Everything is still under heavy development, and this pre-alpha quality - but that also means design ideas are easiest to implement now!

Regarding displaying of available sound card hardware: some OSes have multiple APIs to the same hardware. For example, Windows has Multimedia Extensions (MME), DirectSound, and ASIO. As of now, it shows all options since some might be better/faster than others (ASIO will have lower latency than MME). This matters since you want full-duplex since timing is so important, which is something that may be available in a subset of APIs. The end result may be drop-down type box where you pick which API you want, then it populates the list with available devices from that API.

Finally, I got C4 aligned box design working for Qts > 0.383. Display of f3 isn't programmed yet, but the response curve looks as is expected at least:
scimpy-screen-shot-C4sealedbox.png


I'm also logging the issues brought up so far:
Default sound card is used regardless of user input:
https://github.com/maqifrnswa/scimpy/issues/1

sound card selector shows all APIs at once, duplicate card entries
https://github.com/maqifrnswa/scimpy/issues/2
 

Ron E

Member
2002-06-27 10:41 pm
USA, MN
Your PDF seems to work now.

Thanks for checking it out!
The default closed box is perfectly damped, but the user can set to over or underdamped as desired.

You will probably want to leave the box and leakage damping terms in. For simplicity just use the same vented box model with Qa(bsorption), Ql(eakage) and Qp(ort), with Qp set to very low value (e.g. 1e-6)

Same will happen for the [vented] box. Default will be QB3-B4-C4 ideal alignment, but the user can override and tune as they wish. Qt=.383 was for the B4 alignment for a driver that also happened to exactly have Qts=0.383. After discussing that, I say how it's pretty unlikely to be used, so instead will use quasi-butterworth and Chebyshev alignments to get a continiuum of possible Qts. One of the figure towards the end shows the response curves of a bunch of different Qts, ranging from under- to over-damped. The code will follow that: for Qts<.0383 will be a QB3 alignment, > 0.383 will be a C4 alignment.

The Qt values change when damping terms are added, and if the full model is used, damping terms make calculating the alignments impractical. They only serve as starting points anyway, you should be able to choose any combination of Vas/Vb or Fb/Fs desired. SC4 alignments can be useful as well.

But that is just the first implementation, anyone can implement any strategy they like - in fact, in the end I'll probably just have a global optimization function where you just give the sepcs of the drivers (multiway) and desired cross over frequencies, and it will find the box design that optimizes the whole system.

Optimization for what goal function? ;)

You're right about the inductor model. In your opinion, how useful is it to include that shunt resistor in speaker design and modeling? Essential, nice to have, or not-really-needed? Figure 4.8 in the text shows the complete model, which is the end goal I'm aiming for. Drivers don't give that shunt resistance value, but we can find it during impedance testing. Same thing with acoustic filling. I think I call it "Reb" in the text, but for now I'm leaving it out to get a proof-of-concept implementation working.

If Fig 4.8 is what you are after, you are moving in the right direction. Generally there will be Re and Le, and also the parallel combination. Marshall Leach has another way of doing this, IIRC.

If you will make crossover designs with acoustic and impedance measurements, modeling the inductive rise "really" accurately doesn't matter as much, but it could be useful for T/S parameter (impedance) curve fits for system identification.

You might wish to purchase or find this book, if only for the standardization of terminology. J.E. Benson was the originator of the unified sealed-vented-passive radiator box model. Much clearer and more thorough than the other papers.
http://www.amazon.com/Theory-Design-Loudspeaker-Enclosures-Benson/dp/0790610930
 
attachment.php


I may be making some incorrect assumptions from this window, but…

Speaker parameters should be in a separate database. A design file should allow the saving of multiple alignments. I find it useful to take a design file and then load a different driver to make comparisons or to start a new design file.

I hope that descriptions make sense.

dave
 

Attachments

  • ScreenSnap.gif
    ScreenSnap.gif
    34.6 KB · Views: 472
I got it to ask for separate input and output so I could use my WT3 (got it for free in a raffle, so don't judge me too harshly Dave :eek: )

I can see an impedance plot (kind of)! Need somewhere to specify what your voltage divider resistor value is somewhere so scales can be right.

wow! That is the first measurement - I haven't even tried that part of the code yet!

I didn't put any math in yet for the test resistor value - nor complex phase+magnitude calculations. What you're seeing is something related to impedance but the numbers don't have meaning yet, but great to know it does something!
 
You will probably want to leave the box and leakage damping terms in. For simplicity just use the same vented box model with Qa(bsorption), Ql(eakage) and Qp(ort), with Qp set to very low value (e.g. 1e-6)

Got it - tracking here
https://github.com/maqifrnswa/scimpy/issues/4


The Qt values change when damping terms are added, and if the full model is used, damping terms make calculating the alignments impractical. They only serve as starting points anyway, you should be able to choose any combination of Vas/Vb or Fb/Fs desired. SC4 alignments can be useful as well.

Thanks - I think that's the idea, right now when you click on "calculate" it gives you a starting point that you can tweak. If the real physical properties are measured, such as acoustic resistance/impedance/compliance/mass, then you don't need to worry about what the Qs are, but they do give a good starting point.


Optimization for what goal function? ;)

That's up to the community/user ;-) Any goal function people want -- at first I can imagine something that says "make SPL flat in some pass band that I care about with no group delay greater than X"


If Fig 4.8 is what you are after, you are moving in the right direction. Generally there will be Re and Le, and also the parallel combination. Marshall Leach has another way of doing this, IIRC.

If you will make crossover designs with acoustic and impedance measurements, modeling the inductive rise "really" accurately doesn't matter as much, but it could be useful for T/S parameter (impedance) curve fits for system identification.

got it - system identification model should include all terms
https://github.com/maqifrnswa/scimpy/issues/5

You might wish to purchase or find this book, if only for the standardization of terminology. J.E. Benson was the originator of the unified sealed-vented-passive radiator box model. Much clearer and more thorough than the other papers.
http://www.amazon.com/Theory-Design-Loudspeaker-Enclosures-Benson/dp/0790610930

Thanks - I've heard great things about that. I think it's also the most commonly used book when it comes to terminology, so whatever language we use should match that for consistency. I just hadn't had the time to get to that one yet!