Old 04-24-2022, 11:47 PM   #1
daniellumertz
Human being with feelings
 
daniellumertz's Avatar
 
Join Date: Dec 2017
Location: Brazil
Posts: 1,694
Default [DEMO] Luasockets - Send/Receive UDP/OSC Messages

First I want to thank a lot gvanbrunt/Mavriq for enabling Luasockets for us!
He open a thread for discussing his implementation of Luasockets in Reascripts https://forums.cockos.com/showthread.php?t=265912


This is a real cool module that will open a lot of ports (ha-ha) for scripters.
gvanbrunt first used it in his zerobranedebugger https://forum.cockos.com/showthread.php?t=262893 and me and him manage to make it work in other context. I have been using it to send and receive OSC/UDP messages. This is really good for communication between softwares like MaxMSP or PureData with REAPER, and also between Scripts!!!

In my exemples all files are embedded so user dont need to download anything more. Other way is to ask user download Mavriq Lua Sockets from reapack. This way user will have the latest version (without you needing to update). His Reapack repository is https://github.com/mavriq-dev/public-reascripts.

And this is the Mavriq repository with a lot info about how to build Lua Sockets and Lua Sockets and Reaper https://github.com/mavriq-dev/mavriq-lua-sockets,


I have made three little exemples using Mavriq Luasockets they are in my reapack

My reapack
Code:
https://raw.githubusercontent.com/daniellumertz/DanielLumertz-Scripts/master/index.xml
In this demo there is three files

Send Sockets Demo
One send OSC messages. Here a exemple where I send the item path and the item count to Max MSP

Here I really want to thanks Cfillion for doing the osc_encode function. Without him I dont think I would pulled that off. This function put strings, integers, floats in the OSC format. You need to use it before send the message like in

Code:
local msg2 = osc_encode('/foo', 'i', 1000, 'i', -1, 's', 'hello', 'f', 1.234, 'f', 5.678) -- Sending many Values types

-- change here to the host an port you want to contact
local host, port = "localhost", 9004
-- convert host name to ip address
local ip = assert(socket.dns.toip(host))
-- create a new UDP object
local udp = assert(socket.udp())
assert(udp:sendto(msg2, ip, port))

Receive Sockets Demo
To receive UDP, OSC messages using a defer loop. Here a exemple where I receive from Max MSP.

you can use ReceiveNewest(udp) function that will only output the latest message (if
you ramp fast between value it wont get all of them)or ReceiveAll(udp) that receives all messages, one per defer loop. If you ramp fast it will process each message per loop leading to receving messages not in real time.

Test with Luasocket functions
Test one of the .lua files that comes with luasockets. These files have a bunch of functions so you dont need to reinvent the wheel.

Last edited by daniellumertz; 04-25-2022 at 06:42 PM.
daniellumertz is online now   Reply With Quote
Old 04-25-2022, 12:23 AM   #2
vitalker
Human being with feelings
 
vitalker's Avatar
 
Join Date: Dec 2012
Posts: 8,969
Default

Wow, the future is here!
vitalker is offline   Reply With Quote
Old 04-25-2022, 02:57 AM   #3
SNJUK2
Human being with feelings
 
SNJUK2's Avatar
 
Join Date: Feb 2017
Location: Ukraine
Posts: 230
Default

Hallo. Thanks for sharing. PD its power
Reapack repository
https://raw.githubusercontent.com/ma...ster/index.xml
__________________
Ableton Live Config

Last edited by SNJUK2; 04-25-2022 at 03:05 AM.
SNJUK2 is offline   Reply With Quote
Old 04-25-2022, 03:27 AM   #4
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 5,393
Default

This looks really promising. What else can be done using it, besides UDP-OSC-messages?
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper
Bugreports&Docs notes please do here:https://github.com/Ultraschall/ultra...-reaper/issues - Donate, if you wish
Meo-Ada Mespotine is offline   Reply With Quote
Old 04-25-2022, 03:49 AM   #5
GameAudioRvlzzr
Human being with feelings
 
GameAudioRvlzzr's Avatar
 
Join Date: Apr 2016
Posts: 191
Default

Yes!! I was hoping for so long for this
GameAudioRvlzzr is offline   Reply With Quote
Old 04-25-2022, 04:01 AM   #6
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 8,382
Default

What kind of message protocol can be send with this that apart OSC ?
X-Raym is offline   Reply With Quote
Old 04-25-2022, 04:20 AM   #7
SNJUK2
Human being with feelings
 
SNJUK2's Avatar
 
Join Date: Feb 2017
Location: Ukraine
Posts: 230
Default

I tried https://github.com/timothyschoen/PlugData but not work
__________________
Ableton Live Config
SNJUK2 is offline   Reply With Quote
Old 04-25-2022, 06:12 AM   #8
Mavriq
Human being with feelings
 
