## Sound

### Description

Plays a sound-file at the end of the build, according to whether the build failed or succeeded. You can specify either a specific sound-file to play, or, if a directory is specified, the `<sound>` task will randomly select a file to play. Note: At this point, the random selection is based on all the files in the directory, not just those ending in appropriate suffixes for sound-files, so be sure you only have sound-files in the directory you specify.

### Parameters

Attribute | Description | Required
loops | the number of extra times to play the sound-file; default is `0`. | No
duration | the amount of time (in milliseconds) to play the sound-file. | No

To specify the sound-files or the sound-file directories, use the nested `<success>` and `<fail>` elements:

>     <success>     the path to a sound-file directory, or the name of a
>                   specific sound-file, to be played if the build succeeded.
>     <fail>        the path to a sound-file directory, or the name of a
>                   specific sound-file, to be played if the build succeeded.

### Examples

>     <target name="fun" if="fun" unless="fun.done">
>       <sound loops="2">
>         <success source="${user.home}/sounds/bell.wav"/>
>         <fail source="${user.home}/sounds/ohno.wav"/>
>       </sound>
>       <property name="fun.done" value="true"/>
>     </target>

plays the `bell.wav` sound-file if the build succeeded, or the `ohno.wav` sound-file if the build failed, three times, if the `fun` property is set to `true`. If the target is a dependency of an "initialization" target that other targets depend on, the `fun.done` property prevents the target from being executed more than once.

>     <target name="fun" if="fun" unless="fun.done">
>       <sound>
>         <success source="//intranet/sounds/success"/>
>         <fail source="//intranet/sounds/failure"/>
>       </sound>
>       <property name="fun.done" value="true"/>
>     </target>

randomly selects a sound-file to play when the build succeeds or fails.

Copyright © 2000,2001 Apache Software Foundation. All rights Reserved.