HOWTO: 24bit 96kHz audio with Intel HDA (OSS4 vs. ALSA)

OSS specific Linux discussion (x86/amd64)

Moderators: cesium, dev, kodachi, hannu

HOWTO: 24bit 96kHz audio with Intel HDA (OSS4 vs. ALSA)

Postby igorzwx » Thu Jul 21, 2011 1:38 am

The audio files of 24bit 96kHz format (linear PCM waves) are normally produced by Olympus LS-11, when you record sound with high quality settings. Olympus LS-11 is a very small, but very powerful magic device for professional audio recording. It is user-friendly in the sense that any ignorant user can easily record high quality sound with it. This magic tool is not man-made, of course. Such magic instruments can only be produced by very powerful magic forces, by those "invisible hands" which normally manufacture Cargo, according to Cargo Cult mythology http://www.youtube.com/watch?v=1skNgYdJXK8

Olympus LS-11. A COMPACT, LIGHTWEIGHT POWERHOUSE OF AUDIO RECORDING.
Code: Select all
http://www.olympusamerica.com/cpg_section/product.asp?product=1471
http://www.frequencycast.co.uk/olympusrecorders.html
http://digitalmedia.oreilly.com/2008/05/22/olympus-ls-10-recorder-review.html
http://www.wingfieldaudio.com/olympus-ls-11-review.html
http://www.wired.com/reviews/2009/09/pr_olympus_ls11/
Videos:
English: http://www.youtube.com/watch?v=DtFjMcC74KA
Deutsch: http://www.youtube.com/watch?v=GPShOwF34X4

There is also Zoom H4n portable recorder
http://www.samsontech.com/products/prod ... rodID=1994
Video: http://www.youtube.com/watch?v=RXQDsptXHr0
Download the H4n User Manual in PDF format ( 19.71 MB PDF file)
http://s3.amazonaws.com/samsontech/rela ... manual.pdf
Sound samples (mp3s and AAC 256kBit): http://www.thomann.de/gb/zoom_h4_n.htm

You may want to edit your recordings with Audacity. Right? In this case, it is advisable to convert them to 32bit 96kHz format with pcm_conv, or any other converter, which you trust. Be careful, however. Inexact conversion may deteriorate sound quality. You may not notice the difference, but it might be noticed by others. You can download pcm_conv here: viewtopic.php?f=3&t=3543&start=45#p15974

When the audio file is converted to the right format, you can set 32bit 96kHz as default format in Audacity and import your audio file. You can edit it how you want, and then export it as 32bit 96kHz wave. Then you can convert it to 16bit 44.1kHz format with pcm_conv, if you want.

You may also want to listen to your 24bit 96kHz wave as is (without resampling). This might be problematic. Let us try it with Intel HDA sound card on a Dell notebook:
Code: Select all
$ lspci | grep -i audio
00:1b.0 Audio device: Intel Corporation N10/ICH 7 Family High Definition Audio Controller (rev 01)

OSS4 does not support 24bit format for this soundcard, but 32bit format is available:
Code: Select all
$ ossinfo -v9
HD Audio play pcm                 /dev/oss/oss_hdaudio0/pcm0  (device index 0)
    Input formats (0x00001010):
      AFMT_S16_LE   - 16 bit signed little endian
      AFMT_S32_LE   - 32 bit signed little endian
    Output formats (0x00001010):
      AFMT_S16_LE   - 16 bit signed little endian
      AFMT_S32_LE   - 32 bit signed little endian
    Supported number of channels (min - max): 2 - 8
    Native sample rates (min - max): 44100 - 192000 (44100,48000,88200,96000,176400,192000)

Notice that the OSS4 driver supports 44100kHz - 192000KHz sample rates. This means that you can play the CD format as is (without software resampling), and the so-called "high definition audio formats" too https://wiki.archlinux.org/index.php/OS ... ample_Rate

NOTE: The same formats might be supported by Windows drivers (you should upgrade them, perhaps, or install something special).

Do ALSA drivers support 24bit 96kHz format for Intel HDA soundcards? To answer this question, you may need to consume a dose of "esoteric knowledge".
In software, an "audio codec" is a computer program implementing an algorithm that compresses and decompresses digital audio data according to a given audio file format or streaming audio format...
In hardware, "audio codec" refers to a single device that encodes analog audio as digital signals and decodes digital back into analog. In other words, it contains both an ADC and DAC running off the same clock. This is used in sound cards that support both audio in and out, for instance.
http://en.wikipedia.org/wiki/Audio_codec

