Skip to contentSkip to conversation

Sequencer port type flags

DISCUSSION Pedro Lopez-Cabanillas 5 participants 10 messages May 7, 2003 – May 12, 2003

lore
Share & tools
lore
#0 lore raw

Hi all,

There are some flags defined in alsa-kernel/include/asequencer.h to describe sequencer ports.

/* port type */
#define SNDRV_SEQ_PORT_TYPE_SPECIFIC (1<<0) /* hardware specific */
#define SNDRV_SEQ_PORT_TYPE_MIDI_GENERIC (1<<1) /* generic MIDI device */
#define SNDRV_SEQ_PORT_TYPE_MIDI_GM (1<<2) /* General MIDI compatible
device */

#define SNDRV_SEQ_PORT_TYPE_MIDI_GS     (1<<3)  /* GS compatible device */
#define SNDRV_SEQ_PORT_TYPE_MIDI_XG     (1<<4)  /* XG compatible device */
#define SNDRV_SEQ_PORT_TYPE_MIDI_MT32   (1<<5)  /* MT-32 compatible device */

/* other standards...*/
#define SNDRV_SEQ_PORT_TYPE_SYNTH (1<<10) /* Synth device */
#define SNDRV_SEQ_PORT_TYPE_DIRECT_SAMPLE (1<<11) /* Sampling device
(support sample download) */
#define SNDRV_SEQ_PORT_TYPE_SAMPLE (1<<12) /* Sampling device (sample can
be downloaded at any time) */
/*...*/
#define SNDRV_SEQ_PORT_TYPE_APPLICATION (1<<20) /* application (sequencer/editor) */

I've checked recently some synth drivers included in ALSA: trident, gus and opl3 are sequencer clients and they set the flag SNDRV_SEQ_PORT_TYPE_SYNTH among others.

The emu synth driver sets several flags but not SNDRV_SEQ_PORT_TYPE_SYNTH. Shouldn't it set also this flag?
See alsa-kernel/synth/emux/emux_seq.c:55

I don't understand why some synth drivers set the flags GM/GS/XG/MT32.

OTOH, the flags for userspace programs using ALSA library are explained here (snd_seq_create_port)
http://www.alsa-project.org/alsa-doc/alsa-lib/group___seq_port.html#a27

I've checked some software synths that also are ALSA sequencer clients:

timidity -iA (2.12.0-pre1) reports SND_SEQ_PORT_TYPE_MIDI_GENERIC RTSynth (1.9.1) reports SND_SEQ_PORT_TYPE_MIDI_GENERIC LegaSynth (0.4.1) reports SND_SEQ_PORT_TYPE_MIDI_GENERIC iiwusynth (0.2.5) reports SND_SEQ_PORT_TYPE_APPLICATION FluidSynth (1.0.1) reports SND_SEQ_PORT_TYPE_APPLICATION amSynth (1.0-rc2) reports SND_SEQ_PORT_TYPE_APPLICATION AlsaModularSynth (1.4.12) reports SND_SEQ_PORT_TYPE_APPLICATION miniFMSynth, from the ALSA 0.9.0 programming howto, reports SND_SEQ_PORT_TYPE_APPLICATION
ZynAddSubFX (1.2) reports SND_SEQ_PORT_TYPE_SYNTH

My question is, shouldn't the soft-synth programs set the SND_SEQ_PORT_TYPE_SYNTH flag?
What should be the right policy for userspace programs and kernel modules? Which set of flags should each program type set?

Thanks in advance.

Regards,
Pedro

Signature · 9 lines
ALSA Library Bindings for Pascal
http://alsapas.alturl.com



-------------------------------------------------------
Enterprise Linux Forum Conference & Expo, June 4-6, 2003, Santa Clara
The only event dedicated to issues related to Linux enterprise solutions
www.enterpriselinuxforum.com
#1 lore raw

On Thu, May 08, 2003 at 01:42:10AM +0200, Pedro Lopez-Cabanillas wrote:
....

Quoted 2 lines

#define SNDRV_SEQ_PORT_TYPE_SYNTH (1<<10) /* Synth device */
#define SNDRV_SEQ_PORT_TYPE_APPLICATION (1<<20) /* application (sequencer/editor) */

.....

Quoted 13 lines

I've checked some software synths that also are ALSA sequencer clients:

