How to use OscDataSend to send points in LinTable

15 visualizações
Pular para a primeira mensagem não lida

Erwin Engelsma

não lida,
26 de jul. de 2022, 13:59:5026/07/2022
para pyo-discuss
Hi there, 
I wrote a program that uses LinTables to send waveshapes to an external interface (ES-8), so I can create complex modulation shapes. 
See the snippet below:
s = Server(nchnls = oscillators, winhost = "ASIO4ALL")
s.setInOutDevice(14)
s.boot()
dataSender= OscDataSend("m",  5006, "/filter")
t = LinTable([(0, 0.0), (16, 0.5)], size = 16)
t.graph(yrange=(-1,1), title = "tabel T")  
OT = Osc(table = t, freq = 1, mul = 0.5)
OT.out(chnl = 1)
msg = t.getPoints()
dataSender.send([[msg]])
s.start()
s.gui(locals()) 

Sending the wave to the interface goes very well, it reacts nicely to me redrawing the shape.
However, in order to store the exact shape for later use I want to send the points of the linear table to a server which can do the file storage of those points.
For this I would like to continuously update the points that are sent, for a flexible number of points. The above program sends the data only one time and it is not the data I would expect.
How do I make this continuous?
Also this program only 'works' for two points in the graph. If I enter a graph with more points the program just crashes, without any error message. 
Anyone any ideas how I should continuously send the graphPoints via Osc?
Thanks, Erwin

Alexandros

não lida,
26 de jul. de 2022, 14:48:0726/07/2022
para pyo-d...@googlegroups.com

I guess you have to put the `dataSender.send([[msg]])` line inside a function that you should call periodically, either with Pattern(), or even bind it to the DSP sample block with `s.setCallback()`, even though maybe it's a good idea to send data at that rate.

Also, in your code, I don't see refreshing the contents of the table anywhere.

--
You received this message because you are subscribed to the Google Groups "pyo-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyo-discuss...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pyo-discuss/1a2cbc8e-b5a4-4365-8b92-cdf9d71ca5e0n%40googlegroups.com.

Erwin Engelsma

não lida,
26 de jul. de 2022, 15:10:1926/07/2022
para pyo-discuss
Thanks for the tip about s.setCallback() and Pattern. I'll try it. That part is very helpful. It is true that the table is not explicitly refreshed. I don't know how that works, but changing the point in the graph with a mouse DOES have immediate effect.
So now the only remaining issue: how to get the points into the message in the right format? I thought as a list of tuples would work okay, but that does not work.

Alexandros

não lida,
27 de jul. de 2022, 02:52:0327/07/2022
para pyo-d...@googlegroups.com

If I understand correctly, you want to send the message as a MIDI packet, right? Hence the "m" argument in dataSender. From Pyo's documentation, I read that a MIDI packet consists of four bytes, while your table has 16 points. Can you tell us what it is that you actually expect to receive and what it is that you are receiving?

Erwin Engelsma

não lida,
27 de jul. de 2022, 14:25:2027/07/2022
para pyo-discuss
Hi Alexandros, thanks for thinking along with me! No there is no MIDI involved ( I thought the 'm' was for message). So what I want: I can draw shapes in the graphs which are then sent to an audio interface where I use them to modulate an analog synthesizer. That part works well and I can make highly complex sounds (like birdsong) that way. So, I have a number of graphs on the screen with a number of points in them that I have 'drawn' with a mouse. Now I would like to store the graphs that I drew in a file so I can recall them again for later use. It is hard to create a working GUI in the same program where graphs are running, so I thought if I send the points in a graph to another program with OSC I can make a decent GUI in that program. I hope that is clear. If it helps I can send the complete program that I have now, which I use to make the modulation waveshapes. The program above is a simplified version of it to focus on the issue at hand. I hope this makes sense.

Alexandros Drymonitis

não lida,
28 de jul. de 2022, 02:05:3828/07/2022
para pyo-d...@googlegroups.com
If you want to send all 16 values, then I think what you need is the "b" string which stands for blob of chars. I've never used it, but from what I understand, you can send a blob of one-byte values.
Otherwise, you'll have to use a string with 16 "f" to send a list of 16 floats. Like this "ffffffffffffffff". 

Erwin Engelsma

não lida,
28 de jul. de 2022, 03:57:4728/07/2022
para pyo-discuss
Thanks for thinking along with me. Your suggestions have put me on the right track. I will experiment and if the results are to my liking I'll keep you informed. Still numbers of issues to be solved but seems feasible now.

Erwin Engelsma

não lida,
28 de jul. de 2022, 14:26:3528/07/2022
para pyo-discuss
Hi Alexandro, 
just to let you know it now works in the way I wanted. Thanks for helping me along the path of thinking like a pyo programmer!
Responder a todos
Responder ao autor
Encaminhar
0 nova mensagem