According to Wikipedia, "audio codec" migh (or might not) be a hardware device, which "contains both an ADC and DAC".
According to Cesium, the "audio codec" of Intel HDA soundcards is a computer program, which emulates a soundcard (it is suggested that Intel HDA soundcards are a kind of software emulation rather than real soundcards).

Regardless of what "audio codec" is, there is a very secret magic command, which may reveal a kind of "esoteric secret":
Code: Select all
$ cat  /proc/asound/card0/codec#0
Codec: SigmaTel STAC9200
Default PCM:
    rates [0x7e0]: 44100 48000 88200 96000 176400 192000
    bits [0xe]: 16 20 24
    formats [0x1]: PCM

This means the SigmaTel codec support 24bit 96kHz format for Intel HDA ICH7 soundcard. This esoteric knowledge was obtained through the help of CTKArch LiveCD viewtopic.php?f=3&t=3933#p17359 The SigmaTel codec might (or might not) be a kind of driver, which might be downloaded from the SigmaTel web site http://en.wikipedia.org/wiki/Intel_High ... tion_Audio Perhaps, Cesium may explain what it really is.

In a word, Petrov's ALSA plugin supports 32bit format for Intel HDA ICH7 soundcard:
48000 Hz, 2 ch, 'S32_LE'
48000 Hz, 2 ch, 'S16_LE'
These formats are played perfectly with Petrov's plugin. With other bit rates and sample rates, you get "test failure" (this means sound distortions).

ALSA is so incomprehensible, because it is so designed. It was not created by invisible magic forces. ALSA is man-made, of course.

Most important, the default ALSA settings permit only 32bit 48kHz output format for Intel HDA ICH7 soundcard, and everything else is converted to 32bit 48kHz format with the hidden linear converter/resampler of the lowest quality (see the ALSA test below). That is why the sound of ALSA does not sound very nice. Since the SigmaTel codec support 24bit 96kHz format, it might be possible to force the evil ALSA to play this format as is (without the evil resampler). However, in this case, the sound quality may depend on the quality of the SigmaTel codec. This does not promise anything good, of course.

–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
EDIT: It turned out that ALSA driver for Intel HDA ICH7 soundcard is broken.
1. 24bit format is not supported by the ALSA driver
Code: Select all
$ aplay -v tabla-24bit_96kHz.wav
Playing WAVE 'tabla-24bit_96kHz.wav' : Signed 24 bit Little Endian in 3bytes, Rate 96000 Hz, Stereo
aplay: set_params:1059: Sample format non available
Available formats:
- S16_LE
- S32_LE

2. 192kHz is played as 96kHz (strong sound distortions)
Code: Select all
$ aplay -v tabla-32bit_192kHz.wav
Playing WAVE 'tabla-32bit_192kHz.wav' : Signed 32 bit Little Endian, Rate 192000 Hz, Stereo
Warning: rate is not accurate (requested = 192000Hz, got = 96000Hz)
         please, try the plug plugin

3. It is possible to disable the evil converter/resampler of ALSA, but the sound of the SigmaTel codec does not sound very nice.

SUMMARY (ALSA):
1. 32bit 96kHz can be played as is (without the evil resampler) - low quality sound
2. 32bit 48kHz can be played as is (without the evil resampler) - low quality sound
3. 16bit 44.1kHz can be played as is (without the evil resampler) - low quality sound
4. 16bit 48kHz can be played as is (without the evil resampler) - low quality sound
5. 16bit 96kHz can be played as is (without the evil resampler) - low quality sound
–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––

ALSA proved to be problematic with this soundcard, and, perhaps, with many other soundcards. This might be the reason why ALSA "musicians" tend to claim that Indel HDA souncards are "crap". To prove this "fact", they created the so-called "market theory of soundcards" and other sorts of mythology. To believe such myths, one should have the gift of faith. In Cargo Cult theology, the gift of faith is the special ability to believe in the truth of the Cargo myth, see also: http://www.biblebc.com/studies/spiritua ... _faith.htm

If you do not have the gift of faith, you may try to google something like this: "best audio interface".
Most soundcards on the market have acceptable quality DACs these days, compared to a few years ago when you had to spend premium dollars to get good DACs. It makes sense if you think of your CD player when thinking of the quality of DACs. Early cd players had a harsh sound to them and were often considered "brittle". As a result of that criticism, audio engineers found ways to make the DACs sound better, with oversampling, error correction, interpolation and other ways to "smooth" the output. http://www.tweakheadz.com/soundcards_fo ... studio.htm

