How to amplify MCU port output?
Based on the comments and responses, your requirement seems to be:


Create a 2-bit DAC using 2 digital outputs of the ATTiny45
Produce an audio-frequency output by varying the 2 bits suitably
Hear this audio signal on the 8-ohm speaker


What you need is an "R-2R" network driven by the two pins. From the diagram you posted:


Connect R15 to Vcc, and R7, R8 and R16 exactly as shown. Keep the values as per the diagram as well, 10k and 20k. Leave out the other resistors in the schematic. 

The junction of R16 and R8 will be the DAC output.

This resultant output voltage needs current amplification to drive the speaker:
An 8 ohm speaker with a 5 volt peak-to-peak signal will generate over half a watt of output, which is pretty loud - but will require anywhere from 100 to 300 mA of drive current. The MCU's pins cannot deliver that kind of current (this is with reference to your original schematic), and even the BC547 is rated only to 100 mA. 



If distortion of output on the speaker is not a show-stopper, you could make a Common Collector unity gain voltage buffer with your BC547 to generate the speaker output you are expecting. Your speaker will be the load resistor, so no separate resistor is needed there. Your power rail must be able to supply sufficient current for this.

The output will not be a perfect 4-level (i.e. 2-bit) DAC output since we have ignored biasing, but will generate recognizable sound as per the MCU pin values generated.