First time here? Check out the FAQ!

How can I use the 'getSamplesFromMonoWavetableFileStartingAt: length:' message on stereo files?

+1 vote
Hi there,

If the wavetable I want to read from is not mono, how can I tell Kyma to read the left (or first) channel only?

asked Jun 15, 2016 in Capytalk & Smalltalk by kymaguy (Virtuoso) (10,580 points)

1 Answer

0 votes
Best answer

You could use

getInterleavedSamplesFromWavetableFileStartingAt: start length: lth

Interleaved means that it alternates between a sample for the left and a sample for the right channels.  The odd numbered samples are for the left channel.

answered Jun 15, 2016 by ssc (Savant) (115,030 points)
selected Jun 20, 2016 by kymaguy
thanks!! this is not in the smalltalk appendix: can we have an updated smalltalk appendix?
for example: how do I check if the wavetable is mono or interleaved? I want to be able to use both but kyma should detect which message to use automatically. the getMono... message returns nil when it doesn't work, so I could use 'isNil varIfTrue: [samplesFile getInterleaved...].' but maybe there is an easier way?
'alien threat.aif' asSamplesFile channels
I'm running into the same situation with having a stereo wavetable, and I want to either read only the left or right...where do I put this bit of code if I'm using the oscillator prototype, for example?
Hi Will, what is the end result you're going for with the Oscillator?
Hi SSC, the end result is world domination. Just kidding. Actually, I'm not using the Oscillator prototype for this sound; I just mentioned it out of curiosity and thought the same idea might apply to other sounds. I'm using the FunctionGenerator/Sample/Multisample prototypes. I've been changing the duration of some impulse responses to 4096 so I can use them as a starting point in the 'impulse drum' sound from the Sound Browser. I realized that a number of the IRs are stereo and that's why I would like to be able to read the left and right separately. When a stereo wavetable is used in the FunctionGenerator is it summed to mono or what happens? Thanks
Hi Will, the FunctionGenerator plays stereo files maintaining the left/right separation so it should be good to go. Not limited to 4096 samples duration (any samples file should work). You could set the duration to, for example:

'bassglass.aif' fileDuration s