Go Down

Topic: [Solved] Noise and low volume Issues with audio amplifier. (Read 30547 times) previous topic - next topic

Jiggy-Ninja

Quote
The bias is intended to be 2.5v isn't it? I'm confused.

The external op amp circuit is biased to half supply, which is 2.5V when running it from 5V. The pwoer amp also has an internal op amp preamplifier of the same inverting topology, but it is biased at 1.5V. You can find this in the datasheet: https://www.adafruit.com/datasheets/MAX9744.pdf

It is on teh second page under Common Mode Bias Voltage.
Quote
5 amps. Should be well over enough.

Yes indeed.

Let's see if I have the facts straight.


  • Using the MIDI Shield, through the op amp circuit (10x gain & 4.7x gain, 5V supply), it has a raspy kind of distortion, but only on the glissando (I had to look that word up :) ), not the individual notes.


  • Using a phone outputting a 900 Hz test signal though the op amp circuit (10x gain, 5V supply), there is no audible distortion. how high did you crank the volume on this test signal? Was it at least equal to the MIDI shield test?


  • Using an iPod to play music through the opamp circuit (10x gain, 5V supply), there is no audible distortion. How high did you crank the volume for this test? Was it at least equal to the MIDI shield test?


  • The MIDI shield, when hooked directly to the power amp, does not cause audible distortion.


  • Placing soft foam underneath the speakers does not improve the distortion, so it's not caused by the speaker rattling on something hard.



Is there anything I got wrong, or am forgetting?
Hackaday: https://hackaday.io/MarkRD
Advanced C++ Techniques: https://forum.arduino.cc/index.php?topic=493075.0

Snowman815901

Quote
Using the MIDI Shield, through the op amp circuit (10x gain & 4.7x gain, 5V supply), it has a raspy kind of distortion, but only on the glissando (I had to look that word up smiley ), not the individual notes.


Correct.

  • At 10x gain (1M/100k) the distortion happens at any level of power amp gain.

  • At 4.7x gain (470k/100k) the distortion begins at any level greater than ~20 for the power amp's gain.

  • These are with a .1uF cap in the input.



Quote
Using a phone outputting a 900 Hz test signal though the op amp circuit (10x gain, 5V supply), there is no audible distortion. how high did you crank the volume on this test signal? Was it at least equal to the MIDI shield test?


Just tested this again to confirm.

- With the gain of the power amp set to 0 and 10x gain in the op amp circuit (1M/100k) distortion DOES occur near the upper limits of the signal volume.

When I tested this before I must have had the gain of the power amp set above zero. I was able to make the tone painfully loud without any distortion.

Quote
Using an iPod to play music through the opamp circuit (10x gain, 5V supply), there is no audible distortion. How high did you crank the volume for this test? Was it at least equal to the MIDI shield test?


- When I did the test above I played a podcast as well. Distortion DID occur near the upper limits of the signal volume. About at the same point as the test tone.

Quote
The MIDI shield, when hooked directly to the power amp, does not cause audible distortion.


Correct. Though I found a way to make the distortion happen in this setup as well. See below.

Quote
Placing soft foam underneath the speakers does not improve the distortion, so it's not caused by the speaker rattling on something hard.


Correct. I've held the speaker in the air at times to confirm.



New findings:


  • "Attack velocity" is a value that's set every time the midi shield is commanded to play a note. Through all of the tests previously, this value had been set to medium (60 out of 0-127). I had assumed that attack velocity referred to how quickly the note reached peak volume which is set separately with a different command. It appears that attack velocity actually controls the relative volume of individual notes.

    With the shield connected directly to the power amp, setting the attack velocity for all the notes to 127 increases the volume significantly (on par with the 4.7x gain op amp in the circuit with the attack velocity at 60). Distortion occurs in this setup when the gain of the power amp is set at or about ~27. With the attack velocity at ~110 and the power amp gain at 30 the distortion disappears.



  • I used a 1Mohm potentiometer in place of the 1M resistor in the op amp circuit. I found that all distortion disappears at any level of power amp gain at < ~300kOhms. and at 0 gain on the power amp distortion, begins at > ~670kOhms.


  • Since the distortion stops when a small enough value of input capacitor is used I tried making a circuit to control the level of bass going to the amps.

    The circuit I built is a Baxandall tone control circuit seen here: http://www.learnabout-electronics.org/Amplifiers/amplifiers42.php (This site seems like a great source of information. I'll be reading it thoroughly.)

    It seems to work as intended and reducing the bass does stop the distortion, though the overall volume was at or below what I was able to achieve otherwise. I may play around with this more later.



