← Home
SPOTLIGHTAI
Catalog

SPOTLIGHT AI

Natural Language → Mathematical Functions → Spotlight Control   v2.0

Overview

SPOTLIGHT AI converts natural language descriptions of movement and color into mathematical functions that control 32 Martin MACOneCD spotlights in real time. Describe a movement — "circular orbit with aurora colors" or "chaotic swarm converging to center" — and the system generates parametric equations evaluated at 30 fps, sending position and color data via OSC, PosiStageNet (PSN), and ArtNet DMX.

Claude API OSC PSN ArtNet DMX WebSocket Node.js

Architecture

 User Prompt (browser)
      │
      ▼
 ┌─────────────┐    WebSocket     ┌──────────────────┐
 │  index.html  │◄───────────────►│   server.js       │
 │  (UI)        │                 │   Express + WS     │
 └─────────────┘                 └────────┬───────────┘
                                          │
                          ┌───────────────┼───────────────┐
                          ▼               ▼               ▼
                   claude-api.js   system-prompt.js  animation-engine.js
                   (Claude API)    (prompt builder)  (math evaluator)
                                                          │
                                          ┌───────────────┼───────────────┐
                                          ▼               ▼               ▼
                                    osc-sender.js   psn-sender.js   artnet-sender.js
                                    (UDP 8000)      (UDP 56565)     (UDP 6454)

Protocol Output

OSC (Open Sound Control)

Target position and color for each spotlight:

/targetposition <id> <x> <y> <z>    (meters, float)
/color <id> <r> <g> <b>             (0–255, int)

Default: localhost:8000

PosiStageNet (PSN)

Stage tracking protocol for spatial position data. Sends PSN data packets at ~30 fps with tracker positions (x, y, z) for each spotlight target.

Default: multicast 236.10.10.10:56565

ArtNet DMX

8-channel per fixture (Pan, Tilt, Dimmer, R, G, B, Zoom, Focus). Converts 3D target positions to pan/tilt angles based on fixture mount positions.

Default: broadcast 255.255.255.255:6454

Stage Layout

                    y = +5m (back)
                         │
       ┌─────────────────┼─────────────────┐
       │     SIM ring     │    (r≈5m, z=3.5m) │
       │   ╭──●──●──●──╮ │                  │
       │  ●             ● │                  │
       │  │  ╭─●─●─╮   │ │                  │
  x=-5m──│──●  PHYS  ●─│─│──── x = +5m
       │  │  ╰─●─●─╯   │ │   (8 fixtures)
       │  ●    (z=2.65m)● │   octagonal
       │   ╰──●──●──●──╯ │                  │
       │                  │                  │
       └─────────────────┼─────────────────┘
                         │
                    y = -5m (front)
              z = 0  (floor)

Coordinate system in meters — origin (0, 0, 0) is center stage at floor level. x: stage left/right, y: back/front, z: floor to ceiling (0–3.5 m).

Usage

Prompt Examples

Transport Controls

Play / Pause / Stop / Restart — timeline controls for the generated animation. Animations loop by default (infinite repeat). Use presets (1–60) for quick pattern loading.

Settings Panel

Click the gear icon to configure OSC, PSN, and ArtNet output addresses and ports. Settings are persisted in localStorage.

Animation JSON Format

The Claude API returns a JSON object with mathFunctions — an array of 6 parametric functions (3 position + 3 color):

{
  "mathFunctions": [
    {"parameter":"x",     "equation":"4.0 * cos(twopi * t / 8 + objectIndex * twopi / 32)", "startTime":0, "endTime":20},
    {"parameter":"y",     "equation":"4.0 * sin(twopi * t / 8 + objectIndex * twopi / 32)", "startTime":0, "endTime":20},
    {"parameter":"z",     "equation":"0.5 + 0.4 * sin(twopi * t / 12 + objectIndex * 0.2)", "startTime":0, "endTime":20},
    {"parameter":"red",   "equation":"0.5 + 0.5 * sin(twopi * (objectIndex / 32.0 + t / 10))", "startTime":0, "endTime":20},
    {"parameter":"green", "equation":"0.5 + 0.5 * sin(twopi * (objectIndex / 32.0 + t / 10) + twopi / 3)", "startTime":0, "endTime":20},
    {"parameter":"blue",  "equation":"0.5 + 0.5 * sin(twopi * (objectIndex / 32.0 + t / 10) + 2 * twopi / 3)", "startTime":0, "endTime":20}
  ],
  "loopStartTime": 0,
  "loopEndTime": 20,
  "repeatCount": -1
}

Equation Variables & Functions

VariableDescription
tCurrent time in seconds
objectIndexSpotlight ID (1–32)
durationTotal animation duration
pi, twopi, eMathematical constants
FunctionDescription
sin(x), cos(x), tan(x)Trigonometric
abs(x), sqrt(x)Absolute value, square root
atan2(y, x)Two-argument arctangent
min(a, b), max(a, b)Min / Max
random(seed)Deterministic pseudo-random (0–1)
noise(t)Smooth Perlin-like noise
randint(seed)Deterministic integer random
if(cond, a, b)Conditional expression

SPOTLIGHT AI

自然言語 → 数学関数 → スポットライト制御   v2.0

概要

