voice alert in arduino

hye all. i wan to add voice alert in my project. when the ultrasonic sensor detect obtacles, there will b a voice alert "obtacles".how to do it with arduino?

You can use piezo buzzer to generate sound, even melody. See piezo buzzer tutorial .

Or using MP3 player module, see this project

A crude, but cheap (minimal hardware cost) option might be to use the Talkie library. This comes with a limited vocabulary, but it’s likely that if it doesn’t have “obstacles”, there will be something similar. The tricky part is that, if I remember correctly, the main Talkie library has not been actively developed for some time and so is not working with the current version of the Arduino IDE. However, there are some popular forks of the library that are updated and working and you will be able to find these very quickly with a bit of searching.

The other options mentioned by IoT_hobbyist are excellent also.

thank you