M. Gagnon wrote: > Hi, i am now trying to port an application to linux using Alsa. At some > point, i have midi bytes as char* and i have to play them. This is exactly > the same data you'd find in a file, expect that it's in memory instead. How > is that possible? > > If this is not possible, i could always take any help on playing midi using > sequencers I looked at the docs, i found a few samples, but they seemed to > be outdated and the one that could interest me segfaulted. After i debugged > it and fixed the segfault, it played nothing... (and i'm sure my midi is > configured correctly BTW, pmidi works and i also succeeded in getting single > notes to play) This is how I do playback in the freebob backend for jack: for (s=0;s<samples_read;s++) { signed int *byte=(buff+s); snd_seq_event_t ev; if ((snd_midi_event_encode_byte( port->parser,(*byte) & 0xFF, &ev) ) > 0) { // a midi message is complete, send it out to ALSA snd_seq_ev_set_subs(&ev); snd_seq_ev_set_direct(&ev); snd_seq_ev_set_source(&ev, port->seq_port_nr); snd_seq_event_output_direct(port->seq_handle, &ev); } } you can check the freebob_driver_midi_* functions in the freebob jack backend for more detail. Pieter ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Alsa-devel mailing list Alsa-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.sourceforge.net/lists/listinfo/alsa-devel