add pitch tracking demo
This commit is contained in:
parent
da4bd8ef2f
commit
f47aa9b4ea
8 changed files with 216 additions and 8 deletions
|
@ -63,6 +63,7 @@
|
||||||
<Compile Include="Assets\Scenes\Examples\MIDI\script\CubeSync.cs" />
|
<Compile Include="Assets\Scenes\Examples\MIDI\script\CubeSync.cs" />
|
||||||
<Compile Include="Assets\Scenes\Examples\MIDI\script\PositionBind.cs" />
|
<Compile Include="Assets\Scenes\Examples\MIDI\script\PositionBind.cs" />
|
||||||
<Compile Include="Assets\Scenes\Examples\PdBackend\script\BoomBall.cs" />
|
<Compile Include="Assets\Scenes\Examples\PdBackend\script\BoomBall.cs" />
|
||||||
|
<Compile Include="Assets\Scenes\Examples\PdBackend\script\MoveBall.cs" />
|
||||||
<Compile Include="Assets\Scenes\Examples\PostProcessing\script\BokehBind.cs" />
|
<Compile Include="Assets\Scenes\Examples\PostProcessing\script\BokehBind.cs" />
|
||||||
<Compile Include="Assets\Scenes\Examples\Texture\TextureMapper.cs" />
|
<Compile Include="Assets\Scenes\Examples\Texture\TextureMapper.cs" />
|
||||||
<Compile Include="Assets\Scenes\Examples\TimbreID\script\IdToText.cs" />
|
<Compile Include="Assets\Scenes\Examples\TimbreID\script\IdToText.cs" />
|
||||||
|
@ -82,6 +83,7 @@
|
||||||
<Compile Include="Assets\Scripts\PdConnection\PdConstant.cs" />
|
<Compile Include="Assets\Scripts\PdConnection\PdConstant.cs" />
|
||||||
<Compile Include="Assets\Scripts\PdConnection\PdLevelBind.cs" />
|
<Compile Include="Assets\Scripts\PdConnection\PdLevelBind.cs" />
|
||||||
<Compile Include="Assets\Scripts\PdConnection\PdNoiseBind.cs" />
|
<Compile Include="Assets\Scripts\PdConnection\PdNoiseBind.cs" />
|
||||||
|
<Compile Include="Assets\Scripts\PdConnection\PdPitchBind.cs" />
|
||||||
<Compile Include="Assets\Scripts\PdConnection\PdProcess.cs" />
|
<Compile Include="Assets\Scripts\PdConnection\PdProcess.cs" />
|
||||||
<Compile Include="Assets\Scripts\PdConnection\PdReceiver.cs" />
|
<Compile Include="Assets\Scripts\PdConnection\PdReceiver.cs" />
|
||||||
<Compile Include="Assets\Scripts\PdConnection\PdSender.cs" />
|
<Compile Include="Assets\Scripts\PdConnection\PdSender.cs" />
|
||||||
|
|
|
@ -586,7 +586,7 @@ Transform:
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_RootOrder: 4
|
m_RootOrder: 5
|
||||||
m_LocalEulerAnglesHint: {x: 50, y: 30, z: -20}
|
m_LocalEulerAnglesHint: {x: 50, y: 30, z: -20}
|
||||||
--- !u!1 &428795648
|
--- !u!1 &428795648
|
||||||
GameObject:
|
GameObject:
|
||||||
|
@ -691,6 +691,7 @@ GameObject:
|
||||||
- component: {fileID: 987772533}
|
- component: {fileID: 987772533}
|
||||||
- component: {fileID: 987772536}
|
- component: {fileID: 987772536}
|
||||||
- component: {fileID: 987772535}
|
- component: {fileID: 987772535}
|
||||||
|
- component: {fileID: 987772537}
|
||||||
m_Layer: 0
|
m_Layer: 0
|
||||||
m_Name: PdBackend
|
m_Name: PdBackend
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
|
@ -793,3 +794,122 @@ MonoBehaviour:
|
||||||
m_BoolArgument: 0
|
m_BoolArgument: 0
|
||||||
m_CallState: 2
|
m_CallState: 2
|
||||||
channel: 0
|
channel: 0
|
||||||
|
--- !u!114 &987772537
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 987772532}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 3a6786dc62886e7458a72d2f241695e7, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
pdbackend: {fileID: 987772533}
|
||||||
|
channel: 1
|
||||||
|
pitchChanged:
|
||||||
|
m_PersistentCalls:
|
||||||
|
m_Calls:
|
||||||
|
- m_Target: {fileID: 1904196533}
|
||||||
|
m_MethodName: set_Position
|
||||||
|
m_Mode: 0
|
||||||
|
m_Arguments:
|
||||||
|
m_ObjectArgument: {fileID: 0}
|
||||||
|
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
|
||||||
|
m_IntArgument: 0
|
||||||
|
m_FloatArgument: 0
|
||||||
|
m_StringArgument:
|
||||||
|
m_BoolArgument: 0
|
||||||
|
m_CallState: 2
|
||||||
|
--- !u!1 &1904196532
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 1904196536}
|
||||||
|
- component: {fileID: 1904196535}
|
||||||
|
- component: {fileID: 1904196534}
|
||||||
|
- component: {fileID: 1904196533}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: PitchBall
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!114 &1904196533
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1904196532}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 967b7d5c3d6acef42b5fd0cb1617c326, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
--- !u!23 &1904196534
|
||||||
|
MeshRenderer:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1904196532}
|
||||||
|
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: 2100000, guid: f044463ea66a19c47aef13261142b54e, type: 2}
|
||||||
|
m_StaticBatchInfo:
|
||||||
|
firstSubMesh: 0
|
||||||
|
subMeshCount: 0
|
||||||
|
m_StaticBatchRoot: {fileID: 0}
|
||||||
|
m_ProbeAnchor: {fileID: 0}
|
||||||
|
m_LightProbeVolumeOverride: {fileID: 0}
|
||||||
|
m_ScaleInLightmap: 1
|
||||||
|
m_ReceiveGI: 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 &1904196535
|
||||||
|
MeshFilter:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1904196532}
|
||||||
|
m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0}
|
||||||
|
--- !u!4 &1904196536
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1904196532}
|
||||||
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
|
m_LocalPosition: {x: -1.24, y: 4.16, z: 3.25}
|
||||||
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 0}
|
||||||
|
m_RootOrder: 4
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace cylvester
|
||||||
|
{
|
||||||
|
interface IMoveBall
|
||||||
|
{
|
||||||
|
float Position { set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class MoveBall : MonoBehaviour, IMoveBall
|
||||||
|
{
|
||||||
|
public float Position
|
||||||
|
{
|
||||||
|
set
|
||||||
|
{
|
||||||
|
var x = value * 0.1f;
|
||||||
|
transform.localPosition = new Vector3(x, 4f, 3f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 967b7d5c3d6acef42b5fd0cb1617c326
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -5,11 +5,11 @@ using UnityEngine.Events;
|
||||||
|
|
||||||
namespace cylvester
|
namespace cylvester
|
||||||
{
|
{
|
||||||
|
|
||||||
public interface IPdBackend
|
public interface IPdBackend
|
||||||
{
|
{
|
||||||
IPdArray LevelArray { get; }
|
IPdArray LevelArray { get; }
|
||||||
IPdArray NoiseArray { get; }
|
IPdArray NoiseArray { get; }
|
||||||
|
IPdArray PitchArray { get; }
|
||||||
IPdArrayContainer SpectrumArrayContainer{ get; }
|
IPdArrayContainer SpectrumArrayContainer{ get; }
|
||||||
IPdArrayContainer WaveformArrayContainer{ get; }
|
IPdArrayContainer WaveformArrayContainer{ get; }
|
||||||
void SendState(IStateManager manager);
|
void SendState(IStateManager manager);
|
||||||
|
@ -31,6 +31,7 @@ namespace cylvester
|
||||||
|
|
||||||
public IPdArray LevelArray { get; private set; }
|
public IPdArray LevelArray { get; private set; }
|
||||||
public IPdArray NoiseArray { get; private set; }
|
public IPdArray NoiseArray { get; private set; }
|
||||||
|
public IPdArray PitchArray { get; private set; }
|
||||||
public IPdArrayContainer SpectrumArrayContainer { get; private set; }
|
public IPdArrayContainer SpectrumArrayContainer { get; private set; }
|
||||||
public IPdArrayContainer WaveformArrayContainer { get; private set; }
|
public IPdArrayContainer WaveformArrayContainer { get; private set; }
|
||||||
|
|
||||||
|
@ -44,6 +45,7 @@ namespace cylvester
|
||||||
{
|
{
|
||||||
LevelArray = new PdArray("level", PdConstant.NumMaxInputChannels);
|
LevelArray = new PdArray("level", PdConstant.NumMaxInputChannels);
|
||||||
NoiseArray = new PdArray("noise", PdConstant.NumMaxInputChannels);
|
NoiseArray = new PdArray("noise", PdConstant.NumMaxInputChannels);
|
||||||
|
PitchArray = new PdArray("pitch", PdConstant.NumMaxInputChannels);
|
||||||
SpectrumArrayContainer = new PdArrayContainer("fft_");
|
SpectrumArrayContainer = new PdArrayContainer("fft_");
|
||||||
WaveformArrayContainer = new PdArrayContainer("wave_");
|
WaveformArrayContainer = new PdArrayContainer("wave_");
|
||||||
|
|
||||||
|
@ -51,6 +53,7 @@ namespace cylvester
|
||||||
{
|
{
|
||||||
(IUpdater) LevelArray,
|
(IUpdater) LevelArray,
|
||||||
(IUpdater) NoiseArray,
|
(IUpdater) NoiseArray,
|
||||||
|
(IUpdater) PitchArray,
|
||||||
(IUpdater) SpectrumArrayContainer,
|
(IUpdater) SpectrumArrayContainer,
|
||||||
(IUpdater) WaveformArrayContainer
|
(IUpdater) WaveformArrayContainer
|
||||||
};
|
};
|
||||||
|
|
31
UnityProject/Assets/Scripts/PdConnection/PdPitchBind.cs
Normal file
31
UnityProject/Assets/Scripts/PdConnection/PdPitchBind.cs
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.Events;
|
||||||
|
|
||||||
|
namespace cylvester
|
||||||
|
{
|
||||||
|
[System.Serializable]
|
||||||
|
public class PitchEvent : UnityEvent<float>
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public class PdPitchBind : MonoBehaviour
|
||||||
|
{
|
||||||
|
[SerializeField] private PdBackend pdbackend;
|
||||||
|
[SerializeField, Range(1, 16)] private int channel = 1;
|
||||||
|
[SerializeField] private LevelEvent pitchChanged;
|
||||||
|
private float pitch_;
|
||||||
|
|
||||||
|
void Update()
|
||||||
|
{
|
||||||
|
var pitch = pdbackend.PitchArray.Data[channel - 1];
|
||||||
|
|
||||||
|
if (pitch_ != pitch)
|
||||||
|
{
|
||||||
|
pitch_ = pitch;
|
||||||
|
pitchChanged.Invoke(pitch_);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
11
UnityProject/Assets/Scripts/PdConnection/PdPitchBind.cs.meta
Normal file
11
UnityProject/Assets/Scripts/PdConnection/PdPitchBind.cs.meta
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 3a6786dc62886e7458a72d2f241695e7
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -96,18 +96,25 @@ files used in this help file., f 22;
|
||||||
#X connect 3 0 0 0;
|
#X connect 3 0 0 0;
|
||||||
#X connect 4 0 3 0;
|
#X connect 4 0 3 0;
|
||||||
#X restore 359 170 pd level;
|
#X restore 359 170 pd level;
|
||||||
#N canvas 0 50 450 300 pitch 0;
|
#N canvas 0 50 450 300 pitch 1;
|
||||||
#X obj 95 44 inlet~;
|
#X obj 95 44 inlet~;
|
||||||
#X obj 95 94 sigmund~ pitch;
|
#X obj 95 94 sigmund~ pitch;
|
||||||
#X floatatom 95 133 5 0 0 0 - - -;
|
|
||||||
#X obj 95 169 tabwrite level;
|
|
||||||
#X obj 198 73 loadbang;
|
#X obj 198 73 loadbang;
|
||||||
#X obj 198 98 f \$1, f 6;
|
#X obj 198 98 f \$1, f 6;
|
||||||
|
#X obj 111 249 tabwrite pitch;
|
||||||
|
#X obj 92 129 moses 0;
|
||||||
|
#X obj 81 182 f 0;
|
||||||
|
#X obj 111 210 change;
|
||||||
|
#X obj 68 154 t b;
|
||||||
#X connect 0 0 1 0;
|
#X connect 0 0 1 0;
|
||||||
#X connect 1 0 2 0;
|
#X connect 1 0 5 0;
|
||||||
#X connect 2 0 3 0;
|
#X connect 2 0 3 0;
|
||||||
#X connect 4 0 5 0;
|
#X connect 3 0 4 1;
|
||||||
#X connect 5 0 3 1;
|
#X connect 5 0 8 0;
|
||||||
|
#X connect 5 1 7 0;
|
||||||
|
#X connect 6 0 7 0;
|
||||||
|
#X connect 7 0 4 0;
|
||||||
|
#X connect 8 0 6 0;
|
||||||
#X restore 432 170 pd pitch;
|
#X restore 432 170 pd pitch;
|
||||||
#N canvas 0 50 450 300 noise 0;
|
#N canvas 0 50 450 300 noise 0;
|
||||||
#X obj 107 208 tabwrite noise;
|
#X obj 107 208 tabwrite noise;
|
||||||
|
|
Loading…
Reference in a new issue