Emulators

Sound Research (Pt. 2)

by Cory on July 2, 2020 12:09 AM (Edited July 2, 2020 12:24 AM)

This is a second part of (what's looking to be) a three part sound series!

I was looking around trying to figure out what I should do next and why my speaker amplifier wasn't working well. Today I just happened to take another look while procastinating my day job and it turns out my circuit had a bug in it when I copied it off the website.

LM386 Amplifier

This is the circuit I was using. See where it says to put a "10R" resistor underneath a 0.1uF capacitor? I miswired the resistor there so that I put it in series with the 1000uF cap and the poor 10 ohm resistor was bridging the positive terminal of the speaker directly to ground! That explains why it would get burning hot...

Once I fixed that, the sound just came to life. In fact, the amplification is so high now that I removed the gain connection between pins 1 and 8 so that it's a factor of 20 instead of 200 and it still saturates, clipping the speaker after like 1/16th of a trimpot turn.

BEHOLD. I don't think the sound comes well even in this video, but in person, it's audibly noticable from a distance. This amplifier is really noisy and I have yet to determine if it's because the voltage rail is noisy or just that the quality of the amp isn't good (probably both).

Before this, I was looking into what the heck a class D amplifier was and it was really interesting. Apparently there's class A amplifiers all the way to class G or H. A class A amplfier (like the LM386) takes an input signal and simply translates it to be a bigger version in the output. Class A means the voltage rails are a constant, high voltage--a.k.a. "always on". Class B will have some modifications to lower the operating voltage of the circuit to be more power efficient. I think there's a class AB that combines the two so that the voltage lowers when the input audio is quiet. Class C through class H, except D, are all optimizations on this principle going to the point that class G amplifiers have this crazy technology that analyzes the input signal in near real time and then sets the voltage of the rails ("power envelope") to juuuust above the loudest amplitude of the input signal. This has the curious effect of making the voltage rail signal, when mapped over time, look a lot like the input signal.

Class D amps are very different. They are special and weird and apparently, very popular in mobile applications because they are super power efficient. A class D amplifier operates in a "switching" mode. What this means is that the circuitry in the amplifier uses a pair (pairs?) of transistors that alternate on and off and these switch states at a really high frequency. That's the really low level mechanical explanation which is probably useless to you. What is really means is that it uses a really high frequency signal that is then "modulated" by the input signal. It is important that the high frequency signal is much higher frequency than anything in the input audio.

So when an electrical engineer says "modulation", what this means is basically that an attribute (amplitude, for instance) of the modulated signal is controlled by another, lower frequency signal.

This picture is a great diagram. Imagine the input audio signal being the topmost one and the high frequency signal used by the amplifier is the middle. When you "multiply" these signals together, you get the bottom one, where the high frequency signal's amplitude is the same value as the message signal at that point in time.

Another way to think of what the class D amplifier does is sample the input signal at a really fast rate (i.e. the same rate that the high frequency signal is). At each sample point, the circuit takes the derivative of the message signal and outputs a square wave (PWM signal actually), but with the frequency depending on the value of the input signal. So instead of amplitude modulation like in the example, it's more like frequency modulation.

So this type of amplifier is extremely power efficient and capable of higher quality signal with less noise interference (since it's a "digitally" recreated signal). But the problem here is that it may require complex circuitry to decode the modulated signal into an analog signal. Basically you want a low pass filter that has a threshold higher than the message frequencies but lower than the high frequency carrier signal. This can be a pain in the ass to make. A lot of modern designs involve placing strategic capacitors to smooth out of the signal and going so far as to use the speaker's internal inductance to smooth out the value in lieu of a low pass filter.

As you can guess, this is some complex bullshit that I don't feel like dealing with right now. So I'll save this for when I go back to each of the components and try to improve them for a more commercial-like quality.

Next is to make another LM386 amplifier for the other channel and than see if I should keep using the PWM output or use the adafruit I2S stereo decoder that I got. And once that's done, it's time to find some second hand buttons and figure out how to build in a controller.



This Thought is part of Emulators

Cory tries to make the perfect handheld emulator

back to the

top