Fun with more/less regex
-
OK so I'm using the facilities found in the blog post "Fun with Regex"
- what I actually want to do is modify each file in my sample maps (all 300 of them) so the SampleStartMod = SampleLength --- and they are all a bit different - even in the same sample map..
So a comment - the property numbers in the blog post are all off by one...
and a question: so before I go make a little python script to get every file name in every sample map - and then import this array into my "modifying script" - so I can roll around each sample map doing this:
mySampler.selectSounds(names[index]);
to get each wav file in turn....
is there a way to get the file names from the sampler for the currently loaded sample map?
Somehting nice like
mySampler.getAllFileNames()
-
There are
Sample.get()
andSample.getId()
functions, I'm not 100% sure what they're for but they sound like they might be what you need. -
@d-healey said in Fun with more/less regex:
There are
Sample.get()
andSample.getId()
functions, I'm not 100% sure what they're for but they sound like they might be what you need.yes, perhaps - but I have no idea how to populate "Sample"
-
There is a better way of changing sample properties now than how it's described in the Fun with Regex blog entry (I might have to update it at some point). Basically you call
Sampler.createSelection
with the regex string and you get an array ofSample
objects that you can iterate and change properties usingget()
andset()
// s is a Sample object... for(s in Sampler.createSelection(".*")) { // Sample.get() returns a string so for a subtraction we need to convert it to an integer var l = parseInt(s.get(Sampler.SampleEnd)) - parseInt(s.get(Sampler.SampleStart)); s.set(Sampler.SampleStartMod, l); }
oh and getting the filename is as easy as
s.get(Sampler.FileName)
-
This post is deleted! -
@Christoph-Hart - yep works like a charm - thanks.