Of course, notebooks are not suggested for professional audio recording, you may better try Olympus LS-11 for the purpose. Nevertheless, Intel HDA soundcards do have acceptable quality DACs, they do produce high quality sound with OSS4, if it is correctly configured. If you do not believe this, you are invited to test such soundcards with OSS4 and Archiso LiveCD. This is what we are going to do now. You can also test them with Skype and OSS4, the manual is here: viewtopic.php?f=3&t=3933#p17316

EDIT: The download link for Archiso-live has already been fixed. viewtopic.php?f=3&t=3933&#p17316
You may also try CTKArch LiveCD. It does not have PulseAudio inside. The manual is here: viewtopic.php?f=3&t=3933#p17359

We are going to design clear-cut empirical tests for ALSA and OSS4. Such test should be reproducible. That is why we are going to use Archiso LiveCD. It is very simple. Just boot the LiveCD and experiment with Linux sound systems, ALSA and OSS4. All these are "virtual" experiments, nothing is going to be installed on your computer. You can safely boot your Ubuntu or Windows as before.

First of all, we need to create audio files of different formats. This can be easily done with pcm_conv. It does not need to be installed. It is "portable", just run it as is:
Code: Select all
$ ./pcm_conv tabla.wav tabla-24bit_96kHz.wav -b 24 -f 96000

=================================================================
Module Info:

Short name: WAVE PCM Converter
Long name : Convert PCM format for WAVE files
Copyright : Copyright (c) 2009-10 PetrovSE
Version   : 1.0.3.0
Build     : Oct 19 2010, 13:09:52
=================================================================

Input file : tabla.wav
Samples rate    = 44100 Hz
Channels        = 2
Bits per sample = 16 (fixed)

Output file: tabla-24bit_96kHz.wav
Samples rate    = 96000 Hz
Channels        = 2
Bits per sample = 24 (fixed)


EXPERIMENT with OSS4

Step 1: Boot the LiveCD, remove PulseAudio, ESound, etc., and install OSS4 following the manual viewtopic.php?f=3&t=3933#p17316

You may notice some strange error messages on terminal:
Code: Select all
[root@archiso arch]#  /etc/rc.d/oss start
:: Starting Open Sound System                                            [BUSY]
ERROR: Module snd_hda_codec_idt is in use
ERROR: Module snd_hda_codec is in use by snd_hda_codec_idt
ERROR: Module snd_hwdep is in use by snd_hda_codec
ERROR: Module snd_pcm is in use by snd_hda_codec
ERROR: Module snd_timer is in use by snd_pcm
ERROR: Module snd_page_alloc is in use by snd_pcm
                                                                         [DONE]

Such errors can be safely ignored. If osstest plays music, everything is O.K.

To find out, which audio formats are supported by OSS4 for your soundcard, run "ossinfo -v9":
Code: Select all
$ ossinfo -v9
Version info: OSS 4.2 (b 2004/201101060828) (0x00040100) GPL
Platform: Linux/i686 2.6.36-ARCH #1 SMP PREEMPT Wed Dec 29 17:44:37 UTC 2010 (archiso)

Number of audio devices:   4
Number of audio engines:   8
Number of MIDI devices:      0
Number of mixer devices:   1


Device objects
0: osscore0 OSS core services
1: oss_hdaudio0 Intel HD Audio interrupts=17285 (17285)
    HD Audio controller Intel HD Audio
    Vendor ID    0x808627d8
    Subvendor ID 0x102801cc
     Codec  0: STAC9200 (0x83847690/0x102801cc)
     Codec  1: Conexant2bfa (0x14f12bfa)
2: oss_usb0 USB audio core services

MIDI devices (/dev/midi*)

Mixer devices
0: High Definition Audio STAC9200 (Mixer 0 of device object 1)
    Device file /dev/oss/oss_hdaudio0/mix0, Legacy device /dev/mixer0
    Priority: 10
    Caps:
    Device handle: PCI01cc1028-0000:00:1b.0-mx01
    Device priority: 10


Audio devices
HD Audio play pcm                 /dev/oss/oss_hdaudio0/pcm0  (device index 0)
    Legacy device /dev/dsp0
    Caps: DUPLEX TRIGGER MMAP
    Modes: IN/OUT
      Out engine  1: 0/HD Audio play pcm
                     Available for use
      Engine      2: 4/HD Audio play pcm (vmix)
                     Available for use
      Engine      3: 5/HD Audio play pcm (vmix)
                     Available for use
      Engine      4: 6/HD Audio play pcm (vmix)
                     Available for use
      Engine      5: 7/HD Audio play pcm (vmix)
                     Available for use
    Input formats (0x00001010):
      AFMT_S16_LE   - 16 bit signed little endian
      AFMT_S32_LE   - 32 bit signed little endian
    Output formats (0x00001010):
      AFMT_S16_LE   - 16 bit signed little endian
      AFMT_S32_LE   - 32 bit signed little endian
    Device handle: PCI01cc1028-0000:00:1b.0-au01
    Related mixer dev: 0
    Sample rate source: 0
    Preferred channel configuration: Not indicated
    Supported number of channels (min - max): 2 - 8
    Native sample rates (min - max): 44100 - 192000 (44100,48000,88200,96000,176400,192000)
    HW Type: Not indicated.
    Minimum latency: Not indicated

HD Audio play modem-out           /dev/oss/oss_hdaudio0/pcm1  (device index 1)
    Legacy device /dev/dsp1
    Caps: TRIGGER MMAP
    Modes: OUTPUT
      Out engine  1: 1/HD Audio play modem-out
                     Available for use
    Input formats (0x00000010):
      AFMT_S16_LE   - 16 bit signed little endian
    Output formats (0x00000010):
      AFMT_S16_LE   - 16 bit signed little endian
    Device handle: PCI01cc1028-0000:00:1b.0-au02
    Related mixer dev: 0
    Sample rate source: 0
    Preferred channel configuration: Not indicated
    Supported number of channels (min - max): 2 - 2
    Native sample rates (min - max): 16000 - 48000 (16000,48000)
    HW Type: Not indicated.
    Minimum latency: Not indicated

HD Audio rec select               /dev/oss/oss_hdaudio0/pcmin0  (device index 2)
    Legacy device /dev/dsp2
    Caps: DUPLEX TRIGGER MMAP
    Modes: IN/OUT
      In engine   1: 2/HD Audio rec select
                     Available for use
      Engine      2: 4/HD Audio play pcm (vmix)
                     Available for use
      Engine      3: 5/HD Audio play pcm (vmix)
                     Available for use
      Engine      4: 6/HD Audio play pcm (vmix)
                     Available for use
      Engine      5: 7/HD Audio play pcm (vmix)
                     Available for use
    Input formats (0x00001010):
      AFMT_S16_LE   - 16 bit signed little endian
      AFMT_S32_LE   - 32 bit signed little endian
    Output formats (0x00001010):
      AFMT_S16_LE   - 16 bit signed little endian
      AFMT_S32_LE   - 32 bit signed little endian
    Device handle: PCI01cc1028-0000:00:1b.0-au03
    Related mixer dev: 0
    Sample rate source: 0
    Preferred channel configuration: Not indicated
    Supported number of channels (min - max): 2 - 2
    Native sample rates (min - max): 44100 - 192000 (44100,48000,88200,96000,176400,192000)
    HW Type: Not indicated.
    Minimum latency: Not indicated

HD Audio rec modem-out            /dev/oss/oss_hdaudio0/pcmin1  (device index 3)
    Legacy device /dev/dsp3
    Caps: TRIGGER MMAP
    Modes: INPUT 
      In engine   1: 3/HD Audio rec modem-out
                     Available for use
    Input formats (0x00000010):
      AFMT_S16_LE   - 16 bit signed little endian
    Output formats (0x00000010):
      AFMT_S16_LE   - 16 bit signed little endian
    Device handle: PCI01cc1028-0000:00:1b.0-au04
    Related mixer dev: 0
    Sample rate source: 0
    Preferred channel configuration: Not indicated
    Supported number of channels (min - max): 2 - 2
    Native sample rates (min - max): 16000 - 48000 (16000,48000)
    HW Type: Not indicated.
    Minimum latency: Not indicated


Nodes
  /dev/dsp -> /dev/oss/oss_hdaudio0/pcm0
  /dev/dsp_in -> /dev/oss/oss_hdaudio0/pcm0
  /dev/dsp_out -> /dev/oss/oss_hdaudio0/pcm0
  /dev/dsp_mmap -> /dev/oss/oss_hdaudio0/pcm0
  /dev/dsp_multich -> /dev/oss/oss_hdaudio0/pcm0

Thus, the available output formats are:
Code: Select all
      AFMT_S16_LE   - 16 bit signed little endian
      AFMT_S32_LE   - 32 bit signed little endian
    Supported number of channels (min - max): 2 - 8
    Native sample rates (min - max): 44100 - 192000 (44100,48000,88200,96000,176400,192000)

24bit format is not supported for this particular soundcard.

