News for hackers. Stuff that matters.
Re:Digital Audio 101: Playing Audio from a Microcontroller by amelius on Thursday April 15, 2021 @11:16AM (#26821474)
Does anyone know where to find suitable equivalent electrical models of speakers and piezo buzzers?

So, for example, a speaker will become an inductor with a series resistor to represent losses, and another resistor to represent power that is converted to audio.

The reason for asking is that I want to be able to plug it into a simulator (spice) and also simulate the mechanical part (using an electrical equivalent circuit).

EDIT: found something here: https://audiojudgement.com/speaker-equivalent-circuit/

Re:Digital Audio 101: Playing Audio from a Microcontroller by dvh on Thursday April 15, 2021 @03:33PM (#26825132)
I'm using this for guitar pickup (2.5H 5kOhm, 30pF, 50mV@440Hz), you can modify it to be more like dynamic speaker (e.g. 8ohm Rs, smaller L0 which you measure from actual speaker)

    .subckt sub_pickup_1 a b
    L0 a 1 2.5 NT=1
    Rs 1 b 5000
    Cp a b 3.0E-11
    Rp a b 10000000
    V1 a 2 DC 0 AC 0.01 0 SIN(0 0.05 440 0 0 0)
    R1 2 b 1
    .ends sub_pickup_1
    xL1 7 0 sub_pickup_1
Re:Digital Audio 101: Playing Audio from a Microcontroller by amelius on Thursday April 15, 2021 @06:14PM (#26826827)
Thanks, but it's not clear to me how/if you modeled the electrical losses related to emitted acoustic power.
Re:Digital Audio 101: Playing Audio from a Microcontroller by dvh on Friday April 16, 2021 @05:38AM (#26831684)
Rp is large parallel resistor across that can simulate loses I think.
Re:Digital Audio 101: Playing Audio from a Microcontroller by nerfhammer on Thursday April 15, 2021 @03:06PM (#26824836)
a piezo is more like a capacitor
Re:Digital Audio 101: Playing Audio from a Microcontroller by amelius on Thursday April 15, 2021 @06:15PM (#26826839)
Correct, you have different models for those.