Jiggy-Ninja

It sounds like the power amp is being overdriven, either at the input stage or the output stage. Maybe both, for all I know.

The input signal has to be under 1.5 V peak (3V peak-to-peak) or it will cause clipping. However, the output also has to be within 6 V peak (12 V pk2pk), because that is limited by your power supply.
Quote
Just tested this again to confirm.

- With the gain of the power amp set to 0 and 10x gain in the op amp circuit (1M/100k) distortion DOES occur near the upper limits of the signal volume.

When I tested this before I must have had the gain of the power amp set above zero. I was able to make the tone painfully loud without any distortion.

According to my theory, setting the power amp gain above 0 would make the distortion occur at a lower volume on your phone, but about the same audio volume.

Just to be clear, the numbers you are using for the gain of the op amp, are those dB values or the volume setting values? I think they're dB.

The next thing I would want to check is the output of the power amp during this distortion. This video from TI (https://www.youtube.com/watch?v=ISILs3MItFE) contains some information about how to analyze the output of a filter-free Class D audio amp like you have. The video recommends a 1kohm / 4.7 nF RC low pass filter on the output of the speaker. Attach the scope probe to the output of the LPF. The negative lead of the scope probe and the ground of the LPF should be circuit ground, not the (-) output of the speaker amp. Connect the other scope probe to the input of the power amp. DC couple both of them. Set the trigger to trigger on the input signal, it should be cleaner than the output signal.

Do not use the op amp circuit for these tests.

Using the frequency generator app, use a moderate volume (no audible distortion) to establish a baseline for comparison. The input should be a clean sine wave, and the output should be a sine wave with a high frequency triangle wave superimposed on it, like what was in the video. Take note of the peak-to-peak value of the input & output, the maximum value of the input (especially if it's more than 3V), the gain setting of the power amp (in dB), and whether there is any clipping or other oddity on the output.

Crank the volume up until there is audible distortion. Take note of the same figures listed above.

If you wish, you can do the same for the MIDI shield and podcast.
Hackaday: https://hackaday.io/MarkRD
Advanced C++ Techniques: https://forum.arduino.cc/index.php?topic=493075.0

Snowman815901

Quote
According to my theory, setting the power amp gain above 0 would make the distortion occur at a lower volume on your phone, but about the same audio volume.


Just tested this again.

With the test tone routed through the op amp, the distortion occurs at the same "phone volume" regardless of power amp gain.

At a power amp gain of 30, my ears would be bleeding by the time the distortion begins.

Quote
Just to be clear, the numbers you are using for the gain of the op amp, are those dB values or the volume setting values? I think they're dB.


dB. Assuming setting 60 = 30dB, setting 30 = 0dB etc.

Quote
Using the frequency generator app, use a moderate volume (no audible distortion) to establish a baseline for comparison. The input should be a clean sine wave, and the output should be a sine wave with a high frequency triangle wave superimposed on it, like what was in the video. Take note of the peak-to-peak value of the input & output, the maximum value of the input (especially if it's more than 3V), the gain setting of the power amp (in dB), and whether there is any clipping or other oddity on the output.


The output certainly seems odd though there is no audible distortion, at any setting, without the op amp in the circuit.
https://drive.google.com/file/d/0BxhYs4r5NIW6eHd1UGMtZ2ZQUTg/edit?usp=sharing

Blue is the input, yellow the output.

This is with max phone volume and max power amp gain. Decreasing the volume on the phone causes the ouput to more and more resemble a sine wave until about 60% where it looks perfect. Anything past that causes the flattening on the negative side though I don't notice any distortion aurally.

The same sort of flattening on the lower side occurs when the midi shield is connected as well and maybe some on the top too.

https://drive.google.com/folderview?id=0BxhYs4r5NIW6aDBaUmlNYVc2LTQ&usp=sharing

Quote
Do not use the op amp circuit for these tests.


There's no distortion during the sine wave test without the op amp in the circuit, so I did a few with it in just to see.

Slowly raising the phone volume, right where the distortion begins to occur, there's clear flattening of the out put of the op amp. This is the op amp clipping correct?

https://drive.google.com/file/d/0BxhYs4r5NIW6ZGFBOEhXa2NWc0U/edit?usp=sharing

Raising the volume to max effectively turns both the output of the op amp and the output of the power amp into square waves.

https://drive.google.com/file/d/0BxhYs4r5NIW6QVVMd2F3eWtmLTg/edit?usp=sharing

Blue = op amp output
Yellow = power amp output



The Vpk-pk of the output of the power amp during the "glissando" , with the attack velocity at max and no op amp in the circuit (audible distortion) being ~13v leads me to believe that the output of the power amp is being over-driven. Though that doesn't explain why there would be distortion with the op amp in the circuit with a gain of 10, the attack velocity at 60, and the power amp gain at 0. I just measured this and the Vpk-pk of the output of the power amp is ~2.4v.

I'm thinking now that during some tests, the input of the power amp is being over-driven and during others, the output is being over-driven. I'll do a more detailed analysis of this scenario tomorrow.

Jiggy-Ninja

Quote
dB. Assuming setting 60 = 30dB, setting 30 = 0dB etc.

Seems to be, according to pages 19-20 in the datasheet (https://www.adafruit.com/datasheets/MAX9744.pdf), which lists the dB gain for the various settings. You have to add 20 to the numbers they give to get the total gain of the preamp+power stage.
Quote
The output certainly seems odd though there is no audible distortion, at any setting, without the op amp in the circuit.
https://drive.google.com/file/d/0BxhYs4r5NIW6eHd1UGMtZ2ZQUTg/edit?usp=sharing

Blue is the input, yellow the output.

This is with max phone volume and max power amp gain. Decreasing the volume on the phone causes the ouput to more and more resemble a sine wave until about 60% where it looks perfect. Anything past that causes the flattening on the negative side though I don't notice any distortion aurally.

The same sort of flattening on the lower side occurs when the midi shield is connected as well and maybe some on the top too.

https://drive.google.com/folderview?id=0BxhYs4r5NIW6aDBaUmlNYVc2LTQ&usp=sharing

Does the MIDI shield have distorted sound when you see the flattening on the negative end? I'll assume not, since you didn't mention it.

This could be a quirk of your amplifier's modulation scheme. To double-check it, hook one scope probe to the (+) speaker output, the other to the (-) output. Low-pass filter both of them just like before, and keep the probes' negative leads hooked to circuit ground. Set them both to DC coupled. Do the sine wave test again at max volume. If I'm correct in my guess, the (-) output will show a positive half-sine wave when the (+) output is flat, and vice-versa. If so, that would explain why you aren't hearing any ditortion.

If you do the op amp test again to the point of distortion, you should see that clipping reflected on the (-) output.
Quote
The Vpk-pk of the output of the power amp during the "glissando" , with the attack velocity at max and no op amp in the circuit (audible distortion) being ~13v leads me to believe that the output of the power amp is being over-driven. Though that doesn't explain why there would be distortion with the op amp in the circuit with a gain of 10, the attack velocity at 60, and the power amp gain at 0. I just measured this and the Vpk-pk of the output of the power amp is ~2.4v.

Some estimates here, the glissando's pk2pk voltage is about 1.5 V, according to one of your pictures. The maximum gain of the power amp is 29.5 dB, which works out to a voltage gain of about 30. That corresponds to a pk2pk output of 45 V, well outside of what your amplifier can handle (since your amp is bridge tied load, it can handle 24 V pk2pk output signal).

Assuming the "attack velocity" setting is proportional, a setting of 60 will give an output of 0.75 V pk2pk. Multiply that by the op amps gain of 10, and it's 7.5V, well outside of what both the op amp itself and the power amp's preamp can handle. Assuming the input preamp saturates at 0V and 3.3V, that gives a pk2pk output of 3.3V. With 0 dB gain, the output should be about 3.3 V pk2pk too. Add some switching noise in there, and that's near enough to the 4.8 V that you measured.
Quote
I'm thinking now that during some tests, the input of the power amp is being over-driven and during others, the output is being over-driven. I'll do a more detailed analysis of this scenario tomorrow.

Sounds like it to me too. Both will cause clipping to show up on the output, which seems to be the distortion you are hearing.
Hackaday: https://hackaday.io/MarkRD
Advanced C++ Techniques: https://forum.arduino.cc/index.php?topic=493075.0

Snowman815901

So, the distortion is certainly caused by either the op amp clipping, the input of the power amp clipping, or the output of the power amp clipping.

Raising each of these to just below their maximum value causes no distortion. Raising any one of them past, introduces distortion, as one would expect.

Conclusion:

The use of the op amp in the circuit led me to believe that I could achieve a much greater volume than this amplifier can handle in a realistic application. With this hardware at least, single notes with a decent interval between them can be played, distortion free, at significantly higher apparent volumes then multiple notes in rapid succession. The best implementation of the devices I'm using is to simply connect the midi shield directly to the power amplifier. The individual notes, set to max volume, produces a ~2.7Vpk-pk signal which, when adding a little headroom, is just within the operating range of the power amp's input. Setting the gain of the power amp to a value which produces an output just below the operating range gives me the maximum volume I can achieve with this hardware. The result is a noise and distortion free sound with decent, though not what I was hoping for, volume.

Solutions to problems in this thread:

- The initial noise I was experiencing was due to a ground loop caused by connecting both the midi shield (-) to the power amp input (-) and the power amp's GND to circuit GND.

- The low volume was due to my misunderstanding of what the velocity value of a midi noteOn command meant (increasing this value increased the signal volume significantly) and my incorrect assumption that increasing system wattage would equal a directly proportional increase in apparent volume . Confounding factors included, no proper baseline for comparison, single notes vs rapid notes producing signal amplitude that was not directly proportional to apparent volume and different, and often not well controlled, input signals producing different apparent volumes at given signal amplitudes.

- The "repeating" source of noise was caused by noise on the USB connection I was using that was greatly amplified by the op amp and power amp in the circuit. Removing the USB connection, reducing total gain and the use of decoupling capacitors mitigated this noise.

- The "squeal" noise was caused by the Musical Instrument Shield introducing noise on the circuit GND and was greatly amplified by the op amp and power amp in the circuit. Reducing total gain and adding a large (1000uF) capacitor directly across the 5v/GND connection on the shield mitigated this noise.

- The distortion, in the later portion of this thread, was caused by either the op amp, power amp input or power amp output clipping. Bringing the signal at all of these points within their operating range eliminated the distortion.

Results of original (3w) setup vs current (20w) setup:

- Improved, though not stellar, volume.
- Greatly improved sound quality.
- Greatly improved bass response.

What I've learned throughout the course of this thread:

- Increasing amplifier/speaker wattage does NOT equal a directly proportional increase in apparent volume.
- The "velocity" value in a noteOn midi command, at least in this midi shield, controls the volume of that individual note.     Not the speed at which the note reaches it's maximum volume.
- The difference between the AC and DC portions of an audio signal.
- How to use an op amp to amplify the voltage range of a signal.
- How to configure an op amp's gain and offset.
- The use of high-pass and low-pass RC filters.
- A tone control method.
- Noise reduction techniques and troubleshooting.
- The basic usage of an oscilloscope.
- Using an oscilloscope to identify certain values of an audio signal. Namely the DC bias and Vpk-pk values.
- General electronics troubleshooting techniques.


Thank you everyone that was willing to help me work through this issue and improve my understanding of audio systems, especially Jiggy-Ninja. Frankly, I'm shocked that you stuck with me all the way through this thread. You sir, are a gentleman and a scholar (literally) and I can't thank you enough for your invaluable help.

If at some point I decide that this hardware is insufficient for this project, I'll create a new thread asking for hardware suggestions. For now though, I can resume work on other aspects of the project. I'll also post the finished results (or a link to them) here when it's done. It should be pretty cool.

Thanks again.

Go Up