{{DISPLAYTITLE:_SNDPLAYCOPY}}
The [[_SNDPLAYCOPY]] statement copies a sound, plays it and automatically closes the copy using a handle parameter passed from [[_SNDOPEN]] or [[_SNDCOPY]]


{{PageSyntax}}
::: [[_SNDPLAYCOPY]] {{Parameter|handle&amp;}}[, {{Parameter|volume!}}]


{{Parameters}}
* The [[LONG]] ''handle&amp;'' value is returned by [[_SNDOPEN]] using a specific sound file. 
* The ''volume'' parameter can be any [[SINGLE]] value from 0 (no volume) to 1 (full volume).


{{PageDescription}}
* Opened sound files must have the &quot;SYNC&quot; capability to use this statement. (Currently WAV, OGG, AIF, RIF and VOC)
*Makes coding easier by doing all of the following automatically:
:#Copies/duplicates the source handle (see [[_SNDCOPY}]]
:#Changes the volume of the copy if volume is passed (file must have &quot;VOL&quot; capability)
:#Plays the copy
:#Closes the copy
* This statement is a better choice than [[_SNDPLAYFILE]] if the sound will be played often, reducing the burden on computer. 
{{TextStart}}    QB64 supports the following sound file formats ('''Bold is a guaranteed capability'''):

             WAV = &quot;'''VOL,SYNC,LEN''',PAUSE&quot;      [http://www.rarewares.org/ogg-oggdropxpd.php Free WAV to OGG GUI converter]
             OGG = &quot;VOL,SYNC,LEN,PAUSE&quot;      [http://www.rarewares.org/ogg-oggenc.php Free WAV to OGG converter]
             AIF = &quot;VOL,SYNC,LEN,PAUSE&quot;
             RIF = &quot;VOL,SYNC,LEN,PAUSE&quot;
             VOC = &quot;VOL,SYNC,LEN,PAUSE&quot;
             MID = &quot;'''VOL'''&quot;
             MOD = &quot;VOL,PAUSE&quot;
             MP3 = &quot;'''VOL''',PAUSE,SETPOS&quot;        [http://www.freemp3wmaconverter.com/index.html Free WMA, MP3 and OGG converter]

        ''Note:'' {{Cb|_SNDBAL}} only affects MP3 volume. Sound will reside in main channel.
{{TextEnd}}


''Example 1:'' Playing a sound at half volume.
{{CodeStart}} '' ''
{{Cl|_SNDPLAYCOPY}} applause&amp;, 0.5 '' ''
{{CodeEnd}}


''Example 2:'' Playing a song at random volumes.
{{CodeStart}} '' '' 
chomp&amp; = _SNDOPEN(&quot;chomp.wav&quot;, &quot;VOL,SYNC&quot;) 
_SNDPLAYCOPY chomp&amp;, 0.5 + RND * 0.49 '' ''     
{{CodeEnd}}



{{PageSeeAlso}}
* [[_SNDOPEN]]
* [[_SNDCOPY]]
* [[_SNDPLAYFILE]] {{text|(plays sound files by file name)}}


{{PageNavigation}}