Atmega ticking

It's hard to say without the schematic, and even then it might be a layout problem, so an image of the PCB layout would probably help.

I'm no expert, but my bit of experience with these things informs me finding the source of audio noise can be difficult.

But, I'm unclear on one thing: You say the clicking is audible, as in mechanical noise you can hear with an ear next to the Atmega328 device? And, that audible sound is somehow winding up as an electrical signal that's mixing with the audio signal being controlled? I'm betting that's a coincidence. Either that, or one of the components is acting as a microphone -- not unheard of. But, are you sure it's not the relays you hear clicking? And if so, there are several ways the activation/deactivation of relay coils could be causing this (more later).

But, my modicum of experience with audio circuit design, where a digital element exists, drives me to offer the following suggestions:

  • Use separate regulators for the digital components and the audio components, OR at least decouple the audio supply with a resistor/capacitor combination (i.e. a low-pass filter). It's especially important to isolate the supply that runs those relay coils, from anything that powers the audio portion. [but, I suspect this one doesn't apply. I don't know what a "true bypass looper for guitar" is, but it sounds like the audio path is only through the relay contacts.
  • Grounds! It's my experience that most "noise in audio" problems, if not from the supply line, are likely from the ground. It's especially important to tie all ground, from all circuit "sections", to the same ground point. And it's especially important to never connect an audio circuitry ground to some point up a ground line that supplies anything that draws widely varying currents -- like relay coils, or even digital circuitry ('cuz everytime a digital device switches, it causes a current spike -- less so with CMOS, but still a factor). Those varying currents, produce varying voltages across the resistance of a length of wire -- or PCB trace, etc. BUT, it sounds like even this may not apply to your project, if, once again, the only thing the audio signal touches is the relay contacts.
  • Ground loops in power cables: like AC extension cords, wiring in the walls, etc. Those wires are resistors, and if your circuit is producing varying currents (like when the relay coils energize), they can turn into noise in those lines [I'm sure you are aware of the nightmare of ground loops :stuck_out_tongue: ]. One way you could mitigate this effect is to include a low-pass filter in your power lines. The idea being to smooth out those current spikes [reduce their frequency component to sub-audio], so they don't produce audible noise in the AC lines. This usually involves inductors and capacitors arranged in one of several filter arrangements -- try Googling power line filters, or power supply noise filters, etc.
  • You have diodes across your relay coils, right? This is very important, because relay coils are...well...coils. And coils, when de-energized, produce something called Reverse EMF. Essentially this is a voltage spike that can reach rather high voltages and wreak all manner of havok! You might even need snubbers on those coils, since audio is involved.
  • This is a shot-in-the-dark but, magnetic coupling, from one or more of those relay coils, to ??? [/i]

That's all I can think of.

BTW: On a couple of occasions, I have noticed an audible click or buzz in circuit components that shouldn't be able to generate a sound! In one case it was a circuit with an LED. Whenever I applied power, it produced a little "tink" sound, like I've heard in filament lamps! The only thing I can think of is some sort of piezoelectric effect.