SPOTLIGHT AI は、動きと色の自然言語記述を数学関数に変換し、32台の Martin MACOneCD スポットライトをリアルタイムで制御します。「オーロラカラーの円軌道」や「中心に収束するカオティックな群れ」といった記述から、30fps で評価されるパラメトリック方程式を生成し、OSC・PosiStageNet (PSN)・ArtNet DMX で位置・カラーデータを送信します。

Claude API OSC PSN ArtNet DMX WebSocket Node.js

アーキテクチャ

 ユーザープロンプト (ブラウザ)
      │
      ▼
 ┌─────────────┐    WebSocket     ┌──────────────────┐
 │  index.html  │◄───────────────►│   server.js       │
 │  (UI)        │                 │   Express + WS     │
 └─────────────┘                 └────────┬───────────┘
                                          │
                          ┌───────────────┼───────────────┐
                          ▼               ▼               ▼
                   claude-api.js   system-prompt.js  animation-engine.js
                   (Claude API)    (プロンプト生成)   (数式評価エンジン)
                                                          │
                                          ┌───────────────┼───────────────┐
                                          ▼               ▼               ▼
                                    osc-sender.js   psn-sender.js   artnet-sender.js
                                    (UDP 8000)      (UDP 56565)     (UDP 6454)

プロトコル出力

OSC (Open Sound Control)

各スポットライトのターゲット位置とカラー:

/targetposition <id> <x> <y> <z>    (メートル, float)
/color <id> <r> <g> <b>             (0–255, int)

デフォルト: localhost:8000

PosiStageNet (PSN)

ステージトラッキングプロトコル。各スポットライトターゲットのトラッカー位置 (x, y, z) を ~30fps で PSN データパケットとして送信します。

デフォルト: マルチキャスト 236.10.10.10:56565

ArtNet DMX

フィクスチャあたり8チャンネル (Pan, Tilt, Dimmer, R, G, B, Zoom, Focus)。3Dターゲット位置をフィクスチャマウント位置に基づいてパン/チルト角度に変換します。

デフォルト: ブロードキャスト 255.255.255.255:6454

ステージレイアウト

                    y = +5m (奥)
                         │
       ┌─────────────────┼─────────────────┐
       │    SIM リング    │   (r≈5m, z=3.5m)  │
       │   ╭──●──●──●──╮ │                  │
       │  ●             ● │                  │
       │  │  ╭─●─●─╮   │ │                  │
  x=-5m──│──●  PHYS  ●─│─│──── x = +5m
       │  │  ╰─●─●─╯   │ │   (8台)
       │  ●    (z=2.65m)● │   八角形配置
       │   ╰──●──●──●──╯ │                  │
       │                  │                  │
       └─────────────────┼─────────────────┘
                         │
                    y = -5m (手前)
              z = 0 (床面)

座標系はメートル単位 — 原点 (0, 0, 0) はステージ中央の床面。x: 左右, y: 奥/手前, z: 床から天井 (0–3.5 m)。

使い方

プロンプト例

トランスポートコントロール

再生 / 一時停止 / 停止 / リスタート — 生成されたアニメーションのタイムラインコントロール。アニメーションはデフォルトでループ (無限リピート)。プリセット (1–60) でパターンをクイックロード可能。

設定パネル

歯車アイコンをクリックして OSC・PSN・ArtNet の出力アドレスとポートを設定。設定は localStorage に保存されます。

アニメーション JSON 形式

Claude API は mathFunctions を含む JSON オブジェクトを返します — 6つのパラメトリック関数の配列 (位置3 + カラー3):

{
  "mathFunctions": [
    {"parameter":"x",     "equation":"4.0 * cos(twopi * t / 8 + objectIndex * twopi / 32)", "startTime":0, "endTime":20},
    {"parameter":"y",     "equation":"4.0 * sin(twopi * t / 8 + objectIndex * twopi / 32)", "startTime":0, "endTime":20},
    {"parameter":"z",     "equation":"0.5 + 0.4 * sin(twopi * t / 12 + objectIndex * 0.2)", "startTime":0, "endTime":20},
    {"parameter":"red",   "equation":"0.5 + 0.5 * sin(twopi * (objectIndex / 32.0 + t / 10))", "startTime":0, "endTime":20},
    {"parameter":"green", "equation":"0.5 + 0.5 * sin(twopi * (objectIndex / 32.0 + t / 10) + twopi / 3)", "startTime":0, "endTime":20},
    {"parameter":"blue",  "equation":"0.5 + 0.5 * sin(twopi * (objectIndex / 32.0 + t / 10) + 2 * twopi / 3)", "startTime":0, "endTime":20}
  ],
  "loopStartTime": 0,
  "loopEndTime": 20,
  "repeatCount": -1
}

数式変数・関数一覧

変数説明
t現在の時間(秒)
objectIndexスポットライト ID (1–32)
durationアニメーション全体の長さ
pi, twopi, e数学定数
関数説明
sin(x), cos(x), tan(x)三角関数
abs(x), sqrt(x)絶対値、平方根
atan2(y, x)2引数アークタンジェント
min(a, b), max(a, b)最小値 / 最大値
random(seed)決定論的擬似乱数 (0–1)
noise(t)滑らかなパーリンライクノイズ
randint(seed)決定論的整数乱数
if(cond, a, b)条件式