Plotting a buffer to a multislider

hi!

does anyone know if there is a way to plot a small buffer in a multislider? maybe there’s a way to just read the values out, one by one, at least.

does anyone know if there is a way to plot a small buffer in a multislider? maybe there’s a way to just read the values out, one by one, at least.

did you look at SoundFileView? and there’s also Plotter (hold down alt and click to post values). both can be embedded in your GUI window. check these helpfiles.

but sure, you can also use a MultiSliderView to display the content of a Buffer.
there are three little gotchas: you’ll want to set elasticMode to 1, and thumbSize to something small (probably 1.0 or lower. 0.0 might work best actually), and also scale your buffer data to be in the range 0-1.

s.boot;
b.free; b= Buffer.readChannel(s, Platform.resourceDir +/+ "sounds/a11wlk01.wav", channels: [0]);

(
var win= Window("", Rect(100, 100, 800, 400));
var msv;
win.view.layout= VLayout(
	msv= MultiSliderView()
	.elasticMode_(1)
	.thumbSize_(1)
	//.drawLines_(true)  //experiment with these
	//.drawRects_(false)
);
//the 0.5 mul and add below scales and shifts the audio data (-1 to 1) to fit the multislider (0-1)
b.loadToFloatArray(action:{|arr| {msv.value= arr*0.5+0.5}.defer});
win.front;

//optional: reading values from the multislider in a loop
Routine({
	var val, index= 0;
	while({win.isClosed.not}, {
		val= msv.value[index];
		if(val.notNil, {
			[index, val].postln;
			index= index+1%msv.size;
		});
		0.05.wait;
	});
}).play(AppClock);
)

_f

#|
fredrikolofsson.com musicalfieldsforever.com