get the original sample location property


(tw1psy) #1

Hi,

I want to write a script that

1- get the sample’s original location for the selected instruments

2- reads the “date modified” timestamp of the samples, save them to some local variable

3- keep checking the timestamps in one second-ish intervals and compare them to the variables saved previously

4 - if a change appears reload the corresponding sample to the instrument and update the timestamp variable

and I’m stuck on the first step, I couldn’t find a function that get me the original sample source. any ideas?


(Raul (ulneiz)) #2

I’ll just leave some thoughts, in case they help.

The song is a ZIP folder, with extension XRNS. The location of all the original samples (MP3 or FLAC) that loads the song are within that ZIP, which will have a specific name, put in or in a normal folder…On the other hand, if you include additional samples, they may be in other loose folders.So, locating the sample is a bit messy. Would not it be feasible to use temporary memory to access that sample data? When you load a sample, the information is at some point in the memory (something like using CTRL + Z).

On the other hand, maybe it’s possible you could make a registry of the location of the samples, as long as the load of each sample is made from your tool, not from the instrument editor. I do not know if Renoise stores somewhere the address of the folder where the sample is. Reloading it would be as simple as cleaning the sample slot and reloading it.

renoise.app():load_instrument_sample(filename)
  -> [boolean]

“filename” is the sample path (location), which will be loaded into the selected sample slot, This sample slot must be loaded previously.Then you can create a window to load samples, and there record the location of a sample with a simple equality.You could use some table for that.

Actually, if you do everything from the tool it would be easier. I mean loading the song from the tool, with

renoise.app():load_song(filename)

“filename” is the path of the song (ZIP). Inside it are all the original samples. Is it possible to reload an MP3 or FLAC file that is inside a compressed ZIP folder?

That is, if you do everything from the tool, you could register those addresses. But I do not know it is possible to load a file that is inside another ZIP with the available API.


(tw1psy) #3

I’ll just leave some thoughts, in case they help.

The song is a ZIP folder, with extension XRNS. The location of all the original samples (MP3 or FLAC) that loads the song are within that ZIP, which will have a specific name, put in or in a normal folder…On the other hand, if you include additional samples, they may be in other loose folders.So, locating the sample is a bit messy. Would not it be feasible to use temporary memory to access that sample data? When you load a sample, the information is at some point in the memory (something like using CTRL + Z).

On the other hand, maybe it’s possible you could make a registry of the location of the samples, as long as the load of each sample is made from your tool, not from the instrument editor. I do not know if Renoise stores somewhere the address of the folder where the sample is. Reloading it would be as simple as cleaning the sample slot and reloading it.

renoise.app():load_instrument_sample(filename)
-> [boolean]

“filename” is the sample path (location), which will be loaded into the selected sample slot, This sample slot must be loaded previously.Then you can create a window to load samples, and there record the location of a sample with a simple equality.You could use some table for that.

Actually, if you do everything from the tool it would be easier. I mean loading the song from the tool, with

renoise.app():load_song(filename)

“filename” is the path of the song (ZIP). Inside it are all the original samples. Is it possible to reload an MP3 or FLAC file that is inside a compressed ZIP folder?

That is, if you do everything from the tool, you could register those addresses. But I do not know it is possible to load a file that is inside another ZIP with the available API.

Hey Raul, Thanks for your elaborated answer, the purpose of the tool would be to somehow integrate external audio editorswith renoise. I’ve sent a msg to dBlue and shared the idea with him, I copy/paste it here: (with some trimming)

Soundforge prior to 5 has an ability called direct mode that saves any changes made on the wave in realtime to the wave file, no need to press ctrl-s. I wanted to make a seamless integration between sound forge (or any other audio editor) and renoise, for this I realized that I need to:

1- save the samples in the selected instruments in a folder named after the song) and set their path and name to a variable pool.

2-copy their corresponding slice marker positions (there’s already a tool that does that), loop playback option and sampleloop beginning and end position to a buffer.

3-start a timer and listen for the “date modified” changes in the samples in the sample path pool every one second.

4- when a change happens reload the sample and apply marker/slice position, loop playback mode and loop end/beginning.

I’ve got to find sometime to really sit down and code the main class at least, I haven’t been coding ever since actionScript era. I’m not as good as before with coding, a change in hobbies… but if you can help me along the way that would be a journey. :slight_smile:


(Raul (ulneiz)) #4

@tw1psy.That is magnificent. Let’s see if DBlue can help you. Particularly I see the subject a bit complicated.

For starters, I could only recommend that you read carefully the available API, to know what you can do and what you can not do, knowing that there are many things of LUA compatible and that do not have to be in the documentation provided by Renoise to create tools . Starting from there, it seems that the problem will not only be to obtain the file routes (path), but to control in some way that the user does not change those files from their place in the meantime, at least making verification conditions, "if something exists, do this ", basically to avoid mistakes.

Start with Renoise.Application.API.lua and Renoise.Song.API.lua, everything that has to do with the manipulation of the samples inside the instrument…