NAME

Peta::Synth::Input - MIDI as it is played: the ALSA sequencer, raw devices

VERSION

version 0.2610180

SYNOPSIS

my $in = Peta::Synth::Input->open('all');      # or 'none', '20:0', 'Keystation', '/dev/snd/midiC1D0'
while (1) {
    $synth->play($_) for $in->events;
    ...
}

say "$_->{address}  $_->{client}: $_->{port}" for Peta::Synth::Input::sources();

DESCRIPTION

A port named MIDI in of a client of the ALSA sequencer (Peta::MIDI::ALSA), that sources are connected to. open takes what to read: all (every source, and those plugged in later), none (only the port, for others to connect), sources by address or name (joined by commas), or the path of a raw MIDI device or pipe (Peta::Synth::Input::Raw).

open, new

open($what): an input reading what is said (all by default); a raw device's or pipe's path gives a Peta::Synth::Input::Raw. new(name => 'Peta::Synth'): the client and its port, connected to nothing yet.

events

events($wait): what has come in, as Peta::Synth::MIDI's events, waiting at most $wait seconds for the first.

sources, connect, follow, connected, address, handle

The sources there are; connecting one; connecting all, and those to come; those connected; this client's port (client:port); its file handle (for select).

AUTHOR

PetaMem s.r.o. <info@petamem.com>

COPYRIGHT

Copyright (c) 2026 PetaMem s.r.o.

LICENSE

This package is free software, dual-licensed under the Artistic License 2.0 and the BSD 2-Clause License. See the LICENSE file of the distribution.