Jump to content


Photo

Hidden Rendering Feature: Sequence marker positions

render hidden feature sequence marker position

  • Please log in to reply
6 replies to this topic

#1 Niklas Liebig

Niklas Liebig

    New Member

  • Normal Members
  • Pip
  • 3 posts

Posted 07 January 2015 - 19:41

Hi,
I want to make use of the sequence position markers after rendering my song to later cut up the wav file. Unfortunately I don't have any clue in which way these position markers are implemented within the riff wave specification and how to use them. Anybody used this feature yet?
Greenings =)
 



#2 4Tey

4Tey

    Big Masta Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPip
  • 533 posts
  • Gender:Male

Posted 08 January 2015 - 10:36

Hi, and welcome...

 

Hmm, just out of curiosity myself to look at the bigger uncut wav file generated with Renoise I started with this page -> http://www.sonicspot...efiles.html#cue  I rendered out a simple XRNS that contains just 4 patterns, with each pattern just 8 lines long.  16-bit sample depth 44KHz.  The resulting wav file was around 530KB.  I then searched for the 'cue' section near the end of the wav file in a hex editor.  Then I broke down the binary section using the information on that page I pointed out... 

RIFF Wav Cue Section Hex Binary Dump:

0000: 63 75 65 20 - 'cue ' in ascii (Chunk ID)
0004: 64 00 00 00 - Chunk Data Size (100)  (4 + (24 * Num of cue points) = 100)
0008: 04 00 00 00 - Number of cue points (4)  

Cue point 1 (1st pattern)
000c: 00 00 00 00 - Unique ID (0)
0010: 00 00 00 00 - Play order position ()
0014: 64 61 74 61 - 'data' in ascii (Data Chunk ID)
0018: 00 00 00 00 - Chunk Start (0)
001c: 00 00 00 00 - Block Start (0)
0020: 00 00 00 00 - Sample Offset (0x0)

Cue point 2 (2nd pattern)
0024: 01 00 00 00 - Unique ID (1)
0028: 33 81 00 00 - Play order position ()
002c: 64 61 74 61 - 'data' in ascii
0030: 00 00 00 00 - Chunk Start (0)
0034: 00 00 00 00 - Block Start (0)
0038: 33 81 00 00 - Sample Offset (0x8133)

Cue point 3 (3rd pattern)
0040: 02 00 00 00 - Unique ID (2)
0044: 66 02 01 00 - Play order position ()
0048: 64 61 74 61 - 'data' in ascii
004c: 00 00 00 00 - Chunk Start (0)
0050: 00 00 00 00 - Block Start (0)
0054: 66 02 01 00 - Sample Offset (0x10266)

Cue point 4 (4th pattern)
0058: 03 00 00 00 - Unique ID (3)
005c: 99 83 01 00 - Play order position ()
0060: 64 61 74 61 - 'data' in ascii
0064: 00 00 00 00 - Chunk Start (0)
0068: 00 00 00 00 - Block Start (0)
006c: 99 83 01 00 - Sample Offset (0x18399)

Assuming a 16-bit L/R two channel sample (and assuming the wav header size is 0x2c bytes long.)
e.g. (0x8133 * 4) + 0x2c = Possible file offset to start of each pattern within the wav file

So I get that each pattern within the big wav file starts at:

Cue point 1 = (0x0 * 4) + 0x2c = 0x2c bytes into file
Cue point 2 = (0x8133 * 4) + 0x2c = 0x204f8 bytes into file
Cue point 3 = (0x10266 * 4) + 0x2c = 0x409c4 bytes into file
Cue point 4 = (0x18399 * 4) + 0x2c = 0x60e90 bytes into file

 

I only quickily looked at it so I could be wrong.  As you can see it is rather low level, however I hope that gives you some ideas on where to begin if you want to go to that level.


Edited by 4Tey, 16 October 2015 - 08:33.


#3 Niklas Liebig

Niklas Liebig

    New Member

  • Normal Members
  • Pip
  • 3 posts

Posted 08 January 2015 - 12:06

Thanks for your reply. I will investigate these cue points by the end of the week. Yep, I also tried the "each pattern into separate file" option. But this doesn't fit my needs because silent patterns being removed after rendering process, producing a "time leap" after stitching the files (especially when combining with the "each track into separate file" option). I can prevent deletion of the silent files by rendering into a folder with write only permission (on linux: chattr +a). This is a workaround that goes for me. Still I'm curious about the "marker positions feature" as described here: http://tutorials.ren...ndering_Feature



#4 dblue

dblue

    Dodgy Geezer

  • Admins
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 5827 posts
  • Gender:Male
  • Location:Berlin
  • Interests:Code. Music. Graphics.

Posted 08 January 2015 - 12:33

Still I'm curious about the "marker positions feature"

Quite simply, cue points will be inserted at the beginning of each pattern in your rendered .WAV file:

renoise-pattern-markers-wavosaur.png


Unfortunately, even though the cue points are part of the RIFF WAVE definition (see: "cue-ck"), some consider them to be non-standard, and so support for them is a bit hit and miss.

In my screenshot you can see that I'm using Wavosaur on Windows. I believe Soundforge also supports them, Goldwave, and a few others. Sadly, Audacity does not, which I suspect you may be using if you're working on Linux? I'm not sure about other audio editors on Linux, but perhaps there's one which supports the cue points.

*Maybe* it's possible to read the cue points using something like FFMPEG, and then split the .WAV into chunks?

#5 Niklas Liebig

Niklas Liebig

    New Member

  • Normal Members
  • Pip
  • 3 posts

Posted 08 January 2015 - 21:41

Thanks! I wasn't aware of the cue-points chunk. There is a python library called "audiotools". Using the get_cuesheet() method it should be a one-liner to get all necessary information for further parsing / cutting.



#6 kopias

kopias

    Super Advanced Member

  • Normal Members
  • PipPipPipPip
  • 155 posts
  • Gender:Male
  • Location:Łask, Poland

Posted 09 January 2015 - 01:42

dblue, since you mentioned it before i get it a try... awesome editor renoise could learn from...

 

 

back to the topic: maybe renoise itself could reed those markers



#7 4Tey

4Tey

    Big Masta Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPip
  • 533 posts
  • Gender:Male

Posted 10 January 2015 - 09:21

*Maybe* it's possible to read the cue points using something like FFMPEG, and then split the .WAV into chunks?

 

Unfortunately I don't think ffmpeg/avconv will read that cue section of the Renoise wav file.  As you say dblue, not many programs do.  Alas.

 

Just for the curious it is possible with a couple of tools from the command line to split the big wav file into smaller pattern wavs with Linux.  Just for completeness I'll outline one solution..(this could be scripted/automated with python/bash/lua.)

 

You'll need two small programs.  'sndfile-info' and 'shnsplit'.  sndfile-info should be part of sndfile-programs package and shnsplit should be part of the shntools package.  Obtain and install both.

 

Render out your Renoise song into a blank directory.  In this example I've called it 'Song.wav'. Change into that directory.

 

First find out what the Block Align of the wav is.  We can use sndfile-info for this:

# sndfile-info Song.wav | grep 'Block Align'

Block Align : 4

This is a 16-bit render so the BA is 4.  A 24-bit render would produce a BA of 6 and a 32-bit render would produce a BA of 8.

 

Next lets grab the cue point offsets from the Renoise wav and store them into a file called 'cuepoints.txt'.  Again we can use sndfile-info.

# sndfile-info Song.wav | grep 'Cue ID' | cut -d':' -f7- > cuepoints.txt

Now we should have a list of Renoise cuepoint offsets in a file.  However we want the sample offsets into the wav file.  To do this we've got to multiply the cuepoint offsets with the Block Align value obtained previously.  We could use awk for this task.

# awk '{print $0 * 4}' cuepoints.txt > tmpfile && mv tmpfile cuepoints.txt

(N.B. Remember to change the '4' in the example above to whatever your Block Align value is.)

 

Finally we should now be able to split the wav file using shnsplit supplying our cuepoints file and Renoise song wav.

# shnsplit -c 0 -f cuepoints.txt -a "pattern_" Song.wav

  • dblue likes this





Also tagged with one or more of these keywords: render, hidden, feature, sequence, marker, position