On Mon, 13 Oct 2008, you wrote:
> John O'Hagan wrote:
> > Great! I'm using Python, and this is how I did it in my program (Python
> > code follows):
> >
> >     from telnetlib import Telnet
> >     fluid = Telnet("localhost","9800")
> >
> >     fluid.write("noteon 1 46 64 \n noteon 1 49 64 \n noteon 1 53 64 \n")
>
> Note that FluidSynth doesn't follow strictly the telnet protocol, so you
> can use something simpler. The command line utility netcat(1) (or 'nc') is

[...]

>
> What I mean is that you can use simple TCP/IP sockets and text streams,
> instead of the telnet class.
>
> #!/usr/bin/python
> import sys
> import time
> from socket import *
> serverHost = "localhost"
> serverPort = 9800
> s = socket(AF_INET, SOCK_STREAM)
> s.connect((serverHost, serverPort))
> s.send("noteon 1 66 100\n")
> time.sleep(1)
> s.send("noteoff 1 66\n")
> s.send("quit\n")
> data = s.recv(1024)
> print data
[...]

Thanks for the suggestion, Pablo: simpler is better, after all. 

I tried the socket approach, and while it works, multiple connections break 
the pipe, whereas Telnet() seems to handle this gracefully, so I put it back 
in, as I want to be able to send several streams of midi messages to one 
instance of fluidsynth. 

Or is this possible with sockets too? If it is, I missed it.

Regards,

John




_______________________________________________
fluid-dev mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/fluid-dev

Reply via email to