First time here? Check out the FAQ!
x

Can Paca return OSC info on number of samples in a Multisample source sound?

+1 vote
107 views
I'm guessing it cannot return the sample file names, but I'm wondering if it can return the number of samples. (Names would be GREAT too.) I'm trying to avoid redundancy. So, I don't want to list the information twice if I don't need to.

If it cannot be read directly, is there a way to prefix the Multisample source with some other Sound like maybe a Constant that OSC will be able to see and that Multisample will be able to use as a source for the sample list to be played?
asked Nov 28, 2015 in Controllers, OSC & MIDI by kevin-cole (Adept) (1,050 points)

2 Answers

0 votes
 
Best answer

It may be a silly way to do it, but since I'm doing this without any CapyTalk, my solution (in Python) currently is to ask how many widgets there are via:

/osc/notify/vcs/... 1

and then loop x from 0 to whatever count the above returns, querying:

/osc/widget x

If the JSON returned has a "label" value that matches a particular pattern, I grab the  "rawLabelsString" value from "tickMarksOrNil" and split it at the newlines (\r).

answered Mar 8, 2016 by kevin-cole (Adept) (1,050 points)
0 votes

Hey Kevin,

If you collect the samples in an array, for example using the 'fileNamesInSameDirectory' argument you can use the 'size' argument on that array to get the number of elements in it. for example:

{'sample.aif' fileNamesInSameDirectory size}

returns 8 (if there are 8 samples in the same folder). You can use that in a STGC to send it via OSC.

 

If you're after controlling which sample should be played via OSC you can use:

!osc_Index * {'sample.aif' fileNamesInSameDirectory size}

in the Index field of the Multisample and send an OSC message in the range 0-1 to go through the samples.

 

If you're not collecting the samples using fileNamesInSameDirectory you can still create an array of the samples by using:

sampleArray := #('sample1.aif' 'sample2.aif' 'sample3.aif' ).

and so on. Also you can concatenate arrays using ',':

{('sample.aif' fileNamesInSameDirectory), sampleArray}.

 

Does that help?

not sure about sending the names as this requires sending OSC-strings...

 

Best,

Gustav

answered Nov 29, 2015 by kymaguy (Virtuoso) (10,580 points)
...