Onomatopoeia is a rhetorical figure of speech in which sounds heard in nature are imitated. So, authors will use sounds like squeak, croak, meow, when they want to show an example of onomatopoeia.
In The Seven Ages of Man, by William Shakespeare, here are some examples of onomatopoeia:
1. MEWLING and PUKING in the nurse`s arms
2. WHINING school boy
3. SIGHING like furnace
4. WHISTLES in his sound