feat: define simulator data contracts
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
$ErrorActionPreference = 'Stop'
|
||||
$projectRoot = [System.IO.Path]::GetFullPath((Join-Path $PSScriptRoot '..'))
|
||||
$outputPath = Join-Path $projectRoot 'assets/array-geometries/rectangular-16x12.array.json'
|
||||
$microphones = [System.Collections.Generic.List[object]]::new()
|
||||
$columns = 16
|
||||
$rows = 12
|
||||
$width = 0.45
|
||||
$height = 0.45
|
||||
|
||||
for ($row = 0; $row -lt $rows; $row++) {
|
||||
for ($column = 0; $column -lt $columns; $column++) {
|
||||
$index = $row * $columns + $column
|
||||
$x = -$width / 2 + $column * $width / ($columns - 1)
|
||||
$y = -$height / 2 + $row * $height / ($rows - 1)
|
||||
$microphones.Add([ordered]@{
|
||||
id = 'mic-{0:D3}' -f ($index + 1)
|
||||
position = @([Math]::Round($x, 6), [Math]::Round($y, 6), 0)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
$arrayDefinition = [ordered]@{
|
||||
schemaVersion = '1.0.0'
|
||||
kind = 'micarrsim.array'
|
||||
id = 'rectangular-16x12'
|
||||
name = '16×12 rectangular baseline'
|
||||
description = '0.45 m square aperture에 균일 배치한 192채널 기준 배열'
|
||||
units = 'm'
|
||||
coordinateSystem = [ordered]@{
|
||||
handedness = 'right'
|
||||
xAxis = 'right'
|
||||
yAxis = 'up'
|
||||
zAxis = 'toward-scene'
|
||||
}
|
||||
aperture = [ordered]@{ width = $width; height = $height }
|
||||
microphones = $microphones
|
||||
}
|
||||
|
||||
$json = $arrayDefinition | ConvertTo-Json -Depth 8
|
||||
[System.IO.File]::WriteAllText($outputPath, $json + [Environment]::NewLine, [System.Text.UTF8Encoding]::new($false))
|
||||
Write-Host "Generated $($microphones.Count) microphones: $outputPath"
|
||||
Reference in New Issue
Block a user