I'm trying sharpen my skills with audio, and need advice please. I've been working with the tone() function and also moving into other synthesizer ic chips.
I know I must use low pass filter on the audio-out line to the amplifier. I first tried:
(2) 33k-ohm resistors, in series, (2) .01 uf non-polar capactiors to ground.
This works good, except it seems to affect the gain too much. So then I tried replacing (2) 33k-ohm resistors, with (2) 10k resistors, and that gave me more volume. I then moved to (2) 5.6k-ohm resistors. It's working but it seems I sacrifice the strength of that signal.
If I just ditch the 1st resistor and use only 1 resistor & 2 capacitors, it seems to get rid of that random squeal noise, leaving some hissing. At this point, I am just sort of replacing stuff to see what happens - not really calculating on a scientific level how to handle this issue.
Is there a better way to design this filter - without sacrificing the gain ?
You need to do proper calculations on the cut off frequency and roll off you actually want or need.
You need an active filter not a passive one, then you design any gain into it. It consists of an op amp and some feedback capacitors and resistor. While what you have are known as two first order filters you can not continue to cascade them because the impedance requirements of each stage. You need a low impedance driver input and a high impedance load for an RC filter and therefore you can't cascade sections very well.
However a second order active filter gives you that and so you can cascade them to get what you want.
There are many on line filter calculation sites bur half the problem is knowing what filter charastics you require.
Filter design is complex and randomly replacing component values is never going to get you far.
The trouble with completely passive filters is their high output impedance. Or in plain layman's terms, their output is "weak". The filter's performance varies dramatically (both gain and frequency response) depending on whatever load is connected to its output. The impedance (or strength) of the input can also matter.
My guess is you probably weren't aware of this, otherwise you would have included more info in your question about what's really connected to both sides of the filter. We can assume the input connects directly to an Arduino pin, which is a fairly known quantity, though the output from older boards is somewhat different than the newer models.
If the load connected to your filter output is reliably known, perhaps the filter can be designed to take it into account. But only so much is possible without adding an amplifier into the filter. To drive low impedance (or "heavy") loads like heaphones or speakers, or to get consistent performance with different loads, an amplifier is needed.
With no filtering circuitry at all, I get all kinds of squealing and hiss through the speaker. After a trial-and-error with resistors I found that a 3.3k-ohm resistor between the capacitors, and a 1k-ohm between the output and the 2nd resistor sound the best with the least effect on the gain.
I recently bought an affordable used digital oscilloscope (instek gds-2102) to help me learn how to analyze signals - I was hoping this can help me to SEE the waveform output so I could study the effect of my filtering circuit design. I am still stumbling over learning it's interface, setting it up as a spectrum analyzer (this this make/model can even be used for that - I still don't know).
I guess I must also clean the 12v signal from this cheap china power supply module, that also runs my LED desk lamps, desktop computer speakers, and a bunch of computer fans to blow smoke fumes away from my desk. When I attach oscilioscope to the 12v signal of the power supply I get a wild looking waveform, I'm not sure what I'm looking at - after I turn the knob dials around I finally something that resembles a flatline for ground, then 12v I then use to look at the square wave output of the arduino output pin and speaker output pin.
I guess if you need more information how/what I'm doing with my project - is kind of complicated, I wanted to keep it simple to avoid confusion. I would like to advance into making digital/analog synthesizer modules (like the old school MOOG TUBE driven rack wall 1/4" patch panel type I was trained on in high school 20 years ago).
If I understand what's going on with the signal, and can test my signals to be sure they are clean - to make other projects that I can pass the audio signal from the arduino to other circuits, like an old school style patch synthesizer works.
Yeah, analog electronics can be tough to really learn. Even a great scope shows you only voltage. There are ways to measure or infer currents, but doing so involves understanding quite a lot ahead of time. Really, really challenging.