diff --git a/release-packaging/Classes/FluidBufSTFT.sc b/release-packaging/Classes/FluidBufSTFT.sc new file mode 100644 index 0000000..382cff6 --- /dev/null +++ b/release-packaging/Classes/FluidBufSTFT.sc @@ -0,0 +1,47 @@ +FluidBufSTFT : FluidBufProcessor { + + *kr { |source, startFrame = 0, numFrames = -1, startChan = 0, magnitudeBuffer, phaseBuffer, resynthesisBuffer, inverse = 0,windowSize = 1024, hopSize = -1, fftSize = -1, trig = 1, blocking = 1| + + // source = source.asUGenInput; + + // source.isNil.if {"FluidBufScale: Invalid source buffer".throw}; + source = source ? -1; + magnitudeBuffer = magnitudeBuffer ? -1; + phaseBuffer = phaseBuffer ? -1; + resynthesisBuffer = resynthesisBuffer ? - 1; + + ^FluidProxyUgen.kr(\FluidBufSTFTTrigger, -1, source, startFrame, numFrames, startChan, magnitudeBuffer, phaseBuffer, resynthesisBuffer, inverse, windowSize, hopSize, fftSize,trig, blocking); + } + + *process { |server, source, startFrame = 0, numFrames = -1, startChan = 0, magnitudeBuffer, phaseBuffer, resynthesisBuffer, inverse = 0, windowSize = 1024, hopSize = -1, fftSize = -1,freeWhenDone = true, action| + + // source = source.asUGenInput; + + // source.isNil.if {"FluidBufSTFT: Invalid source buffer".throw}; + source = source ? -1; + magnitudeBuffer = magnitudeBuffer ? -1; + phaseBuffer = phaseBuffer ? -1; + resynthesisBuffer = resynthesisBuffer ? - 1; + + ^this.new( + server, nil, [magnitudeBuffer,phaseBuffer,resynthesisBuffer].select{|b| b != -1} + ).processList( + [source, startFrame, numFrames, startChan, magnitudeBuffer, phaseBuffer, resynthesisBuffer, inverse, windowSize, hopSize, fftSize, 0], freeWhenDone, action + ); + } + + *processBlocking { |server, source, startFrame = 0, numFrames = -1, startChan = 0, magnitudeBuffer, phaseBuffer, resynthesisBuffer, inverse = 0, windowSize = 1024, hopSize = -1, fftSize = -1,freeWhenDone = true, action| + + // source = source.asUGenInput; + source = source ? -1; + magnitudeBuffer = magnitudeBuffer ? -1; + phaseBuffer = phaseBuffer ? -1; + resynthesisBuffer = resynthesisBuffer ? - 1; + + ^this.new( + server, nil, [magnitudeBuffer,phaseBuffer,resynthesisBuffer].select{|b| b != -1} + ).processList( + [source, startFrame, numFrames, startChan, magnitudeBuffer, phaseBuffer, resynthesisBuffer, inverse, windowSize, hopSize, fftSize,1], freeWhenDone, action + ); + } +} diff --git a/release-packaging/Classes/FluidBufSelect.sc b/release-packaging/Classes/FluidBufSelect.sc new file mode 100644 index 0000000..a9cf200 --- /dev/null +++ b/release-packaging/Classes/FluidBufSelect.sc @@ -0,0 +1,67 @@ +FluidBufSelect : FluidBufProcessor { + + *kr { |source, destination, indices=#[-1], channels=#[-1], trig = 1, blocking = 1| + + var params; + + source = source.asUGenInput; + destination = destination.asUGenInput; + + indices = indices.asArray; + channels = channels.asArray; + + indices = [indices.size] ++ indices; + channels = [channels.size] ++ channels; + + source.isNil.if {"FluidBufSelect: Invalid source buffer".throw}; + destination.isNil.if {"FluidBufSelect: Invalid destination buffer".throw}; + + params = indices ++ channels ++ [trig, blocking] + + ^FluidProxyUgen.kr(\FluidBufSelectTrigger,-1, source, destination, *params); + } + + + *process { |server, source, destination, indices=#[-1], channels=#[-1], freeWhenDone = true, action| + + source = source.asUGenInput; + destination = destination.asUGenInput; + + source.isNil.if {"FluidBufSelect: Invalid source buffer".throw}; + destination.isNil.if {"FluidBufSelect: Invalid destination buffer".throw}; + + + indices = indices.asArray; + channels = channels.asArray; + + + + indices = [indices.size] ++ indices; + channels = [channels.size] ++ channels; + + indices.postln; + + ^this.new(server, nil, [destination]).processList([source, destination]++ indices ++ channels ++ [1], freeWhenDone, action);//NB always blocking + } + + *processBlocking { |server, source, destination, indices=#[-1], channels=#[-1], freeWhenDone = true, action| + + source = source.asUGenInput; + destination = destination.asUGenInput; + + source.isNil.if {"FluidBufSelect: Invalid source buffer".throw}; + destination.isNil.if {"FluidBufSelect: Invalid destination buffer".throw}; + + indices = indices.asArray; + channels = channels.asArray; + + indices = [indices.size] ++ indices; + channels = [channels.size] ++ channels; + + + ^this.new( + server, nil, [destination] + ).processList([source, destination]++ indices ++ channels ++ [1], freeWhenDone, action);//NB always blocking + } +} +FluidBufSelectTrigger : FluidProxyUgen {} diff --git a/release-packaging/Classes/FluidBufSelectEvery.sc b/release-packaging/Classes/FluidBufSelectEvery.sc new file mode 100644 index 0000000..3339e51 --- /dev/null +++ b/release-packaging/Classes/FluidBufSelectEvery.sc @@ -0,0 +1,44 @@ +FluidBufSelectEvery : FluidBufProcessor { + + *kr { |source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, destination, frameHop = 1, channelHop = 1, trig = 1, blocking = 1| + + source = source.asUGenInput; + destination = destination.asUGenInput; + + source.isNil.if {"FluidBufSelectEvery: Invalid source buffer".throw}; + destination.isNil.if {"FluidBufSelectEvery: Invalid destination buffer".throw}; + + ^FluidProxyUgen.kr(\FluidBufSelectEveryTrigger, -1, source, startFrame, numFrames, startChan, numChans, destination, frameHop, channelHop, trig, blocking); + } + + *process { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, destination, frameHop = 1, channelHop = 1, freeWhenDone = true, action| + + source = source.asUGenInput; + destination = destination.asUGenInput; + + source.isNil.if {"FluidBufSelectEvery: Invalid source buffer".throw}; + destination.isNil.if {"FluidBufSelectEvery: Invalid destination buffer".throw}; + + ^this.new( + server, nil, [destination] + ).processList( + [source, startFrame, numFrames, startChan, numChans, destination, frameHop, channelHop, 0], freeWhenDone, action + ); + } + + *processBlocking { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, destination, frameHop = 1, channelHop = 1, freeWhenDone = true, action| + + source = source.asUGenInput; + destination = destination.asUGenInput; + + source.isNil.if {"FluidBufSelectEvery: Invalid source buffer".throw}; + destination.isNil.if {"FluidBufSelectEvery: Invalid destination buffer".throw}; + + ^this.new( + server, nil, [destination] + ).processList( + [source, startFrame, numFrames, startChan, numChans, destination, frameHop, channelHop, 1], freeWhenDone, action + ); + } +} +FluidBufSelectEveryTrigger : FluidProxyUgen {} diff --git a/release-packaging/Classes/FluidServerObject.sc b/release-packaging/Classes/FluidServerObject.sc index cbaeeac..06ce7c1 100644 --- a/release-packaging/Classes/FluidServerObject.sc +++ b/release-packaging/Classes/FluidServerObject.sc @@ -194,7 +194,7 @@ FluidBufProcessor : FluidServerObject FluidOSCPatternInversion : OSCMessageDispatcher { value {|msg, time, addr, recvPort| - var msgpath = msg[0]; + var msgpath = msg[0].asSymbol; active.keysValuesDo({|key, func| if(msgpath.matchOSCAddressPattern(key), {func.value(msg, time, addr, recvPort);}); }) diff --git a/release-packaging/HelpSource/Classes/FluidBufSTFT.schelp b/release-packaging/HelpSource/Classes/FluidBufSTFT.schelp new file mode 100644 index 0000000..e9fe662 --- /dev/null +++ b/release-packaging/HelpSource/Classes/FluidBufSTFT.schelp @@ -0,0 +1,154 @@ +TITLE:: FluidBufSTFT +summary:: (put short description here) +categories:: Undocumented classes, UGens>Undocumented +related:: Classes/SomeRelatedClass, Reference/SomeRelatedStuff, etc. + +DESCRIPTION:: +(put long description here) + +CLASSMETHODS:: + +METHOD:: processBlocking +(describe method here) + +ARGUMENT:: server +(describe argument here) + +ARGUMENT:: source +(describe argument here) + +ARGUMENT:: startFrame +(describe argument here) + +ARGUMENT:: numFrames +(describe argument here) + +ARGUMENT:: startChan +(describe argument here) + +ARGUMENT:: magnitudeBuffer +(describe argument here) + +ARGUMENT:: phaseBuffer +(describe argument here) + +ARGUMENT:: resynthesisBuffer +(describe argument here) + +ARGUMENT:: inverse +(describe argument here) + +ARGUMENT:: freeWhenDone +(describe argument here) + +ARGUMENT:: action +(describe argument here) + +returns:: (describe returnvalue here) + +METHOD:: process +(describe method here) + +ARGUMENT:: server +(describe argument here) + +ARGUMENT:: source +(describe argument here) + +ARGUMENT:: startFrame +(describe argument here) + +ARGUMENT:: numFrames +(describe argument here) + +ARGUMENT:: startChan +(describe argument here) + +ARGUMENT:: magnitudeBuffer +(describe argument here) + +ARGUMENT:: phaseBuffer +(describe argument here) + +ARGUMENT:: resynthesisBuffer +(describe argument here) + +ARGUMENT:: inverse +(describe argument here) + +ARGUMENT:: freeWhenDone +(describe argument here) + +ARGUMENT:: action +(describe argument here) + +returns:: (describe returnvalue here) + +METHOD:: kr +(describe method here) + +ARGUMENT:: source +(describe argument here) + +ARGUMENT:: startFrame +(describe argument here) + +ARGUMENT:: numFrames +(describe argument here) + +ARGUMENT:: startChan +(describe argument here) + +ARGUMENT:: magnitudeBuffer +(describe argument here) + +ARGUMENT:: phaseBuffer +(describe argument here) + +ARGUMENT:: resynthesisBuffer +(describe argument here) + +ARGUMENT:: inverse +(describe argument here) + +ARGUMENT:: trig +(describe argument here) + +ARGUMENT:: blocking +(describe argument here) + +returns:: (describe returnvalue here) + + +INSTANCEMETHODS:: + + +EXAMPLES:: + +code:: +s.reboot +( +b = Buffer.read(s,File.realpath(FluidBufSTFT.class.filenameSymbol).dirname.withTrailingSlash ++ "../AudioFiles/Tremblay-AaS-AcousticStrums-M.wav"); +m = Buffer.new; +p = Buffer.new; +r = Buffer.new; +) +b +( +fork{ + FluidBufSTFT.process(s,source:b,magnitudeBuffer:m,phaseBuffer:p).wait; + FluidBufSTFT.process(s,magnitudeBuffer:m,phaseBuffer:p,resynthesisBuffer:r,inverse:1).wait; + "Done".postln; +} +) + + +{ PlayBuf.ar(1,r); }.play + +//null? +{ PlayBuf.ar(1,r) - PlayBuf(1,b); }.play + + + + +:: diff --git a/src/FluidBufSTFT/CMakeLists.txt b/src/FluidBufSTFT/CMakeLists.txt new file mode 100644 index 0000000..9646a4e --- /dev/null +++ b/src/FluidBufSTFT/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/FluidBufSTFT/FluidBufSTFT.cpp b/src/FluidBufSTFT/FluidBufSTFT.cpp new file mode 100644 index 0000000..ecd1001 --- /dev/null +++ b/src/FluidBufSTFT/FluidBufSTFT.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(OfflineFluidDecompositionUGens) +{ + ft = inTable; + using namespace fluid::client; + makeSCWrapper("FluidBufSTFT", ft); +} diff --git a/src/FluidBufSelect/CMakeLists.txt b/src/FluidBufSelect/CMakeLists.txt new file mode 100644 index 0000000..9646a4e --- /dev/null +++ b/src/FluidBufSelect/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/FluidBufSelect/FluidBufSelect.cpp b/src/FluidBufSelect/FluidBufSelect.cpp new file mode 100644 index 0000000..43fc58a --- /dev/null +++ b/src/FluidBufSelect/FluidBufSelect.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(OfflineFluidDecompositionUGens) +{ + ft = inTable; + using namespace fluid::client; + makeSCWrapper("FluidBufSelect", ft); +} diff --git a/src/FluidBufSelectEvery/CMakeLists.txt b/src/FluidBufSelectEvery/CMakeLists.txt new file mode 100644 index 0000000..9646a4e --- /dev/null +++ b/src/FluidBufSelectEvery/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/FluidBufSelectEvery/FluidBufSelectEvery.cpp b/src/FluidBufSelectEvery/FluidBufSelectEvery.cpp new file mode 100644 index 0000000..87c1d9b --- /dev/null +++ b/src/FluidBufSelectEvery/FluidBufSelectEvery.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(OfflineFluidDecompositionUGens) +{ + ft = inTable; + using namespace fluid::client; + makeSCWrapper("FluidBufSelectEvery", ft); +}