Hi i have built a basic amp with TDA2030 to drive my 2.1 speakers im able to hear humming noise when i connect it to my PC but the noise does not come when i connect it to my PC . I have double checked my wire connections and found it to be a Ground loop problem . Please advice me on the transformer to use and the circuit opto-isolators are preferred . thanks in advance

When the phone is on battery power, it is isolated from the mains.
There's your clue.

Now test your amplifier thoroughly before you attach any speaker.
When you are satisfied that the amp has passed all it's tests, start connecting your various source/s and test all combinations again, thoroughly.

Only when it has passed all these tests, do you attach a disposable (very cheap) speaker.

__________________
regards Andrew T.
Sent from my desktop computer using a keyboard

When the phone is on battery power, it is isolated from the mains.
There's your clue.

Now test your amplifier thoroughly before you attach any speaker.
When you are satisfied that the amp has passed all it's tests, start connecting your various source/s and test all combinations again, thoroughly.

Only when it has passed all these tests, do you attach a disposable (very cheap) speaker.

well i attached the charger to my phone when i was playing music the noise came and when i disconnect it there was no noise
i found this 1:1 transformer and when i connect primary to pc audio out and secondary to the amp NO NOISE and NO BASS .