timidity -iA (2.12.0-pre1) reports SND_SEQ_PORT_TYPE_MIDI_GENERIC RTSynth (1.9.1) reports SND_SEQ_PORT_TYPE_MIDI_GENERIC LegaSynth (0.4.1) reports SND_SEQ_PORT_TYPE_MIDI_GENERIC iiwusynth (0.2.5) reports SND_SEQ_PORT_TYPE_APPLICATION FluidSynth (1.0.1) reports SND_SEQ_PORT_TYPE_APPLICATION amSynth (1.0-rc2) reports SND_SEQ_PORT_TYPE_APPLICATION AlsaModularSynth (1.4.12) reports SND_SEQ_PORT_TYPE_APPLICATION miniFMSynth, from the ALSA 0.9.0 programming howto, reports SND_SEQ_PORT_TYPE_APPLICATION
ZynAddSubFX (1.2) reports SND_SEQ_PORT_TYPE_SYNTH

Quoted 5 lines

My question is, shouldn't the soft-synth programs set the SND_SEQ_PORT_TYPE_SYNTH flag?
What should be the right policy for userspace programs and kernel modules? Which set of flags should each program type set?

Hi Pedro,

you are perfectly right, the soft-synth programs should indeed set the SND_SEQ_PORT_TYPE_SYNTH flag, and possibly the others (GM/XG etc.) if they support that standard.

The port type is supposed to help applications/users in setting up connections (eg provide sensible defaults).

To the clients it does not matter if another clients resides in userland or kernel space; in fact in the future a part or whole of the alsa sequencer might transparantly move into userspace.

Regards,
Frank.

Signature · 11 lines
+---- --- -- -  -   -    - 
| Frank van de Pol                  -o)    A-L-S-A
| [email protected]                    /\\  Sounds good!
| http://www.alsa-project.org      _\_v
| Linux - Why use Windows if we have doors available?


-------------------------------------------------------
Enterprise Linux Forum Conference & Expo, June 4-6, 2003, Santa Clara
The only event dedicated to issues related to Linux enterprise solutions
www.enterpriselinuxforum.com
#2 lore raw
Quoted 25 lines · Frank van de Pol

On Thu, May 08, 2003 at 01:42:10AM +0200, Pedro Lopez-Cabanillas wrote:
....

Quoted 2 lines

#define SNDRV_SEQ_PORT_TYPE_SYNTH (1<<10) /* Synth device */
#define SNDRV_SEQ_PORT_TYPE_APPLICATION (1<<20) /* application (sequencer/editor) */

.....

Quoted 13 lines

I've checked some software synths that also are ALSA sequencer clients:

timidity -iA (2.12.0-pre1) reports SND_SEQ_PORT_TYPE_MIDI_GENERIC RTSynth (1.9.1) reports SND_SEQ_PORT_TYPE_MIDI_GENERIC LegaSynth (0.4.1) reports SND_SEQ_PORT_TYPE_MIDI_GENERIC iiwusynth (0.2.5) reports SND_SEQ_PORT_TYPE_APPLICATION FluidSynth (1.0.1) reports SND_SEQ_PORT_TYPE_APPLICATION amSynth (1.0-rc2) reports SND_SEQ_PORT_TYPE_APPLICATION AlsaModularSynth (1.4.12) reports SND_SEQ_PORT_TYPE_APPLICATION miniFMSynth, from the ALSA 0.9.0 programming howto, reports SND_SEQ_PORT_TYPE_APPLICATION
ZynAddSubFX (1.2) reports SND_SEQ_PORT_TYPE_SYNTH

Quoted 5 lines

My question is, shouldn't the soft-synth programs set the SND_SEQ_PORT_TYPE_SYNTH flag?
What should be the right policy for userspace programs and kernel modules? Which set of flags should each program type set?

Quoted 5 lines

Hi Pedro,

you are perfectly right, the soft-synth programs should indeed set the SND_SEQ_PORT_TYPE_SYNTH flag, and possibly the others (GM/XG etc.) if they support that standard.

Note that the SYNTH ports should support SNDRV_SEQ_EVENT_SAMPLE* events. It means direct wavetable synthesis not MIDI event communication.

Jaroslav

-----
Jaroslav Kysela <[email protected]>
Linux Kernel Sound Maintainer
ALSA Project, SuSE Labs

-------------------------------------------------------
Enterprise Linux Forum Conference & Expo, June 4-6, 2003, Santa Clara The only event dedicated to issues related to Linux enterprise solutions www.enterpriselinuxforum.com

#3 lore raw
Quoted 2 lines · Jaroslav Kysela

Note that the SYNTH ports should support SNDRV_SEQ_EVENT_SAMPLE* events. It means direct wavetable synthesis not MIDI event communication.

