Voice change in app

what code should be used for voice change i.e female to male voice

There are no blocks. The user has to change this on their device. They may also need to download other voices.

Welcome Anusha.

You can experiment with Pitch, it sets the speech pitch for the TextToSpeech.
The values should be between 0 and 2 where lower values lower the tone of synthesized voice and greater values raise it. The default value is 1.0 for normal pitch. Changing pitch can make an installed voice seem more masculine or feminine sounding. Otherwise, follow Tim's advice.

What you can do with the Blocks is described TextToSpeech

also see Setting text to speech to an English accent and How do I change voice with Text to Speech?