diff --git a/UnityProject/Assembly-CSharp.csproj b/UnityProject/Assembly-CSharp.csproj index 8f19932..17f313a 100644 --- a/UnityProject/Assembly-CSharp.csproj +++ b/UnityProject/Assembly-CSharp.csproj @@ -66,6 +66,7 @@ + @@ -85,6 +86,7 @@ + diff --git a/UnityProject/Assets/Editor/PdBackendEditor.cs b/UnityProject/Assets/Editor/PdBackendEditor.cs index c7cd88f..2e6da97 100644 --- a/UnityProject/Assets/Editor/PdBackendEditor.cs +++ b/UnityProject/Assets/Editor/PdBackendEditor.cs @@ -21,7 +21,8 @@ namespace cylvester "Kick", "Pads+Strings", "Rose_Sax", - "Roses_Front" + "Roses_Front", + "TimbreID_Test" }; private void Awake() diff --git a/UnityProject/Assets/StreamingAssets/SteamVR.meta b/UnityProject/Assets/Scenes/Examples/TimbreID.meta similarity index 77% rename from UnityProject/Assets/StreamingAssets/SteamVR.meta rename to UnityProject/Assets/Scenes/Examples/TimbreID.meta index 934a266..3795626 100644 --- a/UnityProject/Assets/StreamingAssets/SteamVR.meta +++ b/UnityProject/Assets/Scenes/Examples/TimbreID.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 10a7e9abd2e228049a0c34678430dae7 +guid: 033a0a884ca183749b3a01372c9220d3 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/UnityProject/Assets/Scenes/Examples/TimbreID/TimbreID.unity b/UnityProject/Assets/Scenes/Examples/TimbreID/TimbreID.unity new file mode 100644 index 0000000..9bdfce7 --- /dev/null +++ b/UnityProject/Assets/Scenes/Examples/TimbreID/TimbreID.unity @@ -0,0 +1,326 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +OcclusionCullingSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: 0.25 + backfaceThreshold: 100 + m_SceneGUID: 00000000000000000000000000000000 + m_OcclusionCullingData: {fileID: 0} +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 9 + m_Fog: 0 + m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + m_FogMode: 3 + m_FogDensity: 0.01 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} + m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} + m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 0 + m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} + m_SkyboxMaterial: {fileID: 0} + m_HaloStrength: 0.5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} + m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1} + m_UseRadianceAmbientProbe: 0 +--- !u!157 &3 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 11 + m_GIWorkflowMode: 1 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 1 + m_LightmapEditorSettings: + serializedVersion: 12 + m_Resolution: 2 + m_BakeResolution: 40 + m_AtlasSize: 1024 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_ExtractAmbientOcclusion: 0 + m_Padding: 2 + m_LightmapParameters: {fileID: 0} + m_LightmapsBakeMode: 1 + m_TextureCompression: 1 + m_FinalGather: 0 + m_FinalGatherFiltering: 1 + m_FinalGatherRayCount: 256 + m_ReflectionCompression: 2 + m_MixedBakeMode: 2 + m_BakeBackend: 1 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 512 + m_PVRBounces: 2 + m_PVREnvironmentSampleCount: 256 + m_PVREnvironmentReferencePointCount: 2048 + m_PVRFilteringMode: 1 + m_PVRDenoiserTypeDirect: 1 + m_PVRDenoiserTypeIndirect: 1 + m_PVRDenoiserTypeAO: 1 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVREnvironmentMIS: 1 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 + m_ExportTrainingData: 0 + m_TrainingDataDestination: TrainingData + m_LightingDataAsset: {fileID: 0} + m_UseShadowmask: 1 +--- !u!196 &4 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentTypeID: 0 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.4 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + minRegionArea: 2 + manualCellSize: 0 + cellSize: 0.16666667 + manualTileSize: 0 + tileSize: 256 + accuratePlacement: 0 + debug: + m_Flags: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &97870067 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 97870070} + - component: {fileID: 97870069} + - component: {fileID: 97870068} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!81 &97870068 +AudioListener: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 97870067} + m_Enabled: 1 +--- !u!20 &97870069 +Camera: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 97870067} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} + m_projectionMatrixMode: 1 + m_GateFitMode: 2 + m_FOVAxisMode: 0 + m_SensorSize: {x: 36, y: 24} + m_LensShift: {x: 0, y: 0} + m_FocalLength: 50 + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.3 + far clip plane: 1000 + field of view: 60 + orthographic: 0 + orthographic size: 5 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 1 + m_AllowMSAA: 1 + m_AllowDynamicResolution: 0 + m_ForceIntoRT: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!4 &97870070 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 97870067} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 1, z: -10} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1398584861 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1398584863} + - component: {fileID: 1398584862} + m_Layer: 0 + m_Name: Directional Light + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!108 &1398584862 +Light: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1398584861} + m_Enabled: 1 + serializedVersion: 9 + m_Type: 1 + m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1} + m_Intensity: 1 + m_Range: 10 + m_SpotAngle: 30 + m_InnerSpotAngle: 21.80208 + m_CookieSize: 10 + m_Shadows: + m_Type: 2 + m_Resolution: -1 + m_CustomResolution: -1 + m_Strength: 1 + m_Bias: 0.05 + m_NormalBias: 0.4 + m_NearPlane: 0.2 + m_CullingMatrixOverride: + e00: 1 + e01: 0 + e02: 0 + e03: 0 + e10: 0 + e11: 1 + e12: 0 + e13: 0 + e20: 0 + e21: 0 + e22: 1 + e23: 0 + e30: 0 + e31: 0 + e32: 0 + e33: 1 + m_UseCullingMatrixOverride: 0 + m_Cookie: {fileID: 0} + m_DrawHalo: 0 + m_Flare: {fileID: 0} + m_RenderMode: 0 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingLayerMask: 1 + m_Lightmapping: 4 + m_LightShadowCasterMode: 0 + m_AreaSize: {x: 1, y: 1} + m_BounceIntensity: 1 + m_ColorTemperature: 6570 + m_UseColorTemperature: 0 + m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0} + m_UseBoundingSphereOverride: 0 + m_ShadowRadius: 0 + m_ShadowAngle: 0 +--- !u!4 &1398584863 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1398584861} + m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261} + m_LocalPosition: {x: 0, y: 3, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0} +--- !u!1 &2090604046 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2090604047} + m_Layer: 0 + m_Name: PdBackEnd + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &2090604047 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2090604046} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} diff --git a/UnityProject/Assets/Scenes/Examples/TimbreID/TimbreID.unity.meta b/UnityProject/Assets/Scenes/Examples/TimbreID/TimbreID.unity.meta new file mode 100644 index 0000000..3f4bbca --- /dev/null +++ b/UnityProject/Assets/Scenes/Examples/TimbreID/TimbreID.unity.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: a8eed78bcf981ad4aa9300bccf6092ae +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityProject/Assets/Scenes/Examples/TimbreID/script.meta b/UnityProject/Assets/Scenes/Examples/TimbreID/script.meta new file mode 100644 index 0000000..e446960 --- /dev/null +++ b/UnityProject/Assets/Scenes/Examples/TimbreID/script.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: df015dbde4103db4697165818e153ac7 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityProject/Assets/Scenes/Examples/TimbreID/script/idtotext.cs b/UnityProject/Assets/Scenes/Examples/TimbreID/script/idtotext.cs new file mode 100644 index 0000000..0793421 --- /dev/null +++ b/UnityProject/Assets/Scenes/Examples/TimbreID/script/idtotext.cs @@ -0,0 +1,25 @@ +using UnityEngine; +using UnityEngine.UI; + +public class IdToText : MonoBehaviour +{ + [SerializeField] private Text text; + + public void OnTimbreIdReceived(int id, int distance) + { + switch (id) + { + case 0: + text.text = "Snare"; + break; + case 1: + text.text = "Hi-hat"; + break; + case 2: + text.text = "Kick"; + break; + default: + return; + } + } +} diff --git a/UnityProject/Assets/Scenes/Examples/TimbreID/script/idtotext.cs.meta b/UnityProject/Assets/Scenes/Examples/TimbreID/script/idtotext.cs.meta new file mode 100644 index 0000000..82e59c2 --- /dev/null +++ b/UnityProject/Assets/Scenes/Examples/TimbreID/script/idtotext.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ad2a508a97fb29948a2d593714fc047b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityProject/Assets/Scripts/PdConnection/PdTimbreIdBind.cs b/UnityProject/Assets/Scripts/PdConnection/PdTimbreIdBind.cs new file mode 100644 index 0000000..5f03be8 --- /dev/null +++ b/UnityProject/Assets/Scripts/PdConnection/PdTimbreIdBind.cs @@ -0,0 +1,24 @@ +using UnityEngine; +using UnityEngine.Events; + +namespace cylvester +{ + [System.Serializable] + public class TimbreIdEvent : UnityEvent + { + } + + public class PdTimbreIdBind : MonoBehaviour + { + [SerializeField] private TimbreIdEvent onTimbreIdReceived; + [SerializeField, Range(1, 16)] private int channel = 1; + + public void OnMidiMessageReceived(MidiMessage midiMessage) + { + if (159 + channel != midiMessage.Status) + return; + + onTimbreIdReceived.Invoke(midiMessage.Data1, midiMessage.Data2); + } + } +} diff --git a/UnityProject/Assets/Scripts/PdConnection/PdTimbreIdBind.cs.meta b/UnityProject/Assets/Scripts/PdConnection/PdTimbreIdBind.cs.meta new file mode 100644 index 0000000..1d647d9 --- /dev/null +++ b/UnityProject/Assets/Scripts/PdConnection/PdTimbreIdBind.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d2ecf927e94d66342b9b3f36bcab8ef3 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityProject/Assets/StreamingAssets/pd/patch/analyzer.pd b/UnityProject/Assets/StreamingAssets/pd/patch/analyzer.pd index 4e2d60d..6ba928c 100644 --- a/UnityProject/Assets/StreamingAssets/pd/patch/analyzer.pd +++ b/UnityProject/Assets/StreamingAssets/pd/patch/analyzer.pd @@ -1,4 +1,5 @@ -#N canvas 437 150 1334 519 10; +#N canvas 349 623 1128 544 10; +#X declare -lib timbreID/timbreIDLib; #X obj 129 475 adc~ 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16; #X obj 59 516 dac~, f 6; #N canvas 215 619 730 390 analyzers_______________________________ @@ -8,17 +9,17 @@ #X obj 148 96 inlet~; #X obj 172 121 inlet~; #X obj 198 45 inlet~; -#X obj 217 72 inlet~; -#X obj 246 101 inlet~; -#X obj 270 124 inlet~; -#X obj 285 52 inlet~; -#X obj 309 77 inlet~; -#X obj 338 104 inlet~; -#X obj 362 129 inlet~; -#X obj 383 55 inlet~; -#X obj 425 80 inlet~; -#X obj 454 111 inlet~; -#X obj 478 132 inlet~; +#X obj 224 72 inlet~; +#X obj 253 101 inlet~; +#X obj 277 124 inlet~; +#X obj 299 50 inlet~; +#X obj 324 76 inlet~; +#X obj 353 104 inlet~; +#X obj 378 129 inlet~; +#X obj 402 55 inlet~; +#X obj 427 80 inlet~; +#X obj 456 111 inlet~; +#X obj 480 132 inlet~; #X obj 96 183 core 0; #X obj 120 204 core 1; #X obj 149 226 core 2; @@ -52,10 +53,10 @@ #X connect 14 0 30 0; #X connect 15 0 31 0; #X restore 130 515 pd analyzers_______________________________; -#X obj 57 107 bang~; -#X obj 57 130 count 16; -#X obj 57 157 sel 0; -#X obj 57 183 s shmemupdate; +#X obj 57 45 bang~; +#X obj 57 68 count 16; +#X obj 57 95 sel 0; +#X obj 57 121 s shmemupdate; #N canvas 763 290 408 235 window 0; #N canvas 0 0 450 300 (subpatch) 0; #X array hann 1024 float 1; @@ -194,8 +195,8 @@ 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 406 101 pd window; -#N canvas 333 794 594 420 commands_from_unity 1; +#X restore 406 39 pd window; +#N canvas 333 794 594 420 commands_from_unity 0; #X obj 66 31 inlet; #X obj 160 326 s sample_playback; #X text 150 55 1 ... sample playback; @@ -232,7 +233,7 @@ #X connect 17 0 9 0; #X connect 17 1 13 0; #X connect 17 2 15 0; -#X restore 242 141 pd commands_from_unity; +#X restore 242 79 pd commands_from_unity; #N canvas 667 603 480 371 sample_playback 0; #X obj 86 166 readsf~; #X obj 95 6 r sample_playback; @@ -258,46 +259,146 @@ #X connect 9 0 7 0; #X connect 10 0 0 0; #X connect 11 0 0 0; -#X restore 59 436 pd sample_playback; -#X obj 56 221 text define -k samplefiles; +#X restore 62 440 pd sample_playback; +#X obj 56 159 text define -k samplefiles; #A set Back_Back.wav \; Brutal_Synth.wav \; Dialog.wav \; Drums.wav \; Fox_Melo.wav \; Kick.wav \; Pads+Strings.wav \; Rose_Sax.wav \; -Roses_Front.wav; -#X obj 242 425 netsend -u -b; -#X msg 242 225 connect localhost 56765; -#X obj 264 195 loadbang; -#X obj 97 280 list prepend send; -#X obj 97 304 list trim; -#X obj 97 256 midiin; -#X msg 417 228 23 31; -#X msg 464 228 80 84, f 10; -#X text 429 202 sample CC; -#X msg 417 263 send 176 \$1 \$2; -#X text 416 285 176... control channel 1; +Roses_Front.wav \; TimbreID_Test.wav \;; +#X obj 242 363 netsend -u -b; +#X msg 242 163 connect localhost 56765; +#X obj 264 133 loadbang; +#X obj 97 218 list prepend send; +#X obj 97 242 list trim; +#X obj 97 194 midiin; +#X msg 417 166 23 31; +#X msg 464 166 80 84, f 10; +#X text 429 140 sample CC; +#X msg 417 201 send 176 \$1 \$2; +#X text 416 223 176... control channel 1; #N canvas 695 332 450 300 level 0; #X obj 90 182 table level 16; #X obj 89 152 shmem level 16; #X obj 89 127 r shmemupdate; #X connect 2 0 1 0; -#X restore 405 133 pd level; -#X obj 6 256 midirealtimein; -#X obj 242 103 netreceive -u 54345; +#X restore 405 71 pd level; +#X obj 6 194 midirealtimein; +#X obj 242 41 netreceive -u 54345; #X obj 598 90 cnv 15 500 60 empty current Outro 20 12 0 45 -204786 -66577 0; -#X obj 798 286 bng 50 250 50 0 empty empty next 15 25 0 10 -204786 +#X obj 786 234 bng 50 250 50 0 empty empty next 15 25 0 10 -204786 -1 -1; -#X obj 600 281 bng 50 250 50 0 empty empty rewind 7 25 0 10 -261234 +#X obj 596 227 bng 50 250 50 0 empty empty rewind 7 25 0 10 -261234 -1 -1; -#X msg 601 356 send 176 127 0; -#X text 900 359 <--- midi is temporal; -#X obj 704 286 bng 50 250 50 0 empty empty previous 4 25 0 10 -204786 +#X msg 596 303 send 176 127 0; +#X text 896 305 <--- midi is temporal; +#X obj 692 231 bng 50 250 50 0 empty empty previous 4 25 0 10 -204786 -1 -1; -#X msg 704 358 send 176 127 1; -#X msg 797 358 send 176 127 2; +#X msg 692 303 send 176 127 1; +#X msg 786 304 send 176 127 2; #X obj 594 46 cnv 12 500 30 empty previous Silent_Hill 20 12 0 25 -262130 -66577 0; #X obj 596 152 cnv 12 500 30 empty next --- 20 12 0 25 -262130 -66577 0; +#X obj 879 467 declare -lib timbreID/timbreIDLib; +#N canvas 28 541 1273 735 timbreID_example 0; +#X obj 77 657 nbx 3 28 -1e+037 1e+037 0 0 empty empty empty 0 -8 0 +28 -262144 -1 -1 0 256; +#X floatatom 189 663 10 0 0 0 - - -; +#X obj 77 690 print timbre; +#X obj 93 556 timbreID, f 17; +#X obj 103 480 tgl 15 0 empty empty train 17 7 0 12 -262144 -1 -1 0 +1; +#X obj 182 480 spigot; +#X obj 231 480 tgl 15 0 empty empty id 17 7 0 12 -262144 -1 -1 0 1 +; +#N canvas 507 196 745 433 onsets 0; +#X obj 56 53 inlet~; +#X obj 146 327 outlet; +#X obj 3 4 cnv 10 400 10 empty empty empty 20 12 0 14 -233017 -66577 +0; +#X obj 3 4 cnv 10 10 400 empty empty empty 20 12 0 14 -233017 -66577 +0; +#X obj 178 173 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 +-1 -1; +#X obj 171 96 r bark-settings; +#X text 308 53 timbreID comes with its own onset detection object: +bark~. See its helpfile for more details. In comparison with bonk~ +(the usual onset detection object in Pd) \, bark~ performs very similarly +but has several extra conveniences. Most importantly \, there is a +non-real-time version of the object \, enabling easy parsing of pre-recorded +audio.; +#X obj 146 135 bark~ 1024 256 0.5; +#X obj 336 292 loadbang; +#X msg 336 314 \; bark-settings minvel 15 \; bark-settings debounce +350 \; bark-settings thresh 5 12 \; bark-settings filter_range 20 49 +\;; +#X obj 56 385 outlet~; +#X text 308 163 Doing the attack detection in a subpatch with the input +signal connected in series before [bfcc~] guarantees the DSP order. +We first analyze the signal with [bark~] here to look for attacks \, +and if we find one \, spit out a bang to get the most recent BFCC analysis +possible back in the parent patch.; +#X text 558 321 These were good onset detection settings for the audio +files used in this help file., f 22; +#X connect 0 0 7 0; +#X connect 0 0 10 0; +#X connect 5 0 7 0; +#X connect 7 0 4 0; +#X connect 7 0 1 0; +#X connect 8 0 9 0; +#X restore 59 259 pd onsets; +#X obj 54 307 bfcc~ 1024 0.5; +#X obj 54 480 spigot; +#X obj 54 329 list split 25; +#N canvas 0 50 450 250 (subpatch) 0; +#X array closed 10584 float 2; +#X coords 0 1 10584 -1 200 140 1; +#X restore 405 118 graph; +#N canvas 0 50 450 250 (subpatch) 0; +#X array snare 16391 float 2; +#X coords 0 1 16391 -1 200 140 1 0 0; +#X restore 623 117 graph; +#N canvas 0 50 450 250 (subpatch) 0; +#X array kick 27342 float 2; +#X coords 0 1 27342 -1 200 140 1 0 0; +#X restore 843 116 graph; +#X obj 851 369 soundfiler; +#X msg 851 317 read -resize samples/snare.wav snare \, read -resize +samples/kick.wav kick \, read -resize samples/closed.wav closed; +#X obj 851 282 loadbang; +#X obj 59 170 tabplay~ snare; +#X obj 86 199 tabplay~ closed; +#X obj 141 231 tabplay~ kick; +#X obj 67 115 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 +-1; +#X obj 107 133 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 +-1 -1; +#X obj 188 169 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 +-1 -1; +#X msg 253 514 write trained.timid; +#X connect 0 0 2 0; +#X connect 3 0 0 0; +#X connect 3 1 1 0; +#X connect 4 0 9 1; +#X connect 5 0 3 1; +#X connect 6 0 5 1; +#X connect 7 0 8 0; +#X connect 7 1 8 0; +#X connect 8 0 10 0; +#X connect 9 0 3 0; +#X connect 10 0 5 0; +#X connect 10 0 9 0; +#X connect 15 0 14 0; +#X connect 16 0 15 0; +#X connect 17 0 7 0; +#X connect 18 0 7 0; +#X connect 19 0 7 0; +#X connect 20 0 17 0; +#X connect 21 0 18 0; +#X connect 22 0 19 0; +#X connect 23 0 3 0; +#X restore 879 442 pd timbreID_example; +#X obj 321 320 r netsend; #X connect 0 0 2 0; #X connect 0 1 2 1; #X connect 0 2 2 2; @@ -337,3 +438,4 @@ Roses_Front.wav; #X connect 30 0 31 0; #X connect 31 0 11 0; #X connect 32 0 11 0; +#X connect 37 0 11 0; diff --git a/UnityProject/Assets/StreamingAssets/pd/patch/core.pd b/UnityProject/Assets/StreamingAssets/pd/patch/core.pd index 76deb0b..fe85f88 100644 --- a/UnityProject/Assets/StreamingAssets/pd/patch/core.pd +++ b/UnityProject/Assets/StreamingAssets/pd/patch/core.pd @@ -1,22 +1,96 @@ -#N canvas 1177 364 450 300 10; +#N canvas 1177 364 831 596 10; #X obj 55 40 inlet~; #X obj 55 139 spectrum \$1; -#X obj 229 240 table fft_\$1 512; -#X obj 200 177 r shmemupdate; -#X obj 228 216 shmem fft_\$1 512; -#X obj 117 241 table wave_\$1 512; -#X obj 119 217 shmem wave_\$1 512; +#X obj 211 291 table fft_\$1 512; +#X obj 182 228 r shmemupdate; +#X obj 210 267 shmem fft_\$1 512; +#X obj 99 292 table wave_\$1 512; +#X obj 101 268 shmem wave_\$1 512; #X obj 135 125 tabwrite~ wave_\$1; -#X obj 270 143 tabwrite level; -#X obj 375 81 loadbang; -#X obj 375 110 f \$1, f 6; -#X obj 270 111 env~ 1024 512; +#X obj 491 150 tabwrite level; +#X obj 596 88 loadbang; +#X obj 596 117 f \$1, f 6; +#X obj 491 118 env~ 1024 512; +#X obj 364 302 timbreID; +#N canvas 507 196 745 433 onsets 0; +#X obj 56 53 inlet~; +#X obj 146 327 outlet; +#X obj 3 4 cnv 10 400 10 empty empty empty 20 12 0 14 -233017 -66577 +0; +#X obj 3 4 cnv 10 10 400 empty empty empty 20 12 0 14 -233017 -66577 +0; +#X obj 178 173 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 +-1 -1; +#X obj 171 96 r bark-settings; +#X text 308 53 timbreID comes with its own onset detection object: +bark~. See its helpfile for more details. In comparison with bonk~ +(the usual onset detection object in Pd) \, bark~ performs very similarly +but has several extra conveniences. Most importantly \, there is a +non-real-time version of the object \, enabling easy parsing of pre-recorded +audio.; +#X obj 146 135 bark~ 1024 256 0.5; +#X obj 336 292 loadbang; +#X msg 336 314 \; bark-settings minvel 15 \; bark-settings debounce +350 \; bark-settings thresh 5 12 \; bark-settings filter_range 20 49 +\;; +#X obj 56 385 outlet~; +#X text 308 163 Doing the attack detection in a subpatch with the input +signal connected in series before [bfcc~] guarantees the DSP order. +We first analyze the signal with [bark~] here to look for attacks \, +and if we find one \, spit out a bang to get the most recent BFCC analysis +possible back in the parent patch.; +#X text 558 321 These were good onset detection settings for the audio +files used in this help file., f 22; +#X connect 0 0 7 0; +#X connect 0 0 10 0; +#X connect 5 0 7 0; +#X connect 7 0 4 0; +#X connect 7 0 1 0; +#X connect 8 0 9 0; +#X restore 385 165 pd onsets; +#X obj 386 214 bfcc~ 1024 0.5; +#X obj 386 236 list split 25; +#X obj 508 217 loadbang; +#X msg 508 245 read trained.timid; +#X obj 270 342 loadbang; +#X obj 270 371 f \$1, f 6; +#X obj 270 396 + 160; +#X obj 379 355 * 64; +#X obj 379 378 clip 0 127; +#X obj 321 386 t b f; +#X obj 322 545 s netsend; +#X obj 379 417 i; +#X obj 322 458 pack 0 0 0; +#X obj 303 432 f; +#X obj 322 485 list prepend send; +#X obj 322 516 list trim; #X connect 0 0 1 0; #X connect 0 0 7 0; #X connect 0 0 11 0; +#X connect 0 0 13 0; #X connect 3 0 4 0; #X connect 3 0 6 0; #X connect 3 0 7 0; #X connect 9 0 10 0; #X connect 10 0 8 1; #X connect 11 0 8 0; +#X connect 12 0 23 0; +#X connect 12 1 21 0; +#X connect 13 0 14 0; +#X connect 13 1 14 0; +#X connect 14 0 15 0; +#X connect 15 0 12 1; +#X connect 16 0 17 0; +#X connect 17 0 12 0; +#X connect 18 0 19 0; +#X connect 19 0 20 0; +#X connect 20 0 27 1; +#X connect 21 0 22 0; +#X connect 22 0 25 0; +#X connect 23 0 27 0; +#X connect 23 1 26 1; +#X connect 25 0 26 2; +#X connect 26 0 28 0; +#X connect 27 0 26 0; +#X connect 28 0 29 0; +#X connect 29 0 24 0; diff --git a/UnityProject/Assets/StreamingAssets/pd/patch/samples.meta b/UnityProject/Assets/StreamingAssets/pd/patch/samples.meta new file mode 100644 index 0000000..81a3901 --- /dev/null +++ b/UnityProject/Assets/StreamingAssets/pd/patch/samples.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 154b49540106a2444a49fcefc96ab692 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityProject/Assets/StreamingAssets/pd/patch/samples/closed.wav b/UnityProject/Assets/StreamingAssets/pd/patch/samples/closed.wav new file mode 100644 index 0000000..0b2b006 Binary files /dev/null and b/UnityProject/Assets/StreamingAssets/pd/patch/samples/closed.wav differ diff --git a/UnityProject/Assets/StreamingAssets/pd/patch/samples/closed.wav.meta b/UnityProject/Assets/StreamingAssets/pd/patch/samples/closed.wav.meta new file mode 100644 index 0000000..3a8ac96 --- /dev/null +++ b/UnityProject/Assets/StreamingAssets/pd/patch/samples/closed.wav.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: ee094c2e712dda840ab02412f2f5b59f +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityProject/Assets/StreamingAssets/pd/patch/samples/closed.wav.reapeaks b/UnityProject/Assets/StreamingAssets/pd/patch/samples/closed.wav.reapeaks new file mode 100644 index 0000000..5c9991e Binary files /dev/null and b/UnityProject/Assets/StreamingAssets/pd/patch/samples/closed.wav.reapeaks differ diff --git a/UnityProject/Assets/StreamingAssets/pd/patch/samples/closed.wav.reapeaks.meta b/UnityProject/Assets/StreamingAssets/pd/patch/samples/closed.wav.reapeaks.meta new file mode 100644 index 0000000..883ec2f --- /dev/null +++ b/UnityProject/Assets/StreamingAssets/pd/patch/samples/closed.wav.reapeaks.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 879526e34518e784aaddc58b9d61b2d9 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityProject/Assets/StreamingAssets/pd/patch/samples/kick.wav b/UnityProject/Assets/StreamingAssets/pd/patch/samples/kick.wav new file mode 100644 index 0000000..99f4d83 Binary files /dev/null and b/UnityProject/Assets/StreamingAssets/pd/patch/samples/kick.wav differ diff --git a/UnityProject/Assets/StreamingAssets/pd/patch/samples/kick.wav.meta b/UnityProject/Assets/StreamingAssets/pd/patch/samples/kick.wav.meta new file mode 100644 index 0000000..ea75801 --- /dev/null +++ b/UnityProject/Assets/StreamingAssets/pd/patch/samples/kick.wav.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: d77ee06bd4d27b245b567a8714d9b3e5 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityProject/Assets/StreamingAssets/pd/patch/samples/kick.wav.reapeaks b/UnityProject/Assets/StreamingAssets/pd/patch/samples/kick.wav.reapeaks new file mode 100644 index 0000000..7c821bf Binary files /dev/null and b/UnityProject/Assets/StreamingAssets/pd/patch/samples/kick.wav.reapeaks differ diff --git a/UnityProject/Assets/StreamingAssets/pd/patch/samples/kick.wav.reapeaks.meta b/UnityProject/Assets/StreamingAssets/pd/patch/samples/kick.wav.reapeaks.meta new file mode 100644 index 0000000..eb13c9b --- /dev/null +++ b/UnityProject/Assets/StreamingAssets/pd/patch/samples/kick.wav.reapeaks.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 74b255f315c17b145860aa60d0ac4403 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityProject/Assets/StreamingAssets/pd/patch/samples/snare.wav b/UnityProject/Assets/StreamingAssets/pd/patch/samples/snare.wav new file mode 100644 index 0000000..0455334 Binary files /dev/null and b/UnityProject/Assets/StreamingAssets/pd/patch/samples/snare.wav differ diff --git a/UnityProject/Assets/StreamingAssets/pd/patch/samples/snare.wav.meta b/UnityProject/Assets/StreamingAssets/pd/patch/samples/snare.wav.meta new file mode 100644 index 0000000..3105174 --- /dev/null +++ b/UnityProject/Assets/StreamingAssets/pd/patch/samples/snare.wav.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: f3d8832cc12a9ca43851f670e1c45e09 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityProject/Assets/StreamingAssets/pd/patch/samples/snare.wav.reapeaks b/UnityProject/Assets/StreamingAssets/pd/patch/samples/snare.wav.reapeaks new file mode 100644 index 0000000..001262d Binary files /dev/null and b/UnityProject/Assets/StreamingAssets/pd/patch/samples/snare.wav.reapeaks differ diff --git a/UnityProject/Assets/StreamingAssets/pd/patch/samples/snare.wav.reapeaks.meta b/UnityProject/Assets/StreamingAssets/pd/patch/samples/snare.wav.reapeaks.meta new file mode 100644 index 0000000..ae1d51d --- /dev/null +++ b/UnityProject/Assets/StreamingAssets/pd/patch/samples/snare.wav.reapeaks.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 246e3b3f68ba61042b3734f81fe707b2 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityProject/Assets/StreamingAssets/pd/patch/trained.timid b/UnityProject/Assets/StreamingAssets/pd/patch/trained.timid new file mode 100644 index 0000000..78e5f5a Binary files /dev/null and b/UnityProject/Assets/StreamingAssets/pd/patch/trained.timid differ diff --git a/UnityProject/Assets/StreamingAssets/pd/patch/trained.timid.meta b/UnityProject/Assets/StreamingAssets/pd/patch/trained.timid.meta new file mode 100644 index 0000000..251d892 --- /dev/null +++ b/UnityProject/Assets/StreamingAssets/pd/patch/trained.timid.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 2a43f02f24b47ad4c8c155e6d100e1d7 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityProject/AudioSamples/TimbreID_Test.wav b/UnityProject/AudioSamples/TimbreID_Test.wav new file mode 100644 index 0000000..63cede1 Binary files /dev/null and b/UnityProject/AudioSamples/TimbreID_Test.wav differ