Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2012-05

Linux sound (especially MIDI) programming: ALSA?

8 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Mark Morgan Lloyd

Has anybody used FPC to control ALSA on Linux? I need to filter a MIDI stream in real time, and handle transposition etc.

If anybody knows of useful resources I'd appreciate any hints.

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email

Wimpie Nortje
to Mark Morgan Lloyd

I have used ALSA to record sound. It was some time ago, I think on Kubuntu 10.04 or so.

I can send you some code I used but I have no idea whether it will work under newer Linux's

Mark Morgan Lloyd wrote 5 lines
Has anybody used FPC to control ALSA on Linux? I need to filter a MIDI stream in real time, and handle transposition etc. If anybody knows of useful resources I'd appreciate any hints.

Reply by email

Mark Morgan Lloyd
to Wimpie Nortje
Wimpie Nortje wrote 5 lines
I have used ALSA to record sound. It was some time ago, I think on Kubuntu 10.04 or so. I can send you some code I used but I have no idea whether it will work under newer Linux's

Thanks, but since it's specifically MIDI I'm interested in it might not be relevant.

Can you remember which Pascal interface to the ALSA libraries you were using? I think I've seen two, but I've not yet checked to see whether they were actually minor variants of the same thing.

Show quoted text 6 lines
On 2012/05/06 10:09 AM, Mark Morgan Lloyd wrote: > Has anybody used FPC to control ALSA on Linux? I need to filter a MIDI > stream in real time, and handle transposition etc. > > If anybody knows of useful resources I'd appreciate any hints.
Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email

Wimpie Nortje
to Mark Morgan Lloyd
Mark Morgan Lloyd wrote 15 lines
Wimpie Nortje wrote: > I have used ALSA to record sound. It was some time ago, I think on > Kubuntu 10.04 or so. > > I can send you some code I used but I have no idea whether it will work > under newer Linux's Thanks, but since it's specifically MIDI I'm interested in it might not be relevant. Can you remember which Pascal interface to the ALSA libraries you were using? I think I've seen two, but I've not yet checked to see whether they were actually minor variants of the same thing.

The readme file says:

ALSAPAS (ALSA library for Pascal)
Version 0.9.7, September 2003.

Copyright (c) 2002-2003, Pedro Lopez-Cabanillas

Reply by email

Mark Morgan Lloyd
to Wimpie Nortje: The readme file says: ALSAPAS (ALSA library for Pascal) Version 0.9.7, September 2003.…
Wimpie Nortje wrote 21 lines
On 2012/05/06 05:49 PM, Mark Morgan Lloyd wrote: > Wimpie Nortje wrote: >> I have used ALSA to record sound. It was some time ago, I think on >> Kubuntu 10.04 or so. >> >> I can send you some code I used but I have no idea whether it will work >> under newer Linux's > Thanks, but since it's specifically MIDI I'm interested in it might > not be relevant. > > Can you remember which Pascal interface to the ALSA libraries you were > using? I think I've seen two, but I've not yet checked to see whether > they were actually minor variants of the same thing. > > The readme file says: ALSAPAS (ALSA library for Pascal) Version 0.9.7, September 2003. Copyright (c) 2002-2003, Pedro Lopez-Cabanillas

Hence http://perso.wanadoo.es/plcl/alsapas/alsapas-en.html

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email

Mark Morgan Lloyd
to leledumbo: http://sourceforge.net/projects/fpalsa/ http://sourceforge.net/projects/humus/ View this…
leledumbo wrote

Thanks for those. Also
http://perso.wanadoo.es/plcl/alsapas/alsapas-en.html so as I thought there appears to be (at least) two sets of ALSA bindings: fpalsa and alsapas.

Noted HuMuS, but that appears to be for PortAudio. However using that as a seed I get to http://breakoutbox.de/pascal/pascal.html#PortAudio which claims to include PortMidi support- this is supposedly cross-platform but requires an additional library which might not be available on all distreaux. Also MIDI is very much the "poor cousin" and operating support is patchy, so since I've got ALSA working I'm reluctant to risk breaking anything.

Since running on anything other than Linux is not a significant priority, I think I'll probably start off with by doing a comparison of fpalsa and alsapas, and writing code that will support either if possible. If I could also code to support PortMidi that would be a bonus, but by no means essential: I'm trying to knock together a MIDI transposer for my own use, and testbed some techniques for another project.

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email

Mark Morgan Lloyd
to Mark Morgan Lloyd
Mark Morgan Lloyd wrote 23 lines
leledumbo wrote: > http://sourceforge.net/projects/fpalsa/ > http://sourceforge.net/projects/humus/ Thanks for those. Also http://perso.wanadoo.es/plcl/alsapas/alsapas-en.html so as I thought there appears to be (at least) two sets of ALSA bindings: fpalsa and alsapas. Noted HuMuS, but that appears to be for PortAudio. However using that as a seed I get to http://breakoutbox.de/pascal/pascal.html#PortAudio which claims to include PortMidi support- this is supposedly cross-platform but requires an additional library which might not be available on all distreaux. Also MIDI is very much the "poor cousin" and operating support is patchy, so since I've got ALSA working I'm reluctant to risk breaking anything. Since running on anything other than Linux is not a significant priority, I think I'll probably start off with by doing a comparison of fpalsa and alsapas, and writing code that will support either if possible. If I could also code to support PortMidi that would be a bonus, but by no means essential: I'm trying to knock together a MIDI transposer for my own use, and testbed some techniques for another project.

To wrap this up, alsapas is a translation of the ALSA headers etc. as of v0.9.7, and fpalsa is similar but corresponds to the slightly later v1.0.24. They have a slightly different style in that alsapas uses variable parameters while fpalsa uses pointers to be a bit closer to the original (and possibly to allow null parameters); alsapas is attractive in that it's got useful examples.

As far as MIDI is concerned, alsapas still works but there's a handful of parameters named "out" that are no longer compatible with FPC, I've followed the author's convention and renamed those to _out; basic operation appears OK on Debian "Squeeze" x86 with a 3.2 kernel.

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email