audio 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. .TH AUDIO 3
  2. .SH NAME
  3. audio \- SoundBlaster audio controller
  4. .SH SYNOPSIS
  5. .nf
  6. .B bind -a #A /dev
  7. .B /dev/audio
  8. .B /dev/volume
  9. .fi
  10. .SH DESCRIPTION
  11. .PP
  12. The audio device serves a one-level directory,
  13. giving access to the stereo audio ports.
  14. .B Audio
  15. is the data file, which can be read or written to use the port.
  16. Audio data is a sequence of stereo samples, left sample first.
  17. Each sample is a 16 bit little-endian two's complement integer;
  18. the default sampling rate is 44.1 kHz.
  19. Some implementations only support audio output
  20. and return a zero length when read.
  21. .PP
  22. The length of the
  23. .B audio
  24. file as returned by
  25. .IR stat (2)
  26. represents the number of bytes buffered for input or output.
  27. This provides some control over record or playback latency.
  28. .PP
  29. The file
  30. .B audiostat
  31. provides additional timing and latency control. When read, it returns
  32. lines of the form
  33. .br
  34. .B "bufsize \f2s\fP buffered \f2b\fP offset \f2o\fP time \f2t\fP
  35. .br
  36. reporting number of bytes
  37. .I s
  38. used for DMA operations (i.e., the minimum useful size for reads and writes),
  39. the number of bytes
  40. .I b
  41. currently buffered, and the time
  42. .I t
  43. at which offset
  44. .I o
  45. was reached. Using
  46. .I t
  47. and
  48. .IR o ,
  49. it is possible to calculate at what time a byte with a different offset will
  50. be recorded or played back. See also
  51. .IR usb (4).
  52. .PP
  53. .B Volume
  54. is the control file associated with the audio port.
  55. Each input and output source has an associated stereo volume control,
  56. ranging from 0 (quiet) to 100 (loud).
  57. In addition, there are controls for the sampling rate of the D/A and A/D converters
  58. and for any tone controls.
  59. Reads
  60. return lines of the form
  61. .IP
  62. .I source
  63. .B in left
  64. .I value
  65. .B right
  66. .I value
  67. .B out left
  68. .I value
  69. .B right
  70. .I value
  71. .PP
  72. possibly abbreviated if the values are shared or non-existent.
  73. For example, if all of the values are shared, the form degenerates to
  74. .RI ` source
  75. .IR value '.
  76. Valid sources depend on the particular audio device,
  77. though all devices have an
  78. .B audio
  79. stereo source, which controls the output volume from the D/A converter
  80. connected to
  81. .BR audio .
  82. .PP
  83. Writes accept the same format with same abbreviations.
  84. Writing the string
  85. .B reset
  86. sets all of the attributes to their default value,
  87. and if no attribute is supplied,
  88. .B audio
  89. is assumed.
  90. .PP
  91. The Sound Blaster 16 (or MCD) is half-duplex and accepts the following controls on its
  92. .B volume
  93. file,
  94. in the format shown above for reads.
  95. .TP
  96. .B audio out
  97. Data written to audio.
  98. .TP
  99. .B synth in out
  100. MIDI synthesizer.
  101. .TP
  102. .B cd in out
  103. CD player.
  104. .TP
  105. .B line in out
  106. Line-level input.
  107. .TP
  108. .B mic in out
  109. Monaural microphone input.
  110. .TP
  111. .B speaker in out
  112. Monaural internal speaker connection.
  113. .TP
  114. .B treb out
  115. Stereo treble tone control.
  116. Values less than 50 decrease the treble,
  117. those greater increase it.
  118. .TP
  119. .B bass out
  120. Stereo bass tone control.
  121. .TP
  122. .B speed in out
  123. Sampling rate for the D/A and A/D converters,
  124. expressed in Hz.
  125. Defaults to 44100.
  126. .PP
  127. .SH SOURCE
  128. .B /sys/src/9/port/devaudio.c