Tone generator in C works