You may want to disable OSS4 resamplers. Right? This can be done with a mouse click or from terminal:
Code: Select all
$ ossmix | grep vmix0-enable
vmix0-enable ON|OFF (currently ON)
$ ossmix vmix0-enable OFF
Value of mixer control vmix0-enable set to OFF
$ ossmix | grep vmix0-enable
vmix0-enable ON|OFF (currently OFF)

Code: Select all
$ ossmix | grep vmix0-src
vmix0-src <Fast|High|OFF> (currently Fast)
$ ossmix vmix0-src OFF
Value of mixer control vmix0-src set to OFF
$ ossmix | grep vmix0-src
vmix0-src <Fast|High|OFF> (currently OFF)

WARNING: This does not always work. You may come to believe that the resampler is already disabled, but it might be still active. To cure the problem, you can apply a magic script:
Code: Select all
$ sudo /usr/lib/oss/scripts/killprocs.sh

See: https://wiki.archlinux.org/index.php/OS ... ample_Rate

Jack-sensing does not work with this card. The OSS Mixer settings (headphones ON, speakers OFF):
Code: Select all
$ ossmix
Selected mixer 0/High Definition Audio STAC9200
Known controls are:
jack.black.mode1 <select|input> (currently select)
jack.black.select1 <pcm|select> (currently pcm)
jack.black.select2 [<leftvol>:<rightvol>] (currently 38.9:38.9 dB)
jack.int-speaker.mode <select|input> (currently input)
jack.int-mic.mode <select|input> (currently input)
jack.black.mode2 <select|input> (currently input)
record.select.select1 [<leftvol>:<rightvol>] (currently 39.9:39.9 dB)
record.select.select2 <select|select> (currently select)
record.select.select3 [<leftvol>:<rightvol>] (currently 19.4:19.4 dB)
misc <-28.-8dB|-19.-2dB|-9.-6dB|0.0dB|mute> (currently 131(too large (a=5)?))
vmix0-enable ON|OFF (currently OFF)
vmix0-rate <decimal value> (currently 48000) (Read-only)
vmix0-channels <Stereo|Multich> (currently Stereo)
vmix0-src <Fast|High|OFF> (currently OFF)
vmix0-outvol <monovol> (currently 25.0 dB)
vmix0-invol <monovol> (currently 25.0 dB)
vmix0.pcm4 [<leftvol>:<rightvol>] (currently 25.0:25.0 dB)
vmix0.pcm5 [<leftvol>:<rightvol>] (currently 25.0:25.0 dB)
vmix0.pcm6 [<leftvol>:<rightvol>] (currently 25.0:25.0 dB)
vmix0.pcm7 [<leftvol>:<rightvol>] (currently 25.0:25.0 dB)

There is no science here, just the ancient method of "trial and error", the Stone Age technology, nothing more https://wiki.archlinux.org/index.php/OS ... leshooting

Now we are ready to play the "legal" test files:
Code: Select all
$ ossplay -vvvv tabla-32bit_192kHz.wav
FORM len = 2949164
tabla-32bit_192kHz.wav: Reading chunk fmt , size 16, pos 0, next 12
FMT chunk: len = 16, fmt = 0
tabla-32bit_192kHz.wav: Reading chunk data, size 2949120, pos 0, next 36
DATA chunk. Offs = 44, len = 2949120
Playing WAVE file tabla-32bit_192kHz.wav, 32 bits/stereo/192000 Hz
Setup device S32_LE/2/192000
Time: 00:01.92 of 00:01.92 VU 0

Code: Select all
$ ossplay -vvvv -R tabla-32bit_192kHz.wav
FORM len = 2949164
tabla-32bit_192kHz.wav: Reading chunk fmt , size 16, pos 0, next 12
FMT chunk: len = 16, fmt = 0
tabla-32bit_192kHz.wav: Reading chunk data, size 2949120, pos 0, next 36
DATA chunk. Offs = 44, len = 2949120
Playing WAVE file tabla-32bit_192kHz.wav, 32 bits/stereo/192000 Hz
Setup device S32_LE/2/192000
Time: 00:01.92 of 00:01.92 VU 0

WARNING: If you play a mono wave to a stereo device with "ossplay -R", it should produce sound distortions, because ossplay should not have any converter/resampler inside.
Code: Select all
$ ossplay -vvvv tabla-16bit_44.1kHz.wav
FORM len = 349180
tabla-16bit_44.1kHz.wav: Reading chunk fmt , size 16, pos 0, next 12
FMT chunk: len = 16, fmt = 0
DATA chunk. Offs = 120, len = 349060
Playing WAVE file tabla-16bit_44.1kHz.wav, 16 bits/stereo/44100 Hz
Setup device S16_LE/2/44100
Time: 00:01.98 of 00:01.98 VU 0