OK, now I'm confused again. Are you saying that a soft synth that can only be driven via MIDI should not describe itself as a SYNTH? If so, how do I know it's a synth?

My interpretation so far has been that most soft synths should set SYNTH, APPLICATION and possibly SAMPLE if they're sample-based, whereas a sequencer like Rosegarden should set APPLICATION and nothing else. Do I have that wrong?

(And I don't know of any soft synths that are always GM devices, so I'm doubtful -- as I mentioned in another email -- whether they should be setting GM or not.)

Chris

-------------------------------------------------------
Enterprise Linux Forum Conference & Expo, June 4-6, 2003, Santa Clara The only event dedicated to issues related to Linux enterprise solutions www.enterpriselinuxforum.com

#4 lore raw
Quoted 3 lines · Chris Cannam

Are you saying that a soft synth that
can only be driven via MIDI should not describe itself as a SYNTH? If so, how do I know it's a synth?

I suppose (replying to myself) that it's all about what these flags are intended to be used for. I had assumed they were basically informational flags for identifying classes of device, and as I've only had to deal with MIDI clients (and then only very naively), I've only really thought about clients that are already assumed to understand MIDI.

I suppose the alternative is that these flags are necessary to distinguish between different modes of communication -- different sorts of events that a particular client understands. So once I've found out that a device is a MIDI device, how I find out that it's then a synth is entirely my problem -- the API doesn't care, because MIDI is all the same to it anyway.

If that's so, then these flags are of no use to Rosegarden.

Chris

-------------------------------------------------------
Enterprise Linux Forum Conference & Expo, June 4-6, 2003, Santa Clara The only event dedicated to issues related to Linux enterprise solutions www.enterpriselinuxforum.com

#5 lore raw
Quoted 12 lines · Chris Cannam
Quoted 3 lines · Chris Cannam

Are you saying that a soft synth that
can only be driven via MIDI should not describe itself as a SYNTH? If so, how do I know it's a synth?

I suppose (replying to myself) that it's all about what these flags are intended to be used for. I had assumed they were basically informational flags for identifying classes of device, and as I've only had to deal with MIDI clients (and then only very naively), I've only really thought about clients that are already assumed to understand MIDI.

Quoted 8 lines

I suppose the alternative is that these flags are necessary to distinguish between different modes of communication -- different sorts of events that a particular client understands. So once I've found out that a device is a MIDI device, how I find out that it's then a synth is entirely my problem -- the API doesn't care, because MIDI is all the same to it anyway.

If that's so, then these flags are of no use to Rosegarden.

Resegarden will probably talk only with ports classified as SNDRV_SEQ_PORT_TYPE_MIDI_*, won't? All other ports doesn't understand the received events.

Jaroslav

-----
Jaroslav Kysela <[email protected]>
Linux Kernel Sound Maintainer
ALSA Project, SuSE Labs

-------------------------------------------------------
Enterprise Linux Forum Conference & Expo, June 4-6, 2003, Santa Clara The only event dedicated to issues related to Linux enterprise solutions www.enterpriselinuxforum.com

#6 lore raw
In reply to Chris Cannam
Quoted 8 lines · Chris Cannam
Quoted 2 lines · Jaroslav Kysela

Note that the SYNTH ports should support SNDRV_SEQ_EVENT_SAMPLE* events. It means direct wavetable synthesis not MIDI event communication.

OK, now I'm confused again. Are you saying that a soft synth that can only be driven via MIDI should not describe itself as a SYNTH? If so, how do I know it's a synth?

Quoted 8 lines

My interpretation so far has been that most soft synths should set SYNTH, APPLICATION and possibly SAMPLE if they're sample-based, whereas a sequencer like Rosegarden should set APPLICATION and nothing else. Do I have that wrong?

(And I don't know of any soft synths that are always GM devices, so I'm doubtful -- as I mentioned in another email -- whether they should be setting GM or not.)

Note that we might change the define if it cause problems. But here is interpretation of flags:

SNDRV_SEQ_PORT_TYPE_MIDI_* defines are for client which understands the midi v1.0 commands and extensions

SNDRV_SEQ_PORT_TYPE_SYNTH define is for clients which can do direct wavetable synthesis (used by modplayers etc.)

SNDRV_SEQ_PORT_TYPE_APPLICATION is for an application (sequencer or editor) - it doesn't apply for software MIDI synthesizers nor for wavetable direct synthesizers in the user space

I think that your confusion is that we separate MIDI synthesizers (clients) and direct wavetable sythesizers (clients).

