I started with a split rail buffer to make it possible to use a single ended power supply. The next step was adding the volume knob and reference voltage pot. I connected the signal generator to the input and varied the reference voltage while watching the output signal on the scope. The circuit did what it was supposed to except I noticed some crossover distortion at the output. This is common for LM324's and can be fixed with a resistor from the output to the negative supply. I wanted to try it with a guitar to see how it sounds so I added an amplifier stage before the comparator to boost the guitar signal. The circuit actually sounds pretty cool with a guitar. It would probably help to put an LPF before the amplifier stage if you're after a pure square wave. Since it's a comparator, the signal cuts out completely after it gets below a certain level which gives it a gated fuzz sound.