Go Back   Cockos Incorporated Forums > REAPER Forums > REAPER Pre-Release Discussion

Reply
 
Thread Tools Display Modes
Old 12-23-2014, 12:29 PM   #1
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,488
Default v5.0pre - New ReaScript functions/IDE testing

gfx_showmenu seems to work in JSFX too



(Don't know what would be the best way to "handle" a menu, but this seems to work)

JSFX - Popup menu test:
Code:
@init
// first menu item with a submenu
menu1.item0 = ">Split target items at...|";
// second menu item (checked)
menu1.item1 = "!Start of source item(s)";
// third menu item (checked)
menu1.item2 = "|!<End of source item(s)";

menu1.item1.state = 1; // "state variable" for second menu item
menu1.item2.state = 1; // "state variable" for third menu item

menu1.state_changed = 1;

@gfx 100 100
!init ? gfx_setfont(1,"Arial", 15); init = 1;

gfx_set(1,1,1,1);

!mouse.state && mouse_cap == 2 ? ( // right click opens a popup menu
  
  gfx_x = mouse_x;
  gfx_y = mouse_y;
  
  #menu1 = "";
  
  #menu1 += menu1.item0;
  #menu1 += menu1.item1;
  #menu1 += menu1.item2;
  
  
  menu1.val = gfx_showmenu(#menu1);
  
  menu1.val > 0 ? ( // user clicked on menu item
    menu1.state_changed = 1;
    
    // user clicked on second menu item
    menu1.val == 1 ? (
      // toggle item state
      menu1.item1.state = !menu1.item1.state
      // else if user clicked on third menu item
    ) : menu1.val == 2 ? (
      // toggle item state
     menu1.item2.state = !menu1.item2.state;
    );
  );
);

menu1.state_changed ? (

  // second menu item's state has changed ?
  menu1.val == 1 ? (
    match("!*", menu1.item1) ? ( // second menu item is checked ?
      menu1.item1 = "Start of source item(s)";
    ) : (
      menu1.item1 = "!Start of source item(s)";
    );
  );
  
  // third menu item's state has changed ?
  menu1.val == 2 ? (
    match("|!*", menu1.item2) ? ( // third menu item is checked ?
      menu1.item2 = "|<End of source item(s)";
    ) : (
      menu1.item2 = "|!<End of source item(s)";
    );
  );
  menu1.state_changed = 0;
);


gfx_x = gfx_y = 10;

// second menu item is currently checked ?
menu1.item1.state ? gfx_set(1,1,1,1) : gfx_set(1,1,1,0.5);
gfx_drawstr("Split target items at start of source item(s)");

gfx_x = 10;
gfx_y += gfx_texth;

// third menu item is currently checked ?
menu1.item2.state ? gfx_set(1,1,1,1) : gfx_set(1,1,1,0.5);
gfx_drawstr("Split target items at end of source item(s)");

mouse_cap == 0 ? mouse.state = 0: mouse.state = 1;

(function description - EEL/JSFX)
Code:
EEL: gfx_showmenu("str")

Shows a popup menu at gfx_x,gfx_y. str is a list of fields separated by | characters. Each field represents a menu item.
Fields can start with special characters:

# : grayed out
! : checked
> : this menu item shows a submenu
< : last item in the current submenu

An empty field will appear as a separator in the menu. gfx_showmenu returns 0 if the user selected nothing from the menu, 1 if the first field is selected, etc.
Example:

gfx_showmenu("first item, followed by separator||!second item, checked|>third item which spawns a submenu|#first item in submenu, grayed out|<second and last item in submenu|fourth item in top menu")

Last edited by spk77; 12-24-2014 at 12:53 AM.
spk77 is offline   Reply With Quote
Old 12-24-2014, 06:34 AM   #2
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,488
Default

EDIT. FIXED IN 5.0pre2

First Lua test...reaper.MIDI_InsertNote is broken. (MIDI_InsertNote is also broken in REAPER v4.x)

This script should add 128 MIDI notes (pitches 0 to 127)...
  • Open an empty MIDI item in ME
  • Run the script
  • weird "00" events are added
  • random missing notes

Code:
-- Open an empty MIDI item in ME
-- Run the script

function msg(m)
  reaper.ShowConsoleMsg(tostring(m))
  reaper.ShowConsoleMsg("\n")
end

function insert_notes()
  local take = reaper.MIDIEditor_GetTake(reaper.MIDIEditor_GetActive())
  --msg(take)
  --msg(reaper.MIDIEditor_GetActive())
  --if take == nil then return end
  for i = 0, 127 do
    --bool MIDI_InsertNote(MediaItem_Take* take, bool selected, bool muted, startppqpos, endppqpos, int chan, int pitch, int vel)
    local ret = reaper.MIDI_InsertNote(take, 1, 0, i * 960.0, i * 960.0 + 960.0, 0, i, 96)
    --msg("Note: "..tostring(i).." Return value: "..tostring(ret))
  end
  --Open "Raw MIDI data" window
  reaper.MIDIEditor_OnCommand(reaper.MIDIEditor_GetActive(), 40666)
end

insert_notes()

Last edited by spk77; 12-24-2014 at 11:33 AM.
spk77 is offline   Reply With Quote
Old 12-24-2014, 06:50 AM   #3
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,488
Default

Lua tutorial (for beginners like me...sigh.. ):
http://www.tutorialspoint.com/lua/index.htm

The syntax doesn't look too complex, though. And there seem to be some nice string manipulation functions...which is nice
spk77 is offline   Reply With Quote
Old 12-24-2014, 09:25 AM   #4
schwa
Administrator
 
schwa's Avatar
 
Join Date: Mar 2007
Location: NY
Posts: 9,839
Default

I'd like to put in a plug for Lua. I have used many scripting languages, going back a long ways. (One of my first programs was a 50,000 line awk script that a whole business ran off of.) I get along better with some languages and worse with others.

I find Lua to be a a real pleasure to use, honestly more fun than any other scripting language I've had experience with. Within a few minutes of using the language for the first time I was working on a script that will represent a significant new feature, which will be released as part of 5.0, and be indistinguishable from functionality coded natively in REAPER. Because, really, it is functionality coded natively in REAPER, with identical access to the internals of REAPER, including access to track audio and MIDI.

I really think that the combination of Lua's ease of use, and improvements to REAPER's API, will open up an almost unlimited world of creative possibilities.
schwa is offline   Reply With Quote
Old 12-24-2014, 09:27 AM   #5
schwa
Administrator
 
schwa's Avatar
 
Join Date: Mar 2007
Location: NY
Posts: 9,839
Default

Quote:
Originally Posted by spk77 View Post
First Lua test...reaper.MIDI_InsertNote is broken.
This should be fixed in 5.0pre2, thanks for the report.
schwa is offline   Reply With Quote
Old 12-24-2014, 09:31 AM   #6
DarkStar
Human being with feelings
 
DarkStar's Avatar
 
Join Date: May 2006
Location: Surrey, UK
Posts: 17,745
Default

Hmm,

JS FX, Python, eel, Lua ....

Pick one! (And make it easy to use in Reaper without installing anything-else)
__________________
DarkStar ... interesting, if true. . . . Inspired by ...
DarkStar is online now   Reply With Quote
Old 12-24-2014, 09:35 AM   #7
EvilDragon
Human being with feelings
 
EvilDragon's Avatar
 
Join Date: Jun 2009
Location: Croatia
Posts: 22,541
Default

Quote:
Originally Posted by DarkStar View Post
Hmm,

JS FX, Python, eel, Lua ....

Pick one! (And make it easy to use in Reaper without installing anything-else)
EEL = JS. And you forgot Perl.


Lua seems to be the way forward - installs natively with Reaper (it's a small compiler, something like 150 KB), which means it's great for portable installs.
EvilDragon is online now   Reply With Quote
Old 12-24-2014, 09:38 AM   #8
EvilDragon
Human being with feelings
 
EvilDragon's Avatar
 
Join Date: Jun 2009
Location: Croatia
Posts: 22,541
Default

Quote:
Originally Posted by schwa View Post
which will be released as part of 5.0, and be indistinguishable from functionality coded natively in REAPER. Because, really, it is functionality coded natively in REAPER, with identical access to the internals of REAPER, including access to track audio and MIDI.
How about performance compared to raw C++/ASM?
EvilDragon is online now   Reply With Quote
Old 12-24-2014, 09:38 AM   #9
schwa
Administrator
 
schwa's Avatar
 
Join Date: Mar 2007
Location: NY
Posts: 9,839
Default

Quote:
Originally Posted by DarkStar View Post
Hmm,

JS FX, Python, eel, Lua ....

Pick one! (And make it easy to use in Reaper without installing anything-else)
JS and EEL are pretty much the same thing; JS is an EEL script that runs as an FX. EEL and Lua are built in to REAPER and don't require installing anything else. Lua is easier to use, EEL is more efficient. Python unfortunately does require a third-party installation, and as such, will never be as portable between users as EEL or Lua.

My recommendation in general would be to use Lua except in cases where performance is critical, such as real-time audio processing, in which case JS/EEL is more appropriate.
schwa is offline   Reply With Quote
Old 12-24-2014, 09:46 AM   #10
schwa
Administrator
 
schwa's Avatar
 
Join Date: Mar 2007
Location: NY
Posts: 9,839
Default

Quote:
Originally Posted by EvilDragon View Post
How about performance compared to raw C++/ASM?
An EEL script can be as efficient as compiled code. Lua is somewhat less efficient, but for most ReaScript use cases, plenty efficient. But the choices you make while programming usually have much more of an effect on performance than the choice of platform.

Off topic slightly, but there do exist Lua engines that are incredibly efficient. http://luajit.org/ is an amazing project and shockingly high performance. We don't plan to compile it into REAPER, but if Lua performance ever becomes an issue, we can support it as a third-party install.
schwa is offline   Reply With Quote
Old 12-24-2014, 09:52 AM   #11
EvilDragon
Human being with feelings
 
EvilDragon's Avatar
 
Join Date: Jun 2009
Location: Croatia
Posts: 22,541
Default

Quote:
Originally Posted by schwa View Post
Off topic slightly, but there do exist Lua engines that are incredibly efficient. http://luajit.org/ is an amazing project and shockingly high performance. We don't plan to compile it into REAPER, but if Lua performance ever becomes an issue, we can support it as a third-party install.
Any particular reasons why not using that one if it offers "shockingly high performance"?
EvilDragon is online now   Reply With Quote
Old 12-24-2014, 10:01 AM   #12
schwa
Administrator
 
schwa's Avatar
 
Join Date: Mar 2007
Location: NY
Posts: 9,839
Default

Quote:
Originally Posted by EvilDragon View Post
Any particular reasons why not using that one if it offers "shockingly high performance"?
It's much bigger, would have to be static-linked rather than compiled in as source code, and it's one (soon to be two) Lua version numbers behind. Less quantifiably, it's entirely the work of one genius programmer who hasn't updated it in a while, as opposed to stock Lua which is very actively developed by a team with long-term financial support.

Not to take anything away from LuaJIT. It is a really impressive project. It's just not as suitable for inclusion with REAPER.
schwa is offline   Reply With Quote
Old 12-24-2014, 10:03 AM   #13
EvilDragon
Human being with feelings
 
EvilDragon's Avatar
 
Join Date: Jun 2009
Location: Croatia
Posts: 22,541
Default

Got it. Thanks for this info, schwa.


(Perhaps get that genius programmer to join Cockos, the more the merrier? )
EvilDragon is online now   Reply With Quote
Old 12-24-2014, 10:14 AM   #14
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,488
Default

Quote:
Originally Posted by schwa View Post
This should be fixed in 5.0pre2, thanks for the report.
Thanks! This has been bothering me for a long time.
Quote:
Originally Posted by schwa View Post
An EEL script can be as efficient as compiled code. Lua is somewhat less efficient, but for most ReaScript use cases, plenty efficient. But the choices you make while programming usually have much more of an effect on performance than the choice of platform.
I really like the (hmm... initial) speed/performance of EEL scripts. Python is almost unusable for simple scripts that needs to be executed fast (for example something like "Move edit cursor to next X position"). Yes, I have an old computer at home
spk77 is offline   Reply With Quote
Old 12-24-2014, 10:21 AM   #15
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,488
Default

# API: added Main_SaveProject, fixed MIDI_InsertNote, improved Get/SetProjExtState

Thank you very much...that was...quite fast

EDIT: and more functions, yeah!
spk77 is offline   Reply With Quote
Old 12-24-2014, 10:29 AM   #16
Xenakios
Human being with feelings
 
Xenakios's Avatar
 
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 7,579
Default

Quote:
Originally Posted by schwa View Post
...
I really think that the combination of Lua's ease of use, and improvements to REAPER's API, will open up an almost unlimited world of creative possibilities.
OK, I guess I have to take a look at the Lua scripting since I sense the future of ReaScript might favor Lua with Python being left even more behind than it currently is. (For example I think Python never gained any support for the gfx_ functionality...)
__________________
For info on SWS Reaper extension plugin (including Xenakios' previous extension/actions) :
http://www.sws-extension.org/
https://github.com/Jeff0S/sws
--
Xenakios blog (about HourGlass, Paul(X)Stretch and λ) :
http://xenakios.wordpress.com/
Xenakios is online now   Reply With Quote
Old 12-24-2014, 10:39 AM   #17
Xenakios
Human being with feelings
 
Xenakios's Avatar
 
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 7,579
Default

How to add into the Lua API from C++ extension plugins? I have couple of a functions added for the ReaScript API from a custom extension plugin that I would need to access from Lua too...(I am assuming things are not just going to magically work already, so I haven't yet tested if my extension plugin provided functions work with Lua or not.)

Notably one of the custom functions deals with this bug which still hasn't been addressed :

http://forum.cockos.com/showthread.php?t=141021
__________________
For info on SWS Reaper extension plugin (including Xenakios' previous extension/actions) :
http://www.sws-extension.org/
https://github.com/Jeff0S/sws
--
Xenakios blog (about HourGlass, Paul(X)Stretch and λ) :
http://xenakios.wordpress.com/
Xenakios is online now   Reply With Quote
Old 12-24-2014, 11:16 AM   #18
schwa
Administrator
 
schwa's Avatar
 
Join Date: Mar 2007
Location: NY
Posts: 9,839
Default

There's no facility for that yet, adding functions from a C++ extension that can then be called from a Lua script. We should be able to add it at some point.

We can definitely add GetMediaSourceLength().
schwa is offline   Reply With Quote
Old 12-24-2014, 11:26 AM   #19
sstillwell
Human being with feelings
 
Join Date: Jul 2006
Location: Cowtown
Posts: 1,550
Default

Quote:
Originally Posted by schwa View Post
My recommendation in general would be to use Lua except in cases where performance is critical, such as real-time audio processing, in which case JS/EEL is more appropriate.
This.

BTW, Hio, schwa! Happy holidays to you all!

Scott
__________________
http://www.stillwellaudio.com/
sstillwell is offline   Reply With Quote
Old 12-24-2014, 11:29 AM   #20
pakkuncung
Human being with feelings
 
pakkuncung's Avatar
 
Join Date: Sep 2012
Location: Indonesia
Posts: 91
Default

Quote:
Originally Posted by DarkStar View Post
Hmm,

JS FX, Python, eel, Lua ....

Pick one! (And make it easy to use in Reaper without installing anything-else)
and WALTER?

i guess the only DAW that eventually encourage its user to hack/write script/code to is REAPER...Haha

i wonder...besides the ease or processing efficency, what is the benefit scripting using Lua vs EEL? is there any API which Lua could access while EEL couldn't?
__________________
JRENG!
EHX
pakkuncung is offline   Reply With Quote
Old 12-24-2014, 11:37 AM   #21
Xenakios
Human being with feelings
 
Xenakios's Avatar
 
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 7,579
Default

Quote:
Originally Posted by pakkuncung View Post
what is the benefit scripting using Lua vs EEL? is there any API which Lua could access while EEL couldn't?
EEL is frankly a quite messy, low level language. I haven't done much coding with Lua but it seems to be a notch above in abstraction capabilities. That is, it's hopefully easier to build more complicated things in Lua than in EEL.

Python seems easier and cleaner still, though...And comes with a ton of library facilities. But sadly I guess it's exactly those libraries that make it non-attractive for Cockos to add directly into Reaper's installer since they do take a considerable amount of space.
__________________
For info on SWS Reaper extension plugin (including Xenakios' previous extension/actions) :
http://www.sws-extension.org/
https://github.com/Jeff0S/sws
--
Xenakios blog (about HourGlass, Paul(X)Stretch and λ) :
http://xenakios.wordpress.com/
Xenakios is online now   Reply With Quote
Old 12-24-2014, 11:41 AM   #22
Xenakios
Human being with feelings
 
Xenakios's Avatar
 
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 7,579
Default

Quote:
Originally Posted by schwa View Post
There's no facility for that yet, adding functions from a C++ extension that can then be called from a Lua script. We should be able to add it at some point.

We can definitely add GetMediaSourceLength().
Thanks for the infos!

Another function besides GetMediaSourceLength() I needed to do was
Code:
MediaItem* AddMediaItemFromFile(const char* filename, MediaTrack* track)
I am not sure if implementing this in an extension plugin is necessary, but I think there was/is some problem doing this directly with the ReaScript facilities. I can test again whether I can manage to implement this with just ReaScript... edit : Ah right, it's the missing GetMediaSourceLength() that prevents doing that sanely. Also I am not sure if the GetSetMediaItemTakeInfo(take, "P_SOURCE", src); is allowed by ReaScript...

The C++ code :
Code:
MediaItem* add_media_item_from_file(const char* infn, MediaTrack* track)
{
	PCM_source* src = PCM_Source_CreateFromFile(infn);
	if (src != nullptr)
	{
		MediaItem* item = AddMediaItemToTrack(track);
		MediaItem_Take* take = AddTakeToMediaItem(item);
		GetSetMediaItemTakeInfo(take, "P_SOURCE", src);
		double srclen = src->GetLength();
		GetSetMediaItemInfo(item, "D_LENGTH", &srclen);
		std::tr2::sys::path path(src->GetFileName());
		auto fn = path.filename().generic_u8string();
		GetSetMediaItemTakeInfo(take, "P_NAME", (void*)fn.c_str());
		UpdateArrange();
		return item;
	}
	return nullptr;
}
__________________
For info on SWS Reaper extension plugin (including Xenakios' previous extension/actions) :
http://www.sws-extension.org/
https://github.com/Jeff0S/sws
--
Xenakios blog (about HourGlass, Paul(X)Stretch and λ) :
http://xenakios.wordpress.com/
Xenakios is online now   Reply With Quote
Old 12-24-2014, 11:42 AM   #23
mete0r
Human being with feelings
 
Join Date: Jul 2013
Posts: 115
Default

Quote:
Originally Posted by schwa View Post
My recommendation in general would be to use Lua except in cases where performance is critical, such as real-time audio processing, in which case JS/EEL is more appropriate.
Is it still possible to do audio processing in lua, even if suboptimal?
mete0r is offline   Reply With Quote
Old 12-24-2014, 12:14 PM   #24
schwa
Administrator
 
schwa's Avatar
 
Join Date: Mar 2007
Location: NY
Posts: 9,839
Default

Quote:
Originally Posted by pakkuncung View Post
i wonder...besides the ease or processing efficency, what is the benefit scripting using Lua vs EEL? is there any API which Lua could access while EEL couldn't?
At present I think the REAPER APIs for Lua and EEL are exactly identical.

Quote:
Originally Posted by mete0r View Post
Is it still possible to do audio processing in lua, even if suboptimal?
Yes, absolutely, see item_fft.lua on landoleet.org. "Suboptimal" is a relative term.
schwa is offline   Reply With Quote
Old 12-24-2014, 12:21 PM   #25
schwa
Administrator
 
schwa's Avatar
 
Join Date: Mar 2007
Location: NY
Posts: 9,839
Default

Though I think where Lua is going to be especially useful/interesting is with regard to MIDI...
schwa is offline   Reply With Quote
Old 12-24-2014, 12:41 PM   #26
Garrick
Human being with feelings
 
Garrick's Avatar
 
Join Date: Jul 2009
Location: Wellington
Posts: 4,503
Default

Cheers, i was wondering about lua
Garrick is offline   Reply With Quote
Old 12-24-2014, 12:46 PM   #27
musicbynumbers
Human being with feelings
 
musicbynumbers's Avatar
 
Join Date: Jun 2009
Location: brighton, uk
Posts: 12,589
Default

Quote:
Originally Posted by schwa View Post
I'd like to put in a plug for Lua. I have used many scripting languages, going back a long ways. (One of my first programs was a 50,000 line awk script that a whole business ran off of.) I get along better with some languages and worse with others.

I find Lua to be a a real pleasure to use, honestly more fun than any other scripting language I've had experience with. Within a few minutes of using the language for the first time I was working on a script that will represent a significant new feature, which will be released as part of 5.0, and be indistinguishable from functionality coded natively in REAPER. Because, really, it is functionality coded natively in REAPER, with identical access to the internals of REAPER, including access to track audio and MIDI.

I really think that the combination of Lua's ease of use, and improvements to REAPER's API, will open up an almost unlimited world of creative possibilities.
that's super exciting to hear Schwa!


awesome news
__________________
subproject FRs click here
note: don't search for my pseudonym on the web. The "musicbynumbers" you find is not me or the name I use for my own music.
musicbynumbers is offline   Reply With Quote
Old 12-24-2014, 12:48 PM   #28
Argitoth
Human being with feelings
 
Argitoth's Avatar
 
Join Date: Feb 2008
Location: Phoenix, AZ
Posts: 2,055
Default

While we are on the subject... is it possible to do eel/gfx stuff from C++ plugin?
__________________
Soundemote - Home of the chaosfly and pretty oscilloscope.
MyReaperPlugin - Easy-to-use cross-platform C++ REAPER extension template
Argitoth is offline   Reply With Quote
Old 12-24-2014, 12:51 PM   #29
Xenakios
Human being with feelings
 
Xenakios's Avatar
 
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 7,579
Default

Quote:
Originally Posted by Argitoth View Post
While we are on the subject... is it possible to do eel/gfx stuff from C++ plugin?
Sure, just open a window and draw with the Lice functions on it! (The smilie is a hint it's not exactly easy. It's not super hard either, but it certainly is annoying as hell to do.)
__________________
For info on SWS Reaper extension plugin (including Xenakios' previous extension/actions) :
http://www.sws-extension.org/
https://github.com/Jeff0S/sws
--
Xenakios blog (about HourGlass, Paul(X)Stretch and λ) :
http://xenakios.wordpress.com/
Xenakios is online now   Reply With Quote
Old 12-24-2014, 01:27 PM   #30
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,488
Default

Quote:
Originally Posted by sstillwell View Post
This.

BTW, Hio, schwa! Happy holidays to you all!

Scott
Happy holidays!

There's a little bug in the editor:

"Go to error" button appears only when mouse is on the button:





Hmmm...maybe I'm doing something wrong, but this doesn't seem to work:
gain = math.pow(10, -40/20)

It shows an error message: "attempt to call a nil value (field 'pow')"
spk77 is offline   Reply With Quote
Old 12-24-2014, 01:29 PM   #31
EvilDragon
Human being with feelings
 
EvilDragon's Avatar
 
Join Date: Jun 2009
Location: Croatia
Posts: 22,541
Default

Quote:
Originally Posted by schwa View Post
Though I think where Lua is going to be especially useful/interesting is with regard to MIDI...
...but all-notes-off issues and CC resetting should still be handled by you guys, not a potential Lua script, right?

http://forum.cockos.com/showthread.php?t=25325
http://forum.cockos.com/showthread.php?t=125481
http://forum.cockos.com/showthread.php?t=151661
EvilDragon is online now   Reply With Quote
Old 12-24-2014, 01:43 PM   #32
Argitoth
Human being with feelings
 
Argitoth's Avatar
 
Join Date: Feb 2008
Location: Phoenix, AZ
Posts: 2,055
Default

FEATURE REQUEST: Double clicking on a variable in the variable monitor window does a find for the variable name/text... as in: to make it easy to go to a variable.
__________________
Soundemote - Home of the chaosfly and pretty oscilloscope.
MyReaperPlugin - Easy-to-use cross-platform C++ REAPER extension template
Argitoth is offline   Reply With Quote
Old 12-24-2014, 01:47 PM   #33
schwa
Administrator
 
schwa's Avatar
 
Join Date: Mar 2007
Location: NY
Posts: 9,839
Default

Quote:
Originally Posted by spk77 View Post
Hmmm...maybe I'm doing something wrong, but this doesn't seem to work:
gain = math.pow(10, -40/20)

We're using Lua 5.3 (currently a release candidate build). math.pow is deprecated, use -40^20 instead.

http://www.lua.org/work/doc/contents.html
schwa is offline   Reply With Quote
Old 12-24-2014, 01:48 PM   #34
mete0r
Human being with feelings
 
Join Date: Jul 2013
Posts: 115
Default

WHOA, that is beyond incredibly cool. Beyond incredibly cool doesn't begin to describe it.

Small nitpick (probably due to wine and not reaper, but reporting it anyway): when using the action to create an eel/lua file, if I leave it at the all files default, and type test.lua as filename, it's test.lua.eel that gets created (and the editor of course complains about syntax errors).
mete0r is offline   Reply With Quote
Old 12-24-2014, 01:54 PM   #35
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,488
Default

Quote:
Originally Posted by schwa View Post
We're using Lua 5.3 (currently a release candidate build). math.pow is deprecated, use -40^20 instead.

http://www.lua.org/work/doc/contents.html
That seems to work, thanks!
spk77 is offline   Reply With Quote
Old 12-24-2014, 02:04 PM   #36
schwa
Administrator
 
schwa's Avatar
 
Join Date: Mar 2007
Location: NY
Posts: 9,839
Default

Quote:
Originally Posted by spk77 View Post
Happy holidays!
Happy holidays to you too!

[edited]

I was going to warn that you can't write an audio FX using reascript -- the only way to alter the audio signal at present is as an FX insert, like a JSFX. Reascripts can use the audioaccessor API to access track and item audio, but it's read-only access.

Then I looked again at your gif and it appears you are doing something like converting audio analysis to envelopes in the project, which is a perfectly suitable use for reascript. So, carry on!

Last edited by schwa; 12-24-2014 at 02:10 PM.
schwa is offline   Reply With Quote
Old 12-24-2014, 02:05 PM   #37
Argitoth
Human being with feelings
 
Argitoth's Avatar
 
Join Date: Feb 2008
Location: Phoenix, AZ
Posts: 2,055
Default

i think the goal is to manipulate item envelopes based on audio accessor
__________________
Soundemote - Home of the chaosfly and pretty oscilloscope.
MyReaperPlugin - Easy-to-use cross-platform C++ REAPER extension template
Argitoth is offline   Reply With Quote
Old 12-24-2014, 02:07 PM   #38
Mercado_Negro
Moderator
 
Mercado_Negro's Avatar
 
Join Date: Aug 2007
Location: Caracas, Venezuela
Posts: 8,245
Default

Man, I really need to dig into this. It looks really cool! ReaScript and all that geek stuff has always been very interesting to me. Hopefully on January I'll take a few hours to read about it For now, let's have the rum controlling the scene lol
__________________
Pressure is what turns coal into diamonds - Michael a.k.a. Runaway
Mercado_Negro is offline   Reply With Quote
Old 12-24-2014, 02:15 PM   #39
Argitoth
Human being with feelings
 
Argitoth's Avatar
 
Join Date: Feb 2008
Location: Phoenix, AZ
Posts: 2,055
Default

Quote:
Originally Posted by Argitoth View Post
i think the goal is to manipulate item envelopes based on audio accessor
omg wait... wait wait wait... spk77 your dreams have come true!!! Because lua can now be used like EEL, you can probably have that "infinite access to item chunks" you wanted!

ey? am I right or am I right? I know you spk77... I know you. I know how you work!
__________________
Soundemote - Home of the chaosfly and pretty oscilloscope.
MyReaperPlugin - Easy-to-use cross-platform C++ REAPER extension template

Last edited by Argitoth; 12-24-2014 at 02:20 PM.
Argitoth is offline   Reply With Quote
Old 12-24-2014, 02:27 PM   #40
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,488
Default

Quote:
Originally Posted by schwa View Post
Happy holidays to you too!

[edited]

I was going to warn that you can't write an audio FX using reascript -- the only way to alter the audio signal at present is as an FX insert, like a JSFX. Reascripts can use the audioaccessor API to access track and item audio, but it's read-only access.

Then I looked again at your gif and it appears you are doing something like converting audio analysis to envelopes in the project, which is a perfectly suitable use for reascript. So, carry on!
Yes, I'm trying to do something like this with Lua :


(http://forum.cockos.com/showpost.php...4&postcount=11)

Quote:
Originally Posted by Argitoth View Post
omg wait... wait wait wait... spk77 your dreams have come true!!! Because lua can now be used like EEL, you can probably have that "infinite access to item chunks" you wanted!

ey? am I right or am I right? I know you spk77... I know you. I know how you work!
You are absolutely right!
spk77 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 07:54 AM.


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