Menu

Sphinx2 on Linux with stereo-only sound card

2001-11-08
2012-09-22
  • Peter Gober

    Peter Gober - 2001-11-08

    At least ad_oss.c assumes, that the sound device always outputs 2 bytes per sample (which is 16 bits mono).

    The "OSS programmer's guide 1.11" says, that while the default format is mono, this is not always true and some devices simply don't support mono mode.

    Unfortunately, we have the problem, that we would like to use Sphinx with a i810 on-board audio device. This doesn't support mono mode (only stereo) and by default outputs 4 bytes per sample. (Any ioctl() setting it to mono fails.) Sphinx simply doesn't work.

    Two questions:

    - Did anybody already modify Sphinx to work with stereo-only devices?

    - It would be nice for future versions of Sphinx at least to check whether mono is supported by the sound device and to abort with an error message if it is not.

    Regards -

    Peter
    mailto: peter.gober@ieee.org

     
    • anselme dewavrin

      Strange problem... I mean that recording from
      a microphone is usually in mono mode.

      Anyway the simplest solution is to modify a bit
      the code so that it "skips" two bytes for every
      block of four bytes. For instance, for windows
      the modification
      should be placed in the rec_win32.c file, in
      the ad_read() function: the line
      memcpy (buf, sysbufp + r->curoff, t * sizeof(int16));
      should be replaced by a "for" loop to copy one
      sample and skip the other one.

      For other platforms it should be similar.

       

Log in to post a comment.