Skip to contentSkip to conversation

Back to basics

DISCUSSION Richard Jones 1 participant 1 message Sep 28, 2005

lore
Share & tools
lore
#0 lore raw

Hi all

I have what I am hoping is a very basic question and the answer will help me better understand ALSA and how it works.

What I want to do is write a simple program that lists the available midi devices currently connected to my machine and I can then choose one and capture the input from that midi device.

I think it best to break it down into the components

1. I connect my Yamaha keyboard to my laptop and it is assigned to one of the midi devices in /dev/snd/midi????. Is there a way with ALSA to list the devices that are currently valid or a way of working it out in a program. I have seen "pmidi -l" but that gives me a list of ports that I don't know how to relate back to the device names in /dev/snd. Similarly, rawmidi requires me to know which device has been allocated to my keyboard. I have seen music applications using ALSA that produce a pull down list of valid devices to choose from. How do they work that out?

2. I want to read the midi stream coming in from the piano and just translate it into its relative note value - middle C. (using the ALSA API)

So, ignoring all error handling and other programming "stuff", could someone please write down the most basic piece of C code where the ALSA API is being used to achieve these two things?

Thanks
Bob

-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions, and more. http://solutions.newsforge.com/ibmarch.tmpl