192kHz bit-perfect problem

OSS specific Linux discussion (x86/amd64)

Moderators: cesium, dev, kodachi, hannu

192kHz bit-perfect problem

Postby bit2bit » Fri Jul 02, 2010 10:35 pm

Hello all,
My main goal is to spdif musics from my dedicated Audio-PC to my receiver as is without re-sampling. I could not achieve this with the ALSA current driver as it does not recognize my sound card. So, I figured out that OSS4 has support for Audiotrak HD2 Advance DE and recently moved to Open Sound System.

Currently, musics with sample rate up to 96 kHz are transfered as expected with no problem. But 192 kHz tracks gets re-sampled. I can see it on the receiver's display, ossxmixer and ossplay output:
Code: Select all
ossplay -d /dev/dsp_spdifout 192kHz-24bit.wav
Warning: Playback using [b]96000[/b] Hz (file 192000 Hz)


The sound itself goes twice slowly (today) or at normal speed with distortions (yesterday) but always is converted into 96 kHz. :( Please help me to fix it. I have tried to play with different ossxmix options but no luck.

Also, anybody know what is vbit for spdif? I am suspecting this is the switch for 20/24 bits but want to be sure.

ossinfo -v3
Code: Select all
ossinfo -v3
Version info: OSS 4.2 (b 2003/201005280201) (0x00040100) TRIAL
Platform: Linux/i686 2.6.32-23-generic-pae #37-Ubuntu SMP Fri Jun 11 09:26:55 UTC 2010 (mini)

Number of audio devices:   3
Number of audio engines:   7
Number of MIDI devices:      0
Number of mixer devices:   1


Device objects
0: osscore0 OSS core services
1: oss_envy24ht0 Audiotrak Prodigy HD2 Advance DE interrupts=2765508 (2765508)
2: oss_usb0 USB audio core services

MIDI devices (/dev/midi*)

Mixer devices
0: Audiotrak Prodigy HD2 Advance D (Mixer 0 of device object 1)
    Device file /dev/oss/oss_envy24ht0/mix0, Legacy device /dev/mixer0
    Priority: 1
    Caps:
    Device handle: PCI24011412-0000:00:06.0-mx01
    Device priority: 1


Audio devices
Audiotrak Prodigy HD2 Advance DE main out  /dev/oss/oss_envy24ht0/pcm0  (device index 0)
    Legacy device /dev/dsp0
    Caps: DUPLEX TRIGGER MMAP
    Modes: IN/OUT
      Out engine  1: 0/Audiotrak Prodigy HD2 Advance DE main out
                     Available for use
      Engine      2: 3/Audiotrak Prodigy HD2 Advance DE main out (vmix)
                     Available for use
      Engine      3: 4/Audiotrak Prodigy HD2 Advance DE main out (vmix)
                     Available for use
      Engine      4: 5/Audiotrak Prodigy HD2 Advance DE main out (vmix)
                     Available for use
      Engine      5: 6/Audiotrak Prodigy HD2 Advance DE main out (vmix)
                     Available for use
    Input formats (0x00001000):
      AFMT_S32_LE   - 32 bit signed little endian
    Output formats (0x00001000):
      AFMT_S32_LE   - 32 bit signed little endian
    Device handle: PCI24011412-0000:00:06.0-au01
    Related mixer dev: 0
    Sample rate source: 0
    Preferred channel configuration: STEREO
    Supported number of channels (min - max): 2 - 2
    Native sample rates (min - max): 96000 - 96000 (8000,9600,11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000,176400,192000)
    HW Type: ANALOG_OUT     Minimum latency: Not indicated

Audiotrak Prodigy HD2 Advance DE digital out  /dev/oss/oss_envy24ht0/spdout  (device index 1)
    Legacy device /dev/dsp1
    Caps: TRIGGER MMAP
    Modes: OUTPUT
      Out engine  1: 1/Audiotrak Prodigy HD2 Advance DE digital out
                     Available for use
    Input formats (0x00001400):
      AFMT_AC3      - AC3 (Dolby Digital) encoded audio
      AFMT_S32_LE   - 32 bit signed little endian
    Output formats (0x00001400):
      AFMT_AC3      - AC3 (Dolby Digital) encoded audio
      AFMT_S32_LE   - 32 bit signed little endian
    Device handle: PCI24011412-0000:00:06.0-au02
    Related mixer dev: 0
    Sample rate source: 0
    Preferred channel configuration: STEREO
    Supported number of channels (min - max): 2 - 2
    Native sample rates (min - max): 96000 - 96000 (8000,9600,11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000,176400,192000)
    HW Type: DIGITAL_OUT     Minimum latency: Not indicated

Audiotrak Prodigy HD2 Advance DE analog in  /dev/oss/oss_envy24ht0/pcmin0  (device index 2)
    Legacy device /dev/dsp2
    Caps: DUPLEX TRIGGER MMAP
    Modes: IN/OUT
      In engine   1: 2/Audiotrak Prodigy HD2 Advance DE analog in
                     Available for use
      Engine      2: 3/Audiotrak Prodigy HD2 Advance DE main out (vmix)
                     Available for use
      Engine      3: 4/Audiotrak Prodigy HD2 Advance DE main out (vmix)
                     Available for use
      Engine      4: 5/Audiotrak Prodigy HD2 Advance DE main out (vmix)
                     Available for use
      Engine      5: 6/Audiotrak Prodigy HD2 Advance DE main out (vmix)
                     Available for use
    Input formats (0x00001000):
      AFMT_S32_LE   - 32 bit signed little endian
    Output formats (0x00001000):
      AFMT_S32_LE   - 32 bit signed little endian
    Device handle: PCI24011412-0000:00:06.0-au03
    Related mixer dev: 0
    Sample rate source: 0
    Preferred channel configuration: STEREO
    Supported number of channels (min - max): 1 - 2
    Native sample rates (min - max): 8000 - 192000 (8000,9600,11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000,176400,192000)
    HW Type: ANALOG_IN     Minimum latency: Not indicated


Nodes
  /dev/dsp -> /dev/oss/oss_envy24ht0/pcm0
  /dev/dsp_in -> /dev/oss/oss_envy24ht0/pcm0
  /dev/dsp_out -> /dev/oss/oss_envy24ht0/pcm0
  /dev/dsp_ac3 -> /dev/oss/oss_envy24ht0/spdout
  /dev/dsp_mmap -> /dev/oss/oss_envy24ht0/pcm0
  /dev/dsp_spdifout -> /dev/oss/oss_envy24ht0/spdout



ossmix
Code: Select all
ossmix
Selected mixer 0/Audiotrak Prodigy HD2 Advance DE
Known controls are:
route.main <DMA|ANALOGIN|DIGITALIN> (currently DMA)
route.spdifout <DMA|ANALOGIN|DIGITALIN> (currently DMA)
envy24.rate <8000|9600|11025|12000|16000|22050|24000|32000|44100|48000|64000|88200|96000|176400|192000> (currently 96000)
envy24.sync <INTERNAL|SPDIF> (currently INTERNAL)
envy24.src ON|OFF (currently OFF)
envy24.ratelock ON|OFF (currently OFF)
envy24.actrate <decimal value> (currently 96000) (Read-only)
vol.mute ON|OFF (currently OFF)
vol.pcm [<leftvol>:<rightvol>] (currently 127:127)
vol.in [<leftvol>:<rightvol>] (currently 127:127)
vol.spdif [<leftvol>:<rightvol>] (currently 127:127)
spdif.audio <AUDIO|DATA> (currently AUDIO)
spdif.vbit ON|OFF (currently ON)
spdif.preemph <OFF|50/16usec> (currently OFF)
spdif.mode <CONSUMER|PRO> (currently CONSUMER)
spdif.copyright <YES|NO> (currently YES)
spdif.generat <COPY|ORIGINAL> (currently ORIGINAL)
vmix0-enable ON|OFF (currently OFF)
vmix0-rate <decimal value> (currently 48000) (Read-only)
vmix0-src <Fast|High|OFF> (currently OFF)
vmix0-outvol <monovol> (currently 25.0 dB)
vmix0-invol <monovol> (currently 25.0 dB)
vmix0.pcm3 [<leftvol>:<rightvol>] (currently 25.0: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)
bit2bit
Member
 
Posts: 11
Joined: Fri Jul 02, 2010 9:46 pm

Re: 192kHz bit-perfect problem

Postby igorzwx » Fri Jul 02, 2010 11:07 pm

Why do you think that S/PDIF is "bit-perfect"?

S/PDIF - Wikipedia
http://en.wikipedia.org/wiki/S/PDIF
igorzwx
Supporter
 
Posts: 998
Joined: Sun Jun 28, 2009 9:31 pm

Re: 192kHz bit-perfect problem

Postby bit2bit » Fri Jul 02, 2010 11:21 pm

Because over spdif you can get bit to bit audio file transfer to a receiver, isn't?
bit2bit
Member
 
Posts: 11
Joined: Fri Jul 02, 2010 9:46 pm

Re: 192kHz bit-perfect problem

Postby igorzwx » Fri Jul 02, 2010 11:32 pm

bit2bit wrote:Because over spdif you can get bit to bit audio file transfer to a receiver, isn't?


It does not look very perfect:
"The source clock may carry inherent jitter or wander, and the process of clock recovery may be further influenced by noise or distortion introduced in the data cable"
http://en.wikipedia.org/wiki/S/PDIF#Limitations
igorzwx
Supporter
 
Posts: 998
Joined: Sun Jun 28, 2009 9:31 pm

Re: 192kHz bit-perfect problem

Postby cesium » Fri Jul 02, 2010 11:48 pm

Hmm.. I don't have the card, but perhaps you should change "envy24.rate" in the mixer (it's currently set at 96000 per pasted output)? What happens if you do "ossmix envy24.rate 192000", and then try playback again?
cesium
Developer
 
Posts: 902
Joined: Sun Aug 12, 2007 12:51 am

Re: 192kHz bit-perfect problem

Postby igorzwx » Fri Jul 02, 2010 11:59 pm

cesium wrote:Hmm.. I don't have the card, but perhaps you should change "envy24.rate" in the mixer (it's currently set at 96000 per pasted output)? What happens if you do "ossmix envy24.rate 192000", and then try playback again?


http://wiki.archlinux.org/index.php/OSS ... ample_Rate
"Exception: envy24(ht) cards have a setting envy24.rate which has a similiar function (see "oss_envy24" manpage). You can follow these steps, but at step 2, change with ossmix the value of "envy24.rate" as well."

man oss_envy24
igorzwx
Supporter
 
Posts: 998
Joined: Sun Jun 28, 2009 9:31 pm

Re: 192kHz bit-perfect problem

Postby bit2bit » Sat Jul 03, 2010 2:13 am

cesium wrote:Hmm.. I don't have the card, but perhaps you should change "envy24.rate" in the mixer (it's currently set at 96000 per pasted output)? What happens if you do "ossmix envy24.rate 192000", and then try playback again?


The mixer is off and a native rate should be set automatically. Nevertheless I tried and it comes back to 96000 at playing 192000 content. Furthermore I have samples 44.1kHz-16bit, 44.1kHz-24bit, 48kHz-24bit, 96kHz-24bit and clock is correctly auto-detected for any of them, so the same behavior is expected for 192kHz-24bit.

I think this is a driver bug as I use ossplay and there is nothing between OSS4 and the sound card. Please tell me I am wrong.
bit2bit
Member
 
Posts: 11
Joined: Fri Jul 02, 2010 9:46 pm

Re: 192kHz bit-perfect problem

Postby bit2bit » Sat Jul 03, 2010 2:28 am

igorzwx wrote:
bit2bit wrote:Because over spdif you can get bit to bit audio file transfer to a receiver, isn't?


It does not look very perfect:
"The source clock may carry inherent jitter or wander, and the process of clock recovery may be further influenced by noise or distortion introduced in the data cable"
http://en.wikipedia.org/wiki/S/PDIF#Limitations


It does not say it is not. A DAC gets same bits what a music file has if you have capable receiver and transmitter. Yes, some bits can be lost at transfer time as the system talks one way only and this is normal for audio players. CD players are allowed to skip difficult read bits, USB audio devices can miss some data at a busy time ... so it is normal and SPDIF is still bit-perfect. I think SPDIF has less chances to lose data than audio CD or USB devices.
bit2bit
Member
 
Posts: 11
Joined: Fri Jul 02, 2010 9:46 pm

Re: 192kHz bit-perfect problem

Postby bit2bit » Sat Jul 03, 2010 4:02 am

even this does not make any changes:
Code: Select all
ossplay -s 192000 -d /dev/dsp_spdifout 192kHz-24bit.wav
Warning: Playback using 96000 Hz (file 192000 Hz)


It seems I have to get the source code to understand where and why this warning comes up.
bit2bit
Member
 
Posts: 11
Joined: Fri Jul 02, 2010 9:46 pm

Re: 192kHz bit-perfect problem

Postby bit2bit » Sat Jul 03, 2010 6:38 am

Compiled source from Mercurial. No changes.
bit2bit
Member
 
Posts: 11
Joined: Fri Jul 02, 2010 9:46 pm

Re: 192kHz bit-perfect problem

Postby bit2bit » Sat Jul 03, 2010 7:30 am

