From 1dfb32be45e9841ee8d702e7acb71691f0f0c459 Mon Sep 17 00:00:00 2001 From: Michael McCrea Date: Sun, 6 Nov 2016 16:20:00 -0800 Subject: [PATCH 1/2] Add Array extension to replace Matrix extension. Fixes SC3Plugins dependency on MathLib Quark. Updates to docs to come.. --- source/ATK/sc/Classes/ATKMatrix.sc | 50 ++++++++++++++++++++++-------- source/ATK/sc/Classes/extArray.sc | 13 ++++++++ source/ATK/sc/Classes/extMatrix.sc | 16 ---------- 3 files changed, 50 insertions(+), 29 deletions(-) create mode 100644 source/ATK/sc/Classes/extArray.sc delete mode 100644 source/ATK/sc/Classes/extMatrix.sc diff --git a/source/ATK/sc/Classes/ATKMatrix.sc b/source/ATK/sc/Classes/ATKMatrix.sc index c14849a..3631905 100644 --- a/source/ATK/sc/Classes/ATKMatrix.sc +++ b/source/ATK/sc/Classes/ATKMatrix.sc @@ -123,12 +123,12 @@ FoaSpeakerMatrix { matrix { var s, directions, pos, dir; - // scatter matrix accumulator - s = Matrix.newClear(m, m); + // scatter matrix accumulator + s = Matrix.newClear(m, m); // output channel (speaker) directions matrix - // NOTE: this isn't the user supplied directions arg - directions = Matrix.newClear(m, n); + // NOTE: this isn't the user supplied directions arg + directions = Matrix.newClear(m, n); n.do({ arg i; @@ -152,7 +152,7 @@ FoaSpeakerMatrix { }); // return resulting matrix - ^sqrt(1/2) * n * k * ( s.inverse * directions); + ^sqrt(1/2) * n * k * ( s.inverse * directions); } printOn { arg stream; @@ -161,25 +161,49 @@ FoaSpeakerMatrix { } AtkMatrix { - var Date: Sun, 6 Nov 2016 17:17:29 -0800 Subject: [PATCH 2/2] Update Help docs to reflect new way to write a Matrix to a file. --- .../sc/HelpSource/Classes/AtkMatrix.schelp | 14 ++++++++++++- .../Guides/Guide-to-ATK-Matrix-Files.schelp | 21 ++++++++++--------- 2 files changed, 24 insertions(+), 11 deletions(-) diff --git a/source/ATK/sc/HelpSource/Classes/AtkMatrix.schelp b/source/ATK/sc/HelpSource/Classes/AtkMatrix.schelp index ffab007..1b59862 100644 --- a/source/ATK/sc/HelpSource/Classes/AtkMatrix.schelp +++ b/source/ATK/sc/HelpSource/Classes/AtkMatrix.schelp @@ -1,7 +1,7 @@ TITLE:: AtkMatrix summary:: A superclass to the Atk's various matrix classes. categories:: Libraries>Ambisonic Toolkit>Internals -related:: Classes/FoaEncoderMatrix, Classes/FoaDecoderMatrix, Classes/FoaXformerMatrix, Classes/Matrix +related:: Classes/FoaEncoderMatrix, Classes/FoaDecoderMatrix, Classes/FoaXformerMatrix, Classes/Matrix, Guides/Guide-to-ATK-Matrix-Files DESCRIPTION:: An AtkMatrix is not typically instantiated directly, but rather through one of its subclasses: @@ -24,6 +24,18 @@ code:: Matrix.with([[row1],[row2],...[rowN]]) :: +ARGUMENT:: set +code::'FOA', 'HOA1', 'HOA2', ... etc::. +Set describes both the signal set and the tool set, encompassing the Ambisonic order, as well as channel ordering and normalisation. + +ARGUMENT:: type +code::'decoder', 'encoder', or 'xformer'::. + +NOTE:: +strong::set:: and strong::type:: will be required if the code::AtkMatrix:: will subsequently be written to a file. +:: + + INSTANCEMETHODS:: PRIVATE:: set, kind diff --git a/source/ATK/sc/HelpSource/Guides/Guide-to-ATK-Matrix-Files.schelp b/source/ATK/sc/HelpSource/Guides/Guide-to-ATK-Matrix-Files.schelp index 305f026..4137102 100644 --- a/source/ATK/sc/HelpSource/Guides/Guide-to-ATK-Matrix-Files.schelp +++ b/source/ATK/sc/HelpSource/Guides/Guide-to-ATK-Matrix-Files.schelp @@ -228,8 +228,8 @@ the link::Classes/AtkMatrix:: subclasses. When writing from these objects, some can be inferred from them, such as the strong::set:: (Ambisonic order, channel ordering, channel normalisation, e.g. code::'FOA'::, code::'HOA3'::, etc.) and strong::type:: of matrix (e.g. code::'encoder', 'decoder', 'xformer'::). -In the case of a raw matrix, this information can't be inferred and should be -explicitly set when writing to file. +In the case of a raw matrix, you must cast it to an code::AtkMatrix::, specifying the +strong::set:: and strong::type:: explicitly, before writing it to a file. code:: ( // Here's a raw A-to-B encoder matrix: @@ -259,21 +259,22 @@ code:: ) :: -Now be sure to list the proper info for the arguments when writing it to file. This is how the ATK will know where to store the file by default (unless a full path is provided to the file name argument). +Be sure to specify the strong::set:: and strong::type:: when creating an +code::AtkMatrix:: from your code::Matrix::. This is how the ATK will know where +to store the file by default (unless a full path is provided to the file name +argument). code:: ( -~matrix.writeToFile( "myA2B_flu_Matrix.yml", // be sure to use .yml for metadata - 'FOA', // set - 'encoder', // type - ~note, - ~properties -) +~atkMatrix = ~matrix.asAtkMatrix('FOA', 'encoder'); // set, type +// be sure to use .yml extension for metadata +~atkMatrix.writeToFile("myA2B_flu_Matrix.yml", ~note, ~properties); ) :: NOTE:: If providing a file path relative to your code::/ATK/extension/matrices/...:: -directory, strong::set:: and strong::type:: are necessary arguments to locate the +directory, strong::set:: and strong::type:: arguments are necessary when creating the +code::AtkMatrix:: from your code::Matrix:: in order to locate the proper directory to store your file. If providing an absolute file path, strong::set:: and strong::type:: are recommended but not strictly enforced. This allows storing matrices outside the ATK paradigm, e.g. VBAP matrices, etc.