According to Wildlife Singapore, a frog croaks by forcing air out of its lungs and through its larynx. When air is forced through the larynx, the frog's vocal cords vibrate and create a croaking sound.
Wildlife Singapore says the croaking sound that frogs make is amplified by vocal sacs, which are pouches under the floor of a frog's mouths. Frogs are able to amplify the sound of their croaks by keeping their mouths and nostrils shut. By using the muscles in their throats and the walls of their bodies, frogs can force air back and forth between their vocal sacs and their lungs. This is also the reason why the croaking of a frog is rhythmical.
According to Wildlife Singapore, male frogs are the only ones that croak. They use the sound to repel other male frogs from their territory and to attract females. Paw Nation says female frogs also emit a vocalization for breeding. However, the vocalization is very quiet and often cannot be heard over male frogs. A paper published in 1999 called “Brain, Behavior and Evolution,” shows that the mating call of a female frog is more similar to the release call that a male frog makes than to a male frog's mating call.