Add non real time HPSS

nix
Owen Green 7 years ago
parent bac7e21c39
commit 0b89aa5b5e

@ -0,0 +1,14 @@
FDHPSS{
*process { arg server, src, offsetframes = 0, numframes = -1, offsetchans = 0, numchans = -1, harmbuf, percbuf, psize = 31, hsize = 17, winsize = 4096, hopsize = 1024, fftsize = -1;
server = server ? Server.default
;if(src.bufnum.isNil) {Error("Invalid Buffer").format(thisMethod.name, this.class.name).throw};
server.sendMsg(\cmd, \BufHPSS, src.bufnum, offsetframes, numframes, offsetchans, numchans,
if( harmbuf.isNil, -1, {harmbuf.bufnum}),
if( percbuf.isNil, -1, {percbuf.bufnum}), psize, hsize, winsize, hopsize, fftsize);
}
}

@ -0,0 +1,14 @@
s.reboot
(
b = Buffer.read(s,"/Users/owen/Desktop/denoise_stn/sources/01-mix.wav");
h = Buffer.new(s);
p = Buffer.new(s);
)
FDHPSS.process(s,b,0,1-1,0,-1,h,p,31,17)
p.play;
h.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)

@ -0,0 +1,91 @@
// FD_BufHPSS, an NRT buffer HPSS 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)
#include "fdNRTBase.hpp"
#include "algorithms/STFT.hpp"
#include "data/FluidTensor.hpp"
#include "clients/nrt/HPSS.hpp"
#include "clients/common/FluidParams.hpp"
#include "SC_PlugIn.h"
#include <unordered_set>
#include <vector>
static InterfaceTable *ft;
//Using statements for fluidtensor
using fluid::FluidTensor;
using fluid::FluidTensorView;
namespace fluid {
namespace sc{
class BufHPSS: public NRTCommandBase
{
/*
- srcbuf num
 src start frame
- src numframes
src start chan
 src num chans
 harms dst
 perc dst
 window size
 hop size
 fft size
*/
public:
using client_type = hpss::HPSSClient;
using NRTCommandBase::NRTCommandBase;
~BufHPSS() {}
void runCommand(World* world, void* replyAddr, char* completionMsgData, size_t completionMsgSize)
{
cmd<BufHPSS, &BufHPSS::process, &BufHPSS::postProcess, &BufHPSS::postComplete>(world, "AsyncNMF", replyAddr, completionMsgData, completionMsgSize);
}
bool process(World* world)
{
//sanity check the parameters
bool parametersOk;
hpss::HPSSClient::ProcessModel processModel;
std::string whatHappened;//this will give us a message to pass back if param check fails
std::tie(parametersOk,whatHappened,processModel) = processor.sanityCheck();
if(!parametersOk)
{
Print("fdNMF: %s \n", whatHappened.c_str());
return false;
}
//Now, we can proceed
processor.process(processModel);
mModel = processModel;
return true;
}
bool postProcess(World* world)
{
static_cast<SCBufferView*>
(parameter::lookupParam("harmbuf", processor.getParams()).getBuffer())->assignToRT(world);
static_cast<SCBufferView*>
(parameter::lookupParam("percbuf", processor.getParams()).getBuffer())->assignToRT(world);
return true;
}
bool postComplete(World* w) { return true; }
std::vector<parameter::Instance>& parameters()
{
return processor.getParams();
}
private:
hpss::HPSSClient processor;
hpss::HPSSClient::ProcessModel mModel;
};//class
} //namespace sc
}//namespace fluid
PluginLoad(OfflineFluidDecompositionUGens) {
ft = inTable;
registerCommand<fluid::sc::BufHPSS,fluid::hpss::HPSS>(ft, "BufHPSS");
fluid::sc::printCmd<fluid::hpss::HPSSClient>(ft,"BufHPSS","FDHPSS");
}
Loading…
Cancel
Save