Ru Vuott | 20 Jun 2012 22:17
Picon
Favicon

Tempo event in a Midi sequencer...

Hello,
I am finally able to make a simple midi sequencer with the Gambas language. It works, but I have some little
problem about changing the metronomic Tempo within a midi song.
Since I used the method of sending an Echo event to send Midi Messages groups to ALSA, I thought I'd solve the
problem of an eventual return of metronomic Time by sending an echo and backing from Alsa custom (Type:
90). At the time of receipt of the echo by the Alsa function:

int snd_seq_event_input(snd_seq_t *handle, snd_seq_event_t **ev)

the code sends the value of the tempo to a routine, where there are these Alsa functions:
snd_seq_queue_tempo_malloc(...)
snd_seq_queue_tempo_set_tempo(...)
snd_seq_set_queue_tempo(...)
snd_seq_queue_tempo_free(...)

...obviously with teir parametres.
I noticed, though, unfortunately (incomprehensibly) that often the change is a bit 'earlier than
required. I do not think there is a problem of Delta Time, since the Delta Time of metronomic Tempo event is
treated the same way as that relating to other MIDI events.
Looking for a solution, I had a look at the code of your Aplaymidi, and I saw this statement:

case 0x51: /* tempo */
    ......
    ...etc
    event->type = SND_SEQ_EVENT_TEMPO;
    ...etc,

so, I thought that the change of Tempo occur simply by sending an event by identifying it with precisely the
type number: 35. I performed the test, checking the result is listening to the song, seeing both as
reported by Aseqdump.
(Continue reading)

Clemens Ladisch | 21 Jun 2012 08:34
Picon
Gravatar

Re: Tempo event in a Midi sequencer...

Ru Vuott wrote:
> I have some little problem about changing the metronomic Tempo within a midi song.
> Looking for a solution, I had a look at the code of your Aplaymidi, and I saw this statement:
>
> case 0x51: /* tempo */
>     ......
>     ...etc
>     event->type = SND_SEQ_EVENT_TEMPO;
>     ...etc,
>
> so, I thought that the change of Tempo occur simply by sending an event
> Instead, listening to the midi track, the change does not happen!

Have a look into play_midi; that event must be sent to the system timer port.

Regards,
Clemens

Gmane