Find the answer to your Linux question:
Results 1 to 3 of 3
Hey all, I plan on writing a audio program under linux using C. The program should read a continuous input sound stream, and output that very stream, but with a ...
  1. #1
    Just Joined!
    Join Date
    Dec 2003
    Posts
    41

    Need some advice (linux sound programming; C)

    Hey all,

    I plan on writing a audio program under linux using C. The program should read a continuous input sound stream, and output that very stream, but with a slight delay (delayed auditory feedback).

    I have done quite a lot of program under linux and I'm very well acquainted with C. I can use file descriptors and the like. But I'm still at a loss as how to approach this. Maybe its because I've never done any sound programming before. Can anyone offer some tips, tutorials, etc? Any guidance is welcome. Maybe even some example code

    Thanks.

  2. #2
    Trusted Penguin Cabhan's Avatar
    Join Date
    Jan 2005
    Location
    Seattle, WA, USA
    Posts
    3,230
    Alrighty. I've never done sound work either (except for a tiny introduction to manipulating Vorbis data), but here's what I imagine we need.

    We will need to somehow access the output stream and write to it. We will also need to somehow decode the input stream. Depending on what the source is (file or microphone stream), we will need to read from it differently.

    If we're reading from or writing to a device of some sort, then I imagine that ALSA has the API we need. This will allow us to open the devices properly, set parameters, and read/write.

    If we're decoding, then we need the specific library. libvorbis allows you to work with Vorbis files, MAD allows you to work with MP3, etc.

    As for the delay, depending on what you mean, there may be a parameter, or you can make great use of the sleep() function.

    Anyway, let me know if you get any ideas. I'd be interested.
    DISTRO=Arch
    Registered Linux User #388732

  3. #3
    Just Joined!
    Join Date
    Dec 2003
    Posts
    41
    Hi Cabhan,

    So far I've been looking at the OSS and ALSA APIs. But they are very low level type APIs. Thats is, they seem (IMO) to require a lot of overhead. This may not be totally true; but its what I've gathered so far in my research.

    In a quest for a more simpler API, I've come across JACK.
    JACK | connecting a world of audio

    They have unique (audio server) approach to the audio thing. So far it seems quite straight forward when compared to OSS, ALSA, et al. I'll have to read up more on it though. I'm currently taking to the guys on jack-dev mailing list to see what I can get out of their API.

    btw, the input signal comes from a microphone, so I don't think I'll need any libs for that.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...