From 3f687e238ae4280c574146c4403555bdc7fdaa6f Mon Sep 17 00:00:00 2001 From: Pierre Alexandre Tremblay Date: Sun, 19 Jul 2020 12:37:37 +0100 Subject: [PATCH] FluidBufNNDSVD is a thing --- release-packaging/Classes/FluidBufNNDSVD.sc | 35 +++++++++++ .../HelpSource/Classes/FluidBufNNDSVD.schelp | 61 +++++++++++++++++++ src/FluidBufNNDSVD/CMakeLists.txt | 21 +++++++ src/FluidBufNNDSVD/FluidBufNNDSVD.cpp | 22 +++++++ 4 files changed, 139 insertions(+) create mode 100644 release-packaging/Classes/FluidBufNNDSVD.sc create mode 100644 release-packaging/HelpSource/Classes/FluidBufNNDSVD.schelp create mode 100644 src/FluidBufNNDSVD/CMakeLists.txt create mode 100644 src/FluidBufNNDSVD/FluidBufNNDSVD.cpp diff --git a/release-packaging/Classes/FluidBufNNDSVD.sc b/release-packaging/Classes/FluidBufNNDSVD.sc new file mode 100644 index 0000000..12fe6d3 --- /dev/null +++ b/release-packaging/Classes/FluidBufNNDSVD.sc @@ -0,0 +1,35 @@ +FluidBufNNDSVD : UGen{ + *new1 { |rate, source, bases, activations, minComponents = 1, maxComponents = 200, coverage = 0.5, method = 0, windowSize = 1024, hopSize = -1, fftSize = -1, trig = 1, blocking=0| + + source.isNil.if {"FluidBufNNDSVD: Invalid source buffer".throw}; + bases.isNil.if {"FluidBufNNDSVD: Invalid bases buffer".throw}; + activations.isNil.if {"FluidBufNNDSVD: Invalid bases buffer".throw}; + source = source.asUGenInput; + bases = bases.asUGenInput; + activations = activations.asUGenInput; + + ^super.new1(rate, source, bases, activations, minComponents, maxComponents, coverage, method, windowSize, hopSize, fftSize, trig, blocking) + + } + + *kr { |source, bases, activations, minComponents = 1, maxComponents = 200, coverage = 0.5, method = 0, windowSize = 1024, hopSize = -1, fftSize = -1, trig = 1| + ^this.new1(\control, source, bases, activations, minComponents, maxComponents, coverage, method, windowSize, hopSize, fftSize, trig); + } + + + *process { |server, source, bases, activations, minComponents = 1, maxComponents = 200, coverage = 0.5, method = 0, windowSize = 1024, hopSize = -1, fftSize = -1, action| + ^FluidNRTProcess.new( + server, this, action, [bases] + ).process( + source, bases, activations, minComponents, maxComponents, coverage, method, windowSize, hopSize, fftSize + ) + } + + *processBlocking { |server, source, bases, activations, minComponents = 1, maxComponents = 200, coverage = 0.5, method = 0, windowSize = 1024, hopSize = -1, fftSize = -1, action| + ^FluidNRTProcess.new( + server, this, action, [bases],blocking:1 + ).process( + source, bases, activations, minComponents, maxComponents, coverage, method, windowSize, hopSize, fftSize + ) + } +} diff --git a/release-packaging/HelpSource/Classes/FluidBufNNDSVD.schelp b/release-packaging/HelpSource/Classes/FluidBufNNDSVD.schelp new file mode 100644 index 0000000..c4a8ec2 --- /dev/null +++ b/release-packaging/HelpSource/Classes/FluidBufNNDSVD.schelp @@ -0,0 +1,61 @@ +TITLE:: FluidBufNNDSVD +summary:: something +categories:: FluidManipulation +related:: Classes/FluidBufNMF + +DESCRIPTION:: +does something + +See +a paper + +CLASSMETHODS:: + +METHOD:: process +Process two audio link::Classes/Buffer:: + +ARGUMENT:: server +The server the process runs on + +ARGUMENT:: source +(describe argument here) + +ARGUMENT:: bases +(describe argument here) + +ARGUMENT:: activations +(describe argument here) + +ARGUMENT:: minComponents +(describe argument here) + +ARGUMENT:: maxComponents +(describe argument here) + +ARGUMENT:: coverage +(describe argument here) + +ARGUMENT:: method +(describe argument here) + +ARGUMENT:: windowSize + The window size. As spectral differencing relies on spectral frames, we need to decide what precision we give it spectrally and temporally, in line with Gabor Uncertainty principles. http://www.subsurfwiki.org/wiki/Gabor_uncertainty + +ARGUMENT:: hopSize + The window hop size. As sinusoidal estimation relies on spectral frames, we need to move the window forward. It can be any size but low overlap will create audible artefacts. The -1 default value will default to half of windowSize (overlap of 2). + +ARGUMENT:: fftSize + The inner FFT/IFFT size. It should be at least 4 samples long, at least the size of the window, and a power of 2. Making it larger allows an oversampling of the spectral precision. The -1 default value will use the next power of 2 equal or above the highest of windowSize and (bandwidth - 1) * 2. + +ARGUMENT:: action + A Function to be evaluated once the offline process has finished and all Buffer's instance variables have been updated on the client side. The function will be passed [destination] as an argument. + +INSTANCEMETHODS:: + +private:: synth, server + +EXAMPLES:: + +code:: +yes +:: diff --git a/src/FluidBufNNDSVD/CMakeLists.txt b/src/FluidBufNNDSVD/CMakeLists.txt new file mode 100644 index 0000000..9646a4e --- /dev/null +++ b/src/FluidBufNNDSVD/CMakeLists.txt @@ -0,0 +1,21 @@ +# Part of the Fluid Corpus Manipulation Project (http://www.flucoma.org/) +# Copyright 2017-2019 University of Huddersfield. +# Licensed under the BSD-3 License. +# See license.md file in the project root for full license information. +# This project has received funding from the European Research Council (ERC) +# under the European Union’s Horizon 2020 research and innovation programme +# (grant agreement No 725899). + +cmake_minimum_required(VERSION 3.11) + +get_filename_component(PLUGIN ${CMAKE_CURRENT_LIST_DIR} NAME_WE) +message("Configuring ${PLUGIN}") +set(FILENAME ${PLUGIN}.cpp) + +add_library( + ${PLUGIN} + MODULE + ${FILENAME} +) + +include(${CMAKE_CURRENT_LIST_DIR}/../../scripts/target_post.cmake) diff --git a/src/FluidBufNNDSVD/FluidBufNNDSVD.cpp b/src/FluidBufNNDSVD/FluidBufNNDSVD.cpp new file mode 100644 index 0000000..2f4e47f --- /dev/null +++ b/src/FluidBufNNDSVD/FluidBufNNDSVD.cpp @@ -0,0 +1,22 @@ +/* +Part of the Fluid Corpus Manipulation Project (http://www.flucoma.org/) +Copyright 2017-2019 University of Huddersfield. +Licensed under the BSD-3 License. +See license.md file in the project root for full license information. +This project has received funding from the European Research Council (ERC) +under the European Union’s Horizon 2020 research and innovation programme +(grant agreement No 725899). +*/ + +#include + +#include + +static InterfaceTable *ft; + +PluginLoad(FluidSTFTUGen) +{ + ft = inTable; + using namespace fluid::client; + makeSCWrapper("FluidBufNNDSVD", ft); +}