commit
812a6de010
@ -1,45 +1,75 @@
|
||||
FluidKrToBuf {
|
||||
*kr {
|
||||
arg krStream, buffer;
|
||||
arg krStream, buffer, krStartChan = 0, krNumChans = -1, destStartFrame = 0;
|
||||
var endChan;
|
||||
|
||||
// fix -1 default
|
||||
if(krNumChans == -1,{krNumChans = krStream.numChannels - krStartChan});
|
||||
|
||||
// what is the last channel that will be used
|
||||
endChan = (krStartChan + krNumChans) - 1;
|
||||
|
||||
if(buffer.isKindOf(Buffer).or(buffer.isKindOf(LocalBuf)),{
|
||||
if(buffer.numFrames == 0) {"FluidKrToBuf:kr Buffer has 0 frames".warn};
|
||||
if(buffer.numFrames > 1000) {
|
||||
Error("FluidKrToBuf:kr Buffer is % frames. This is probably not the buffer you intended.".format(buffer.numFrames)).throw;
|
||||
|
||||
// sanity check
|
||||
if(buffer.numFrames == 0){"% Buffer has 0 frames".format(this.class).warn};
|
||||
|
||||
// oopsie check
|
||||
if(buffer.numFrames > 1000){
|
||||
Error("% Buffer is % frames. This is probably not the buffer you intended.".format(this.class,buffer.numFrames)).throw;
|
||||
};
|
||||
|
||||
// out of bounds check
|
||||
if((destStartFrame + krNumChans) > buffer.numFrames,{
|
||||
Error("% (destStartFrame + krNumChans) > buffer.numFrames".format(this.class)).throw;
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
^krStream.numChannels.do{
|
||||
arg i;
|
||||
BufWr.kr(krStream[i], buffer, i);
|
||||
^(krStartChan..endChan).do{
|
||||
arg kr_i, i;
|
||||
BufWr.kr(krStream[kr_i], buffer, destStartFrame + i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FluidBufToKr {
|
||||
*kr {
|
||||
arg buffer, numFrames = -1;
|
||||
arg buffer, startFrame = 0, numFrames = -1;
|
||||
|
||||
if((buffer.isKindOf(Buffer).or(buffer.isKindOf(LocalBuf))).not.and(numFrames.isNil),{
|
||||
Error("FluidBufToKr:kr needs to be passed either an existing buffer or an OutputProxy and a number of frames for the buffer that will be supplied").throw;
|
||||
});
|
||||
// out of bounds check
|
||||
if(startFrame < 0,{Error("% startFrame must be >= 0".format(this.class)).throw;});
|
||||
|
||||
if(buffer.isKindOf(Buffer) or: {buffer.isKindOf(LocalBuf)},{
|
||||
|
||||
// fix default -1
|
||||
if(numFrames == -1,{numFrames = buffer.numFrames - startFrame});
|
||||
|
||||
if(numFrames == -1,{
|
||||
numFrames = buffer.numFrames;
|
||||
// dummy check
|
||||
if(numFrames < 1,{Error("% numFrames must be >= 1".format(this.class)).throw});
|
||||
|
||||
// out of bounds check
|
||||
if((startFrame+numFrames) > buffer.numFrames,{Error("% (startFrame + numFrames) > buffer.numFrames".format(this.class)).throw;});
|
||||
|
||||
},{
|
||||
// make sure the numFrames give is a positive integer
|
||||
if((numFrames < 1) || (numFrames.isInteger.not),{
|
||||
Error("% if no buffer is specified, numFrames must be a value >= 1.".format(this.class)).throw;
|
||||
});
|
||||
});
|
||||
|
||||
if(numFrames == 0) {"FluidKrToBuf:kr indicated numFrames is zero.".warn};
|
||||
// oopsie check
|
||||
if(numFrames > 1000) {
|
||||
Error("FluidKrToBuf: Buffer is indicated to have % frames. This is probably not the buffer you intended.".format(numFrames)).throw;
|
||||
Error("%: numframes is % frames. This is probably not what you intended.".format(this.class, numFrames)).throw;
|
||||
};
|
||||
|
||||
if(numFrames > 1,{
|
||||
^numFrames.collect{
|
||||
arg i;
|
||||
BufRd.kr(1,buffer,i,0,0);
|
||||
BufRd.kr(1,buffer,i+startFrame,0,0);
|
||||
}
|
||||
},{
|
||||
^BufRd.kr(1,buffer,0,0,0);
|
||||
^BufRd.kr(1,buffer,startFrame,0,0);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,107 @@
|
||||
{
|
||||
"labels": {
|
||||
"labels": [
|
||||
"tone",
|
||||
"noise"
|
||||
],
|
||||
"rows": 2
|
||||
},
|
||||
"mlp": {
|
||||
"layers": [
|
||||
{
|
||||
"activation": 1,
|
||||
"biases": [
|
||||
9.475189836135217e-245,
|
||||
-7.312978302687739e-296,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"cols": 5,
|
||||
"rows": 7,
|
||||
"weights": [
|
||||
[
|
||||
-0.7070957130289968,
|
||||
0.2529529084252004,
|
||||
-0.6315006118399392,
|
||||
0.2641365029014226,
|
||||
-0.11879484878940468
|
||||
],
|
||||
[
|
||||
-0.5210842572299229,
|
||||
0.25356340881888756,
|
||||
0.04200241621968997,
|
||||
0.12583197506255497,
|
||||
0.2845264672854667
|
||||
],
|
||||
[
|
||||
0.36148051326296066,
|
||||
0.614748588906755,
|
||||
0.24204178015383798,
|
||||
0.6087291285844215,
|
||||
0.5802812834026664
|
||||
],
|
||||
[
|
||||
-0.05847754423619632,
|
||||
-0.16475294200213061,
|
||||
-0.6962199018410693,
|
||||
0.48955391140174614,
|
||||
0.3708040237508281
|
||||
],
|
||||
[
|
||||
0.04633987154978883,
|
||||
0.02745889671058346,
|
||||
-0.16487516786286913,
|
||||
0.03808304248049002,
|
||||
-0.33594219806125813
|
||||
],
|
||||
[
|
||||
-0.3974517302751846,
|
||||
0.4680556811476128,
|
||||
-0.6125775823484346,
|
||||
-0.5770487854150471,
|
||||
-0.6399818221697359
|
||||
],
|
||||
[
|
||||
-0.6405756468993841,
|
||||
-0.65821443359875,
|
||||
-0.1166924540077695,
|
||||
0.21767428398943345,
|
||||
0.3338702030112145
|
||||
]
|
||||
]
|
||||
},
|
||||
{
|
||||
"activation": 1,
|
||||
"biases": [
|
||||
-0.3628999139757816,
|
||||
-0.42250374321781475
|
||||
],
|
||||
"cols": 2,
|
||||
"rows": 5,
|
||||
"weights": [
|
||||
[
|
||||
-0.31804841180355814,
|
||||
-0.46839296834399485
|
||||
],
|
||||
[
|
||||
-4.2805091183479895,
|
||||
4.474227050298208
|
||||
],
|
||||
[
|
||||
0.4747799633725462,
|
||||
0.4122869489228666
|
||||
],
|
||||
[
|
||||
0.5463246485585964,
|
||||
0.04662010562772569
|
||||
],
|
||||
[
|
||||
3.913863778074305,
|
||||
-3.7226634012685995
|
||||
]
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue