[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Sound - handmade how?

On Thu, Oct 8, 2009 at 02:01, Alexey Salmin <alexey.salmin@gmail.com> wrote:
> You should select some engine to work with.
> You can work directly with ALSA (that will tie you to linux), or for
> example use Phonon architecture - that is portable in terms of OS but
> will tie you to kdelibs.

Phonon has dropped down a level, and is now part of QT (>=4.4), not KDE
(although KDE still uses it of course, just like any other QT component)

On Thu, Oct 8, 2009 at 23:17, David Christensen
<dpchrist@holgerdanske.com> wrote:
> Hartwig Atrops wrote:
>> I want to write a program that generates sounds - sinus waves, random
>> sound and so on. What is the format I can send to the sound card? Which
>> device to use? The program should work on different architectures (i386,
>> sparc ...)
> I wrote an audio recorder and audio player based on the Open Sound System
> (OSS) API back in 2002.  Compiling and testing just now, my stuff doesn't
> work (no /dev/dsp on Debian 5.0.3 desktop OOTB).  :-(
> FWIW, I used the OSS Programmer's Guide:
>    http://www.opensound.com/pguide/oss.pdf

OSS is effectively dead on Linux. The OSS emulation from ALSA was
always limited, and more recently it hasn't had much work to even
keep it from bit-rotting. Fedora recently stopped turning on OSS emu
by default, other distros will probably follow sooner or later.

> Advanced Linux Sound Architecture (ALSA) was an upcoming, competing API at
> the time.
> Now I see references to Pulse Audio.
> So, I'm also curious as to the how to read/ write audio devices (and files)
> on modern Linux...

Well, it is still somewhat in flux, and certainly messy at the moment.

short answers:
2. the safe ALSA sub-set [1]
3. possibly Portaudio

for more, keep reading

(see also this chart I made:
www.clowersnet.net/~krc/computers/realistic_linux_audio_v2.png )

PulseAudio is a sound server, and it is pretty well inevitable that
everything will move to it. Note that as a sound server, PA needs
an underling sound system/drivers, namely ALSA.

There is also JACK which is focused solely on pro audio production,
but fits in about the same space as PA (PA is desktop audio-oriented
at this time).

Libao and PortAudio are low-level abstraction APIs (abstracting
OSS/ALSA/CoreAudio/Windows Audio).

In the realm of things that are related, but not really important for this
project, there is gstreamer which is more about codecs and such high
level concepts (e.g. it can replace xine)

Phonon is the QT/KDE audio abstraction API. It does not do anything
by itself, it just lets QT/KDE apps not worry about whether they are
using xine or gstreamer or whatever.

So what do you use?

JACK is specifically oriented to audio production, and works on
Linux, *BSD, Solaris, Mac OS X, and even Windows. This might
be your best bet.

If you are ok with just Linux, ALSA could work, if you use the "safe
ALSA subset" it will also talk to PA just fine (although PA is too
high latency for many audio production apps).

PortAudio might be good if you want a basic audio abstraction.

[1] http://0pointer.de/blog/projects/guide-to-sound-apis.html

Kelly Clowers

Reply to: