1.\" $NetBSD: audioplay.1,v 1.34 2024/03/04 06:29:35 mrg Exp $ 2.\" 3.\" Copyright (c) 1998, 1999, 2002, 2010, 2019, 2024 Matthew R. Green 4.\" All rights reserved. 5.\" 6.\" Redistribution and use in source and binary forms, with or without 7.\" modification, are permitted provided that the following conditions 8.\" are met: 9.\" 1. Redistributions of source code must retain the above copyright 10.\" notice, this list of conditions and the following disclaimer. 11.\" 2. Redistributions in binary form must reproduce the above copyright 12.\" notice, this list of conditions and the following disclaimer in the 13.\" documentation and/or other materials provided with the distribution. 14.\" 15.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 16.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 20.\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 22.\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 23.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25.\" SUCH DAMAGE. 26.\" 27.Dd March 3, 2024 28.Dt AUDIOPLAY 1 29.Os 30.Sh NAME 31.Nm audioplay 32.Nd play audio files 33.Sh SYNOPSIS 34.Nm 35.Op Fl hinqV 36.Op Fl B Ar buffersize 37.Op Fl b Ar balance 38.Op Fl d Ar device 39.Op Fl p Ar port 40.Op Fl v Ar volume 41.Oo 42.Fl f 43.Op Fl c Ar channels 44.Op Fl e Ar encoding 45.Op Fl P Ar precision 46.Op Fl s Ar sample-rate 47.Oc 48.Op files ... 49.Sh DESCRIPTION 50The 51.Nm 52program copies the named audio files, or the standard input if no files are 53named, to the audio device. 54The special name 55.Dq - 56is assumed to mean the standard input. 57The input files must contain a valid audio header, and the encoding must be 58understood by the underlying driver. 59.Sh OPTIONS 60The following options are available: 61.Bl -tag -width 123456 62.It Fl B 63Set the write block size to 64.Ar buffersize . 65The default value is the play.buffer_size of the audio device. 66.It Fl b 67Set the balance to 68.Ar balance . 69This value must be between 0 and 63. 70.It Fl c 71When combined with the 72.Fl f 73option, sets the number of channels to its argument. 74.It Fl d 75Set the audio device to be 76.Ar device . 77The default is 78.Pa /dev/sound . 79.It Fl e 80When combined with the 81.Fl f 82option, sets the encoding to its argument. 83Possible values are 84.Cm mulaw , 85.Cm ulaw , 86.Cm alaw , 87.Cm slinear , 88.Cm linear , 89.Cm ulinear , 90.Cm adpcm , 91.Cm ADPCM , 92.Cm slinear_le , 93.Cm linear_le , 94.Cm ulinear_le , 95.Cm slinear_be , 96.Cm linear_be , 97.Cm ulinear_be , 98.Cm mpeg_l1_stream , 99.Cm mpeg_l1_packets , 100.Cm mpeg_l1_system , 101.Cm mpeg_l2_stream , 102.Cm mpeg_l2_packets , 103and 104.Cm mpeg_l2_system . 105.It Fl f 106Force playing, even if the format is unknown. 107The 108.Fl f 109flag can be used in addition with the 110.Fl c , 111.Fl e , 112.Fl P , 113and 114.Fl s 115flags to change the number of channels, encoding, precision, and 116sample rate. 117.It Fl h 118Print a help message. 119.It Fl i 120If the audio device cannot be opened, exit now rather than wait for it. 121.It Fl n 122Do not write audio data, only parse files for sanity. 123.It Fl P 124When combined with the 125.Fl f 126option, sets the precision to its argument. 127This value must be either 4, 8, 16, 24 or 32. 128.It Fl p 129Set the output port to 130.Ar port . 131The valid values of 132.Ar port 133are 134.Dq speaker , 135.Dq headphone 136and 137.Dq line . 138.It Fl q 139Be quiet. 140.It Fl s 141When combined with the 142.Fl f 143option, sets the sample rate to its argument. 144This value must be a valid value for the audio device or an error will 145be returned. 146.It Fl V 147Be verbose. 148.It Fl v 149Set the volume (gain) to 150.Ar volume . 151This value must be between 0 and 255. 152.El 153.Sh ENVIRONMENT 154.Bl -tag -width AUDIOCTLDEVICE 155.It AUDIOCTLDEVICE 156the audio control device to be used. 157.It AUDIODEVICE 158the audio device to be used. 159.El 160.Sh EXAMPLES 161Play a raw dump taken from an audio CD ROM: 162.Pp 163.Dl "audioplay -f -c 2 -P 16 -s 44100 -e slinear_le filename" 164.Pp 165The 166.Xr audioctl 1 167program can be used to show the available supported encodings: 168.Pp 169.Dl "audioctl encodings" 170.Sh NOTES 171.Nm 172can be used to play Sun/NeXT audio files, and also RIFF WAVE audio files. 173.Nm 174can be configured in a web browser as the program to use when playing audio 175files. 176.Pp 177In addition to the audio driver encodings list in the EXAMPLES section, 178.Nm 179supports playing IEEE floating point data in RIFF WAVE audio files 180(with one caveat that the floating point size must be native). 181In this case 182.Nm 183converts the floating point data into signed linear samples before 184they are passed to the chosen audio device. 185.Sh ERRORS 186If the audio device or the control device can not be opened, an error is 187returned. 188.Pp 189If an invalid parameter is specified, an error is returned. 190The set of valid values for any audio parameter is specified by the 191hardware driver. 192.Sh SEE ALSO 193.Xr audioctl 1 , 194.Xr audiorecord 1 , 195.Xr audio 4 196.Sh HISTORY 197The 198.Nm 199program was first seen in SunOS 5. 200The 201.Nx 202.Nm 203was first made available in 204.Nx 1.4 . 205Support for RIFF WAVE recording was introduced in 206.Nx 1.6 . 207Support for RIFF WAVE IEEE floating point data was introduced in 208.Nx 10.0 . 209.Sh AUTHORS 210The 211.Nm 212program was written by 213.An Matthew R. Green Aq Mt mrg@eterna23.net . 214