OpenBSD Journal

Developer Blog ratchov@: development of the envy(4) sound driver

Contributed by jl on from the can-you-hear-me dept.

Alexandre Ratchov (ratchov@) writes in about the envy(4) driver which he has just enabled on i386 and amd64 platforms.
The envy(4) driver is for "professional" audio interfaces based on the VIA Envy24 chip, like the M-Audio Delta 1010, currently only AK4524 codecs are supported. Such cards can play and record up to 10 audio streams in full-duplex. They use 24-bit sample precision and can work at 96kHz sample frequency. The hardware design is very simple and elegant compared to typical over-engineered "consumer-grade" cards, so the driver code is very simple; this is good for its maintainability and robustness.
From the user point of view this allows one to do multi-channel recordings, for instance to simultaneously record voice, guitar and piano on separate tracks, so they can be mixed and processed later. Unfortunately there are few applications that support 10-channel 24-bit sample formats, however one example is the audacity port.

From the developers point of view, having a driver that supports 24-bit formats and many channels gives the basics (a kind of "playground") for working on the generic audio layer (code common to all drivers) and on userland code. Indeed, to improve usability of envy-like cards (ie support for advanced audio), various interesting changes and features are required. Some of which are:
  • make the mixer multi-channel
  • add a generic format and sample rate converter
  • allow multiple soft audio devices to share a single physical device
All sound devices, not just envy(4), would benefit from such changes.
Alas that's a lot of work...
If you have an envy(4) device please provide feedback to ratchov@ and help test this in time for the 4.3 release.

(Comments are closed)


