I want to generate electricty from sound but i don't know how to detect the sound
From your question it's not clear to me if you want to win electricity from sound or just convert sound into an electrical signal? Many microphones need electricity to function correctly (phantom power), and a preamp that boosts the signal, requiring more electricity.
In theory it's possible to use a dynamic microphone or a piezo element to create electricity without spending it, but the gain will be minuscule. You'll need to add components in the circuit that turn the very fluctuating voltage you generate into a usable, stable voltage. Such a circuit is not 100% efficient, so part of the energy will get lost in the process (it gets converted to heat).
If you are really set on doing this, piezo elements are a good starting point. If you want to turn air pressure or movement into electricity, and you have a possibility to mechanically or physically amplify the pressure or movement before it gets converted, that might be another option worth exploring.