Then the answer depends on how you are going about playing midi.<br><br>1. Is the api call for this playMidiFile :: FilePath -&gt; IO (), where it waits until the file finishes before it returns?<br>You may have to spawn a thread (forkIO) before you play, save it&#39;s threadId in some sort of state and then attempt to kill it from the input thread when the time comes.<br>
<br>2. Does it play the file and return an id you can reference for later manipulation?<br>You can simply keep that reference in some sort of state and when the command comes to kill it, just use that reference.<br><br>3. Are you sending external system commands to a sound system like mplayer or alsa?<br>
Just send the commands and let the system handle it.<br><br><div class="gmail_quote">On Wed, Jan 30, 2013 at 5:32 PM, Martin Drautzburg <span dir="ltr">&lt;<a href="mailto:Martin.Drautzburg@web.de" target="_blank">Martin.Drautzburg@web.de</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On Tuesday, 29. January 2013 11:01:30 Miguel Negrao wrote:<br>
<br>
&gt;<br>
&gt; main =        forever readFromConsole<br>
&gt;<br>
&gt; readFromConsole = do<br>
&gt;       in &lt;- getLine<br>
&gt;       processInput in<br>
&gt;<br>
&gt; processInput “start” = startMidi<br>
&gt; processInput “stop” = stopMidi<br>
&gt;<br>
&gt; where startMidi and stopMidi are functions.<br>
<br>
</div>How to implement these functions is exactly my problem.<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Martin<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org">Beginners@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/beginners" target="_blank">http://www.haskell.org/mailman/listinfo/beginners</a><br>
</div></div></blockquote></div><br>