Re: play midi file to midi port?

Jerash music <[email protected]> Tue, 29 Dec 2020 17:12:46 +0100
Newsgroups gmane.comp.audio.ecasound.general
Message-ID <CACHZ1iiE+VnEJ_y=-sDSq39mg4koPrH+904zJ1h_7JjzgvBMUQ@mail.gmail.com>
--===============1685216309451650450==
Content-Type: multipart/alternative; boundary="0000000000001c83c305b79caae9"

--0000000000001c83c305b79caae9
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Hello,
just to work to say you could try some python midi library to play your
files, as you could easily have the python script as a server also and
would trigger playing rapidly.
I had used pygame in a project, after struggling with python 2.7 vs 3 for
some reason i can't remember, it finally worked very easilly.
Good luck with your project !
Rapha=C3=ABl

Le mar. 29 d=C3=A9c. 2020 =C3=A0 07:33, Bellan, Leon Marcel <
[email protected]> a =C3=A9crit :

> 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 chai=
n
> 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 set=
up
> 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 aplaymi=
di
> 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 senso=
r
> (along with various MIDI files going to multiple different MIDI ports), a=
nd
> 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 l=
ot
> 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 se=
nd
> MIDI events, it seems to send the wrong ones (i.e I see events reported b=
y
> midimonster but they are not correct, lots of "unsupported type").   Mayb=
e
> 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 seem=
s
> to have a few issues related to timing and missing an event every so ofte=
n,
> but overall it seems ok for this purpose.  I'd certainly be open to tryin=
g
> to get midish to work correctly if it'd provide better timing and not mis=
s
> events.
>
> Thanks again for all your help!
> -Leon
>
> -----Original Message-----
> From: Joel Roth <[email protected]>
> Sent: Sunday, December 27, 2020 9:04 PM
> To: [email protected]
> 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 t=
o
> 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 set=
up
> (longer for large projects.)
>
> Nama could startup faster if it had an option to simply load Ecasound wit=
h
> 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
> [email protected]
>
> https://nam04.safelinks.protection.outlook.com/?url=3Dhttps%3A%2F%2Flists=
.sourceforge.net%2Flists%2Flistinfo%2Fecasound-list&amp;data=3D04%7C01%7Cle=
on.bellan%40vanderbilt.edu%7Cebe1978986fa40e2202808d8aae0192d%7Cba5a7f39e3b=
e4ab3b45067fa80faecad%7C0%7C0%7C637447226771119395%7CUnknown%7CTWFpbGZsb3d8=
eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&a=
mp;sdata=3DhLn18ZGAP%2BYdwth7%2BPWbrZpcm4yh5Ai%2FKIGU7DURHbQ%3D&amp;reserve=
d=3D0
>
>
> _______________________________________________
> Ecasound-list mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/ecasound-list
>

--0000000000001c83c305b79caae9
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Hello,<div>just to work to say you could try some python m=
idi library to play your files, as you could easily have the python script =
as a server also and would trigger playing rapidly.</div><div>I had used py=
game in a project, after struggling with python 2.7 vs 3 for some reason i =
can&#39;t remember, it finally worked very easilly.</div><div>Good luck wit=
h your project !</div><div>Rapha=C3=ABl</div></div><br><div class=3D"gmail_=
quote"><div dir=3D"ltr" class=3D"gmail_attr">Le=C2=A0mar. 29 d=C3=A9c. 2020=
 =C3=A0=C2=A007:33, Bellan, Leon Marcel &lt;<a href=3D"mailto:leon.bellan@v=
anderbilt.edu">[email protected]</a>&gt; a =C3=A9crit=C2=A0:<br></=
div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;bor=
der-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Joel, thanks so mu=
ch for the rapid response!=C2=A0 And I certainly meant no offense at all re=
garding nama startup time;=C2=A0 I&#39;m still figuring out which programs =
are good for what in the Linux audio world, and the Pi Zero W (BCM2835=C2=
=A0 processor) doesn&#39;t seem intended to handle anything requiring signi=
ficant processing power.=C2=A0 Your suggestion makes much more sense than w=
hat I was doing before (starting a new ecasound instance each time the &quo=
t;show&quot; started and employing command line arguments to establish the =
chain setup, and relaying on ecasound closing to reset the &quot;show&quot;=
 props); as suggested I&#39;m now running ecasound as a server and prepping=
 the chain setup separately from starting playback of the multiple WAV file=
s, which seems to work much better.=C2=A0 I now have Node Red sending comma=
nds to a running ecasound process (started with -c --server) to prep the ch=
ain setup, and then after I send it a &quot;start&quot; at the same time as=
 I launch a few aplaymidi commands (I have multiple MIDI files going to mul=
tiple ports to control multiple ArtNet nodes [NodeMCU boards] via midimonst=
er MIDI-&gt;ArtNet conversion).=C2=A0 The timing still doesn&#39;t yield pe=
rfect 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 sh=
ort delays between commands are reproducible).=C2=A0 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 diffe=
rent MIDI ports), and other tracks chime in when other motion sensors are t=
riggered, so relatively fast response times are important to get the desire=
d effect.=C2=A0 I&#39;ve eliminated the need to turn on/off the MIDI tracks=
 themselves by switching to turning on/off the ArtNet nodes&#39; response t=
o the MIDI/ArtNet data based on whether motion was detected; this has simpl=
ified things a lot on the playback side.<br>
<br>
I&#39;ve tried using midish to play back my MIDI files, but it seems to sen=
d the wrong MIDI data to the port for some reason.=C2=A0 Midimonster report=
s to the terminal which MIDI events it sees in real time, and aplaymidi fil=
e1.mid generates events that correlate to what&#39;s in the file and are re=
cognized, but I can&#39;t get midish to do the same thing.=C2=A0 When it do=
es send MIDI events, it seems to send the wrong ones (i.e I see events repo=
rted by midimonster but they are not correct, lots of &quot;unsupported typ=
e&quot;).=C2=A0 =C2=A0Maybe I need to configure the controllers as I&#39;m =
using controller changes as my signals?=C2=A0 Or maybe it doesn&#39;t like =
signals on CC 0?=C2=A0 Aplaymidi still seems to have a few issues related t=
o timing and missing an event every so often, but overall it seems ok for t=
his purpose.=C2=A0 I&#39;d certainly be open to trying to get midish to wor=
k correctly if it&#39;d provide better timing and not miss events.<br>
<br>
Thanks again for all your help!<br>
-Leon<br>
<br>
-----Original Message-----<br>
From: Joel Roth &lt;<a href=3D"mailto:[email protected]" target=3D"_blank">jo=
[email protected]</a>&gt; <br>
Sent: Sunday, December 27, 2020 9:04 PM<br>
To: <a href=3D"mailto:[email protected]" target=3D"_blank=
">[email protected]</a><br>
Subject: Re: [ecasound] play midi file to midi port?<br>
<br>
Hi Leon,<br>
<br>
Nama author here. You hooked me when you said &#39;nama is crazy slow&#39; =
:-)<br>
<br>
On Sun, Dec 27, 2020 at 05:39:26PM +0000, Bellan, Leon Marcel wrote:<br>
&gt; I&#39;m trying to use ecasound for an animatronic project, and have mo=
tion <br>
&gt; sensor events appropriately turning on/off audio (wav) tracks via the =
<br>
&gt; ecasound server interface (selectively muting/unmuting channels upon <=
br>
&gt; motion sensor events).=C2=A0 The wav data is going to an ALSA output.=
=C2=A0 I&#39;d <br>
&gt; like to also have ecasound play .MID files to a MIDI port I have set <=
br>
&gt; up that controls DMX fixtures over ArtNet (midimonster is converting <=
br>
&gt; MIDI to ArtNet and displays the MIDI events to the terminal for <br>
&gt; debugging)To get everything synced correctly, it&#39;d be great if the=
 wav <br>
&gt; and midi data is read by the same program (i.e. a multitrack audio <br=
>
&gt; program playing wav and midi at the same time).<br>
&gt; Ecasound does just what I want when I only use wav files (I can load <=
br>
&gt; multiple files and selectively mute/unmute them via the server <br>
&gt; interface), and I can get the midi files to control fixtures correctly=
 <br>
&gt; using aplaymidi to the port I&#39;ve set up, but I can&#39;t seem to g=
et <br>
&gt; ecasound to send MIDI data from a MIDI file to the MIDI port.=C2=A0 I&=
#39;m not <br>
&gt; sure whether ecasound is capable of doing this, but it&#39;d be great =
if <br>
&gt; it could.=C2=A0 Is there a way to play a MIDI file in ecasound and rou=
te <br>
&gt; not to Timidity but to a MIDI port (e.g. 129:0)?=C2=A0 I&#39;m using &=
quot;ecasound <br>
&gt; -a:1 -i miditest1.mid -o:alsa=C2=A0 -Md:alsaseq,129:0&quot;, which see=
ms to send <br>
&gt; a START and a STOP to the port, but nothing from the MIDI file itself.=
=C2=A0 <br>
&gt; &quot;aplaymidi -p 128:0 miditest1.mid&quot; sends the data correctly =
(MIDI CC <br>
&gt; data that midimonster reads), but I can&#39;t get it to sync well with=
 the <br>