Comments
  1. By Anonymous Coward (169.244.143.119) on

    Even though I don't use OpenBSD for audio recording and mixing, a positive technical endorsement from a developer is important to me when considering a hardware purchase.

    Comments
    1. By Anonymous Coward (91.21.79.46) on

      > Even though I don't use OpenBSD for audio recording and mixing, a positive technical endorsement from a developer is important to me when considering a hardware purchase.

      Yes Sir, a firewall with sound. I like it *g*

      Comments
      1. By Paladdin (213.97.233.52) on

        >
        > Yes Sir, a firewall with sound. I like it *g*

        Du'h, OBSD is more than a firewall, but a robust and clean base for developing anything you are wishing to play with.

        Sure it excels at firewall and routing, but we should not take the name of the part to refer to the whole, are we? ;)

    2. By Anonymous Coward (169.244.143.119) on

      > Even though I don't use OpenBSD for audio recording and mixing, a positive technical endorsement from a developer is important to me when considering a hardware purchase.

      Looks like other systems also have trouble with audio recording:
      http://www.linux.com/feature/126408

      "M-Audio has supplied hardware and software to computer-based musicians for 20 years. Its new "make-music-now" line of products, aimed at musicians just getting into computers or PC users with an interest in music, includes a microphone, speakers, drum machine, and DJ mixer deck. Unfortunately, its bundled software, called Session, is for Windows only. Our challenge was to try out this hardware -- specifically the KeyStudio MIDI keyboard and Fast Track audio interface -- with Linux applications. We were half successful."

      Comments
      1. By Anonymous Coward (213.41.142.105) on

        >
        > Looks like other systems also have trouble with audio recording:
        > http://www.linux.com/feature/126408
        >

        That's insane, computers are capable of playing and recording audio since several years; this task is not more complicated today than ten years ago. Recording is very simple: it's just storing samples issued by the ADC in memory. Nothing more is done by recent audio chips.

        MIDI is even simpler, it's a dumb serial port, and the protocol is 25 years old, very simple but powerful enough.

        However hardware is becoming more an more complicated, to the point that it is now hard to support recent cards. IMO, it's not normal to have 6000 lines of C to make the integrated sound chip of a recent board work.

        So if i'm in trouble for such simple tasks, i'd assume that the hardware or the software (or both) are just crappy.

        -- my 2 cents

        Comments
        1. By Jacob Meuser (71.237.209.121) jakemsr@sdf.lonestar.org on

          > >
          > > Looks like other systems also have trouble with audio recording:
          > > http://www.linux.com/feature/126408
          > >
          >
          > That's insane, computers are capable of playing and recording audio since several years; this task is not more complicated today than ten years ago. Recording is very simple: it's just storing samples issued by the ADC in memory. Nothing more is done by recent audio chips.
          >

          not entirely true. multichannel audio is far more prevalent now than
          10 years ago.

          > MIDI is even simpler, it's a dumb serial port, and the protocol is 25 years old, very simple but powerful enough.
          >
          > However hardware is becoming more an more complicated, to the point that it is now hard to support recent cards. IMO, it's not normal to have 6000 lines of C to make the integrated sound chip of a recent board

          if by "integrated sound chip" you are referring to ac97(4) and azalia(4), you can't compare the driver size to a "normal" driver.
          ac97(4) and azalia(4) support multiple codecs and multiple controllers.
          "normal" drivers do not. and as far as comparing driver size with
          older hardware, take a look at the gus(4) driver ...

          >
          > So if i'm in trouble for such simple tasks, i'd assume that the hardware or the software (or both) are just crappy.
          >
          > -- my 2 cents
          >

  2. By Anonymous Coward (24.37.242.64) on

    Awesome stuff man! Thank you!

  3. By Frank (129.143.6.145) on

    Lovely! I recently thought about the possibility to use OBSD in our jam place to do some recordings. Well I guess I have to have a look at those envy cards.

  4. By Anonymous Coward (66.225.173.140) on

    The chaintech av-710 is an envy24 card. Runs about 25$ these days.

    Comments
    1. By Alexandre Ratchov (213.41.142.105) on

      > The chaintech av-710 is an envy24 card. Runs about 25$ these days.
      >
      >

      chaintech av-710 seems to use the Envy24HT chip (note the "HT" suffix) which is not the same as Envy24, so it will not work with the envy(4) driver.

  5. By Anonymous Coward (62.34.182.27) on

    * allow multiple soft audio devices to share a single physical device


    So we can have multiple audio streams open at once ?
    For example xmms and vlc can play in the same time with software mixing ?
    /dev/audio is no more exclusive ?

    Comments
    1. By Alexandre Ratchov (213.41.142.105) on

      /dev/audio is exclusive, and will remain exclusive for a long time. However to get advantage of some nice features of envy-like cards (like allocating monitoring channels to a different device), we'll need a "converter" that, later, will ease changing /dev/audio not to be exclusive.

    2. By Jacob Meuser (71.237.209.121) jakemsr@sdf.lonestar.org on

      > * allow multiple soft audio devices to share a single physical device
      >
      >
      > So we can have multiple audio streams open at once ?
      > For example xmms and vlc can play in the same time with software mixing ?

      I believe they both support esd, so, you could do that already.

      if not, I know it will work with jack, as I have already done so.

      > /dev/audio is no more exclusive ?

      to make that possible will take a -lot- of work.

  6. By Anonymous Coward (85.101.43.178) on

    So, this will fix ac97 48000 Hz issue too; right?

    Comments
    1. By Alexandre Ratchov (213.41.142.105) on

      > So, this will fix ac97 48000 Hz issue too; right?

      sure; if we add a converter, this would fix the 48kHz issue.

    2. By Anonymous Coward (216.138.195.228) on

      > So, this will fix ac97 48000 Hz issue too; right?

      What issue?

      Comments
      1. By Anonymous Coward (213.41.142.105) on

        certain cards support only 48kHz sample rate, so applications that require 44.1kHz (for instance) don't work properly

        Comments
        1. By Brad (216.138.195.228) brad at comstyle dot com on

          > certain cards support only 48kHz sample rate, so applications that require 44.1kHz (for instance) don't work properly

          Fix the app to do resampling or use a sound server.

          Comments
          1. By Anonymous Coward (85.101.14.175) on

            > > certain cards support only 48kHz sample rate, so applications that require 44.1kHz (for instance) don't work properly
            >
            > Fix the app to do resampling or use a sound server.

            I appreciate your help but sound servers are slow and some apps don't support them. Referring to third party apps and other operating systems would be off topic. So, I won't do it.

            Comments
            1. By Brad (216.138.195.228) brad at comstyle dot com on

              > > > certain cards support only 48kHz sample rate, so applications that require 44.1kHz (for instance) don't work properly
              > >
              > > Fix the app to do resampling or use a sound server.
              >
              > I appreciate your help but sound servers are slow and some apps don't support them. Referring to third party apps and other operating systems would be off topic. So, I won't do it.

              Nothing else is going to change.

            2. By Jacob Meuser (71.237.209.121) jakemsr@sdf.lonestar.org on

              > > > certain cards support only 48kHz sample rate, so applications that require 44.1kHz (for instance) don't work properly
              > >
              > > Fix the app to do resampling or use a sound server.
              >
              > I appreciate your help but sound servers are slow.

              that's simply not true. I run artsd with approx 45ms latency, and it
              uses about 3% cpu when it's actually running and resampling, on a not
              so new machine.

              > and some apps don't support them.

              true, but most anything decently useful or recent does. e.g, after
              ports unlocks, I am going to fix SDL so you can use anything that
              uses SDL for audio with arts or esd. and jack is coming to the
              picture soon after as well. hell, I'm currently running artsd
              as a jack client ...

              > Referring to third party apps and other operating systems would be off topic. So, I won't do it.

              then what did you mean by "sound servers are slow"?

  7. By Anonymous Coward (88.192.78.86) on

    There has been long thread in gmane.os.openbsd.misc about
    the ultimate goal of OpenBSD. If this driver makes
    OpenBSD mode media-sexy, fine. If this driver makes its creator
    a better programmer, fine. But is the goal to make OpenBSD
    the world's most secure media player?

    Comments
    1. By Alexandre Ratchov (213.41.142.105) on

      Sure!

      But our ultimate goal is to have the most secure multi-tracker in order to protect the musician against malicious chords captured by the microphone (you never know with who you're jamming). We've already started adding some audio filtering rules in pf(4), like the following:

      block in quick on audio1 humpa

      We're also working on audio device virtualization, it will bring us additional security and reliability, as noted on misc@ recently

      Comments
      1. By ahafey (82.69.184.245) on

        > Sure!
        >
        > But our ultimate goal is to have the most secure multi-tracker in order to protect the musician against malicious chords captured by the microphone (you never know with who you're jamming). We've already started adding some audio filtering rules in pf(4), like the following:
        >
        > block in quick on audio1 humpa
        >
        > We're also working on audio device virtualization, it will bring us additional security and reliability, as noted on misc@ recently
        >

        ROFL!

        block in quick on audio1 riaa

        every mixers dream...

  8. By Planner (194.44.175.234) on

    if AK4358 DAC will be supported too, ESI Juli@ will be my next soundcard.

    Still using old Creative SB Live! here (not -5.1, and not -24 one - that old with M-Audio chips)...

Credits

Copyright © - Daniel Hartmeier. All rights reserved. Articles and comments are copyright their respective authors, submission implies license to publish on this web site. Contents of the archive prior to as well as images and HTML templates were copied from the fabulous original deadly.org with Jose's and Jim's kind permission. This journal runs as CGI with httpd(8) on OpenBSD, the source code is BSD licensed. undeadly \Un*dead"ly\, a. Not subject to death; immortal. [Obs.]