Lua Rendering results in dB drop?

**EDIT : Similar discrpencies can happen with changing song headroom for Render To Sample. See post below.

After a scripting render operation:

  • Render to temp file
  • load to new instrument/sample slot

I have set Song to 0dB headroom but renders seem to come out up to a couple of dB quieter.

Does anyone know why?

/////////////////////////////////////////////////////////////

Original (left) vs render (right) – Only 0.5db in this case:

render%20difference

Gets even a bit stranger:

  • When Song Headroom set to -6dB then renoise ‘Ctrl Alt R’ works:Both render and original are at same volume

  • But also when Song Headroom set to -6dB Lua renders end up about -13db off.

  • When Song Headroom set to 0dB then ‘Ctrl Alt R’ and Lua renders are about 0.5 dB out vs the original.

Just a thought Ledger (although you’ve probably already taken this into account), is when you set say the song options headroom to -6dB and you render to a sample (Ctrl Alt R), with the resulting sample you get back, Renoise automatically switches the volume up by 6dB in the sample properties. When you are at 0dB in the song options headroom setting, the resulting rendered sample volume is 0dB in the sample properties.

I suppose if you now render to sample (via a script) and your song options are at -6dB of headroom, the resulting sample will be a -6dB quieter sample. When you manually load in the sample into Renoise, the chances are the sample volume in the properties will be set at 0dB (not +6dB as if you’ve just clicked Render to Sample.) Don’t know if it will help any or not :slight_smile:

@Ledger, can you provide a testcase song?

@4tey thanks for the info, I wasn’t aware of that, but I’ve checked this now and even eliminating it, the problem still seems to crop up

I am wondering if it has something to do with auto master reduction on loud samples, though I`m not sure.

Autovolume

@ffx this is happening frustratingly sporadically, and with different dB reductions. I will post up a song when I get a consistant exmple.

In mean time here is an Lua render snippet I am using for testing:

---------------------
local song = renoise.song()
--create a temporary os file to make the render
local file_path = os.tmpname("wav") 

---------------------------------
function post_render_callback()
---------------------------------
  local song = renoise.song()
  --create new instrument
  local new_inst = song:insert_instrument_at(#song.instruments+1)
  --select the new instrument
  renoise.song().selected_instrument_index = #song.instruments
  --insert a new empty sample in the new instrument
  new_inst:insert_sample_at(1)
  --load rendered file into new slot
  new_inst.samples[1].sample_buffer:load_from(file_path)
  --name new instrument
  new_inst.name = "New Render"
 
  --add a c-4 of new instrument to track 2
  song:pattern(1):track(2):line(1):note_column(1).note_string = "C-4"
  song:pattern(1):track(2):line(1):note_column(1).instrument_value = song.selected_instrument_index - 1
end

 
--render (to continue the function without crashing, we need to complete the rest
--of the code in the callback function: continue_post_render())
song:render({},file_path,post_render_callback)

–UPDATED–

Ok here`s a test case that results in 0.2dB difference when render is done before anything else including pressing play.

  • Load song
  • Run test pad render (or renoise render ot sample Ctrl + Alt + Shift + R)
  • check differences

The master volume reduction is triggered by the testpad render. Off to check if this happens with it disabled

If you don`t have VUMT just insert something that will give you an accurate peak value in its place:

testcase dB render clap.xrns (23.8 KB)

The master volume reduction is triggered by the testpad render. Off to check if this happens with it disabled

After testing, disabling master safety volume button actually makes no difference here.

Ledger (just wondering), does ‘Render Song to Disk…’ on the File menu produce the same dB as your script, but different to ‘Render to Sample’?

Just checked:

  • Lua Render
  • Render To Sample Slot (Native)
  • Render Song

All result in volume difference if done as very first action with above linked xrns

Render song to disk also definitely takes master volume into consideration.

Another ‘just wondering’ about something Ledger :slight_smile:

Now this isn’t really to do with your above problem, but I am just curious about something to do with rendering out samples. Could you load in the attached simple xrns for me, make sure your audio preferences sample rate is 44100Hz. Then could you render out track 01 to a new sample (i.e. right mouse button, Track->Render To Sample in the menu.) You should have a rendered instrument of that track in the next instrument slot.

Now here’s the thing I was wondering about… If you save out instrument 0 sample as a wav file, and you save out instrument 1 sample (the just rendered version) as a wav file from the sample editor, should those two wav files be binary byte for byte identical?

If you save out the rendered wav, could you attach it to a post?

sample_test.xrns (36.9 KB)

should those two wav files be binary byte for byte identical?

That would be dependent on the render method and properties wouldn`t it?

What are the results on your system?

Well I’ve just tried it under Linux, and the wav files are identical :slight_smile: But could you try it under Windows?

yep, sure, I’ve download the file and I’ll post back when done.

forum%20files%20not%20allowed

dropbox download widget on top right:

1 Like

Ledger maybe it actually is your metering tool altering volume ? :slight_smile:

Thanks Ledger. Hmm, nope not identical from the original here. Difference in math (rounding error) between Linux and Windows version maybe :slight_smile:

Finally to show what happens to a sample when you keep rendering the rendered sample out, you can flick between instrument 0 and 1 in the sample editor of this attached song. Instrument 0 is the original, instrument 1 is a render of a render of a render…about 1500 times over of the original clap sample. Watch your math libraries/results :slight_smile:

sample_1500.xrns (37.1 KB)

Ledger maybe it actually is your metering tool altering volume ? :slight_smile:

Not sure what`s going on to be honest, I tried again just now, with and without VUMT and there were no peak differeces. Fortunately when the differences do occur they are not huge so I can just get on with the tool if I account for song headroom.

Thanks Ledger. Hmm, nope not identical from the original here. Difference in math between Linux and Windows version maybe :slight_smile:

Yes maybe, also I did make sure to follow your instructions using the right-click menu to engage the render.

Don’t worry about it Ledger, played perfectly. The thing is, I’m not much for the result :slight_smile:

The thing is, I’m not much for the result :slight_smile:

It’s not a bug it’s a windows 7 feature, adding some lovely analog warmth! :fire:

1 Like