&gt; wav data played by ecasound (i.e. running &quot;ecasound XXXX &amp; ap=
laymidi <br>
&gt; YYYY &quot;<br>
&gt; doesn&#39;t start playback of both files at the same time due to longe=
r <br>
&gt; and slightly variable startup time for ecasound)<br>
&gt; <br>
&gt; I&#39;ve thought about trying to use nama, but it is crazy slow on the=
 <br>
&gt; system I&#39;m hoping to use for this project (Pi Zero W) whereas <br>
&gt; ecasound, aplaymidi, etc seem to run at a reasonable speed, and I&#39;=
m <br>
&gt; not sure if nama is designed to be used for only playback purposes <br=
>
&gt; like what I&#39;m doing here.<br>
<br>
Midish is a MIDI editor/player that can play to any MIDI port. Maybe it wil=
l suit your needs. Jeanette can tell you more as she uses it a lot :-)<br>
<br>
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 iss=
ue &#39;cs-connect&#39;.<br>
This done, ecasound can start instaneously when you give it the &#39;start&=
#39; command.<br>
<br>
Nama will start Ecasound and midish together and stop them together. The Na=
ma command prompt will pass through midish commands but doesn&#39;t do any =
setup for you. <br>
<br>
Nama does take time to start, especially the first run that generates a reg=
istry 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 (longe=
r for large projects.)<br>
<br>
Nama could startup faster if it had an option to simply load Ecasound with =
a pre-generated chain setup for a project.<br>
Without having corresponding data structures, Nama would lose realtime abil=
ities, such as adjusting effects parameters or fading on start/stop. <br>
<br>
warm regards,<br>
<br>
--<br>
Joel Roth<br>
<br>
<br>
_______________________________________________<br>
Ecasound-list mailing list<br>
<a href=3D"mailto:[email protected]" target=3D"_blank">Ec=
[email protected]</a><br>
<a href=3D"https://nam04.safelinks.protection.outlook.com/?url=3Dhttps%3A%2=
F%2Flists.sourceforge.net%2Flists%2Flistinfo%2Fecasound-list&amp;amp;data=
=3D04%7C01%7Cleon.bellan%40vanderbilt.edu%7Cebe1978986fa40e2202808d8aae0192=
d%7Cba5a7f39e3be4ab3b45067fa80faecad%7C0%7C0%7C637447226771119395%7CUnknown=
%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6=
Mn0%3D%7C1000&amp;amp;sdata=3DhLn18ZGAP%2BYdwth7%2BPWbrZpcm4yh5Ai%2FKIGU7DU=
RHbQ%3D&amp;amp;reserved=3D0" rel=3D"noreferrer" target=3D"_blank">https://=
nam04.safelinks.protection.outlook.com/?url=3Dhttps%3A%2F%2Flists.sourcefor=
ge.net%2Flists%2Flistinfo%2Fecasound-list&amp;amp;data=3D04%7C01%7Cleon.bel=
lan%40vanderbilt.edu%7Cebe1978986fa40e2202808d8aae0192d%7Cba5a7f39e3be4ab3b=
45067fa80faecad%7C0%7C0%7C637447226771119395%7CUnknown%7CTWFpbGZsb3d8eyJWIj=
oiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;amp=
;sdata=3DhLn18ZGAP%2BYdwth7%2BPWbrZpcm4yh5Ai%2FKIGU7DURHbQ%3D&amp;amp;reser=
ved=3D0</a><br>
<br>
<br>
_______________________________________________<br>
Ecasound-list mailing list<br>
<a href=3D"mailto:[email protected]" target=3D"_blank">Ec=
[email protected]</a><br>
<a href=3D"https://lists.sourceforge.net/lists/listinfo/ecasound-list" rel=
=3D"noreferrer" target=3D"_blank">https://lists.sourceforge.net/lists/listi=
nfo/ecasound-list</a><br>
</blockquote></div>

--0000000000001c83c305b79caae9--


--===============1685216309451650450==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline


--===============1685216309451650450==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Ecasound-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ecasound-list

--===============1685216309451650450==--