renoise ipc?

I’ve developed my own sample browser. I currently drag and drop samples into renoise to create new instruments.
Is there any way to connect with renoise to invoke “add new instrument from sample” and “replace current active instrument with sample” commands?

Take a look at Renoise.ScriptingTool.API.lua in the scripting documentation and search for “file_import_hook”

-- Returns true when the given hook already exists, otherwise false.  
renoise.tool():has_file_import_hook(category, extensions_table)  
 -> [boolean]  
  
-- Add a new file import hook as described above.  
renoise.tool():add_file_import_hook(file_import_hook_definition_table)  
  
-- Remove a previously added file import hook by specifying its category   
-- and extension(s)  
renoise.tool():remove_file_import_hook(category, extensions_table)  

These hooks will trigger when loading a file via the Disk Browser or from Explorer/Finder.

You can see such hooks in action in mxb’s Additional File Format Support tool.

Note: If you hook into standard file extensions that Renoise already handles, such as WAV, FLAC and AIF, then your custom file import hooks will override/replace the standard functionality. Your tool must therefore also provide the appropriate code to actually continue loading the sample into the song, using sample_buffer:load_from(filename) for example.

Sorry that i wasn’t specific enough, my sample browser is developed as c# application.
I’m searching for a way to control renoise from external applications.
Could OSC the solution? It has a command called: “renoise/evaluate(string)”.
Is there a lua oneliner to add a sample as instrument? Something like renoise.instrument.add(‘D:\Samplelib\bigbang.wav’);

You can create your own OSC responder routines so that you can send arbitrary messages through OSC (click help -> show preferences folder, in there browse the Scripts folder and open the GlobalOSCActions.lua to get the idea). In those functions you can use dBlue’s advised Lua API functions to complete the option.

Sorry that i wasn’t specific enough, my sample browser is developed as c# application.
I’m searching for a way to control renoise from external applications.
Could OSC the solution? It has a command called: “renoise/evaluate(string)”.
Is there a lua oneliner to add a sample as instrument? Something like renoise.instrument.add(‘D:\Samplelib\bigbang.wav’);

As vV said you can create your own OSC handlers.

There are two ways (at least) to manage this. One is to provide your own version of GlobalOSCActions.lua and add custom handlers there. These will then be available in all songs at all times.

I’ve added some helper OSC handlers to my Renoise setup; you can check them out here to get an idea of how it might be done:

https://github.com/Neurogami/renoise-ng/blob/master/lua/GlobalOscActions.lua

Another way is to write a tool that provides its own OSC server.

I wrote one to allow the use of OSC messages to control line and pattern location in a song:

https://github.com/Neurogami/renoise-ng/tree/master/lua/com.neurogami.OscJumper.xrnx

The upside to putting things into a tool is that it makes it easier to distribute to others.

It may also be easier to debug: If something is broken in a tool you can edit the tool then reload it, but if something is broken in GlobalOscActions.lua then I think you’d have to reload Renoise in order see changes.

A (possible) downside to using a tool is that you end up with a separate OSC server that runs on a different port from the default Renoise OSC server. Any client that wants to use both the standard Renoise OSC and your custom OSC would need to talk to multiple ports.

EDIT: It’s possible for a tool to proxy OSC messages. This is what I now do in my tools that provide their own OSC server. They listen on a custom port, and any message that does not match a tool-specific address pattern prefix gets passed on to the Renoise OSC server. That way an OSC client need only talk to a single port, and can send both tool-specific messages or general Renoise messages.

Ok thx, i’ll check this.

I found out, that renoise can process WM_COPYDATA. So it was quite easy to send renoise a file path, so it would load it as new sample. Thanks to the dev team which implemented this :slight_smile: