I have connected a 3906 PNP transistor base to a GPIO pin of ESP32 board. Emitter is connected to 5v and collector is connected to a buzzer. When I program the buzzer (send a HIGH from ESP32), it is permanently on. When I check it against a multimeter, the transistor turns on even when base current is 3.4v (when I though it turns on only if voltage is less than 0.7v).
To cross check the transistor and buzzer, I directly connect base to 5v and the transistor is turned off. Connecting to ground turns on. So, it works correctly when connected directly.
For those who would like to suggest a NPN transistor, I have tried using 3904 NPN transistor and everything works as expected. However the issue is that when programming, all the pins of ESP32 are high by default and the buzzer is ON until programming done.