Code: Select all
$ ossplay -vvvv -R tabla-16bit_44.1kHz.wav
FORM len = 349180
tabla-16bit_44.1kHz.wav: Reading chunk fmt , size 16, pos 0, next 12
FMT chunk: len = 16, fmt = 0
DATA chunk. Offs = 120, len = 349060
Playing WAVE file tabla-16bit_44.1kHz.wav, 16 bits/stereo/44100 Hz
Setup device S16_LE/2/44100
Time: 00:01.98 of 00:01.98 VU 0

and "illegal" one:
Code: Select all
$ ossplay -vvvv tabla-24bit_96kHz.wav
FORM len = 1105964
tabla-24bit_96kHz.wav: Reading chunk fmt , size 16, pos 0, next 12
FMT chunk: len = 16, fmt = 0
tabla-24bit_96kHz.wav: Reading chunk data, size 1105920, pos 0, next 36
DATA chunk. Offs = 44, len = 1105920
Playing WAVE file tabla-24bit_96kHz.wav, 24 bits/stereo/96000 Hz
Setup device S32_LE/2/96000
Time: 00:01.92 of 00:01.92 VU 0

Code: Select all
$ ossplay -vvvv -R tabla-24bit_96kHz.wav
FORM len = 1105964
tabla-24bit_96kHz.wav: Reading chunk fmt , size 16, pos 0, next 12
FMT chunk: len = 16, fmt = 0
tabla-24bit_96kHz.wav: Reading chunk data, size 1105920, pos 0, next 36
DATA chunk. Offs = 44, len = 1105920
Playing WAVE file tabla-24bit_96kHz.wav, 24 bits/stereo/96000 Hz
Setup device S32_LE/2/96000
Time: 00:01.92 of 00:01.92 VU 0

Notice that 24bit wave was played to 32bit device. This means that sound was somehow distorted. If you want to understand what it means, you may try to play special mono waves (20Hz + 20kHz) to stereo devices with "ossplay -R" (you do not have mono devices with this soundcard).
Code: Select all
$ man ossplay
       -R     Disable  redirection  to  virtual  mixer  engines   and   sample
              rate/format  conversions.  Should  not be used unless absolutely
              necessary.

WARNING: The test audio files (20Hz + 20kHz) are very dangerous! Do not play them, unless you know how to play them safely.

To summarize: You can simply convert your 24bit 96kHz waves to 32bit 96kHz format with pcm_conv and play them with "ossplay -R". This would produce the sound which is genuine enough. You can also edit 32bit 96kHz waves with Audacity, if you want.

EXPERIMENT with ALSA

As you, perhaps, have already noticed, ALSA is very mysterious and unpredictable.
Neither .asoundrc or /etc/asound.conf is normally required. You should be able to play and record sound without either (assuming your mic and speakers are hooked up properly). If your system won't work without one, and you are running the most current version of ALSA, you probably should file a bug report. http://alsa.opensrc.org/.asoundrc

The Arch LiveCD does not have such ALSA configs, and we are not going to use them in our experiments.

To ensure that our experiments can be easily reproduced by any Ubuntu user, we boot the same Arch LiveCD:
Code: Select all
http://godane.wordpress.com/2011/01/05/archiso-live-20110104-release/

First of all, we have to remove the evil PulseAudio:
Code: Select all
$ sudo su
# killall pulseaudio
# pacman -Rn pulseaudio
# pacman -Rndd esound

The trouble with ALSA is that you never know whether or not your audio files are somehow resampled by "invisible hands". There is, however, a very secret esoteric ritual, which may help to clarify which audio format is actually played by ALSA:
While playing HD audio (e.g. 24bit 96kHz wave), check the actual output format (which is played by your soundcard) with the secret magic command:
Code: Select all
$ cat /proc/asound/card0/pcm0p/sub0/hw_params

If you have several soundcards, substitute 'card0' with your soundcard ID.
If the actual output format is different from what is expected, apply another magic command:
Code: Select all
$ aplay -v *.wav

It may tell you which evil resampler/converter deteriorates sound quality.


Regardless of what is played, the output audio format is always the same:
Code: Select all
$ cat /proc/asound/card0/pcm0p/sub0/hw_params
access: MMAP_INTERLEAVED
format: S32_LE
subformat: STD
channels: 2
rate: 48000 (48000/1)
period_size: 1024
buffer_size: 8192