It seems to be wrong.

<oss_envy24th.c>
Code: Select all
  if (portc->dev_flags & DF_SPDIF)
    {
      /* Allow only supported S/PDIF rates */
      if (arg < 32000)
   arg = 32000;
      if (arg > 96000)
   arg = 96000;
    }


will try to change it as
Code: Select all
if (portc->dev_flags & DF_SPDIF)
    {
      /* Allow only supported S/PDIF rates */
      if (arg < 32000)
   arg = 32000;
      if (arg > 192000)
   arg = 192000;
    }
bit2bit
Member
 
Posts: 11
Joined: Fri Jul 02, 2010 9:46 pm

Re: 192kHz bit-perfect problem

Postby bit2bit » Sat Jul 03, 2010 8:03 am

I rebuilt it and got changes, no warning :) and no sound :( at all over spdif at 192kHz. The analogue signal and lower sample rates over spdif are OK.
bit2bit
Member
 
Posts: 11
Joined: Fri Jul 02, 2010 9:46 pm

Re: 192kHz bit-perfect problem

Postby bit2bit » Sat Jul 03, 2010 8:31 am

The warning message strangely came back.
Code: Select all
#:~/samples$ ossplay -d /dev/dsp_spdifout 44.1kHz-24bit.wav  =>yes sound
^C
#:~/samples$ ossplay -d /dev/dsp_spdifout 192kHz-24bit.wav =>NO sound
^C
#:~/samples$ ossplay -d /dev/dsp_spdifout 96kHz-24bit.wav =>yes sound
^C
#:~/samples$ ossplay -d /dev/dsp_spdifout 192kHz-24bit.wav =>NO sound
^C
#:~/samples$ ossplay -d /dev/dsp_spdifout 192kHz-24bit.wav =>yes sound at slow speed
Warning: Playback using 96000 Hz (file 192000 Hz)
^C
#:~/samples$ ossplay -d /dev/dsp_spdifout 192kHz-24bit.wav =>yes sound at slow speed
Warning: Playback using 96000 Hz (file 192000 Hz)
^C
#:~/samples$ ossplay -d /dev/dsp_spdifout 192kHz-24bit.wav =>yes sound at slow speed
Warning: Playback using 96000 Hz (file 192000 Hz)
^C
#:~/samples$ ossplay -d /dev/dsp_spdifout 192kHz-24bit.wav =>yes sound at slow speed
Warning: Playback using 96000 Hz (file 192000 Hz)
^C


will try to continue tomorrow.
bit2bit
Member
 
Posts: 11
Joined: Fri Jul 02, 2010 9:46 pm

Re: 192kHz bit-perfect problem

Postby igorzwx » Sat Jul 03, 2010 9:26 am

bit2bit wrote:
igorzwx wrote:
bit2bit wrote:Because over spdif you can get bit to bit audio file transfer to a receiver, isn't?


It does not look very perfect:
"The source clock may carry inherent jitter or wander, and the process of clock recovery may be further influenced by noise or distortion introduced in the data cable"
http://en.wikipedia.org/wiki/S/PDIF#Limitations


It does not say it is not. A DAC gets same bits what a music file has if you have capable receiver and transmitter. Yes, some bits can be lost at transfer time as the system talks one way only and this is normal for audio players. CD players are allowed to skip difficult read bits, USB audio devices can miss some data at a busy time ... so it is normal and SPDIF is still bit-perfect. I think SPDIF has less chances to lose data than audio CD or USB devices.


It sounds like a kind of ALSA mythology.

If you have ALSA, you may need SPDIF.

If you have OSS4, you may simply disable resampling to avoid distortions.
Since you card support 192Khz sample rate, the problem can be solved with a mouse click (without SPDIF).

You can also set 192Khz sample rate in vmix, see this manual:

Changing the Sample Rate
http://wiki.archlinux.org/index.php/OSS ... ample_Rate
igorzwx
Supporter
 
Posts: 998
Joined: Sun Jun 28, 2009 9:31 pm

Re: 192kHz bit-perfect problem

Postby bit2bit » Sat Jul 03, 2010 4:27 pm

I did similar changes in different place. The rate for all my sample tracks are auto-detected and set properly now, for 192kHz track ossxmix shows rate 192000 and spdifout peaks but no sound through the receiver. :(


igorzwx, I want to keep resamling off.
bit2bit
Member
 
Posts: 11
Joined: Fri Jul 02, 2010 9:46 pm

Next

Return to Linux

Who is online

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