Re: [ecasound] play midi file to midi port?

From: Bellan, Leon Marcel <leon.bellan@email-addr-hidden>
Date: Tue Dec 29 2020 - 05:00:33 EET

Hi Joel, thanks so much for the rapid response! And I certainly meant no offense at all regarding nama startup time; I'm still figuring out which programs are good for what in the Linux audio world, and the Pi Zero W (BCM2835 processor) doesn't seem intended to handle anything requiring significant processing power. Your suggestion makes much more sense than what I was doing before (starting a new ecasound instance each time the "show" started and employing command line arguments to establish the chain setup, and relaying on ecasound closing to reset the "show" props); as suggested I'm now running ecasound as a server and prepping the chain setup separately from starting playback of the multiple WAV files, which seems to work much better. I now have Node Red sending commands to a running ecasound process (started with -c --server) to prep the chain setup, and then after I send it a "start" at the same time as I launch a few aplaymidi commands (I have multiple MIDI files
 going to multiple ports to control multiple ArtNet nodes [NodeMCU boards] via midimonster MIDI->ArtNet conversion). The timing still doesn't yield perfect synchronization (fractions of a second off), but I can probably move things around in the MIDI files to get the sync fine-tuned (assuming the short delays between commands are reproducible). The overall goal is to have one track of a multitrack recording start immediately upon a trigger from a motion sensor (along with various MIDI files going to multiple different MIDI ports), and other tracks chime in when other motion sensors are triggered, so relatively fast response times are important to get the desired effect. I've eliminated the need to turn on/off the MIDI tracks themselves by switching to turning on/off the ArtNet nodes' response to the MIDI/ArtNet data based on whether motion was detected; this has simplified things a lot on the playback side.

I've tried using midish to play back my MIDI files, but it seems to send the wrong MIDI data to the port for some reason. Midimonster reports to the terminal which MIDI events it sees in real time, and aplaymidi file1.mid generates events that correlate to what's in the file and are recognized, but I can't get midish to do the same thing. When it does send MIDI events, it seems to send the wrong ones (i.e I see events reported by midimonster but they are not correct, lots of "unsupported type"). Maybe I need to configure the controllers as I'm using controller changes as my signals? Or maybe it doesn't like signals on CC 0? Aplaymidi still seems to have a few issues related to timing and missing an event every so often, but overall it seems ok for this purpose. I'd certainly be open to trying to get midish to work correctly if it'd provide better timing and not miss events.

Thanks again for all your help!
-Leon

-----Original Message-----
From: Joel Roth <joelz@email-addr-hidden>
Sent: Sunday, December 27, 2020 9:04 PM
To: ecasound-list@email-addr-hidden
Subject: Re: [ecasound] play midi file to midi port?

Hi Leon,

Nama author here. You hooked me when you said 'nama is crazy slow' :-)

On Sun, Dec 27, 2020 at 05:39:26PM +0000, Bellan, Leon Marcel wrote:
> I'm trying to use ecasound for an animatronic project, and have motion
> sensor events appropriately turning on/off audio (wav) tracks via the
> ecasound server interface (selectively muting/unmuting channels upon
> motion sensor events). The wav data is going to an ALSA output. I'd
> like to also have ecasound play .MID files to a MIDI port I have set
> up that controls DMX fixtures over ArtNet (midimonster is converting
> MIDI to ArtNet and displays the MIDI events to the terminal for
> debugging)To get everything synced correctly, it'd be great if the wav
> and midi data is read by the same program (i.e. a multitrack audio
> program playing wav and midi at the same time).
> Ecasound does just what I want when I only use wav files (I can load
> multiple files and selectively mute/unmute them via the server
> interface), and I can get the midi files to control fixtures correctly
> using aplaymidi to the port I've set up, but I can't seem to get
> ecasound to send MIDI data from a MIDI file to the MIDI port. I'm not
> sure whether ecasound is capable of doing this, but it'd be great if
> it could. Is there a way to play a MIDI file in ecasound and route
> not to Timidity but to a MIDI port (e.g. 129:0)? I'm using "ecasound
> -a:1 -i miditest1.mid -o:alsa -Md:alsaseq,129:0", which seems to send
> a START and a STOP to the port, but nothing from the MIDI file itself.
> "aplaymidi -p 128:0 miditest1.mid" sends the data correctly (MIDI CC
> data that midimonster reads), but I can't get it to sync well with the
> wav data played by ecasound (i.e. running "ecasound XXXX & aplaymidi
> YYYY "
> doesn't start playback of both files at the same time due to longer
> and slightly variable startup time for ecasound)
>
> I've thought about trying to use nama, but it is crazy slow on the
> system I'm hoping to use for this project (Pi Zero W) whereas
> ecasound, aplaymidi, etc seem to run at a reasonable speed, and I'm
> not sure if nama is designed to be used for only playback purposes
> like what I'm doing here.

Midish is a MIDI editor/player that can play to any MIDI port. Maybe it will suit your needs. Jeanette can tell you more as she uses it a lot :-)

To be able to sync ecasound playback start with midi playback, you have to load the ecasound chain setup (or create it with IAM commands) and then issue 'cs-connect'.
This done, ecasound can start instaneously when you give it the 'start' command.

Nama will start Ecasound and midish together and stop them together. The Nama command prompt will pass through midish commands but doesn't do any setup for you.

Nama does take time to start, especially the first run that generates a registry of all the plugins available. After that, on my mobile i5, it takes a second or two to load a simple project and generate its chain setup (longer for large projects.)

Nama could startup faster if it had an option to simply load Ecasound with a pre-generated chain setup for a project.
Without having corresponding data structures, Nama would lose realtime abilities, such as adjusting effects parameters or fading on start/stop.

warm regards,

--
Joel Roth
_______________________________________________
Ecasound-list mailing list
Ecasound-list@email-addr-hidden
https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.sourceforge.net%2Flists%2Flistinfo%2Fecasound-list&amp;data=04%7C01%7Cleon.bellan%40vanderbilt.edu%7Cebe1978986fa40e2202808d8aae0192d%7Cba5a7f39e3be4ab3b45067fa80faecad%7C0%7C0%7C637447226771119395%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=hLn18ZGAP%2BYdwth7%2BPWbrZpcm4yh5Ai%2FKIGU7DURHbQ%3D&amp;reserved=0
_______________________________________________
Ecasound-list mailing list
Ecasound-list@email-addr-hidden
https://lists.sourceforge.net/lists/listinfo/ecasound-list
Received on Wed Dec 30 04:15:02 2020

This archive was generated by hypermail 2.1.8 : Wed Dec 30 2020 - 04:15:02 EET