CNA Samples

Sound and Music

Ported from Microsoft's XNA 4.0 Sound and Music sample.

Source for this sample on GitHub ↗

Portrait sound player with a fire and forget effect, a looping sound and a song, each with its controls. Play ▸

Opens in a new tab. Click the game to enable audio in your browser.

About this sample

The top control plays a short sound effect once. The middle controls play a looping sound effect and let you pause, resume, stop, pan it between speakers, and change its pitch and volume. The bottom controls play a song and let you pause, resume, stop and change its volume.

Controls

ActionControl
Play a one-shot soundTap or click the top Play button
Control the looping soundTap or click the middle Play, Pause and Stop buttons
Change pan, pitch and volumeDrag the middle three slider handles
Control the songTap or click the bottom Play, Pause and Stop buttons; drag the bottom volume slider