You may notice a very unpleasant message on the terminal:
$ aplay -v tabla-24bit_96kHz.wav
Playing WAVE 'tabla-24bit_96kHz.wav' : Signed 24 bit Little Endian in 3bytes, Rate 96000 Hz, Stereo
Plug PCM: Rate conversion PCM (48000, sformat=S32_LE)
Converter: linear-interpolation

"Linear-interpolation" means the evil resampler of the lowest quality. If you are not completely deaf, you should be able to hear the difference. Be careful! The sound of the evil resampler may cause mental disorder and damage brain.
Code: Select all
$ aplay -v tabla-24bit_96kHz.wav
Playing WAVE 'tabla-24bit_96kHz.wav' : Signed 24 bit Little Endian in 3bytes, Rate 96000 Hz, Stereo
Plug PCM: Rate conversion PCM (48000, sformat=S32_LE)
Converter: linear-interpolation
Protocol version: 10002
Its setup is:
  stream       : PLAYBACK
  access       : RW_INTERLEAVED
  format       : S24_3LE
  subformat    : STD
  channels     : 2
  rate         : 96000
  exact rate   : 96000 (96000/1)
  msbits       : 24
  buffer_size  : 16384
  period_size  : 2048
  period_time  : 21333
  tstamp_mode  : NONE
  period_step  : 1
  avail_min    : 2048
  period_event : 0
  start_threshold  : 16384
  stop_threshold   : 16384
- Hide quoted text -
  silence_threshold: 0
  silence_size : 0
  boundary     : 1073741824
Slave: Soft volume PCM
Control: PCM Playback Volume
min_dB: -51
max_dB: 0
resolution: 256
Its setup is:
  stream       : PLAYBACK
  access       : MMAP_INTERLEAVED
  format       : S32_LE
  subformat    : STD
  channels     : 2
  rate         : 48000
  exact rate   : 48000 (48000/1)
  msbits       : 32
  buffer_size  : 8192
  period_size  : 1024
  period_time  : 21333
  tstamp_mode  : NONE
  period_step  : 1
  avail_min    : 1024
  period_event : 0
  start_threshold  : 8192
  stop_threshold   : 8192
  silence_threshold: 0
  silence_size : 0
  boundary     : 1073741824
Slave: Direct Stream Mixing PCM
Its setup is:
  stream       : PLAYBACK
  access       : MMAP_INTERLEAVED
  format       : S32_LE
  subformat    : STD
  channels     : 2
  rate         : 48000
  exact rate   : 48000 (48000/1)
  msbits       : 32
  buffer_size  : 8192
  period_size  : 1024
  period_time  : 21333
  tstamp_mode  : NONE
  period_step  : 1
  avail_min    : 1024
  period_event : 0
  start_threshold  : 8192
  stop_threshold   : 8192
  silence_threshold: 0
  silence_size : 0
  boundary     : 1073741824
Hardware PCM card 0 'HDA Intel' device 0 subdevice 0
Its setup is:
  stream       : PLAYBACK
  access       : MMAP_INTERLEAVED
  format       : S32_LE
  subformat    : STD
  channels     : 2
  rate         : 48000
  exact rate   : 48000 (48000/1)
  msbits       : 32
  buffer_size  : 8192
  period_size  : 1024
  period_time  : 21333
  tstamp_mode  : ENABLE
  period_step  : 1
  avail_min    : 1024
  period_event : 0
  start_threshold  : 1
  stop_threshold   : 1073741824
  silence_threshold: 0
  silence_size : 1073741824
  boundary     : 1073741824
  appl_ptr     : 0
  hw_ptr       : 0

To summarize: It does not matter what you play with ALSA. The output is always 32bit 48kHz. Your "high definition" audio file is downsampled with the linear resampler of the lowest quality. Although it may look like 32bit 48kHz format is played as is, it might be a fake, as well. Instead of trusting ALSA, you may better study its source code, especially, if you have an inclination to masochism.

How many ALSA users are there? The number of Linux users is said to be very small, about 0.5 percent:
Adobe has announced that it will no longer be producing versions of Adobe AIR - or security updates - for desktop Linux; instead, they see Android as the future. Some more information can be found in this blog entry: "So, with Desktop Linux, we see a basically flat growth curve hovering around 1%. And since the release of AIR, we've seen only a 0.5% download share for desktop Linux. For Android and IOS we see substantial growth in share, and see predictions that indicate that in the Mobile OS market, the Android share could be 46%, with iOS at 16% (IDC March 2011)."
http://lwn.net/Articles/447576/
http://blogs.adobe.com/open/2011/06/foc ... lient.html

