New Tool: Run Cmd On Selection

downloading 0.2 and replacing the script in Renoise doesn’t give me the update, but similar window like 0.1?

EDIT:

nevermind, found it :)

great update,works better i think

cheers :)

Would be great if this tool would allow you to generate the processed script onto a new instrument in Renoise as well.

ahh yes,was about to edit my post for this question/FT :D

The commandline tool I’m trying to get to work on a selection in Renoises sample editor accepts ‘infile’ (– input soundfile to filter) & ‘outfile’ (– output (filtered) soundfile).

In other words a .wav file that is present in the current directory. Is there a way I can bypass this need for a physical .wav file and use what is selected in Renoise instead, like how Sox works?

I can pm you the tool if you have time and like to try it out for yourself?

EDIT:

Nevermind, got it to work! :drummer:

Had one of the arguments wrong :)

hey, that’s a great idea! and shouldn’t be hard to add.

one thing I also really want is the ability to save presets from within the script. so you can try out stuff, then save what works. but that’s still a bit advanced for me, it will have to wait ^^

Oooh, that would be sweet indeed :) . All the cdp tools I’ve got here are really picky with their arguments, forget to put a dot somewhere and the script will fail to process the audio. Storing presets would be uberhandy.

turns out the renoise API and LUA should make that super easy!

Renoise handles the storing anyway, LUA makes the access easier than writing this post - basically the only work I have to do is figure it out GUI wise. I mean, storing the current command is obvious, I should have that working soon, but what about deleting them, giving them nicknames etc…

oh, I also found a bug that causes temporary samples to not be deleted when there is something going wrong. will be fixed in the next one, I don’t think it’s a biggie.

I just hope it will be possible some day to maintain zoom and selection (set them to what they were before the operation, that is). then we’re beginning to talk seamless integration! it’s just a shame nobody makes commandline tools these days :lol:

oh I spoke way too soon… you cannot store tables, so I’d have to store them all in a string that can’t even have line breaks in it… guh… which means one divider between the commands, and another divider for the linebreaks IN the commands. I’ll try anyway, because it’s not impossible, but it’s more like regular programming than the utter BREEZE this whole thing otherwise is. plus, I still don’t know shit about LUA, which makes it 10 times more complicated than it would have to be I guess :P

edit: nah, I think I just have a bunch of stuff to learn about the API first…

alas, I had some ideas for things one can do with sox:

  • generate a spectrogram from the selection, then display it with an image viewer (though you cannot use renoise before you quit the image viewer)
  • reverse it, add reverb, then reverse it again (sox can do that in one go I think)
  • generate test tones

not much but hey :lol:

hey isent that the old trick for making “horror voices”

What would be ridiculous is to be able to set gui elements with min-max values and link it to the separate arguments. Some kind of graphical front end to change values within the limits of the tool. dies cumming

Well, the way LUA and the renoise GUI stuff is structured, I wouldn’t be surprised if that is possible - you’d just have to define the GUI(s) yourself (which shouldn’t be too hard with a few templates to go by), and then select them from a dropdown menu, and ta-daa, new dialog pops up with the sliders you defined, which replace the values you defined in the commandline(s) you defined – ready to run on anything you select in the sample editor. You could even write notifier functions that transform the entered values, so you have a slider that goes from X to Y, and then puts that into a format the commandline tool understands… oh yeah… I better get coding, because I’d rather work towards it than talk about it :P but I’m still busy with the whole storing presets thing. then I’ll see what is possible, or rather, what I can do haha.

dunno, hadn’t had time to try it out myself, too busy scripting. since the 2.6 beta came out I spent like 10 minutes on music. literally. o_O

Some of the tools I’m trying out with your script give me a ‘There seems to be no output file’ notice after running it (nothing happens to the selection in the sample), though a new sample is added to the Renoise instrument!

Unfortunately this new added sample isn’t processed, just a copy of the selection :( . Maybe the commandline tool I’m trying out automatically alters the name of the outputfile and your script can’t replace the selection?

EDIT:

ok, premature blurb, I had an argument wrong that seems to produce this behavior :blush: , now it works like expected!

well, it’s still a bug, when it bails out because it finds no output file, it bails out without the deleting the temporary sample (the copy of the selection). I fixed that already, I just haven’t updated the file yet because I want to try the custom GUI thing first yay.

ahaaaa!!!

1063 runcommandsonselection2.png

[details=“Click to view contents”]

t_gui_presets = {  
 test =  
 {  
 name = "Test", -- title  
 filename = "_gui_preset__test.lua", -- source filename  
 gui_data_id = "test", -- has to match the variable name in the source file  
 dialog = nil, -- ignore this  
 view = nil -- ignore this  
 }  
}  
  
t_gui_data = {} -- ignore this  
t_gui_data.test = --- has to be the same as "gui_data_id" in config.lua  
 {  
 command_lines = "sox $1 $2 pitch $p1",  
 variables =  
 {  
 input_file =  
 {  
 placeholder = "$1",  
 value = nil,  
 type = "input_file"  
 },  
 output_file =  
 {  
 placeholder = "$2",  
 value = nil,  
 type = "output_file"  
 },  
 sample_rate =  
 {  
 placeholder = "$sr",  
 value = nil,  
 type = "sample_rate"  
 },  
 bit_depth =  
 {  
 placeholder = "$bd",  
 value = nil,  
 type = "bit_depth"  
 },  
 parameter_1 =  
 {  
 placeholder = "$p1",  
 value = nil,  
 type = "parameter",  
 id = "Parameter1" -- has to match the id below  
 }  
 },  
 gui = vb:row  
 {  
 vb:valuebox  
 {  
 id = "Parameter1",  
 min = -4800,  
 max = 4800,  
 value = 0,  
 tooltip = "Parameter",  
 notifier = function (v)  
 end  
 }  
 }  
 }  
  
``` [/details]  
  
it's still verrrry basic, it's just that I got *something* working, to my own surprise lol.. turning that into something nice will take a while, and making it robust, so you can launch guis and run the command without stuff getting mixed up (and maybe even define menu shortcuts for the GUI presets so you can launch them directly).... well, that'll take even longer, and I hope nobody ever looks at the code ![:lol:](https://files.renoise.com/forum/emoticons/default/laugh.gif)

Updated! And what an odyssey that was… it’s still very raw, but it actually seems to work.

I cannot POSSIBLY believe that this is not full of bugs though, so testing would be appreciated. Frankly I hardly know what I’m doing here and I’m pretty sure it will fail in many hilarious ways once you throw stuff at it.

Surely the GUI could be improved, too ^^

But to be honest, I haven’t even tested it with more than two GUI presets. I really gotta get some for SoX going, and find some other commandline tools, to test drive this baby fully… but yeah, if you’re already using it, this update should make you happy :D

Good work Johann,

will try it out!

Cheers,

R

edit:

Thought there was something wrong with your script, but apparently overwriting the old version with your new update in Renoise removes all content (=sox + my own tools) from the folder!

edit2:

Found a bug, I was pressing the ‘del’ button nonstop with the mouse and got this:

[i]"Script ‘C:\Users\plugexpert\AppData\Roaming\Renoise\V2.6.0\Scripts\Tools\de.johann-lau.RunCommandsOnSelection.xrnx\main.lua’ failed in one of its notifiers:

std::logic_error: ‘ViewBuilder: invalid index for popup: ‘0’. value must be (1 - 1).’
stack traceback:
[C]: ?
[C]: in function ‘__newindex’
[string “do…”]:22: in function <[string “do…”]:11>
main.lua:408: in function main.lua:400"
[/i]

sorry I should have warned you… that can’t be avoided, renoise does that. which kinda spells havoc for GUI templates, too. but hey, that’s the life on the bleeding edge, can’t have it both ways :lol:

I guess the best idea is to put your tools elsewhere, and modify the system path so they get found, or modify your command lines to contain the full path to where they are (which is kinda ugly though)

good news is, next release will include sox and soundstretch by default. they are (L)GPL so I figure my script is now GPL too ^^ though that may have implications about using it on commercial productions or something… I think in the real world that doesn’t matter, not even a lawyer would care about that, much less everybody else :P but still, I will have to investigate that I guess.

thanks! in the next version you can’t delete the first (empty) preset, as it should be ^_^ (and I guess I will call that preset “— PRESETS —” for added niceness)

I really didn’t test much to be honest, since it’s still very early anyway, gotta find tools and build a few GUI’s first… plus I really have no clue what I’m doing most of the time. I’m very amazed at what convoluted spaghetti code LUA allows for, it’s like giving ten monkeys a hundred guns. I love it.