c version of the sound generator