Mixing multiple “boolean” audio signals

audiodigital-logicmixer

I want to mix up to 4 rectangle audio signals which come directly from a microcontroller's timer output pin and contain only one frequncy each. For example, if the microcontroller outputs 400Hz and 600 Hz, i want the output to contain both freqencys like they are played on individual speakers.

Afterwards, the mixed signal is amplified by a BC547, then a 2SC5449 transistor and finally played by a speaker.

The problem is that just adding the signals wouldn't apply here because the transistors just cut off everything above 1V.

So i need a mixing "function" which accepts booleans and outputs booleans. Is that possible? I tried XOR, but combining 300Hz and 400Hz sounds like a razor, which is obviously wrong.

Do you have any idea how to do this? I already have an ATtiny13, which is connected to the raw signals and the amplifier, where I XORed the signals.

my 'amplifier'

The 120 ohm resistor was added later when i noticed the speaker was quite load.

Best Answer

I think you need to make two changes to the circuit. Firstly to mix the four signals together, then to bias the amplifier so the signals mix linearly.

1) To mix the signals together, you can just use a resistor from each of the four digital outputs, all connecting at the base of Q1. If you make each resistor 3k9 or 4k7, you will get a similar impedance to the 1k you have at the base of Q1 now.

2) You also need to bias the Q1/Q2 pair so that they are just starting to turn on when all four outputs are off. This way your outputs will combine linearly. You bias Q1/Q2 with another resistor from base of Q1 to VCC. Q1/Q2 start to turn on when base of Q1 is at around 1.3V. For VCC at 5V, and four 3k9 resistors from the digital outputs, the correct value here is (5-1.3)(3k9/4) / 1.3 = 2.775, so use a 2k7 resistor here. For VCC = 3.3V and 3k9 resistors, the value should be (3.3-1.3)(3k9/4) / 1.3 = 1.578, so use a 1k5 resistor.

So, in summary My suggestion is:
- Remove resistor R3
- 3k9 resistor from each of the four digital outputs to the base of Q1
- 2k7 resistor from the base of Q1 to VCC (if VCC is 5V), else 1k5 if VCC is 3.3V

These values aren't too critical, If you use 4k7 instead of 3k9, you can make your bias resistor a little larger too (3k3 for 5V or 1k8 for 3.3V VCC)