Jaroslav

-----
Jaroslav Kysela <[email protected]>
Linux Kernel Sound Maintainer
ALSA Project, SuSE Labs

-------------------------------------------------------
Enterprise Linux Forum Conference & Expo, June 4-6, 2003, Santa Clara The only event dedicated to issues related to Linux enterprise solutions www.enterpriselinuxforum.com

#7 lore raw
Quoted 2 lines · Jaroslav Kysela

SNDRV_SEQ_PORT_TYPE_MIDI_* defines are for client which understands the midi v1.0 commands and extensions

Right, so these flags are all about the events that a client understands, not about describing the client as I had first imagined.

So there is no way for a MIDI-based soft synth (that does not support GM etc and does not do direct wavetable synthesis) to indicate that it is a synth, for the benefit of an application such as Rosegarden that would like to be able to show the user a distinction between a soft synth and e.g. a record port on another sequencer?

Similarly, since the APPLICATION type is not a MIDI_* type, does that mean that it indicates a port that only understands application-specific non-MIDI events? So the numerous existing soft synths that set APPLICATION on their MIDI input ports -- including the ALSA 0.9 programming howto example -- are actually giving false (rather than merely incomplete) information?

And harking back to the other part of Pedro's initial question, does this also mean that we shouldn't rely on the presence of the SND_SEQ_PORT_TYPE_SYNTH flag to identify soundcard-hosted MIDI synths that accept MIDI events (in order to distinguish them from external MIDI devices), because that flag will not be there if MIDI is all the synth's driver understands?

Chris

-------------------------------------------------------
Enterprise Linux Forum Conference & Expo, June 4-6, 2003, Santa Clara The only event dedicated to issues related to Linux enterprise solutions www.enterpriselinuxforum.com

#8 lore raw
In reply to Jaroslav Kysela
Quoted 2 lines · Jaroslav Kysela

SNDRV_SEQ_PORT_TYPE_SYNTH define is for clients which can do direct wavetable synthesis (used by modplayers etc.)

Emu chip based soundcards, as SoundBlaster AWE XX, are able to do wavetable synthesis. Aren't it? The ALSA emu driver for these cards does not set SNDRV_SEQ_PORT_TYPE_SYNTH flag. See emux_seq.c:55

OTOH, opl3 ALSA driver is for a family of FM synths that doesn't do wavetable synthesis. This driver *sets* SNDRV_SEQ_PORT_TYPE_SYNTH flag. See opl3_seq.c:204

This seems contradictory with your explanation. Could you clarify if i missed something or if those drivers are wrong and need to be updated ?

Regards,
Pedro

Signature · 9 lines
ALSA Library Bindings for Pascal
http://alsapas.alturl.com



-------------------------------------------------------
Enterprise Linux Forum Conference & Expo, June 4-6, 2003, Santa Clara
The only event dedicated to issues related to Linux enterprise solutions
www.enterpriselinuxforum.com
#9 lore raw

At Sat, 10 May 2003 19:15:39 +0200,

Quoted 8 lines · Pedro Lopez-Cabanillas
Quoted 2 lines · Jaroslav Kysela

SNDRV_SEQ_PORT_TYPE_SYNTH define is for clients which can do direct wavetable synthesis (used by modplayers etc.)

Emu chip based soundcards, as SoundBlaster AWE XX, are able to do wavetable synthesis. Aren't it? The ALSA emu driver for these cards does not set SNDRV_SEQ_PORT_TYPE_SYNTH flag. See emux_seq.c:55

the mentioned above is that the functionality of sample-download and playback over ALSA sequencer API. yes, Emu chip supports Wavetable, but from outside it's nothing but a MIDI playback device.

Quoted 3 lines

OTOH, opl3 ALSA driver is for a family of FM synths that doesn't do wavetable synthesis. This driver *sets* SNDRV_SEQ_PORT_TYPE_SYNTH flag. See opl3_seq.c:204

OPL3 supports the instrument layer on sequencer. You can (need to) load the samples before using this device.

OTOH, AWE (and Emu10k1) don't support this function (yet), at least as "native ALSA" mode. There is a compatible "synth" mode as an OSS sequencer emulation device, but it's not controlled directly over ALSA sequencer ports. that's why SYNTH flag is not set on AWE ports.

ciao,

Takashi

-------------------------------------------------------
Enterprise Linux Forum Conference & Expo, June 4-6, 2003, Santa Clara The only event dedicated to issues related to Linux enterprise solutions www.enterpriselinuxforum.com