Mavriq's Avatar
 
Join Date: Aug 2016
Location: Thunder Bay, Canada
Posts: 284
Default

Everything that luasockets offers is available. It has raw sockets, UDP, SMTP, FTP and HTTP built in. Unfortunately it does not have HTTPS..Yet. There is a companion library that I will have to build special like I did with Sockets. Then that should work too. I will do that right after I release my next project which should be any day.
Mavriq is offline   Reply With Quote
Old 04-25-2022, 01:35 PM   #9
daniellumertz
Human being with feelings
 
daniellumertz's Avatar
 
Join Date: Dec 2017
Location: Brazil
Posts: 1,694
Default

Quote:
Originally Posted by SNJUK2 View Post
Sorry I don't see how this is related to the topic
daniellumertz is online now   Reply With Quote
Old 04-25-2022, 05:37 PM   #10
AlbertoV5
Human being with feelings
 
Join Date: Feb 2020
Posts: 39
Default

Man, this is bigger news than the Musk man buying Twitter.

Thank you.
AlbertoV5 is offline   Reply With Quote
Old 04-25-2022, 08:17 PM   #11
DaniloVillanova
Human being with feelings
 
Join Date: Jan 2019
Posts: 107
Default

Could this be used to download from freesound.org straight to REAPER?
DaniloVillanova is offline   Reply With Quote
Old 04-25-2022, 08:41 PM   #12
daniellumertz
Human being with feelings
 
daniellumertz's Avatar
 
Join Date: Dec 2017
Location: Brazil
Posts: 1,694
Default

Quote:
Originally Posted by DaniloVillanova View Post
Could this be used to download from freesound.org straight to REAPER?
Maybe with FTP https://w3.impa.br/~diego/software/luasocket/ftp.html

If not then probably only with HTTPS access.
daniellumertz is online now   Reply With Quote
Old 04-25-2022, 09:38 PM   #13
lachinhan
Human being with feelings
 
lachinhan's Avatar
 
Join Date: Nov 2014
Location: Can Tho - Viet Nam
Posts: 254
Default

Quote:
Originally Posted by daniellumertz View Post
Maybe with FTP https://w3.impa.br/~diego/software/luasocket/ftp.html

If not then probably only with HTTPS access.
Pls see this thread https://forum.cockos.com/showthread.php?t=249571

And Mixcraft has integrated Freesound 4 years ago.
https://youtu.be/CNNUtT_SAVE

It would be great to have this in Reaper

Hope you will complete this utility soon

Thanks
__________________
NK Recording Studio
Email: lachinhan@gmail.com or admin@thuamninhkieu.com
Website:nkpro.top and ntmusicpro.com
lachinhan is offline   Reply With Quote
Old 04-26-2022, 07:35 AM   #14
Mavriq
Human being with feelings
 
Mavriq's Avatar
 
Join Date: Aug 2016
Location: Thunder Bay, Canada
Posts: 284
Default

I do plan on getting https working soon. You can follow the progress here. That is unless the devs fix the underlying issue first.
Mavriq is offline   Reply With Quote
Old 04-26-2022, 11:25 AM   #15
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 8,382
Default

This project can surely help interacting with smart devices etc like in this thread for red bulb light: https://forum.cockos.com/showthread.php?t=263506 :P
X-Raym is offline   Reply With Quote
Old 04-26-2022, 03:09 PM   #16
daniellumertz
Human being with feelings
 
daniellumertz's Avatar
 
Join Date: Dec 2017
Location: Brazil
Posts: 1,694
Default

Quote:
Originally Posted by X-Raym View Post
This project can surely help interacting with smart devices etc like in this thread for red bulb light: https://forum.cockos.com/showthread.php?t=263506 :P
Yeah will be a lot easier than the previous solutions, I think heheh
daniellumertz is online now   Reply With Quote
Old 05-01-2022, 06:46 AM   #17
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 5,393
Default

@Mavriq
Is it possible to do stuff like, getting the http(s) status code of websites?
Like 404 on a link?
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper
Bugreports&Docs notes please do here:https://github.com/Ultraschall/ultra...-reaper/issues - Donate, if you wish
Meo-Ada Mespotine is offline   Reply With Quote
Old 05-01-2022, 07:03 AM   #18
Mavriq
Human being with feelings
 
Mavriq's Avatar
 
Join Date: Aug 2016
Location: Thunder Bay, Canada
Posts: 284
Default

Yes, but not https... yet. I'm actually working on that today. There is an add on module called luasec that I'm going to build that allows security.
Mavriq is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 05:22 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2022, vBulletin Solutions Inc.