This means that the number of ALSA users is comparable with the number of the deaf:
A Brief Summary of Estimates for the Size of the Deaf Population
in the USA Based on Available Federal Data and Published Research:


About 2 to 4 of every 1,000 people in the United States are "functionally deaf," though more than half became deaf relatively late in life; fewer than 1 out of every 1,000 people in the United States became deaf before 18 years of age.

However, if people with a severe hearing impairment are included with those who are deaf, then the number is 4 to 10 times higher. That is, anywhere from 9 to 22 out of every 1,000 people have a severe hearing impairment or are deaf. Again, at least half of these people reported their hearing loss after 64 years of age.

Finally, if everyone who has any kind of "trouble" with their hearing is included then anywhere from 37 to 140 out of every 1,000 people in the United States have some kind of hearing loss, with a large share being at least 65 years old.
http://research.gallaudet.edu/Demographics/deaf-US.php

This may explain the phenomenon of PulseAudio. The Arch Linux developers are not likely to be audiophiles. Otherwise, they would remove PulseAudio from Arch Linux repositories. The most exotic folk is, perhaps, ALSA "musicians". They tend to claim that there is no audible difference between 96kHz and 44.1kHz sample rates. Should we trust them? Deafness does not seem to be an obstacle to creativity. Ludwig van Beethoven "continued to compose, conduct, and perform, even after becoming completely deaf" http://en.wikipedia.org/wiki/Ludwig_van_Beethoven Of course, ALSA "musicians" may not be so great and so deaf. However, the ability to hear sound may deteriorate with age http://en.wikipedia.org/wiki/Sound
SENNHEISER EW 135 G3 - User Manual
Important safety instructions
• Danger due to high volumes
This device is capable of producing sound pressure exceeding 85 dB(A). 85 dB(A) is the sound pressure corresponding to the maximum permissible volume which is by law (in some countries) allowed to affect your hearing for the duration of a working day. It is used as a basis according to the specifications of industrial medicine. Higher volumes or longer durations can damage your hearing. At higher volumes, the duration must be shortened in order to prevent hearing damage. The following are sure signs that you have been subjected to excessive noise for too long a time:
– You can hear ringing or whistling sounds in your ears.
– You have the impression (even for a short time only) that you can no longer hear high notes.

Video: How to Test Hearing (+transcript for the deaf) http://video.about.com/deafness/Hearing-Test.htm
Video: 6 Ways to Prevent Hearing Loss (+transcript for the deaf) http://video.about.com/deafness/Noise-Reduction.htm

Symptoms of hearing loss:
http://www.webmd.com/a-to-z-guides/hear ... s-symptoms
http://www.freehearingtest.com/symptoms.shtml
http://nihseniorhealth.gov/hearingloss/ ... is/01.html
Noise-Induced Hearing Loss:
http://www.nidcd.nih.gov/health/hearing/noise.asp
http://www.sennheiser.com/sennheiser/ho ... ing_living
Reduced hearing capacity – understanding less and less, almost without noticing it
People are creatures of habit. We can quickly adapt to reductions in our hearing capacity. We barely notice how we keep having to ask people to repeat things, how we increase the volume on the television set, or how we are no longer able to filter out the voice of the person we are talking to when there are many other conversations going on around us. This is because the deterioration of our hearing is a subtle process. Those who recognize this in time and act accordingly have the best chance of counteracting this process and being able to continue hearing.

Did you know? Even a brief, violent sound (such as an exploding firecracker) can cause permanent hearing impairment.

Regardless of "hearing capacity", it is perfectly possible to record "music" with Audacity, Ubuntu Linux and ALSA. There is a manual for the purpose: The Book of Audacity by Carla Schroder, No Starch Press (2011) http://nostarch.com/audacity.htm It seems to be a "closed-source" non-free documentation for "open-source" software. Although the quality of such "knowledge" might be a matter of belief, it does contain a dose of "secret esoteric knowledge" of ALSA mixed with a kind of ALSA mythology.
The Myth of the Golden Ear
Some audiophiles love to obsess over specs and are convinced that, yes, they too can hear super-high frequencies just like bats, and the super-low frequencies just like whatever animal hears super-low frequencies...
Carla Schroder, The Book of Audacity (2011), p.333.
igorzwx
Supporter
 
Posts: 998
Joined: Sun Jun 28, 2009 9:31 pm

Return to Linux

Who is online

Users browsing this forum: Google [Bot], Yahoo [Bot] and 1 guest