diff --git a/UnityProject/Assembly-CSharp-Editor.csproj b/UnityProject/Assembly-CSharp-Editor.csproj index e177087..27c3759 100644 --- a/UnityProject/Assembly-CSharp-Editor.csproj +++ b/UnityProject/Assembly-CSharp-Editor.csproj @@ -60,8 +60,10 @@ - + + + diff --git a/UnityProject/Assembly-CSharp.csproj b/UnityProject/Assembly-CSharp.csproj index 2a7c8af..06c41ef 100644 --- a/UnityProject/Assembly-CSharp.csproj +++ b/UnityProject/Assembly-CSharp.csproj @@ -62,8 +62,8 @@ - + diff --git a/UnityProject/Assets/Editor/PdBindEditor.cs b/UnityProject/Assets/Editor/PdBindEditor.cs deleted file mode 100644 index eae664c..0000000 --- a/UnityProject/Assets/Editor/PdBindEditor.cs +++ /dev/null @@ -1,104 +0,0 @@ -using UnityEngine; -using UnityEditor; -using Random = UnityEngine.Random; - -namespace cylvester -{ - - [CustomEditor(typeof(PdBind))] - class PdBindEditor : UnityEditor.Editor - { - - private int selectedSpectrum_; - private Texture2D texture_; - private readonly string[] channels = { - "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16" - }; - - private Rect paintSpace_; - private Rect selectedArea_; - private Rect scaledRect_; - - public void OnEnable() - { - texture_ = new Texture2D(256, 256); - } - - public override void OnInspectorGUI() - { - var backend = (PdBackend)target; - if (Event.current.isMouse && Event.current.button == 0) - { - switch (Event.current.type) - { - case EventType.MouseDown: - { - var mousePos = Event.current.mousePosition; - selectedArea_.x = mousePos.x; - selectedArea_.y = mousePos.y; - break; - } - case EventType.MouseDrag: - { - var mousePos = Event.current.mousePosition; - selectedArea_.width = mousePos.x - selectedArea_.x; - selectedArea_.height = mousePos.y - selectedArea_.y; - UpdateScaledRect(); - break; - } - } - } - - GUILayout.Label("PureData Inputs", EditorStyles.boldLabel); - - selectedSpectrum_ = EditorGUILayout.Popup("Input Channel", selectedSpectrum_, channels); - GUILayout.Space(30); - GUILayout.Label("Spectrum Extractor", EditorStyles.boldLabel); - - var paintSpace = GUILayoutUtility.GetRect(256, 512, 256, 256); - if (Event.current.type == EventType.Repaint) - { - paintSpace_ = paintSpace; - RenderTexture(); - GUI.DrawTexture(paintSpace_, texture_); - } - - Repaint(); - } - - private void RenderTexture() - { - for (var y = 0; y < texture_.height; y++) - { - for (var x = 0; x < texture_.width; x++) - { - var alpha = 0.4f; - if ((scaledRect_.x < x && x < (scaledRect_.x + scaledRect_.width)) && - (scaledRect_.y < y && y < (scaledRect_.y + scaledRect_.height))) - { - alpha = 1f; - } - var color = new Color(Random.value, Random.value, Random.value, alpha); - texture_.SetPixel(x, 256-y, color); - } - } - texture_.Apply(); - } - - - private void UpdateScaledRect() - { - var xPos = (selectedArea_.x - paintSpace_.x) / paintSpace_.width; - var yPos = (selectedArea_.y - paintSpace_.y) / paintSpace_.height; - var width = selectedArea_.width / paintSpace_.width; - var height = selectedArea_.height / paintSpace_.height; - - scaledRect_.x = xPos * texture_.width; - scaledRect_.y = yPos * texture_.height; - scaledRect_.width = width * texture_.width; - scaledRect_.height = height * texture_.height; - - Debug.Log(scaledRect_); - } - } -} diff --git a/UnityProject/Assets/Editor/PdSpectrumBindEditor.cs b/UnityProject/Assets/Editor/PdSpectrumBindEditor.cs new file mode 100644 index 0000000..6b04cd4 --- /dev/null +++ b/UnityProject/Assets/Editor/PdSpectrumBindEditor.cs @@ -0,0 +1,64 @@ +using UnityEngine; +using UnityEditor; + +namespace cylvester +{ + [CustomEditor(typeof(PdSpectrumBind))] + class PdSpectrumBindEditor : Editor + { + private const int TextureWidth = 512; + private const int TextureHeight = 256; + private readonly string[] channels = { + "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16" + }; + private int selectedSpectrum_; + private ISpectrumGenerator spectrumGenerator_; + private IRectangularSelection rectangularSelection_; + private Rect paintSpace_; + + public void OnEnable() + { + spectrumGenerator_ = new SpectrumGenerator(TextureWidth, TextureHeight); + rectangularSelection_ = new RectangularSelection(ref paintSpace_, TextureWidth, TextureHeight); + } + + public override void OnInspectorGUI() + { + var behaviour = (PdSpectrumBind)target; + + + if (Event.current.isMouse && Event.current.button == 0) + { + switch (Event.current.type) + { + case EventType.MouseDown: + { + rectangularSelection_.Start(Event.current.mousePosition); + break; + } + case EventType.MouseDrag: + { + rectangularSelection_.Update(Event.current.mousePosition); + break; + } + } + } + + GUILayout.Label("PureData Inputs", EditorStyles.boldLabel); + + selectedSpectrum_ = EditorGUILayout.Popup("Input Channel", selectedSpectrum_, channels); + GUILayout.Space(5); + GUILayout.Label("Spectrum Extractor", EditorStyles.boldLabel); + + var paintSpace = GUILayoutUtility.GetRect(TextureHeight, TextureWidth, TextureHeight, TextureHeight); + if (Event.current.type == EventType.Repaint) + { + paintSpace_ = paintSpace; + spectrumGenerator_.Update(ref rectangularSelection_.Selection); + GUI.DrawTexture(paintSpace_, spectrumGenerator_.Spectrum); + } + + Repaint(); + } + } +} diff --git a/UnityProject/Assets/Editor/PdBindEditor.cs.meta b/UnityProject/Assets/Editor/PdSpectrumBindEditor.cs.meta similarity index 100% rename from UnityProject/Assets/Editor/PdBindEditor.cs.meta rename to UnityProject/Assets/Editor/PdSpectrumBindEditor.cs.meta diff --git a/UnityProject/Assets/Editor/RectangularSelection.cs b/UnityProject/Assets/Editor/RectangularSelection.cs new file mode 100644 index 0000000..1ea1d73 --- /dev/null +++ b/UnityProject/Assets/Editor/RectangularSelection.cs @@ -0,0 +1,52 @@ +using UnityEngine; + +namespace cylvester +{ + interface IRectangularSelection + { + ref Rect Selection { get; } + + void Start(Vector2 mousePosition); + void Update(Vector2 mousePosition); + } + + public class RectangularSelection : IRectangularSelection + { + private readonly Rect paintSpace_; + + private Rect selectedArea_; + private Rect selectionRect_; + private readonly int textureWidth_; + private readonly int textureHeight_; + + public ref Rect Selection => ref selectionRect_; + + public RectangularSelection(ref Rect paintSpace, int textureWidth, int textureHeight) + { + paintSpace_ = paintSpace; + textureWidth_ = textureWidth; + textureHeight_ = textureHeight; + } + + public void Start(Vector2 mousePosition) + { + selectedArea_.x = mousePosition.x; + selectedArea_.y = mousePosition.y; + } + + public void Update(Vector2 mousePosition) + { + selectedArea_.width = mousePosition.x - selectedArea_.x; + selectedArea_.height = mousePosition.y - selectedArea_.y; + var xPos = (selectedArea_.x - paintSpace_.x) / paintSpace_.width; + var yPos = (selectedArea_.y - paintSpace_.y) / paintSpace_.height; + var width = selectedArea_.width / paintSpace_.width; + var height = selectedArea_.height / paintSpace_.height; + + selectionRect_.x = xPos * textureWidth_; + selectionRect_.y = yPos * textureHeight_; + selectionRect_.width = width * textureWidth_; + selectionRect_.height = height * textureHeight_; + } + } +} \ No newline at end of file diff --git a/UnityProject/Assets/Editor/RectangularSelection.cs.meta b/UnityProject/Assets/Editor/RectangularSelection.cs.meta new file mode 100644 index 0000000..cc33292 --- /dev/null +++ b/UnityProject/Assets/Editor/RectangularSelection.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 422a7a65df524b57bacf009a035444c7 +timeCreated: 1569749893 \ No newline at end of file diff --git a/UnityProject/Assets/Editor/SpectrumGenerator.cs b/UnityProject/Assets/Editor/SpectrumGenerator.cs new file mode 100644 index 0000000..c272682 --- /dev/null +++ b/UnityProject/Assets/Editor/SpectrumGenerator.cs @@ -0,0 +1,42 @@ +using UnityEngine; + +namespace cylvester +{ + interface ISpectrumGenerator + { + Texture2D Spectrum { get; } + void Update(ref Rect selectionRect); + } + + public class SpectrumGenerator : ISpectrumGenerator + { + private Texture2D texture_; + private readonly int height_; + public Texture2D Spectrum => texture_; + + public SpectrumGenerator(int width, int height) + { + texture_ = new Texture2D(width, height); + height_ = height; + } + + public void Update(ref Rect selectionRect) + { + for (var y = 0; y < texture_.height; y++) + { + for (var x = 0; x < texture_.width; x++) + { + var alpha = 0.4f; + if ((selectionRect.x < x && x < (selectionRect.x + selectionRect.width)) && + (selectionRect.y < y && y < (selectionRect.y + selectionRect.height))) + { + alpha = 1f; + } + var color = new Color(Random.value, Random.value, Random.value, alpha); + texture_.SetPixel(x, height_-y, color); + } + } + texture_.Apply(); + } + } +} \ No newline at end of file diff --git a/UnityProject/Assets/Editor/SpectrumGenerator.cs.meta b/UnityProject/Assets/Editor/SpectrumGenerator.cs.meta new file mode 100644 index 0000000..625f263 --- /dev/null +++ b/UnityProject/Assets/Editor/SpectrumGenerator.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: b9ec12d2c1d14323b612b07799422f5a +timeCreated: 1569749431 \ No newline at end of file diff --git a/UnityProject/Assets/Scenes/Examples/PdBackendDemo/PdBackendDemo.unity b/UnityProject/Assets/Scenes/Examples/PdBackendDemo/PdBackendDemo.unity index cdcf8f9..63ea294 100644 --- a/UnityProject/Assets/Scenes/Examples/PdBackendDemo/PdBackendDemo.unity +++ b/UnityProject/Assets/Scenes/Examples/PdBackendDemo/PdBackendDemo.unity @@ -112,6 +112,83 @@ NavMeshSettings: debug: m_Flags: 0 m_NavMeshData: {fileID: 0} +--- !u!1 &127705016 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 127705019} + - component: {fileID: 127705018} + - component: {fileID: 127705017} + m_Layer: 0 + m_Name: Cube + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!23 &127705017 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 127705016} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 +--- !u!33 &127705018 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 127705016} + m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!4 &127705019 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 127705016} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 4.8635645, y: -4.5257893, z: 12.978625} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &267275365 GameObject: m_ObjectHideFlags: 0 diff --git a/UnityProject/Assets/Scripts/PdConnection/PdBackend.cs b/UnityProject/Assets/Scripts/PdConnection/PdBackend.cs index 9ec83f2..9b4668f 100644 --- a/UnityProject/Assets/Scripts/PdConnection/PdBackend.cs +++ b/UnityProject/Assets/Scripts/PdConnection/PdBackend.cs @@ -13,7 +13,7 @@ namespace cylvester [ExecuteInEditMode] public class PdBackend : MonoBehaviour, IPdBackend { - [SerializeField] string mainPatch; + [SerializeField] string mainPatch = ""; [SerializeField] int inchannels = 2; private Action onToggled_; diff --git a/UnityProject/Assets/Scripts/PdConnection/PdBind.cs b/UnityProject/Assets/Scripts/PdConnection/PdBind.cs deleted file mode 100644 index 54d337c..0000000 --- a/UnityProject/Assets/Scripts/PdConnection/PdBind.cs +++ /dev/null @@ -1,12 +0,0 @@ -using UnityEngine; - -namespace cylvester -{ - public class PdBind : MonoBehaviour - { - private void Start() - { - - } - } -} \ No newline at end of file diff --git a/UnityProject/Assets/Scripts/PdConnection/PdSpectrumBind.cs b/UnityProject/Assets/Scripts/PdConnection/PdSpectrumBind.cs new file mode 100644 index 0000000..b985f1d --- /dev/null +++ b/UnityProject/Assets/Scripts/PdConnection/PdSpectrumBind.cs @@ -0,0 +1,31 @@ +using UnityEngine; + +namespace cylvester +{ + public interface IPdSpectrumBind + { + float TrimmedEnergy { get; } + } + + public class PdSpectrumBind : MonoBehaviour, IPdSpectrumBind + { + public int channel; + public int startBin; + public int endBin; + [SerializeField] private float topClip; + [SerializeField] private float bottomClip; + [SerializeField] private float trimmedEnergy = 0f; + + public float TrimmedEnergy => trimmedEnergy; + + private void Start() + { + + } + + private void Update() + { + + } + } +} \ No newline at end of file diff --git a/UnityProject/Assets/Scripts/PdConnection/PdBind.cs.meta b/UnityProject/Assets/Scripts/PdConnection/PdSpectrumBind.cs.meta similarity index 100% rename from UnityProject/Assets/Scripts/PdConnection/PdBind.cs.meta rename to UnityProject/Assets/Scripts/PdConnection/PdSpectrumBind.cs.meta diff --git a/UnityProject/Assets/StreamingAssets/pd/patch/analyzer.pd b/UnityProject/Assets/StreamingAssets/pd/patch/analyzer.pd index b997bdd..a0b9edb 100644 --- a/UnityProject/Assets/StreamingAssets/pd/patch/analyzer.pd +++ b/UnityProject/Assets/StreamingAssets/pd/patch/analyzer.pd @@ -1,26 +1,19 @@ -#N canvas 646 421 694 441 10; -#X msg 294 172 \; pd dsp 1; -#X obj 359 49 loadbang; +#N canvas 550 301 727 406 10; +#X msg 307 54 \; pd dsp 1; +#X obj 187 61 loadbang; #X obj 80 273 adc~ 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16; -#N canvas 1223 661 730 390 levelmeter______________________________ +#N canvas 0 50 450 250 (subpatch) 0; +#X array loop 211681 float 2; +#X coords 0 1 211681 -1 200 140 1 0 0; +#X restore 446 219 graph; +#X obj 274 146 soundfiler; +#X msg 269 109 read -resize drumloop.wav loop; +#X obj 6 318 dac~, f 6; +#X obj 31 228 tabplay~ loop; +#X obj 30 179 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 +-1; +#N canvas 1194 597 730 390 analyzers_______________________________ 0; -#X obj 109 321 table levelmeters 16; -#X obj 96 181 levelwriter 0; -#X obj 120 204 levelwriter 1; -#X obj 149 226 levelwriter 2; -#X obj 173 249 levelwriter 3; -#X obj 199 182 levelwriter 4; -#X obj 224 205 levelwriter 5; -#X obj 252 227 levelwriter 6; -#X obj 277 250 levelwriter 7; -#X obj 300 183 levelwriter 8; -#X obj 324 206 levelwriter 9; -#X obj 353 228 levelwriter 10; -#X obj 377 251 levelwriter 11; -#X obj 403 184 levelwriter 12; -#X obj 428 207 levelwriter 13; -#X obj 457 229 levelwriter 14; -#X obj 481 252 levelwriter 15; #X obj 95 44 inlet~; #X obj 119 69 inlet~; #X obj 148 96 inlet~; @@ -37,65 +30,213 @@ #X obj 425 80 inlet~; #X obj 454 111 inlet~; #X obj 478 132 inlet~; -#X connect 17 0 1 0; -#X connect 18 0 2 0; -#X connect 19 0 3 0; -#X connect 20 0 4 0; -#X connect 21 0 5 0; -#X connect 22 0 6 0; -#X connect 23 0 7 0; -#X connect 24 0 8 0; -#X connect 25 0 9 0; -#X connect 26 0 10 0; -#X connect 27 0 11 0; -#X connect 28 0 12 0; -#X connect 29 0 13 0; -#X connect 30 0 14 0; -#X connect 31 0 15 0; -#X connect 32 0 16 0; -#X restore 79 309 pd levelmeter______________________________; -#X obj 63 167 shmem levelmeters 16; -#X obj 63 108 metro 50; -#X obj 58 19 loadbang; -#X obj 66 79 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 1 1 -; -#X msg 64 50 1; -#N canvas 0 50 450 250 (subpatch) 0; -#X array loop 211681 float 2; -#X coords 0 1 211681 -1 200 140 1 0 0; -#X restore 446 219 graph; -#X obj 446 134 soundfiler; -#X msg 441 97 read -resize drumloop.wav loop; -#X obj 6 318 dac~, f 6; -#X obj 31 228 tabplay~ loop; -#X obj 30 179 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 --1; +#X obj 96 183 core 0; +#X obj 120 204 core 1; +#X obj 149 226 core 2; +#X obj 173 249 core 3; +#X obj 199 182 core 4; +#X obj 225 205 core 5; +#X obj 252 227 core 6; +#X obj 277 250 core 7; +#X obj 300 183 core 8; +#X obj 324 206 core 9; +#X obj 354 228 core 10; +#X obj 377 251 core 11; +#X obj 403 184 core 12; +#X obj 428 207 core 13; +#X obj 457 229 core 14; +#X obj 481 252 core 15; +#X connect 0 0 16 0; +#X connect 1 0 17 0; +#X connect 2 0 18 0; +#X connect 3 0 19 0; +#X connect 4 0 20 0; +#X connect 5 0 21 0; +#X connect 6 0 22 0; +#X connect 7 0 23 0; +#X connect 8 0 24 0; +#X connect 9 0 25 0; +#X connect 10 0 26 0; +#X connect 11 0 27 0; +#X connect 12 0 28 0; +#X connect 13 0 29 0; +#X connect 14 0 30 0; +#X connect 15 0 31 0; +#X restore 80 309 pd analyzers_______________________________; +#X obj 46 26 bang~; +#X obj 46 49 count 16; +#X obj 46 76 sel 0; +#X obj 46 102 s shmemupdate; +#N canvas 0 50 450 300 shmems 0; +#X obj 45 78 shmem levelmeters 16; +#X obj 45 42 r shmemupdate; +#X obj 42 105 table levelmeters 16; #X connect 1 0 0 0; -#X connect 1 0 11 0; -#X connect 1 0 14 0; -#X connect 2 0 3 0; -#X connect 2 1 3 1; -#X connect 2 2 3 2; -#X connect 2 3 3 3; -#X connect 2 4 3 4; -#X connect 2 5 3 5; -#X connect 2 6 3 6; -#X connect 2 7 3 7; -#X connect 2 8 3 8; -#X connect 2 9 3 9; -#X connect 2 10 3 10; -#X connect 2 11 3 11; -#X connect 2 12 3 12; -#X connect 2 13 3 13; -#X connect 2 14 3 14; -#X connect 2 15 3 15; +#X restore 608 25 pd shmems; +#N canvas 763 290 686 441 window 0; +#N canvas 0 0 450 300 (subpatch) 0; +#X array hann 1024 float 1; +#A 0 0 1.88351e-005 3.76403e-005 9.41157e-005 0.000150591 0.000244677 +0.000338793 0.000470519 0.000602275 0.000771612 0.000940949 0.00114787 +0.00135478 0.00159925 0.00184369 0.00212568 0.00240764 0.00272709 0.00304651 +0.00340337 0.00376022 0.00415444 0.00454867 0.00498021 0.00541174 0.00588053 +0.0063493 0.00685525 0.00736117 0.0079042 0.00844723 0.0090273 0.00960734 +0.0102243 0.0108413 0.0114951 0.0121489 0.0128395 0.01353 0.0142572 +0.0149843 0.015748 0.0165117 0.0173118 0.0181119 0.0189483 0.0197847 +0.0206572 0.0215298 0.0224383 0.0233469 0.0242914 0.0252359 0.0262161 +0.0271963 0.0282121 0.0292279 0.0302792 0.0313304 0.032417 0.0335035 +0.0346252 0.0357469 0.0369035 0.0380601 0.0392516 0.040443 0.041669 +0.042895 0.0441554 0.0454159 0.0467106 0.0480052 0.0493339 0.0506626 +0.0520252 0.0533877 0.0547839 0.05618 0.0576096 0.0590392 0.060502 +0.0619648 0.0634605 0.0649563 0.0664848 0.0680134 0.0695744 0.0711355 +0.0727288 0.0743222 0.0759476 0.077573 0.0792302 0.0808874 0.0825762 +0.0842649 0.085985 0.0877051 0.0894562 0.0912073 0.0929892 0.0947711 +0.0965835 0.0983959 0.100239 0.102081 0.103954 0.105826 0.107729 0.109631 +0.111563 0.113494 0.115455 0.117416 0.119406 0.121395 0.123413 0.125431 +0.127478 0.129524 0.131598 0.133672 0.135774 0.137876 0.140005 0.142134 +0.14429 0.146446 0.148629 0.150811 0.15302 0.155229 0.157464 0.159699 +0.161959 0.16422 0.166506 0.168792 0.171102 0.173413 0.175748 0.178084 +0.180443 0.182803 0.185186 0.18757 0.189977 0.192384 0.194814 0.197244 +0.199697 0.20215 0.204625 0.2071 0.209598 0.212095 0.214614 0.217133 +0.219674 0.222214 0.224775 0.227337 0.229919 0.2325 0.235102 0.237704 +0.240326 0.242948 0.245589 0.24823 0.25089 0.25355 0.256229 0.258907 +0.261604 0.264301 0.267015 0.26973 0.272462 0.275194 0.277942 0.280691 +0.283457 0.286222 0.289003 0.291785 0.294582 0.297379 0.300191 0.303003 +0.305831 0.308658 0.311499 0.314341 0.317196 0.320052 0.322921 0.32579 +0.328672 0.331555 0.334449 0.337344 0.340252 0.343159 0.346078 0.348997 +0.351927 0.354857 0.357798 0.36074 0.363691 0.366643 0.369605 0.372567 +0.375538 0.37851 0.38149 0.384471 0.38746 0.390449 0.393447 0.396444 +0.399449 0.402455 0.405467 0.40848 0.411499 0.414519 0.417545 0.420571 +0.423603 0.426635 0.429672 0.432709 0.435752 0.438794 0.441842 0.444889 +0.44794 0.450991 0.454046 0.457101 0.460159 0.463218 0.466279 0.46934 +0.472403 0.475466 0.478531 0.481596 0.484663 0.487729 0.490797 0.493864 +0.496932 0.5 0.503068 0.506136 0.509203 0.512271 0.515337 0.518404 +0.521469 0.524534 0.527597 0.53066 0.533721 0.536782 0.539841 0.542899 +0.545954 0.549009 0.55206 0.555111 0.558158 0.561205 0.564248 0.56729 +0.570328 0.573365 0.576397 0.579429 0.582455 0.585481 0.588501 0.59152 +0.594533 0.597545 0.600551 0.603556 0.606553 0.609551 0.61254 0.615529 +0.61851 0.62149 0.624462 0.627433 0.630395 0.633357 0.636308 0.63926 +0.642201 0.645143 0.648073 0.651003 0.653922 0.656841 0.659748 0.662656 +0.66555 0.668445 0.671328 0.67421 0.677079 0.679948 0.682804 0.685659 +0.688501 0.691342 0.694169 0.696997 0.699809 0.702621 0.705418 0.708215 +0.710997 0.713778 0.716543 0.719309 0.722057 0.724806 0.727538 0.73027 +0.732984 0.735699 0.738396 0.741092 0.743771 0.74645 0.74911 0.75177 +0.754411 0.757052 0.759674 0.762295 0.764897 0.767499 0.770081 0.772663 +0.775224 0.777786 0.780326 0.782867 0.785386 0.787905 0.790402 0.7929 +0.795375 0.79785 0.800303 0.802756 0.805186 0.807616 0.810023 0.812431 +0.814814 0.817197 0.819557 0.821916 0.824252 0.826587 0.828898 0.831209 +0.833494 0.83578 0.838041 0.840301 0.842536 0.844771 0.84698 0.849189 +0.851372 0.853554 0.85571 0.857866 0.859995 0.862124 0.864226 0.866328 +0.868402 0.870476 0.872523 0.874569 0.876587 0.878605 0.880595 0.882584 +0.884545 0.886506 0.888438 0.890369 0.892272 0.894174 0.896047 0.897919 +0.899762 0.901605 0.903417 0.905229 0.907011 0.908793 0.910544 0.912295 +0.914015 0.915736 0.917424 0.919113 0.92077 0.922428 0.924053 0.925678 +0.927272 0.928865 0.930426 0.931987 0.933516 0.935044 0.93654 0.938036 +0.939499 0.940961 0.942391 0.94382 0.945217 0.946613 0.947975 0.949338 +0.950667 0.951995 0.95329 0.954585 0.955845 0.957106 0.958332 0.959558 +0.960749 0.96194 0.963097 0.964254 0.965375 0.966497 0.967584 0.96867 +0.969721 0.970773 0.971788 0.972804 0.973784 0.974765 0.975709 0.976654 +0.977562 0.978471 0.979343 0.980216 0.981052 0.981889 0.982689 0.983489 +0.984252 0.985016 0.985743 0.98647 0.987161 0.987852 0.988505 0.989159 +0.989776 0.990393 0.990973 0.991553 0.992096 0.992639 0.993145 0.993651 +0.99412 0.994589 0.99502 0.995452 0.995846 0.99624 0.996597 0.996954 +0.997273 0.997593 0.997874 0.998156 0.998401 0.998645 0.998852 0.999059 +0.999228 0.999398 0.99953 0.999661 0.999755 0.999849 0.999906 0.999962 +0.999981 1 0.999981 0.999962 0.999906 0.999849 0.999755 0.999661 0.999529 +0.999398 0.999228 0.999059 0.998852 0.998645 0.998401 0.998156 0.997874 +0.997592 0.997273 0.996953 0.996596 0.996239 0.995845 0.995451 0.995019 +0.994588 0.994119 0.99365 0.993144 0.992638 0.992095 0.991552 0.990972 +0.990392 0.989775 0.989158 0.988504 0.987851 0.98716 0.986469 0.985742 +0.985015 0.984251 0.983488 0.982687 0.981887 0.981051 0.980215 0.979342 +0.978469 0.977561 0.976652 0.975708 0.974763 0.973783 0.972803 0.971787 +0.970771 0.96972 0.968669 0.967582 0.966495 0.965374 0.964252 0.963095 +0.961939 0.960747 0.959556 0.95833 0.957104 0.955843 0.954583 0.953288 +0.951993 0.950665 0.949336 0.947973 0.946611 0.945215 0.943818 0.942389 +0.940959 0.939496 0.938034 0.936538 0.935042 0.933514 0.931985 0.930424 +0.928863 0.927269 0.925676 0.924051 0.922425 0.920768 0.919111 0.917422 +0.915733 0.914013 0.912293 0.910542 0.908791 0.907009 0.905227 0.903414 +0.901602 0.899759 0.897917 0.896044 0.894171 0.892269 0.890367 0.888435 +0.886503 0.884542 0.882582 0.880592 0.878602 0.876584 0.874566 0.87252 +0.870473 0.868399 0.866325 0.864223 0.862121 0.859992 0.857863 0.855707 +0.853551 0.851368 0.849186 0.846977 0.844768 0.842533 0.840298 0.838037 +0.835777 0.833491 0.831205 0.828895 0.826584 0.824249 0.821913 0.819554 +0.817194 0.814811 0.812427 0.81002 0.807613 0.805183 0.802753 0.8003 +0.797847 0.795372 0.792896 0.790399 0.787901 0.785382 0.782863 0.780323 +0.777782 0.775221 0.77266 0.770078 0.767496 0.764894 0.762292 0.75967 +0.757048 0.754407 0.751766 0.749106 0.746446 0.743767 0.741089 0.738392 +0.735695 0.732981 0.730266 0.727534 0.724802 0.722054 0.719305 0.71654 +0.713774 0.710993 0.708211 0.705414 0.702617 0.699805 0.696993 0.694165 +0.691338 0.688497 0.685655 0.6828 0.679944 0.677075 0.674206 0.671324 +0.668441 0.665546 0.662652 0.659744 0.656837 0.653918 0.650999 0.648069 +0.645139 0.642197 0.639256 0.636304 0.633353 0.630391 0.627429 0.624458 +0.621486 0.618506 0.615525 0.612536 0.609547 0.606549 0.603552 0.600546 +0.597541 0.594529 0.591516 0.588496 0.585477 0.582451 0.579425 0.576393 +0.573361 0.570324 0.567286 0.564244 0.561201 0.558154 0.555107 0.552056 +0.549004 0.545949 0.542894 0.539836 0.536778 0.533717 0.530656 0.527593 +0.52453 0.521464 0.518399 0.515333 0.512266 0.509199 0.506131 0.503064 +0.499996 0.496928 0.49386 0.490792 0.487725 0.484659 0.481592 0.478527 +0.475462 0.472399 0.469335 0.466274 0.463213 0.460155 0.457097 0.454042 +0.450987 0.447936 0.444884 0.441837 0.43879 0.435748 0.432705 0.429668 +0.42663 0.423598 0.420566 0.417541 0.414515 0.411495 0.408476 0.405463 +0.40245 0.399445 0.39644 0.393442 0.390445 0.387456 0.384466 0.381486 +0.378505 0.375534 0.372563 0.369601 0.366639 0.363687 0.360736 0.357794 +0.354853 0.351923 0.348993 0.346074 0.343155 0.340247 0.33734 0.334445 +0.331551 0.328668 0.325786 0.322917 0.320048 0.317192 0.314337 0.311495 +0.308654 0.305827 0.302999 0.300187 0.297375 0.294578 0.291781 0.288999 +0.286218 0.283453 0.280687 0.277939 0.27519 0.272458 0.269726 0.267012 +0.264297 0.2616 0.258904 0.256225 0.253547 0.250886 0.248226 0.245585 +0.242944 0.240323 0.237701 0.235099 0.232497 0.229915 0.227333 0.224772 +0.222211 0.21967 0.21713 0.214611 0.212092 0.209594 0.207097 0.204622 +0.202146 0.199693 0.19724 0.19481 0.19238 0.189973 0.187566 0.185183 +0.182799 0.18044 0.17808 0.175745 0.17341 0.171099 0.168788 0.166502 +0.164217 0.161956 0.159696 0.157461 0.155226 0.153017 0.150808 0.148625 +0.146443 0.144287 0.142131 0.140002 0.137873 0.135771 0.133669 0.131595 +0.129521 0.127474 0.125428 0.12341 0.121392 0.119402 0.117413 0.115452 +0.113491 0.11156 0.109628 0.107726 0.105823 0.103951 0.102078 0.100236 +0.0983929 0.0965805 0.0947681 0.0929862 0.0912043 0.0894532 0.0877021 +0.0859821 0.084262 0.0825733 0.0808845 0.0792273 0.0775701 0.0759448 +0.0743194 0.0727261 0.0711327 0.0695717 0.0680107 0.0664822 0.0649537 +0.0634579 0.0619622 0.0604994 0.0590366 0.0576071 0.0561775 0.0547814 +0.0533852 0.0520227 0.0506602 0.0493315 0.0480028 0.0467082 0.0454136 +0.0441532 0.0428927 0.0416667 0.0404407 0.0392494 0.038058 0.0369014 +0.0357447 0.0346231 0.0335014 0.0324149 0.0313284 0.0302772 0.0292259 +0.0282102 0.0271944 0.0262142 0.025234 0.0242896 0.0233451 0.0224366 +0.0215281 0.0206555 0.019783 0.0189467 0.0181103 0.0173103 0.0165102 +0.0157465 0.0149829 0.0142557 0.0135286 0.0128381 0.0121476 0.0114938 +0.01084 0.0102231 0.00960615 0.00902611 0.0084461 0.0079031 0.0073601 +0.00685418 0.00634828 0.00587955; +#A 1000 0.00541082 0.00497931 0.00454783 0.00415364 0.00375944 0.00340265 +0.00304583 0.00272644 0.00240701 0.00212508 0.00184315 0.00159872 0.00135431 +0.00114745 0.000940561 0.000771254 0.000601947 0.000470281 0.000338584 +0.000244498 0.000150442 9.39965e-005 3.75807e-005 1.87755e-005; +#X coords 0 1 1023 0 300 100 1 0 0; +#X restore 39 32 graph; +#X restore 611 47 pd window; +#X connect 1 0 0 0; +#X connect 1 0 5 0; +#X connect 1 0 8 0; +#X connect 2 0 9 0; +#X connect 2 1 9 1; +#X connect 2 2 9 2; +#X connect 2 3 9 3; +#X connect 2 4 9 4; +#X connect 2 5 9 5; +#X connect 2 6 9 6; +#X connect 2 7 9 7; +#X connect 2 8 9 8; +#X connect 2 9 9 9; +#X connect 2 10 9 10; +#X connect 2 11 9 11; +#X connect 2 12 9 12; +#X connect 2 13 9 13; +#X connect 2 14 9 14; +#X connect 2 15 9 15; #X connect 5 0 4 0; -#X connect 6 0 8 0; -#X connect 7 0 5 0; +#X connect 7 0 6 1; +#X connect 7 0 6 0; +#X connect 7 0 9 0; +#X connect 7 1 8 0; #X connect 8 0 7 0; -#X connect 11 0 10 0; -#X connect 13 0 12 1; -#X connect 13 0 12 0; -#X connect 13 0 3 0; -#X connect 13 1 14 0; -#X connect 14 0 13 0; +#X connect 10 0 11 0; +#X connect 11 0 12 0; +#X connect 12 0 13 0; diff --git a/UnityProject/Assets/StreamingAssets/pd/patch/levelwriter.pd b/UnityProject/Assets/StreamingAssets/pd/patch/core.pd similarity index 74% rename from UnityProject/Assets/StreamingAssets/pd/patch/levelwriter.pd rename to UnityProject/Assets/StreamingAssets/pd/patch/core.pd index 3fe2d81..03a019d 100644 --- a/UnityProject/Assets/StreamingAssets/pd/patch/levelwriter.pd +++ b/UnityProject/Assets/StreamingAssets/pd/patch/core.pd @@ -4,7 +4,10 @@ #X obj 162 153 loadbang; #X obj 167 201 f \$1; #X obj 57 239 tabwrite levelmeters; +#X obj 85 135 spectrum \$1; +#X obj 229 240 table fft_\$1 512; #X connect 0 0 4 0; #X connect 1 0 0 0; +#X connect 1 0 5 0; #X connect 2 0 3 0; #X connect 3 0 4 1; diff --git a/UnityProject/Assets/StreamingAssets/pd/patch/levelwriter.pd.meta b/UnityProject/Assets/StreamingAssets/pd/patch/core.pd.meta similarity index 74% rename from UnityProject/Assets/StreamingAssets/pd/patch/levelwriter.pd.meta rename to UnityProject/Assets/StreamingAssets/pd/patch/core.pd.meta index 90dc964..a5ad7cd 100644 --- a/UnityProject/Assets/StreamingAssets/pd/patch/levelwriter.pd.meta +++ b/UnityProject/Assets/StreamingAssets/pd/patch/core.pd.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: ce1d1fba9496a6f45ac752b4d01ef632 +guid: ffeec6b2f4ee66447a818305fd0fd53c DefaultImporter: externalObjects: {} userData: diff --git a/UnityProject/Assets/StreamingAssets/pd/patch/count.pd b/UnityProject/Assets/StreamingAssets/pd/patch/count.pd new file mode 100644 index 0000000..fea5cb3 --- /dev/null +++ b/UnityProject/Assets/StreamingAssets/pd/patch/count.pd @@ -0,0 +1,14 @@ +#N canvas 1383 500 450 449 10; +#X obj 76 96 inlet; +#X obj 166 145 + 1; +#X obj 76 149 f 0; +#X obj 76 242 sel \$1; +#X msg 178 210 0, f 11; +#X obj 5 292 outlet; +#X connect 0 0 2 0; +#X connect 1 0 2 1; +#X connect 2 0 3 0; +#X connect 2 0 5 0; +#X connect 3 0 4 0; +#X connect 3 1 1 0; +#X connect 4 0 2 1; diff --git a/UnityProject/Assets/StreamingAssets/pd/patch/count.pd.meta b/UnityProject/Assets/StreamingAssets/pd/patch/count.pd.meta new file mode 100644 index 0000000..14f8580 --- /dev/null +++ b/UnityProject/Assets/StreamingAssets/pd/patch/count.pd.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 6459c895fc8fc584197b481bb701000e +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityProject/Assets/StreamingAssets/pd/patch/spectrum.pd b/UnityProject/Assets/StreamingAssets/pd/patch/spectrum.pd new file mode 100644 index 0000000..d1799fd --- /dev/null +++ b/UnityProject/Assets/StreamingAssets/pd/patch/spectrum.pd @@ -0,0 +1,20 @@ +#N canvas 1959 406 681 467 10; +#X obj 38 30 inlet~; +#X obj 45 134 rfft~; +#X obj 45 186 *~; +#X obj 82 186 *~; +#X obj 45 226 q8_sqrt~; +#X obj 169 96 block~ 1024 1 1; +#X obj 102 58 tabreceive~ hann; +#X obj 76 92 *~; +#X obj 45 266 tabsend~ fft_\$1; +#X connect 0 0 7 0; +#X connect 1 0 2 0; +#X connect 1 0 2 1; +#X connect 1 1 3 0; +#X connect 1 1 3 1; +#X connect 2 0 4 0; +#X connect 3 0 4 0; +#X connect 4 0 8 0; +#X connect 6 0 7 1; +#X connect 7 0 1 0; diff --git a/UnityProject/Assets/StreamingAssets/pd/patch/spectrum.pd.meta b/UnityProject/Assets/StreamingAssets/pd/patch/spectrum.pd.meta new file mode 100644 index 0000000..6206b64 --- /dev/null +++ b/UnityProject/Assets/StreamingAssets/pd/patch/spectrum.pd.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: e56e8121fbc616141996c04e582ed74a +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: