Real time and non real time transient modelling segmentation

nix
Owen Green 7 years ago
parent 9bcfa3199b
commit 37876f09ee

@ -0,0 +1,13 @@
FluidBufTransientSlice{
*process { arg server, src, offsetframes = 0, numframes = -1, offsetchans = 0, numchans = -1, transbuf, order = 200, blocksize = 2048, padding = 1024, skew = 0, threshfwd = 3, threshback = 1.1, windowsize = 14, debounce = 25;
server = server ? Server.default
;if(src.bufnum.isNil) {Error("Invalid Buffer").format(thisMethod.name, this.class.name).throw};
server.sendMsg(\cmd, \BufTransientSlice, src.bufnum, offsetframes, numframes, offsetchans, numchans,
if( transbuf.isNil, -1, {transbuf.bufnum}), order, blocksize, padding, skew, threshfwd, threshback, windowsize, debounce);
}
}

@ -0,0 +1,7 @@
s.reboot
b = Buffer.read(s,"/Users/owen/Desktop/denoise_stn/sources/01-mix.wav",0,44100);
c = Buffer.new
FluidBufTransientSlice.process(s,b,0,-1,0,-1,c,20,1024,1024,0,3,1.1,14,25)
//Num frames => num transients, values = indices (in samps)
c.query

@ -0,0 +1,72 @@
// FD_BufNMF, an NRT buffer NMF Processor
// A tool from the FluCoMa project, funded by the European Research Council (ERC) under the European Unions Horizon 2020 research and innovation programme (grant agreement No 725899)
#define EIGEN_USE_BLAS
#include "clients/nrt/TransientSliceNRT.hpp"
#include "fdNRTBase.hpp"
#include "data/FluidTensor.hpp"
#include "clients/common/FluidParams.hpp"
#include "SC_PlugIn.h"
#include <unordered_set>
#include <vector>
static InterfaceTable *ft;
namespace fluid {
namespace sc{
class BufTransientsSlice: public NRTCommandBase
{
public:
using client_type = segmentation::TransientSliceNRT;
using NRTCommandBase::NRTCommandBase;
~BufTransientsSlice() {}
void runCommand(World* world, void* replyAddr, char* completionMsgData, size_t completionMsgSize)
{
cmd<BufTransientsSlice, &BufTransientsSlice::process, &BufTransientsSlice::postProcess, &BufTransientsSlice::postComplete>(world, "/BufTransientSlice", replyAddr, completionMsgData, completionMsgSize);
}
bool process(World* world)
{
//sanity check the parameters
bool parametersOk;
client_type::ProcessModel processModel;
std::string whatHappened;//this will give us a message to pass back if param check fails
std::tie(parametersOk,whatHappened,processModel) = trans.sanityCheck();
if(!parametersOk)
{
Print("FluidBufTransientSlice: %s \n", whatHappened.c_str());
return false;
}
trans.process(processModel);
mModel = processModel;
return true;
}
bool postProcess(World* world)
{
static_cast<SCBufferView*>(mModel.trans)->assignToRT(world);
return true;
}
bool postComplete(World* w) { return true; }
std::vector<parameter::Instance>& parameters()
{
return trans.getParams();
}
private:
client_type trans;
client_type::ProcessModel mModel;
};//class
} //namespace sc
}//namespace fluid
PluginLoad(OfflineFluidDecompositionUGens) {
ft = inTable;
registerCommand<fluid::sc::BufTransientsSlice,fluid::segmentation::TransientSliceNRT>(ft, "BufTransientSlice");
fluid::sc::printCmd<fluid::segmentation::TransientSliceNRT>(ft,"BufTransientsSlice","FluidBufTransientSlice");
}

@ -0,0 +1,39 @@
s.reboot
////////////////////////////
// test for efficiency
(
b = Buffer.read(s,"/Users/pa/Documents/documents@hudd/research/projects/fluid corpus navigation/research/fluid_decomposition/AudioFiles/Tremblay-AaS-SynthTwoVoices-M.wav");
c = Buffer.new(s);
d = Buffer.new(s);
)
(
// without basic params
Routine{
t = Main.elapsedTime;
FluidBufTransients.process(s,b.bufnum, transBufNum:c.bufnum, resBufNum:d.bufnum);
s.sync;
(Main.elapsedTime - t).postln;
}.play
);
c.query;
c.play;
d.query;
d.play;
//nullsumming tests
{(PlayBuf.ar(1,c.bufnum))+(PlayBuf.ar(1,d.bufnum))+(-1*PlayBuf.ar(1,b.bufnum,doneAction:2))}.play
// with everything changed to make it much faster
(
Routine{
t = Main.elapsedTime;
FluidBufTransients.process(s,b.bufnum, 44100, 44100, 0, 0, c.bufnum, d.bufnum, 100, 512,256,1,2,1,12,20);
s.sync;
(Main.elapsedTime - t).postln;
}.play
);

@ -0,0 +1,20 @@
cmake_minimum_required(VERSION 3.3)
get_filename_component(PLUGIN ${CMAKE_CURRENT_LIST_DIR} NAME_WE)
message("Configuring ${PLUGIN}")
set(FILENAME ${PLUGIN}.cpp)
add_library(
${PLUGIN}
MODULE
${FILENAME}
)
target_include_directories(
${PLUGIN} PRIVATE ${CMAKE_CURRENT_LIST_DIR}/../../include
)
target_link_libraries(
${PLUGIN} PRIVATE FLUID_DECOMPOSITION
)
include(${CMAKE_CURRENT_LIST_DIR}/../../scripts/target_post.cmake)

@ -103,5 +103,5 @@ namespace segmentation{
PluginLoad(FluidSTFTUGen) {
ft = inTable;
registerUnit<fluid::segmentation::FluidSliceTransients>(ft, "FluidSliceTransients");
registerUnit<fluid::segmentation::FluidSliceTransients>(ft, "FluidTransientSlice");
}
Loading…
Cancel
Save