OS2 World Community Forum

OS/2, eCS & ArcaOS - Technical => Multimedia => Topic started by: Neil Waldhauer on February 25, 2017, 04:10:15 pm

Title: USB Audio
Post by: Neil Waldhauer on February 25, 2017, 04:10:15 pm
Is anyone using Lars Erdmann's USB Audio? What hardware are you using?
Title: Re: USB Audio
Post by: Lars on February 26, 2017, 10:17:40 pm
I myself am testing with a Terratec Aureon Dual USB.
To make it short: for certain technical reasons only 44.1 kHz sampling rate will do.
Title: Re: USB Audio
Post by: Neil Waldhauer on February 28, 2017, 01:40:22 am
OK, Aureon seems to use CM119 chipset, but older ones might be CM108 or CM106. I'll give one of those a try.
Title: Re: USB Audio
Post by: Lars on February 28, 2017, 03:08:50 pm
I also tried some cheapo chinese USB Audio stick (which broke after about 2 weeks of use).
In general any USB Audio device should work but manufacturers are free to support dedicated sample rates.
They will almost always support 44.1 kHz Stereo because it is so common, then the good stuff will also support 48 kHz Stereo (the Terratec Aureon does) because that is the sample rate for professional sound equipment (as far as I know).

What they will normally not support is the 22,05 kHz and 11,025 kHz sound files that OS/2 comes with. For that a sample rate converter (in SW) would be needed and "fitted" into OS/2 MMPM subsystem (I think that is possible but it is work and the data amount would double or quadruple respectively and I don't know how to increase a sound buffer in size).

That's also the reason why those OS/2 Sound files sound so funny if you play them ...
Title: Re: USB Audio
Post by: David McKenna on February 28, 2017, 11:21:11 pm
Lars,

  Maybe it would be simpler to just provide the same set of OS/2 sound files that have been 'translated' to 44.1k?

Regards
Title: Re: USB Audio
Post by: Lars on March 01, 2017, 10:29:48 am
Hi David,

that is obviously possible but not a good solution in general. We need a sound subsystem that is able to deal with different sound formats and also with different sample rates. You don't want the user to convert his sound files to the very few formats that OS/2 and the Audio HW understand.
The MMIO mechanism deals with the conversion between different sound formats (say: MPG to WAV), therefore that is already covered.
In addition, we also need to deal with different sample rates which is not yet covered.
Title: Re: USB Audio
Post by: David McKenna on March 01, 2017, 12:30:50 pm
Hi Lars,

  Absolutely agree that a sub-system that can handle any sample rate or format would be ideal. I only thought that since 44.1k is a rate that is more or less 'standard' for USB (or any) sound devices, it would make sense to convert the sound files that come with OS/2 to 44.1k so they can be played out of the box with more devices.

Regards
Title: Re: USB Audio
Post by: Fahrvenugen on March 02, 2017, 02:09:04 am
I also tried some cheapo chinese USB Audio stick (which broke after about 2 weeks of use).
In general any USB Audio device should work but manufacturers are free to support dedicated sample rates.
They will almost always support 44.1 kHz Stereo because it is so common, then the good stuff will also support 48 kHz Stereo (the Terratec Aureon does) because that is the sample rate for professional sound equipment (as far as I know).

Lars,

You're correct on the 44.1 and 48, but the other 2 sample rates that are sometimes supported on the higher end USB audio stuff is 96000 Hz and 192000 Hz.  Admittedly these are much less common as they're usually only used in industries where audio is the product (recording industry, radio broadcast production, etc).  I regularly work with a number of sound cards (both USB and non-USB) that support these sample rates.

Admittedly these sample rates are rarely used on consumer-based stuff, and considering that OS/2 doesn't have any current and up to date professional audio production software, I would not suggest that this be a priority.  44.1 and 48 kHz are more then adequate to cover pretty much all the needs that OS/2 would run into.  And given the limited market for high-end audio production I don't really see anyone running out to develop or port high-end audio recording / production software to OS/2.

Title: Re: USB Audio
Post by: Lars on March 02, 2017, 06:32:09 am
Yes, I was thinking about the average consumer who wants to hear some bells and whistles here and there.

Actually, supporting 11.025 kHz or 22.05 kHz can be accomplished by inserting zeros in between the samples (3 zeros for 11.025 kHz and 1 zero for 22.05 kHz) and then convolving with a low pass filter window. That'll create a 44.1 kHz signal. Tried that in MATLAB and it works.
I also found a way to "hook into" the MMPM subsystem and get an address to the buffer containing the sample data (for playing sound).
The one thing I don't know is how I can "exchange" that buffer against one of bigger size ...
The other alternative would be to allocate a temporary buffer directly in the driver USBAUDIO.SYS. But I don't like that idea.
Title: Re: USB Audio
Post by: Andi B. on March 02, 2017, 09:02:23 am
....
Actually, supporting 11.025 kHz or 22.05 kHz can be accomplished by inserting zeros in between the samples (3 zeros for 11.025 kHz and 1 zero for 22.05 kHz) and then convolving with a low pass filter window...

There exist sophisticated algorithm for sample rate conversion but we definitely will not need them on OS/2 IMHO. Though putting zeros into the stream I would consider one of the worst solution. A much better and adequate approach (IMHO) would be inserting the same sample a second time for making 22.05 to 44.1 conversion. A slightly better algorithm would be inserting the mean value of two neighbor samples in between.
Title: Re: USB Audio
Post by: Neil Waldhauer on March 03, 2017, 03:09:43 am
I bought a Trond USB Audio Adapter, and it works just as Lars said. There is good sound, except for System Sounds.
Title: Re: USB Audio
Post by: Dave Yeo on March 03, 2017, 04:50:32 am
Did you plug it in and it just worked or did you have to do what?
Title: Re: USB Audio
Post by: Olafur Gunnlaugsson on March 03, 2017, 05:47:44 am
I bought a Trond USB Audio Adapter, and it works just as Lars said. There is good sound, except for System Sounds.
Do system sounds not play at all or do they sound distorted?
Title: Re: USB Audio
Post by: Neil Waldhauer on March 03, 2017, 06:49:38 am
1. use multi-media install to remove uniaud
2. reboot
3. use multi-media install to install usbaudio files
4. reboot again

System sounds sound distorted. Actually that may be understating it. If you are familiar with waveform generators, you may be able to recognize distorted system sounds. Otherwise, you hear "sput".

added bonus, USB ports are on the back and front, so now my wiring is more orderly.
Title: Re: USB Audio
Post by: Olafur Gunnlaugsson on March 03, 2017, 01:12:47 pm
System sounds sound distorted. Actually that may be understating it. If you are familiar with waveform generators, you may be able to recognize distorted system sounds. Otherwise, you hear "sput".

The CM108 chip in the Trend only appears to support the playback of 16 bit 44.1 and 48kHz PCM data, so the 10 & 20 kHz system audio files sound distorted for that reason, while a frequency converter in the system would fix that, a simpler solution is to replace the system sound files with 16bit 44.1kHz versions.
Title: Re: USB Audio
Post by: Martin Iturbide on March 03, 2017, 02:05:40 pm
Hi

Sorry for jumping into the thread this way.

It can be interesting if you are testing USB Audio devices to list the ones that works with brand, name, model, chipset, hardwareid and include them on the wiki:
http://www.os2world.com/wiki/index.php/Audio_Cards#USB (http://www.os2world.com/wiki/index.php/Audio_Cards#USB)

I'm open for any suggestion to include more working hardware on the wiki. Remember that you can access the wiki with the same user and password of this forum.

Regards

Title: Re: USB Audio
Post by: Wim Brul on March 03, 2017, 03:57:45 pm
Hi Neil,

I bought a Trond USB Audio Adapter, and it works just as Lars said. There is good sound, except for System Sounds.

You might try and convert the system sounds yourself with the IBM Wave Doctor application that I think is part of the IBM Multimedia Presentation Manager Toolkit/2.
\ MMOS2\MMTOOLKT\ NEATSTUF\WVDOC\WVDOC.EXE

Wim
Title: Re: USB Audio
Post by: Neil Waldhauer on March 04, 2017, 04:02:43 pm
I've converted my system sounds to 16-bit, 44.1 KHz. I was going to post the files, but they are over 10 MB zipped.

I used the sox port by Mentore Siesto to convert the files. http://hobbes.nmsu.edu/h-search.php?key=sox&pushbutton=Search (http://hobbes.nmsu.edu/h-search.php?key=sox&pushbutton=Search)

Here is a crude REXX program to convert your files using sox. It shows the options I gave sox to do the work. The documentation for sox is here: http://sox.sourceforge.net/sox.html (http://sox.sourceforge.net/sox.html)

Code: [Select]
/* batch file to convert from old style wave files to
   16-bit 44.1 KHz ones. Requires sox to run.
    run from the directory named "sounds"
   */

call SysMkDir '..\SOUND4'

call SysFileTree '*.*', 'wdir.', 'DO'

do i=1 to wdir.0
   soundPointer = pos('sounds', wdir.i)
   say soundPointer wdir.i
   outputFile = overlay('SOUND4', wdir.i, soundPointer)
   call SysMkDir outputFile
   say 'created' outputFile
end
call SysFileTree '*.wav', 'wav.', 'FOS'

do i=1 to wav.0
   soundPointer = pos('sounds', wav.i)
   outputFile = overlay('SOUND4', wav.i, soundPointer)
   'sox' wav.i '-b 16' outputFile 'rate -s -a 44100 dither -s'
   say 'converted' outputFile
end
Title: Re: USB Audio
Post by: Fahrvenugen on March 04, 2017, 04:55:23 pm
The CM108 chip in the Trend only appears to support the playback of 16 bit 44.1 and 48kHz PCM data, so the 10 & 20 kHz system audio files sound distorted for that reason, while a frequency converter in the system would fix that, a simpler solution is to replace the system sound files with 16bit 44.1kHz versions.

Good to hear that it is working with the CM108 (as long as the sample rates of the original files are correct).  There is a ton of USB stuff that uses that chipset - from the cheap USB audio dongles that you can find on ebay for $1 to $5, a ton of USB headsets.  I'd also be interested to find out if it works with the Texas Instruments PCM-2900/2902  series chipset which also gets used in a lot of USB audio gear.
Title: Re: USB Audio
Post by: Wim Brul on March 04, 2017, 06:25:52 pm
Nice Neil,

I wonder if you would need the following to ensure stereo output:
Code: [Select]
'sox' wav.i '-b 16' outputFile 'channels 2 rate -s -a 44100 dither -s'

Wim
Title: Re: USB Audio
Post by: Dave Yeo on March 04, 2017, 06:57:26 pm
You could try compressing the wav files to flac (about 50% compression) or vorbis (10%?) which should still work as system sounds. Easiest is to just right click the wav and use the convert menu.
Title: Re: USB Audio
Post by: Lars on March 05, 2017, 03:44:51 pm
....
Actually, supporting 11.025 kHz or 22.05 kHz can be accomplished by inserting zeros in between the samples (3 zeros for 11.025 kHz and 1 zero for 22.05 kHz) and then convolving with a low pass filter window...

There exist sophisticated algorithm for sample rate conversion but we definitely will not need them on OS/2 IMHO. Though putting zeros into the stream I would consider one of the worst solution. A much better and adequate approach (IMHO) would be inserting the same sample a second time for making 22.05 to 44.1 conversion. A slightly better algorithm would be inserting the mean value of two neighbor samples in between.

You did not read properly. I said to add in zeros and THEN to convolve with a low pass filter window. There is nothing sophisticated about that. And using a proper window (say dolph-chebychev) instead of doing linear interpolation gives a much better result at only very little additional cost.
Title: Re: USB Audio
Post by: Andi B. on March 06, 2017, 09:29:40 am
Quote
..add in zeros and THEN to convolve with a low pass filter window..
If I understand correctly then this would lower the output level. My suggestions do not change sound level (less than one LSB max.). Low pass filtering is done after the DAC anyway. Absolutely no need to do anything here in software except if you plan high perfomance audio processing. Which I doubt is of any use for OS/2 and is definitely not doable with any of these USB audio toys. 

The simplest solution (doubling each sample for 22.05 to 44.1 conversion) is better than anything you can get out of these creepy USB toys anyway. Even on good sound cards (which are not available for OS/2) you hardly will find someone who can even measure the difference to more sophisticate algorithm at the analog output. And I bet you will not find anyone in the OS/2 community who can hear the difference in a blind test.
Title: Re: USB Audio
Post by: Neil Waldhauer on March 06, 2017, 07:37:20 pm
I have tried converting to FLAC and OGG just from the context menu. On my eCS 2.2 b2 system, this does not result in a playable file for either format. I understand more work has been done on these codecs.

I tried modifying the sox command to produce 2 channel files. This seems to fix all problems I had with a few files. I tried playing one of the QT games, and early in the play, I got a trap in the USB driver. (see attached photo of trap screen) Converting the sound file eliminates the trap.

Now I an suspicious that any WAV file might need converting unless it is already 2 channel 16 bit 44.1 KHz.

Modified code with new sox invocation that gives stereo
Code: [Select]
/* batch file to convert from old style wave files to
   stereo 16-bit 44.1 KHz ones. Requires sox to run.
   All sounds in the OS/2 multimedia directory are converted
   A backup named IBMSOUND.ZIP is created.
   */

soundDir = SysBootDrive() || '\MMOS2\SOUNDS'
backupZip = SysBootDrive() || '\MMOS2\IBMSOUND.ZIP'

if stream(backupZip, 'c', 'query exists') <> '' then do
   say "No backup created becuase file already exists:" backupZip
end
else do
   'zip -qr' backupZip soundDir
   if rc <> 0 then do
      say "backup file created:" backupZip
   end
end

call SysFileTree soundDir || '\*.wav', 'wav.', 'FOS'

do i=1 to wav.0
   soundPointer = lastpos('.wav', wav.i)
   outputFile = left(wav.i, soundPointer - 1) || '4.wav'
   'sox "' || wav.i || '" -b 16 -c 2 "' || outputFile || '" rate -s -a 44100 dither -s'
   if rc = 0 then do
      say 'converted' filespec('Name', outputFile)
      'copy "' ||  outputFile || '" "' ||  wav.i || '"'
      if rc <> 0 then do
         say 'Error' rc 'updating' wav.i
      end
      'del' outputFile
   end
end

return
Title: Re: USB Audio
Post by: Lars on March 06, 2017, 11:15:40 pm
Yes, I have also experienced this very same trap and even another one. "Your trap" occurs in a frequently used copy routine where the copy routine tries to copy past the end of the segment (compare SI to DSLIM: that's the "end of segment" condition on an attempt to copy in units of 4 Bytes from DS:SI to ES:DI) and even though I have a full system dump for that trap, the dump is broken in a way that I cannot do a stack trace to find out where the error originates. Too bad.

About the other trap I ran into, I know where and why it occurs but I don't yet know what would be the proper solution to fix the error.

By the way: are you using the USB Audio device attached to an external USB 2.0 hub or are you using it in a system that in principle has EHCI only but also a rate matching hub built-in ? Or is this USB Audio device really a USB 2.0 device  (which I doubt) ?

Posting the device descriptor (copied from USBRES.EXE) would help. If the device is USB 1.x, it's a problem with USBEHCD.SYS having to do special processing when handling USB 1.x isochronous devices. That stuff is not really well tested.


Title: Re: USB Audio
Post by: Lars on March 06, 2017, 11:25:26 pm
Quote
..add in zeros and THEN to convolve with a low pass filter window..
If I understand correctly then this would lower the output level. My suggestions do not change sound level (less than one LSB max.). Low pass filtering is done after the DAC anyway. Absolutely no need to do anything here in software except if you plan high perfomance audio processing. Which I doubt is of any use for OS/2 and is definitely not doable with any of these USB audio toys. 

The simplest solution (doubling each sample for 22.05 to 44.1 conversion) is better than anything you can get out of these creepy USB toys anyway. Even on good sound cards (which are not available for OS/2) you hardly will find someone who can even measure the difference to more sophisticate algorithm at the analog output. And I bet you will not find anyone in the OS/2 community who can hear the difference in a blind test.

No, if you properly choose the window coefficients, you will not lower the output level, instead it will properly "fill up" the gaps between the original samples. For example, if you properly choose the window coefficients, a DC signal will still be a DC signal with the "gaps filled in" to the very same level as the original samples. I am not sure if this is dramatic but just repeating the samples will lead to distortion that might not be too good for earphones for example. In other words: it might not only be a question of quality.
Title: Re: USB Audio
Post by: Neil Waldhauer on March 07, 2017, 01:09:10 am
By the way: are you using the USB Audio device attached to an external USB 2.0 hub or are you using it in a system that in principle has EHCI only but also a rate matching hub built-in ? Or is this USB Audio device really a USB 2.0 device  (which I doubt) ?

Posting the device descriptor (copied from USBRES.EXE) would help. If the device is USB 1.x, it's a problem with USBEHCD.SYS having to do special processing when handling USB 1.x isochronous devices. That stuff is not really well tested.

Sadly, I do not know what the hardware looks like. All the ports claim to be USB 3.0, yet USBEHCI can still get a USB 2.0 connection on all ports. The computer is a ThinkCentre M92p tiny form factor. I was using one of the rear ports.

I also do not know how to use USBRES to get a device descriptor.
Title: Re: USB Audio
Post by: Lars on March 07, 2017, 07:32:57 am
Open USBRES.EXE (it's in \ecs\bin folder).
Select the device that is the sound device (should be able to guess from the Product name).
Now, right click on the device, "view device report" will show in the appearing context menu.
Click on the context menu entry.
A window "Device Report View" will pop up. Copy everything in the window (can be fairly long and you will need to scroll) and paste it here.

By the way: what driver version of USBEHCD.SYS are you using ? Seems you are using AN 11.14, correct ? Unfortunately, for that I don't have a map file, therefore I cannot locate the point of the trap (it's not at the same CS:IP as the trap that I had even though the error is similar).
You will need to report the trap on the AN bugtracker.


Thanks !
Title: Re: USB Audio
Post by: Neil Waldhauer on March 07, 2017, 04:52:04 pm
I looked at the version, and it appears to be Arca Noae 11.12. I will experiment with 10.215 next.

The device report for the sound device is here.

Code: [Select]
<<< Device Description >>>
 Type            : 01
 USB Rev         : 110
 Class           : Reserved (0)
 Subclass        : Reserved (0)
 Protocol        : Reserved (0)
  Device Information is defined at interface Level
 Max. packetsize : 08
 Vendor  ID      : 0D8C
 Product ID      : 0014
 Device Release# : 0100
 Strings:
  Manufacturer Name : C-Media Electronics Inc.
  Product Name      : USB Audio Device
  Serial number     : Not implemented
 Number of Configurations : 1

 Configuration 0 :
  Lenght     : 253
  Name       : <NONE>
  Value      : 1
  Attributes : 0x80
  Power      : 100 mA
  Interfaces : 4

  Interface 0
   Alt Setting : 0
   Name        : <NONE>
   Class       : Audio
   SubClass    : AudioControl
   Protocol    : Not used(0)
   Endpoints   : 0
     Audiocontrol CS Interface Descriptor
     Length  : 10
     Type    : 0x24
     Subtype : 0x01
    Header :
     Audio Device Class Release Number : 0100
     Max size of AudioControl interface descriptor. : 16205
     Number of AudioStreaming and MIDIStreaming interfaces : 2
      1. Streaming interface on Device Interface 1
      2. Streaming interface on Device Interface 2
     Audiocontrol CS Interface Descriptor
    Input Terminal :
     Length  : 12
     Type    : 0x24
     Subtype : 0x02
     Unique Terminal ID       : 1
     Terminal Type            : 0x0101
     Assoc. Terminal ID       : 0
     Number of Log. Channels  : 2
     Spatial channel location : 0x0003
     Name of Channel          : Not Implemented
     Name of Terminal         : Has Index 12(GetString Error -225)
     Audiocontrol CS Interface Descriptor
    Input Terminal :
     Length  : 12
     Type    : 0x24
     Subtype : 0x02
     Unique Terminal ID       : 2
     Terminal Type            : 0x0201
     Assoc. Terminal ID       : 0
     Number of Log. Channels  : 1
     Spatial channel location : 0x0001
     Name of Channel          : Not Implemented
     Name of Terminal         : Has Index 9(GetString Error -225)
     Audiocontrol CS Interface Descriptor
    Output Terminal :
     Length  : 9
     Type    : 0x24
     Subtype : 0x03
     Unique Terminal ID : 6
     Terminal Type      : 0x0301
     Assoc. Terminal ID : 0
     Source ID          : 9
     Name of Terminal   : Not Implemented
     Audiocontrol CS Interface Descriptor
    Output Terminal :
     Length  : 9
     Type    : 0x24
     Subtype : 0x03
     Unique Terminal ID : 7
     Terminal Type      : 0x0101
     Assoc. Terminal ID : 0
     Source ID          : 8
     Name of Terminal   : Not Implemented
     Audiocontrol CS Interface Descriptor
    Selector Unit :
     Length  : 7
     Type    : 0x24
     Subtype : 0x05
     Unique Unit ID    : 8
     Input pins        : 1
      Pin 0 is Connected to Unit 1
      Pin 1 is Connected to Unit 10
     Name of Selector Unit : Has Index 10(GetString Error -225)
     Audiocontrol CS Interface Descriptor
    Feature Unit :
    Length  : 10
    Type    : 36
    Subtype : 6
    Dumped Data :
     09 0F 01 01 02 02
     00 09
     Unique Unit ID  : 9
     Source ID       : 15
     Size of Control Item  : 1
     ControlMap for Master : 0x01
     ControlMap for Channel 1 : 0x02
     ControlMap for Channel 2 : 0x02
     Name of Feature Unit : Has Index 9(GetString Error -225)
     Audiocontrol CS Interface Descriptor
    Feature Unit :
    Length  : 9
    Type    : 36
    Subtype : 6
    Dumped Data :
     0A 02 01 43 00 00
     09
     Unique Unit ID  : 10
     Source ID       : 2
     Size of Control Item  : 1
     ControlMap for Master : 0x43
     ControlMap for Channel 1 : 0x00
     Name of Feature Unit : Has Index 9(GetString Error -225)
     Audiocontrol CS Interface Descriptor
    Feature Unit :
    Length  : 9
    Type    : 36
    Subtype : 6
    Dumped Data :
     0D 02 01 03 00 00
     0D
     Unique Unit ID  : 13
     Source ID       : 2
     Size of Control Item  : 1
     ControlMap for Master : 0x03
     ControlMap for Channel 1 : 0x00
     Name of Feature Unit : Has Index 13(GetString Error -225)
     Audiocontrol CS Interface Descriptor
    Mixer Unit :
     Length  : 13
     Type    : 0x24
     Subtype : 0x04
     Unique Unit ID    : 15
     Input pins        : 2
      Pin 0 is Connected to Unit 2
      Pin 1 is Connected to Unit 1
      Pin 2 is Connected to Unit 13
     Logical Output channels  : 3
     Spatial channel location : 0x0000
     Name of 1st log. Channel : Not Implemented
     Name of Mixer Unit : Has Index 4(GetString Error -225)

  Interface 1
   Alt Setting : 0
   Name        : <NONE>
   Class       : Audio
   SubClass    : Streaming Audio
   Protocol    : Not used(0)
   Endpoints   : 0

  Interface 1
   Alt Setting : 1
   Name        : <NONE>
   Class       : Audio
   SubClass    : Streaming Audio
   Protocol    : Not used(0)
   Endpoints   : 1
    General Endpoint Information:
     Length  : 7
     Type    : 0x24
     Subtype : 0x01
     Controls:
      - Sampling Frequency
      - Locktime 16323 ms
     Audiostreaming CS Interface Descriptor
     Format Type:
     Length  : 14
     Type    : 0x24
     Subtype : 0x02
      Physical Channels : 2
      Subframe size     : 2
      Bits used         : 16
      Supported Frequencies
       - 48000Hz
       - 44100Hz
       - 66825Hz

   Endpoint 0:
    Address     : 01
    Attributes  : 09
    Packetsize  : 00C8
    Interval    : 1
    General Endpoint Information:
     Length  : 7
     Type    : 0x25
     Subtype : 0x01
     Controls:
      - Sampling Frequency
      - Locktime 16353 ms

  Interface 2
   Alt Setting : 0
   Name        : <NONE>
   Class       : Audio
   SubClass    : Streaming Audio
   Protocol    : Not used(0)
   Endpoints   : 0

  Interface 2
   Alt Setting : 1
   Name        : <NONE>
   Class       : Audio
   SubClass    : Streaming Audio
   Protocol    : Not used(0)
   Endpoints   : 1
    General Endpoint Information:
     Length  : 7
     Type    : 0x24
     Subtype : 0x01
     Controls:
      - Sampling Frequency
      - Pitch
      - Locktime 16378 ms
     Audiostreaming CS Interface Descriptor
     Format Type:
     Length  : 14
     Type    : 0x24
     Subtype : 0x02
      Physical Channels : 1
      Subframe size     : 2
      Bits used         : 16
      Supported Frequencies
       - 48000Hz
       - 44100Hz
       - 8520969Hz

   Endpoint 0:
    Address     : 82
    Attributes  : 0D
    Packetsize  : 0064
    Interval    : 1
    General Endpoint Information:
     Length  : 7
     Type    : 0x25
     Subtype : 0x01
     Controls:
      - Sampling Frequency
      - Locktime 16408 (No Unit)

  Interface 3
   Alt Setting : 0
   Name        : <NONE>
   Class       : Human Interface Device (HID)
   SubClass    : No Subclass
   Protocol    : None
   Endpoints   : 1
   HID Description:
    Length          : 09
    HID Rel. Number : 100
    Country Code    : 0000
    Descriptors     : 1
     Type          : 22
     Length        : 0
     Type          : 07
     Length        : 0

   Endpoint 0:
    Address     : 87
    Attributes  : 03
    Packetsize  : 0004
    Interval    : 2

I have now tried 10.215, and it does not trap while playing the 1-channel 16-bit 44.1 KHz sound file from Blubbels game. It still sounds wrong until converted, but it doesn't trap
Title: Re: USB Audio
Post by: Lars on March 07, 2017, 06:58:14 pm
HI Neil,

thanks for posting the device descriptor. I seem to have the very same (inside), I have the sample rates etc. and for my device it also says
"C-M" which surely stands for C-Media.

Plus: Good news, I think I have fixed the trap you had with 11.12 and even though 10.215 seems to work for you: it's a serialization issue for isochronous buffer handling and it can likely strike again at any time (for isochronous devices).
By the way: I had the same trap with USBEHCD 10.215 and that trap is now gone.

I have now added proper serialization to ALL HC drivers (USBEHCD,USBOHCD,USBUHCD). Additionally Wim has fixed an issue in USBAUDIO.SYS with not properly keeping up the correct sample rate (for any sample rate that is not a multiple of 1000 Hz).

Would you be willing to test a new set of drivers ? If yes let me know where to send the stuff ...
Title: Re: USB Audio
Post by: Neil Waldhauer on March 07, 2017, 10:01:05 pm

Would you be willing to test a new set of drivers ? If yes let me know where to send the stuff ...

OK, sure. Sent you PM with contact info.

Title: Re: USB Audio
Post by: Neil Waldhauer on March 08, 2017, 03:51:11 am
Thanks for the test driver. I installed both the USB stack and the USB audio driver.

Without them, I was able to play system sounds and PM123 sounded pretty good. Both VLC and Firefox would give a sort of a squeal when attempting to play a sound.

With the new drivers, I was able to play system sounds, PM123, VLC and Firefox. I got an occasional drop-out while watching a YouTube video.

I did not see traps, but I did not do extensive testing. I will leave these drivers installed as I go on to test other things.
Title: Re: USB Audio
Post by: Lars on March 08, 2017, 09:02:38 pm
Good to hear that it does not trap any more. That was the predominant thing to fix, obviously.
If possible you should try and play those system sound files (non sample rate converted files) that led to the trap and see if they will work without trap now.
Just today, Wim has found another bug in USBAUDIO.SYS that might also have a bearing on the problem.

About drop outs in Firefox: maybe that cannot fully be avoided. It might happen on high interrupt load. Isochronous transfer will lead to a fairly steady interrupt load. If something else is busy in the system (hard disk etc.) that might lead to a delay in interrupt processing.

Title: Re: USB Audio
Post by: Neil Waldhauer on March 09, 2017, 03:13:22 am
I have now tried a variety of the old 11 KHz and 22 KHz and 1-channel 44 KHz files. Of course they sound wrong, but none of them seem to give a trap. So I think the test build you provided has improved matters quite a bit.
Title: Re: USB Audio
Post by: Wim Brul on March 09, 2017, 12:37:59 pm
Quote
About drop outs in Firefox: maybe that cannot fully be avoided. It might happen on high interrupt load. Isochronous transfer will lead to a fairly steady interrupt load. If something else is busy in the system (hard disk etc.) that might lead to a delay in interrupt processing.

Most likely the drop outs of sound in firefox occur when the sample rate is too low to be handled in time. It probably occurred when the sound was playing too fast. The usb audio driver goes into a kind of overdrive to spit out the 16 bit stereo sound samples at a rate of 44.1 kHz. whereas the application produces say 8 bit mono sound at 8 kHz. hence lack of samples occur  i.e. drop out of sound. Moreover the overdrive operation results in an interrupt load that is in this case 2*2*44100/8000 i.e. 22 times so high. I am having sound dropouts when I play the macaw.avi file which produces 8 bit mono sound at 22.050 kHz.

Wim
Title: Re: USB Audio
Post by: Lars on March 09, 2017, 08:31:30 pm
Hi Wim,

from what I can tell from USBAUDIO.SYS tracing, Youtube will use 44.1 kHz stereo 16-bit PCM for sounds it wants to play. Therefore the dropouts when using Youtube in Firefox must stem from a different problem.
Title: Re: USB Audio
Post by: ak120 on March 09, 2017, 10:28:21 pm
Hi Wim,

from what I can tell from USBAUDIO.SYS tracing, Youtube will use 44.1 kHz stereo 16-bit PCM for sounds it wants to play. Therefore the dropouts when using Youtube in Firefox must stem from a different problem.

Do you use any add-ons or the normal youtube website? How many tabs are opened? If you want to listen to continuous sound playback from a youtube stream, simply switch to a newly opened tab. For video playback I would recommend to use HTML5 everywhere add-on, to disable all the fancy yt stuff and open the video playback in its own tab or fullscreen. The behaviour seems to be introduced with the new audio backend which relies on this kai library. You can compare it to Firefox 10 (or Seamonkey 2.7.2) where the same stuff runs smoothier on the same hardware.
Title: Re: USB Audio
Post by: Neil Waldhauer on March 10, 2017, 05:59:08 am
When playing a YouTube movie, I can run AcpiStat.exe and show the number of interrupts, and it is thousands per second.
Title: Re: USB Audio
Post by: Dave Yeo on March 10, 2017, 06:07:30 am
The audio problem seems to be caused by Mozilla switching from sydneyaudio to libcubeb. One uses a push API and the other uses a pull API.
Title: Re: USB Audio
Post by: roberto on March 11, 2017, 11:33:34 pm
My problem with youtube videos seems to have been solved simply with this:
Rem this line in config.sys and restart
REM 11-03-2017 DEVICE=C:\OS2\BOOT\USBRESMG.SYS

I have little tried but the difference is substantial.
And with different versions I appreciate important differences.
Saludos
Title: Re: USB Audio
Post by: Pete on March 12, 2017, 02:05:16 am
Hi roberto

How current is the usbresmg.sys? - It might be worth testing with Wims latest from here http://home.hccnet.nl/w.m.brul/usbcalls/


Regards

Pete
Title: Re: USB Audio
Post by: roberto on March 12, 2017, 10:36:49 am
The fact is that I was trying to use a relay plate, which I have been unable to make it work.
It seems that not only is it trying to remove the usbresmg.sys, I also have to plug the relay board to the usb, with this in the config.sys:
 DEVICE = c: \ OS2 \ BOOT \ USBECD.SYS / D: 067B: 2303: 0300 / N: $ / S / V
Before starting firefox.
Now on this computer I am using Lars usb 10.215.
From my point of view, video crashes are a problem in the usb.
Title: Re: USB Audio
Post by: Lars on March 12, 2017, 01:23:57 pm
Just to be sure,

have you ensured that USBCALLS.DLL was properly updated ?
It should be in the \OS2\DLL directory (only !) and bldlevel.exe run against USBCALLS.DLL should tell you that it's version 10.215.
I can see no reason that USBRESMG.SYS should interfere with USB audio unless you use it with something, in your case, that seems to be USBECD.SYS.
By the way: USBCALLS 10.215 is fully compatible with Wim Brul's latest USBCALLS.DLL. Wim just did some additions to the header file but that's only relevant to programmers.
Title: Re: USB Audio
Post by: roberto on March 12, 2017, 03:51:08 pm
Just to be sure,

have you ensured that USBCALLS.DLL was properly updated ?
yes, I install from another partition and have this:
2017/02/28  10:23:16  49098     C:\OS2\DLL\usbcalls.dll

Quote
It should be in the \OS2\DLL directory (only !)
Is ok.

 
Quote
and bldlevel.exe run against USBCALLS.DLL should tell you that it's version 10.215.

I have:
[C:\]bldlevel.exe c:\os2\dll\usbcalls.dll
Build Level Display Facility Version 6.12.675 Sep 25 2001
(C) Copyright IBM Corporation 1993-2001
Signature:       @#W.M.Brul:14.20170228#@USBCALLS
Vendor:          W.M.Brul
Revision:        14.20170228
File Version:    14.20170228
Description:     USBCALLS


Quote
I can see no reason that USBRESMG.SYS should interfere with USB audio unless you use it with something, in your case, that seems to be USBECD.SYS.
Yes, I have to connect the usb to the board for a good result.

Finally the firefox with youtuve, failed, but the improvement is considerable.

If I run the cmd that attach with the rem usbresmg.sys, show:
[d:\usbreles]usb-queryversion
+RxUsbQueryVersion(),RC=0x0
*RxUsbQueryVersion(),RC=0x1B58
USBCALLS 15356.6175
USBRESMG 4.0
-RxUsbQueryVersion(),RC=0x0
+RxUsbQueryNumberDevices(),RC=0x0
*RxUsbQueryNumberDevices(),RC=0x1B58
number NUMBER
-RxUsbQueryNumberDevices(),RC=0x0

0x1B58 - USB_NOT_INIT
  Library not initialized.
Code: [Select]
/* add RxUsbQueryVersion */
rc = RxFuncAdd('RxUsbQueryVersion','usbcalls','RxUsbQueryVersion')
say '+RxUsbQueryVersion(),RC=0x'd2x(rc)

/* invoke RxUsbQueryVersion */
drop DLLMajor DLLMinor /* receives usbcalls version */
drop USBMajor USBMinor /* receives usbresmg version */
rc = RxUsbQueryVersion(DLLMajor,DLLMinor,USBMajor,USBMinor)
say '*RxUsbQueryVersion(),RC=0x'd2x(rc)
say 'USBCALLS 'DLLMajor'.'DLLMinor
say 'USBRESMG 'USBMajor'.'USBMinor

/* drop RxUsbQueryVersion */
rc = RxFuncDrop('RxUsbQueryVersion')
say '-RxUsbQueryVersion(),RC=0x'd2x(rc)

/* add RxUsbQueryNumberDevices */
rc = RxFuncAdd('RxUsbQueryNumberDevices','usbcalls','RxUsbQueryNumberDevices')
say '+RxUsbQueryNumberDevices(),RC=0x'd2x(rc)

/* invoke RxUsbQueryNumberDevices */
drop Number /* receives number of devices */
rc = RxUsbQueryNumberDevices(Number)
say '*RxUsbQueryNumberDevices(),RC=0x'd2x(rc)
say 'number' number
/* drop RxUsbQueryNumberDevices */
rc = RxFuncDrop('RxUsbQueryNumberDevices')
say '-RxUsbQueryNumberDevices(),RC=0x'd2x(rc)
Title: Re: USB Audio
Post by: Lars on March 12, 2017, 04:37:07 pm
What you attempt to do will not work. There is a version crosscheck between USBCALLS.DLL and USBRESMG.SYS.
That is, you need to install them BOTH from the same package, either AN package, my package or Wim's package. You cannot mix my drivers with Wim's USBCALLS.DLL (and it is also not necessary).

Title: Re: USB Audio
Post by: Wim Brul on March 12, 2017, 05:01:08 pm
For proper result you MUST have DEVICE=C:\OS2\BOOT\USBRESMG.SYS in your CONFIG.SYS file. If you REM it out then you get RC=0x1B58.
I ran your script over here and I get USBCALLS 14.210  and USBRESMG 14.210 which is correct for with my latest set.
Title: Re: USB Audio
Post by: roberto on March 12, 2017, 05:32:00 pm
That's correct, but if I do not override usbresmg.sys, I do not have improvements with the videos. What is not exactly why?
I can also tell you that with different versions of usbresmg.sys, the program usbres.exe shows me different connected devices. Having physically the same. Without rem usbresmg.sys.
Title: Re: USB Audio
Post by: roberto on March 12, 2017, 10:50:59 pm
I have a question to Wim.
After returning the config.sys to its correct state with the usbresmg.sys and restart. Run the cmd and show me this:with 2 devices, the external devices conected. The firts time that I see 2 devices only.
[d:\usbreles]usb-queryversion
+RxUsbQueryVersion(),RC=0x0
*RxUsbQueryVersion(),RC=0x0
USBCALLS 14.210
USBRESMG 14.210
-RxUsbQueryVersion(),RC=0x0
+RxUsbQueryNumberDevices(),RC=0x0
*RxUsbQueryNumberDevices(),RC=0x0
number 4
-RxUsbQueryNumberDevices(),RC=0x0

The question, Is it normal for the device list to show me the internal devices?
And I ask this because I only have two accessories connected. One wifi mouse, and relay board2303.
When I show the other two internal usb, if I pulse the wifi on / off one of them disappears and appears.

The 2 internal devices are:
<<< Device Description >>>
 Type            : 01
 USB Rev         : 200
 Class           : Unknown class E0
 Subclass        : Unknown Subclass E0
 Protocol        : Unknown Protocol E0
 Max. packetsize : 40
 Vendor  ID      : 03F0
 Product ID      : 231D
 Device Release# : 0306
 Strings:
  Manufacturer Name : Broadcom Corp
  Product Name      : HP Integrated Module
  Serial number     : Not implemented
 Number of Configurations : 1
----------------------------------------------
<<< Device Description >>>
 Type            : 01
 USB Rev         : 110
 Class           : Vendor specific
 Subclass        : Vendor specific
 Protocol        : Vendor specific
 Max. packetsize : 08
 Vendor  ID      : 138A
 Product ID      : 0007
 Device Release# : 0072
 Strings:
  Manufacturer Name : Not implemented
  Product Name      : Not implemented
  Serial number     : 00a058c13587
 Number of Configurations : 1
-----------------
saludos
Title: Re: USB Audio
Post by: Wim Brul on March 13, 2017, 11:51:12 am
Hallo Roberto,

Quote
The question, Is it normal for the device list to show me the internal devices?
And I ask this because I only have two accessories connected. One wifi mouse, and relay board2303.
When I show the other two internal usb, if I pulse the wifi on / off one of them disappears and appears.

It is normal that both the internal and external connected devices are shown in the device list.
It is possible on some systems  that the bios allows you to enable/disable internal connected devices.
There are devices that disappear/ reappear as part of their device specific initialization sequence.

The 03F0:231D device - Broadcom Corp HP Integrated Module - is one of those device that first appears as one type of device and later on (after disappear/reappear) shows op as a different type of device.

The 138A:0007 device - is your Fingerprint Reader.

Regards