From 4306d6b277ae500810f61046c647ac227afba4e1 Mon Sep 17 00:00:00 2001 From: Owen Green Date: Tue, 3 Dec 2019 18:04:49 +0100 Subject: [PATCH] More TB2 help stubs (KMeans, (Buf)AudioTransport, and base client) --- .../Classes/FluidAudioTransport.schelp | 47 +++++++++ .../Classes/FluidBufAudioTransport.schelp | 82 ++++++++++++++++ .../HelpSource/Classes/FluidKMeans.schelp | 96 +++++++++++++++++++ .../Classes/FluidManipulationClient.schelp | 51 ++++++++++ 4 files changed, 276 insertions(+) create mode 100644 release-packaging/HelpSource/Classes/FluidAudioTransport.schelp create mode 100644 release-packaging/HelpSource/Classes/FluidBufAudioTransport.schelp create mode 100644 release-packaging/HelpSource/Classes/FluidKMeans.schelp create mode 100644 release-packaging/HelpSource/Classes/FluidManipulationClient.schelp diff --git a/release-packaging/HelpSource/Classes/FluidAudioTransport.schelp b/release-packaging/HelpSource/Classes/FluidAudioTransport.schelp new file mode 100644 index 0000000..c9b7c6b --- /dev/null +++ b/release-packaging/HelpSource/Classes/FluidAudioTransport.schelp @@ -0,0 +1,47 @@ +TITLE:: FluidAudioTransport +summary:: Interpolate between sounds +categories:: FluidManipulation +related:: Classes/FluidBufAudioTransport + +DESCRIPTION:: +Interpolates between the spectra of two sounds using the Optimal Transport algorithm + +See +Henderson and Solomonm (2019) AUDIO TRANSPORT: A GENERALIZED PORTAMENTO VIA OPTIMAL TRANSPORT, DaFx + + +CLASSMETHODS:: + +METHOD:: ar +Process incoming audio signals + +ARGUMENT:: in +Source A + +ARGUMENT:: in2 +Source B + +ARGUMENT:: interpolation +The amount to interpolate between A and B (0-1, 0 = A, 1 = B) + +ARGUMENT:: bandwidth +Someone tell me + +ARGUMENT:: windowSize +The size of the processing window (kr) + +ARGUMENT:: hopSize +The processing hop size (kr). Default = windowSize / 2 + +ARGUMENT:: fftSize +The processing FFT size (kr). Default = windowSize + +ARGUMENT:: maxFFTSize +The maximum FFT size for processing + + +EXAMPLES:: + +code:: +(some example code) +:: diff --git a/release-packaging/HelpSource/Classes/FluidBufAudioTransport.schelp b/release-packaging/HelpSource/Classes/FluidBufAudioTransport.schelp new file mode 100644 index 0000000..f5040ac --- /dev/null +++ b/release-packaging/HelpSource/Classes/FluidBufAudioTransport.schelp @@ -0,0 +1,82 @@ +TITLE:: FluidBufAudioTransport +summary:: Interpolate between buffers +categories:: FluidManipulation +related:: Classes/FluidAudioTransport + +DESCRIPTION:: +Interpolates between the spectra of two sounds using the Optimal Transport algorithm + +See +Henderson and Solomonm (2019) AUDIO TRANSPORT: A GENERALIZED PORTAMENTO VIA OPTIMAL TRANSPORT, DaFx + +CLASSMETHODS:: + +METHOD:: process +Process two audio link::Classes/Buffer:: + +ARGUMENT:: server +The server the process runs on + +ARGUMENT:: source1 +The first source buffer + +ARGUMENT:: startFrame1 +offset into the first source buffer (samples) + +ARGUMENT:: numFrames1 +number of samples to use from first source buffer + +ARGUMENT:: startChan1 +starting channel of first source buffer + +ARGUMENT:: numChans1 +number of channels to process in first source buffer + +ARGUMENT:: source2 +the second source buffer + +ARGUMENT:: startFrame2 +offset into the second source buffer (samples) + +ARGUMENT:: numFrames2 +number of samples to process from second buffer + +ARGUMENT:: startChan2 +starting channel for second buffer + +ARGUMENT:: numChans2 +number of channels to process in second buffer + +ARGUMENT:: destination +buffer for interpolated audio + +ARGUMENT:: interpolation +The amount to interpolate between A and B (0-1, 0 = A, 1 = B) + +ARGUMENT:: bandwidth +Someone tell me + +ARGUMENT:: windowSize +The size of the processing window (kr) + +ARGUMENT:: hopSize +The processing hop size (kr). Default = windowSize / 2 + +ARGUMENT:: fftSize +The processing FFT size (kr). Default = windowSize + +ARGUMENT:: action +Function to run when processing complete, taking the destination buffer as its argument + +INSTANCEMETHODS:: + +private:: synth, server + +METHOD:: cancel +cancel processing on the server + +EXAMPLES:: + +code:: +(some example code) +:: diff --git a/release-packaging/HelpSource/Classes/FluidKMeans.schelp b/release-packaging/HelpSource/Classes/FluidKMeans.schelp new file mode 100644 index 0000000..fa27fd3 --- /dev/null +++ b/release-packaging/HelpSource/Classes/FluidKMeans.schelp @@ -0,0 +1,96 @@ +TITLE:: FluidKMeans +summary:: Cluster data points with K-Means +categories:: FluidManipulation +related:: Classes/FluidDataSet, Classes/FluidLabelSet, Classes/FluidKNN + +DESCRIPTION:: +Uses the K-Means algorithm to learn clusters from a link::Classes/FluidDataSet:: + +https://scikit-learn.org/stable/tutorial/statistical_inference/unsupervised_learning.html#clustering-grouping-observations-together + +CLASSMETHODS:: + +INSTANCEMETHODS:: + +PRIVATE::k + +METHOD:: predictPoint +Given a trained object, return the cluster ID for a data point in a link::Classes/Buffer:: + +ARGUMENT:: buffer +a link::Classes/Buffer:: containing a data point + +ARGUMENT:: action +A function to run when the server responds, taking the ID of the cluser as its argument + +METHOD:: fit +Identify code::k:: clusters in a link::Classes/FluidDataSet:: + +ARGUMENT:: dataset +A link::Classes/FluidDataSet:: of data points + +ARGUMENT:: k +The number of clusters to identify in the data set + +ARGUMENT:: maxIter +Maximum number of iterations to use partitioning the data + +ARGUMENT:: buffer +Seed centroids for clusters WARNING:: Not yet implemented :: + +ARGUMENT:: action +A function to run when fitting is complete, taking as its argument an array with the number of data points for each cluster + +METHOD:: write +write learned clusters to disk as a JSON file. Will not overwrite existing files + +ARGUMENT:: filename +Absolute path for file + +ARGUMENT:: action +A function to run when the file is written + +METHOD:: read +Read a learned clustering of a data set from a JSON file + +ARGUMENT:: filename +Absolute path of the JSON file + +ARGUMENT:: action +Function to run when the file has been read + +METHOD:: getClusters +Fill a link::Classes/FluidLabelSet:: with the assignments for each point in the passed link::Classes/FluidDataSet:: that was used to train this instance + +ARGUMENT:: dataset +The link::Classes/FluidDataSet:: used to train this instance + +ARGUMENT:: labelset +A link::Classes/FluidLabelSet:: to fill with assignments + +ARGUMENT:: action +A function to run when the operation is complete + +METHOD:: cols +Retreive the dimentionality of the dataset this instance is trained on + +ARGUMENT:: action +A function to run when the server responds, taking the dimensionality as its argument + +METHOD:: predict +Report cluster assignments for previously unseen data + +ARGUMENT:: dataset +A link::Classes/FluidDataSet:: of data points + +ARGUMENT:: labelset +A link::Classes/FluidLabelSet:: to contain assigments + +ARGUMENT:: action +A function to run when complete, taking an array of the counts for each catgegory as its argument + +EXAMPLES:: + +code:: +(some example code) +:: diff --git a/release-packaging/HelpSource/Classes/FluidManipulationClient.schelp b/release-packaging/HelpSource/Classes/FluidManipulationClient.schelp new file mode 100644 index 0000000..3e2d69a --- /dev/null +++ b/release-packaging/HelpSource/Classes/FluidManipulationClient.schelp @@ -0,0 +1,51 @@ +TITLE:: FluidManipulationClient +summary:: A base case for FluidManipulation classes +categories:: FluidManipulation + +DESCRIPTION:: +A utility base class for FluidManipulation classes, that deals with common functionality (wrapping a link::Classes/Synth:: in the instance, etc.) + +Not intended to be used directly. + +CLASSMETHODS:: + +PRIVATE:: nonBlocking + +METHOD:: kr +The kr of the underlying UGem, which will output progress readings once all messages can be asynchronous. + +If, for whatever reason, you create an instance of a client object using code::kr:: in your own synth, make sure to set the instance's link::Classes/FluidManipulationClient#synth:: and link::Classes/FluidManipulationClient#server::, or nothing will work. + +returns:: An instance + +METHOD:: new +Language-side constructor. Internally, this creates a new synth around an instance of the sub-class being constructed, and maintains a variable pointing to the synth, so that it can be communicated with. + +ARGUMENT:: server +The link::Classes/Server:: this instance is running on + +ARGUMENT:: ... args +Arguments specific to the sub-class at hand + +returns:: A new instance + +INSTANCEMETHODS:: + +private:: pr_sendMsg + +METHOD:: synth +Fluid Manipulation client objects are server-side entities, wrapped in a Node to manage communication between language and object. For this, a link::Classes/Synth:: is needed, as the representation of a server node. + +returns:: the instance's link::Classes/Synth:: + +METHOD:: server +The link::Classes/Server:: that our instance's object is running on + +returns:: a link::Classes/Server:: + + +EXAMPLES:: + +code:: +(some example code) +:: \ No newline at end of file