rochars / wavefile

Create, read and write wav files according to the specs. :star: :notes: :heart:
MIT License
226 stars 48 forks source link

CUE: Marker & Region #4

Closed X-Raym closed 6 years ago

X-Raym commented 6 years ago

Hi,

In REAPER, is seems that there is two type of elements marked by CUE points, markers, and regions.

It seems that wavefile is only able to get marker and region start, not region end.

Screenshot

PS: note that pointes are simply named with an index, contrary to what I can see in REAPER. But this is surely another issue.

Thanks again for this library !

rochars commented 6 years ago

Regions will be supported in version 6.11.

As for the name of the points, do you mean the text associated with each point? If so, they are stored apart from the points, on "labl" chunks inside the "LIST" chunk, one for each point. the "dwName" property of each point is a unique index used to link the point with its label (among other things).

Cheers! :D

X-Raym commented 6 years ago

@rochars Good for region support ! :)

And thanks for the LIST infos !

Here is for eg a code snippet to get a list of all markers names:

for( let id in wav.LIST) {
    for( let sub_id in wav.LIST[id].subChunks) {
        console.log( wav.LIST[id].subChunks[sub_id].value )
    }
}

(of course, other types of array loops could have been used).

Surely, a function like UpdateMarkerName( dwName, str ) could be written with the .find array method.

Cheers !

rochars commented 6 years ago

Regions are now supported.

You can update a cue point label with WaveFile.updateLabel(dwName, label). It goes like this: wav.updateLabel(2, "new marker text");

Cheers!

X-Raym commented 6 years ago

@rochars nice, thanks !