Hitchhiker's Guide to Openbsd
- Playing different kinds of audio
Download 1.27 Mb. Pdf ko'rish
|
obsd-faq49
13.2 - Playing different kinds of audio
Digitized audio Lossless audio formats (AU, PCM, WAV, FLAC, TTA) Some of the lossless audio formats may be played without the need for third party software, provided they contain the uncompressed digital samples in chunks of bytes. These formats include Sun audio (AU), raw PCM files (without headers), and RIFF WAV. OpenBSD comes with aucat(1) , a program for recording and playing uncompressed audio. The following example will play a WAV file. $ aucat -i filename.wav aucat(1) supports both headerless and WAV audio files with the -i option. aucat also plays Sun audio files where the audio data is encoded as 8 kHz monaural mulaw, which is the most common encoding for this type of audio file. http://www.openbsd.org/faq/faq13.html (4 of 25)9/4/2011 10:02:21 AM 13 - Multimedia It is also possible to play uncompressed audio data by passing it directly to the audio device. To do this, you need to know its main parameters: encoding type, number of channels, sample rate, bits per sample. If you don't know this, you might find out with the file(1) utility: $ file music.au music.au: Sun/NeXT audio data: 16-bit linear PCM, stereo, 44100 Hz $ file music.wav music.wav: Microsoft RIFF, WAVE audio data, 16 bit, stereo 44100 Hz The only remaining things to know about these example files is that they use little-endian byte ordering and signed linear quantization. You could figure this out by reading the header with hexdump(1) . If you are using a headerless (raw) file, there is no way to know the parameters beforehand. Set the following parameters accordingly using audioctl(1) . play.encoding=slinear_le play.rate=44100 play.channels=2 play.precision=16 Next, pass the audio file to the sound device: $ cat music.au > /dev/sound If you applied the correct settings, you should be hearing what you expected. Note: Always use /dev/sound , not /dev/audio , if you want the settings you applied with audioctl to stay in place. There are, of course, other utilities you can use to play these files. Such as XMMS which is available in packages and ports and can play numerous other audio formats. Apart from the above, there are audio formats which use lossless data compression. Examples are the Free Lossless Audio Codec (FLAC) and TTA. The FLAC implementation has been ported to OpenBSD and may be found under audio/flac in packages and ports. Download 1.27 Mb. Do'stlaringiz bilan baham: |
Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2025
ma'muriyatiga murojaat qiling
ma'muriyatiga murojaat qiling