I need to play a wave file using `aplay`. However, my wave files are few seconds in length. So I plan to play them in loop for certain period of time. `aplay` does not seem to have loop options. From my C file create a sub-process using `popen()` The playback is working fine. But the difficulty is that I can't monitor when the wave file playback is completed so that I can start over. 

```
popen("aplay WaveFile","r");

```

How do I know when this command has finished playback?

Thanks in advance!