Render same song "x" times

Hello Renoise community,

I am reaching out to seek your expertise and assistance in creating a custom rendering tool for Renoise. I must admit that I am not proficient in scripting, but I have been experimenting with tools like GPT to enhance my understanding.

My goal is to develop a tool that mimics the functionality of the default rendering tool in Renoise, with one specific addition. I would like the rendering process to be repeated a certain number of times (let’s call it “X”) without requiring manual intervention for each render.

The reason behind this request is that I am working on generating procedurally generated samples within Renoise, and automating the rendering process would greatly enhance my workflow. I believe this could lead to more efficient and creative exploration of sound design possibilities.

If any of you have experience with Renoise scripting or are knowledgeable in creating tools, I would greatly appreciate your guidance and support in achieving this functionality. Your assistance will be instrumental in helping me streamline my creative process.

I end up with such code, and i admit I dont know if its any good or its just some fantasy generated by chat GPT :smile:

-- main.lua
local vb = renoise.ViewBuilder()

renoise.tool():add_menu_entry {
  name = "Main Menu:Tools:RenderSong",
  invoke = function()
    show_combined_render_dialog()
  end
}

function show_combined_render_dialog()
  local dialog_content = vb:column {
    margin = 10,
    vb:text {
      text = "Choose options for rendering:",
      font = "bold"
    },
    vb:row {
      vb:text {
        text = "Save Path:"
      },
      vb:textfield {
        id = "save_path",
        width = 200,
        notifier = function()
          -- Add validation or processing if needed
        end
      },
      vb:button {
        text = "Browse",
        notifier = function()
          browse_for_save_path()
        end
      }
    },
    vb:row {
      vb:text {
        text = "Song Name:"
      },
      vb:textfield {
        id = "song_name",
        width = 200,
        notifier = function()
          -- Add validation or processing if needed
        end
      }
    },
    vb:row {
      vb:text {
        text = "Number of Renders:"
      },
      vb:valuebox {
        id = "render_count",
        min = 1,
        max = 10,
        value = 1
      }
    },
    vb:button {
      text = "Render Song",
      notifier = function()
        render_song()
      end
    }
  }

  renoise.app():show_custom_dialog("Render Song", dialog_content)
end

function browse_for_save_path()
  local dialog = renoise.app():prompt_for_path("Choose a folder to save the rendered song")
  if dialog then
    local save_path_field = vb.views.save_path
    if save_path_field then
      save_path_field.text = dialog
    end
  end
end

function render_song()
  local song = renoise.song()

  if not song then
    renoise.app():show_error("No active song found.")
    return
  end

  local sequencer = song.sequencer
  if not sequencer then
    renoise.app():show_error("No sequencer found in the active song.")
    return
  end

  local pattern_sequence = sequencer.pattern_sequence
  if not pattern_sequence then
    renoise.app():show_error("No pattern sequence found in the active song's sequencer.")
    return
  end

  -- Set rendering options for the combined tool
  local render_options_combined = {
    start_pos = 1,
    end_pos = pattern_sequence:find_last_pattern(pattern_sequence:sequence_length()),
    sample_rate = 44100,
    bit_depth = 16,
    interpolation = "cubic",
    create_backups = false,
  }

  -- Set the rendering filename
  local save_path_combined = vb.views.save_path.text
  local song_name_combined = vb.views.song_name.text
  local filename_combined = save_path_combined .. "/" .. song_name_combined .. "_RenderedSong_combined.wav"

  -- Display a message
  renoise.app():show_message("Combined Rendering started. Please check Renoise for progress.")

  -- Start the combined rendering process
  local render_count_combined = vb.views.render_count.value
  for i = 1, render_count_combined do
    local success_combined, error_message_combined = song:render(render_options_combined, filename_combined, rendering_done_callback_combined)
    if not success_combined then
      renoise.app():show_error("Combined Rendering failed. Error: " .. error_message_combined)
      return
    end
  end

  renoise.app():show_message("Combined Rendering completed successfully.")
end

-- Callback function for combined rendering done
function rendering_done_callback_combined()
  renoise.app():show_message("Combined Rendering done callback called.")
end

2 Likes

Hi @zulugula, although this is not what you are asking, there is the Render Multiple Songs or RMS tool:

Render Multiple Songs allows multiple songs to be rendered in a single pass. Simply select a folder with all the XRNS songs you want to render, configure a few things, and that’s it.

In your case you can duplicate the XRNS song you want to render X times and that’s it. Changing the name with name_1.xrns, name_2.xrns … name_8.xrns is enough. In this case you would get 8 renders of the same song. If you are not interested in the tool, at least you can see what things can be done.

Regarding the GPT, I doubt the result will work. Usually, it is necessary to “adapt” the code in some way. It may help, but you still need to program in a later step.

3 Likes

I wrote a tool that makes it easy to save the current song, plus a rendered version of it, using the keyboard. This way if I want to explore different ideas in a song while not losing what I’ve already done I can just save a version of it. The rendering is so that I can listen to a version without having to load the xrns file. The code looks for loop points and will render just the looped section if a loop exists (because sometimes that’s the part of the song I think is special).

I have no GUI for this because I don’t want to be interrupted to have to click around on stuff. It just uses whatever were the last rendering settings and auto-generates the file names.

You may find some code here useful. To render multiple times just add a loop.

The main part of my tool just loads this code and sets up a tool menu entry and allows the tool to have a keyboard shortcut defined (that code isn’t in the Gitlab snippet).

2 Likes

Well its all nice solutions :slight_smile: But got my renoise temps are set like every time i start a song its a differend track.

Its all randomized. Its look like im creating some track, set things up. Random sample picks, and i need to render this one track 100 times.

I used to use actiona macro automation for this, It was pressing render button render after render, but i cant use my PC at a same time :smile:

So i tried to make a tool but it seems i suck with that :smiley: and that code frome chat gpt gives me error. I can set song path, song name but it wont render :stuck_out_tongue: