<div dir="ltr">On a separate <a href="http://haskell.1045720.n5.nabble.com/How-to-send-a-string-somewhere-via-UDP-td5758418.html">thread</a>, Rohan Drape showed me how to send OSC. The following test, which simplifies the old one and replaces printf with OSC, demonstrates timing as perfect as my ears are able to distinguish.<div><br><div>    import Control.Concurrent</div><div>    import Control.Monad</div><div>    import System.IO</div><div>    import Sound.OSC</div><div>    </div><div>    main = do</div><div>        hSetBuffering stdout NoBuffering</div><div>        mapM_ note (cycle [1,1,2])</div><div>    </div><div>    withMax = withTransport (openUDP "127.0.0.1" 9000)</div><div>    beat = 60000 -- 60 ms, measured in µs</div><div>    </div><div>    note :: Int -> IO ()</div><div>    note n = do</div><div>        withMax (sendMessage (Message "sin0 frq 100" []))</div><div>            -- set sine wave 0 to frequency 100</div><div>        withMax (sendMessage (Message "sin0 amp 1" []))</div><div>            -- set sine wave 0 to amplitude 1</div><div>        threadDelay $ beat * n</div><div>        withMax (sendMessage (Message "sin0 amp 0" []))</div><div>            -- set sine wave 0 to amplitude 0</div><div>        threadDelay $ beat * n</div><br></div><div><span style="font-family:arial,sans-serif;font-size:12.5714282989502px">This means I can use Haskell instead of Python or SuperCollider. I am beside myself with excitement.</span><br></div><div><span style="font-family:arial,sans-serif;font-size:12.5714282989502px"><br></span></div><div><span style="font-family:arial,sans-serif;font-size:12.5714282989502px">Thanks again, everyone!</span></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Oct 21, 2014 at 2:24 AM, Brandon Allbery <span dir="ltr"><<a href="mailto:allbery.b@gmail.com" target="_blank">allbery.b@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><span class=""><div class="gmail_quote">On Tue, Oct 21, 2014 at 4:05 AM, Heinrich Apfelmus <span dir="ltr"><<a href="mailto:apfelmus@quantentunnel.de" target="_blank">apfelmus@quantentunnel.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I would be hesitant to attribute your problem to the scheduler. An alternative explanation could be the following: The sound file played by the terminal when it encounters the \BEL character is longer than 100ms. A new sound will be played only when the previous sound has finished playing,</blockquote></div><br></span>On most systems I've used, this isn't true; they're either suppressed or they overlap, depending on system. (I've had to work around this.)<span class=""><br clear="all"><div><br></div>-- <br><div dir="ltr"><div>brandon s allbery kf8nh                               sine nomine associates</div><div><a href="mailto:allbery.b@gmail.com" target="_blank">allbery.b@gmail.com</a>                                  <a href="mailto:ballbery@sinenomine.net" target="_blank">ballbery@sinenomine.net</a></div><div>unix, openafs, kerberos, infrastructure, xmonad        <a href="http://sinenomine.net" target="_blank">http://sinenomine.net</a></div></div>
</span></div></div>
<br>_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
<br></blockquote></div><br></div>