FluidWaveform in alpha
parent
f96f5d7000
commit
636d9b2e78
@ -0,0 +1,47 @@
|
||||
FluidWaveform {
|
||||
|
||||
*new {
|
||||
arg audio_buf, slices_buf, bounds;
|
||||
^super.new.init(audio_buf,slices_buf, bounds);
|
||||
}
|
||||
|
||||
init {
|
||||
arg audio_buf, slices_buf, bounds;
|
||||
Task{
|
||||
var path = "%%_%_FluidWaveform.wav".format(PathName.tmp,Date.localtime.stamp,UniqueID.next);
|
||||
var sfv, win, userView;
|
||||
|
||||
bounds = bounds ? Rect(0,0,800,200);
|
||||
win = Window("FluidWaveform",bounds);
|
||||
audio_buf.write(path,"wav");
|
||||
|
||||
audio_buf.server.sync;
|
||||
|
||||
sfv = SoundFileView(win,Rect(0,0,bounds.width,bounds.height));
|
||||
sfv.readFile(SoundFile(path));
|
||||
sfv.gridOn_(false);
|
||||
|
||||
win.onClose_({
|
||||
File.delete(path)
|
||||
});
|
||||
|
||||
slices_buf.loadToFloatArray(action:{
|
||||
arg slices_fa;
|
||||
|
||||
userView = UserView(win,Rect(0,0,bounds.width,bounds.height))
|
||||
.drawFunc_({
|
||||
slices_fa.do{
|
||||
arg start_samp;
|
||||
var x = start_samp.linlin(0,audio_buf.numFrames,0,bounds.width);
|
||||
Pen.line(Point(x,0),Point(x,bounds.height));
|
||||
Pen.color_(Color.red);
|
||||
Pen.stroke;
|
||||
};
|
||||
});
|
||||
|
||||
win.front;
|
||||
});
|
||||
}.play(AppClock);
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,14 @@
|
||||
(
|
||||
s.waitForBoot{
|
||||
|
||||
Task{
|
||||
var buf = Buffer.read(s,"/Users/macprocomputer/Desktop/_flucoma/code/flucoma-core-src/AudioFiles/Nicol-LoopE-M.wav");
|
||||
var slicepoints = Buffer(s);
|
||||
|
||||
FluidBufAmpSlice.process(s,buf,indices:slicepoints,fastRampUp:10,fastRampDown:2205,slowRampUp:4410,slowRampDown:4410,onThreshold:10,offThreshold:5,floor:-40,minSliceLength:4410,highPassFreq:20,action:{
|
||||
FluidWaveform(buf,slicepoints,Rect(0,0,1600,400));
|
||||
});
|
||||
|
||||
}.play(AppClock);
|
||||
}
|
||||
)
|
||||
Loading…
Reference in New Issue