Old 05-22-2018, 02:19 PM   #1
montag
Human being with feelings
 
Join Date: May 2014
Location: Poland
Posts: 17
Default Getting input from an url into a script in Reaper

Hello

I am working on an artistic project. The idea here is to take some data from the internet (by sending a request to an url and getting some xml or json in return) and then use it to create or alter sound in Reaper.

Now I tried to look both on Lua and Python approach but I am a bit stuck in trying to understand how it works.

For example. Reaper natively interprets Lua but for adding the url-request part to Lua I read that I need to use Luasocket, that (according to some forum post I can't find right now) would not work inside Reaper as this is making a call to luasocket that is some C-based add-on

For another example - this kind of request is easily done in Python, but then again, can I create this entirely in Python (outside Reaper) then contact Reaper API from that script to run some sound/musical command on this?

I would like to start this in a way that is efficient and Reaper-wise makes sense. Can you advise what would be the most sensible approach here?

Thanks!
montag is offline   Reply With Quote
Old 06-17-2018, 11:34 AM   #2
montag
Human being with feelings
 
Join Date: May 2014
Location: Poland
Posts: 17
Default hmmm

nobody?
montag is offline   Reply With Quote
Old 06-17-2018, 12:23 PM   #3
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

Can't be done natively. Scripts can't access the internet aside from using your browser to open a web page, and Lua scripts can't load libraries that aren't written in plain Lua.

Lua: you'd have to write a standalone script that CAN use LuaSocket and have it save to a text file. Then your Reaper script can run that one using os.execute and periodically check the text file for changes to get the results.

Python: The beyond.Reaper extension lets you access Python stuff outside Reaper somehow. I'm not familiar with Python, sadly.
__________________
I'm no longer using Reaper or working on scripts for it. Sorry. :(
Default 5.0 Nitpicky Edition / GUI library for Lua scripts / Theory Helper / Radial Menu / Donate
Lokasenna is offline   Reply With Quote
Old 06-17-2018, 12:25 PM   #4
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,900
Default

I think you can use cURL-like CLI tools with Lua, or any other CLI which is abble to handle HTTP requests.
There is ReaScript function to call CLI tools from REAPER (see reaper.ExecProcess( cmd ) ).

I'm pretty sure Heda's scripts downloader use cURL for the URL requests. beyond.reaper is a bit complex to install compared to this.



There may be other libraries or others CLI than cURL which you can consider, but you get the main idea.



for Python, you can run python script within REAPER without it to be "external", just like any other reascript. May be simpler to install for you if you already have all the necessary libraries, and the basic Python skills.

Last edited by X-Raym; 06-17-2018 at 10:26 PM.
X-Raym is offline   Reply With Quote
Old 06-17-2018, 03:26 PM   #5
geraintluff
Human being with feelings
 
geraintluff's Avatar
 
Join Date: Nov 2009
Location: mostly inside my own head
Posts: 346
Default

Could you do it in JavaScript, using the Web Remote?

REAPER exports a web API for controlling itself, along with a web-page which you can load in a browser or other devices to remote-control it. You can add custom stuff to this controller web-page, and that definitely can get URLs and stuff - cross-platform, no extra installation.

I've never actually used the Web Controller myself, though.
__________________
JSFX set | Bandcamp/SoundCloud/Spotify
geraintluff is offline   Reply With Quote
Old 06-17-2018, 08:57 PM   #6
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,773
Default

Beyond already has been mentioned.
A friend of mine uses this very successfully in a project that has Reaper record sessions and upload the result to a site in the Internet.
Beyond is more like remote-controlling Reaper from an external (Python) Program than having Reaper (scripting) access the outside world. But as Beyond installs a communication path between inside and outside Reaper (via OSC/TCP-IP-Network), and is open source Python code, it can be extended to do additional tricks, if appropriate.

-Michael
mschnell is offline   Reply With Quote
Old 06-23-2018, 07:04 AM   #7
montag
Human being with feelings
 
Join Date: May 2014
Location: Poland
Posts: 17
Default Thanks!

Thank You!

Lots of interresting suggestions here. I will try them out and let you know how it went
montag 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 06:32 AM.


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