Put the CBA bed height row on the 62-level grid and render PCM 2.0/5.1/7.1 binaurally

The height row of the bed reference coordinates sits at ADM 62-level steps
15/62 and 47/62, not at the room corners: Tfl/Tfr, Tsl/Tsr and Tbl/Tbr move
from x = -1 / 1 to -0.516113 / 0.516113, which puts their Q15 numerators at
7928 / 24840 so every bed channel lands on its reference position instead of
being snapped to the nearest neighbour. Lw/Rw keep Y = 21/31 (5285). The
ADM-to-Q15 conversion scales by 32768, the full scale the renderer divides
by, so half-step positions such as 16384 and 7928 are no longer one count
low.

5.1, 5.1.2 and 5.1.4 keep their single surround pair at the rear corners
(y = 32767) instead of y = 16384. That family has no side pair, so its Ls/Rs
is the rear pair, which is the same point the multichannel PCM virtual
sources use; 7.1.x and 9.1.x keep Ls/Rs at 0.5 and Lrs/Rrs at 1.

Add the multichannel PCM binaural path. src/multichannel_binaural.py maps the
2.0 / 5.1 / 7.1 WAV channel order to synthetic objects (LFE on slot 0, the
full-band channels on slots 1..N in ffmpeg order, the remaining slots
silent), resamples the input to the native 48 kHz and drives the Rosella or
.jochrtf adapter. FixedPositionTimeline gives those static directions the
positions_at interface the OAMD timeline exposes, and both adapters accept an
optional fixed_positions argument instead of deriving a timeline from bed
labels.

Checked: the fifteen bed labels convert to the reference Q15 triples, the nine
output layouts agree with the layout table region by region, bed routing and
the derived direct bed labels are unchanged for every layout, and the
regression suite passes.
This commit is contained in:
TheM14 committed 2026-11-18 17:05:30 +08:00
1 parent 7de17a8576
commit 76074a05ba
9 files changed
+381 -60

No files matched your search

+3 -3
View File
@@ -15,9 +15,9 @@ It covers the currently implemented stream forms. Unknown variants fail explicit
- Parse ID11 OAMD position updates and build object trajectories.
- Read the bed layout the OAMD declares (5.1, 7.1, 7.1.2, 7.1.4, 9.1.4, 9.1.6, ...): for
bed-only content the 15 object slots are the bed channels, each rendered as a point
source at the fixed position its channel label defines (ETSI TS 103 420 table B.10);
speaker and binaural output share those source positions and never re-place them per
layout, while LFE keeps its separate path.
source at the fixed position its channel label defines; speaker and binaural output
share those source positions and never re-place them per layout, while LFE keeps its
separate path.
- Reconstruct LFE plus 15 object channels through analysis QMF, parameter interpolation, the object matrix, and inverse QMF.
- Write a 25-channel ADM BWF: a 10-channel 7.1.2 bed (silent except for LFE) plus 15 objects.
- Render directly to `2.0`, `3.1`, `4.0`, `5.1`, `6.0`, `7.1`, `5.1.2`, `5.1.4`, `7.1.2`, `7.1.4`, `9.1.4`
+2 -2
View File
@@ -14,8 +14,8 @@
- 解析 ID14 dense / sparse JOC 参数、Huffman 数据、差分矩阵与 `joc_clipgain`;
- 解析 ID11 OAMD 位置更新并生成对象轨迹;
- 读取 OAMD 声明的 bed 布局(5.1、7.1、7.1.2、7.1.4、9.1.4、9.1.6 等):bed-only 内容的
15 路对象就是 bed 声道,每个声道按其声道标签的固定方位(ETSI TS 103 420 Table B.10)
作为点声源渲染,扬声器与双耳共用同一组源位置,不随输出布局改变;LFE 独立处理;
15 路对象就是 bed 声道,每个声道按其声道标签的固定方位作为点声源渲染,扬声器与双耳
共用同一组源位置,不随输出布局改变;LFE 独立处理;
- 通过 analysis QMF、参数插值、对象矩阵和 inverse QMF 重建 LFE + 15 路对象 PCM;
- 输出 25 声道 ADM BWF:10 声道 7.1.2 bed(除 LFE 外静音)+ 15 个对象;
- 直接渲染 `2.0`、`3.1`、`4.0`、`5.1`、`6.0`、`7.1`、`5.1.2`、`5.1.4`、`7.1.2`、`7.1.4`、`9.1.4`、
+20 -16
View File
@@ -82,11 +82,11 @@ BED_CHANNEL_NAMES = {
"RC_TBL": "Ltr", "RC_TBR": "Rtr", "RC_LW": "Lw", "RC_RW": "Rw",
}
# 每个 bed 声道的固定方位(ADM 笛卡尔坐标,x 向右、y 向前、z 向上),取自
# ETSI TS 103 420 V1.2.1 clause B.2.1.4 Table B.10:speakerLabel 各自对应唯一的
# position(X,Y,Z),与目标扬声器布局无关。bed 对象在 OAMD 里没有位置字段,位置只由
# 声明的声道标签决定。
# Table B.10 把 Lw/Rw 的 Y 记作 0,677419,即 ADM 62 级网格上的 42/62 = 21/31。
# 每个 bed 声道的固定方位(ADM 笛卡尔坐标,x 向右、y 向前、z 向上):speakerLabel
# 各自对应唯一的 position(X,Y,Z),与目标扬声器布局无关。bed 对象在 OAMD 里没有位置
# 字段,位置只由声明的声道标签决定。
# 顶部那一行取 ADM 62 级网格的 15/62 与 47/62,即归一化 x 的 0,241943 / 0,758057
# (Q15 分子 7928 / 24840);Lw/Rw 的 Y 记作 0,677419,即 42/62 = 21/31。
BED_CHANNEL_ADM_POSITION = {
"RC_L": (-1.0, 1.0, 0.0),
"RC_R": (1.0, 1.0, 0.0),
@@ -96,12 +96,12 @@ BED_CHANNEL_ADM_POSITION = {
"RC_RS": (1.0, 0.0, 0.0),
"RC_LB": (-1.0, -1.0, 0.0),
"RC_RB": (1.0, -1.0, 0.0),
"RC_TFL": (-1.0, 1.0, 1.0),
"RC_TFR": (1.0, 1.0, 1.0),
"RC_TSL": (-1.0, 0.0, 1.0),
"RC_TSR": (1.0, 0.0, 1.0),
"RC_TBL": (-1.0, -1.0, 1.0),
"RC_TBR": (1.0, -1.0, 1.0),
"RC_TFL": (-0.516113, 1.0, 1.0),
"RC_TFR": (0.516113, 1.0, 1.0),
"RC_TSL": (-0.516113, 0.0, 1.0),
"RC_TSR": (0.516113, 0.0, 1.0),
"RC_TBL": (-0.516113, -1.0, 1.0),
"RC_TBR": (0.516113, -1.0, 1.0),
"RC_LW": (-1.0, 21.0 / 31.0, 0.0),
"RC_RW": (1.0, 21.0 / 31.0, 0.0),
"RC_LFE2": (1.0, 1.0, -1.0),
@@ -273,10 +273,14 @@ ADM_BED_712 = ("L", "R", "C", "LFE", "Ls", "Rs", "Lrs", "Rrs", "Ltf", "Rtf")
def adm_xyz_to_q(x, y, z):
"""ADM 笛卡尔坐标 → OAMD/渲染器使用的 Q15 方位三元组。"""
q1 = int(round((float(x) + 1.0) * 0.5 * 32767.0))
q2 = int(round((1.0 - float(y)) * 0.5 * 32767.0))
q3 = int(round(float(z) * 32767.0))
"""ADM 笛卡尔坐标 → OAMD/渲染器使用的 Q15 方位三元组。
Q15 满刻度是 32768(渲染器按 ``q / 32768`` 还原方位),因此用 32768 定标;
除满刻度外按四舍五入取整。
"""
q1 = int(round((float(x) + 1.0) * 0.5 * 32768.0))
q2 = int(round((1.0 - float(y)) * 0.5 * 32768.0))
q3 = int(round(float(z) * 32768.0))
clamp = lambda value: max(0, min(32767, value)) # noqa: E731
return clamp(q1), clamp(q2), clamp(q3)
@@ -331,7 +335,7 @@ def bed_layout(assignments):
def bed_object_positions(labels):
"""JOC 对象槽 → 固定 ADM 位置:(1..15) 对应未含 LFE 的 bed 声道。
positions 由声道标签唯一决定(Table B.10),与目标输出布局无关——同一个 bed 声道
positions 由声道标签唯一决定,与目标输出布局无关——同一个 bed 声道
在扬声器布局和双耳渲染里都落在同一个源位置。返回的字典只包含能给出固定位置的
标准声道;不是 bed 声道的对象不在其中,仍按 OAMD 坐标渲染。LFE 走独立通路,
不出现在对象槽里。
+22
View File
@@ -188,3 +188,25 @@ class OamdPositionTimeline:
return np.stack(
[track.position_at(sample) for track in self.tracks], axis=0
).astype(np.float64, copy=False)
class FixedPositionTimeline:
"""Static 15-object positions for synthesized objects (no OAMD payloads).
The multichannel path gives every input channel a fixed direction and never
submits metadata payloads, so the binaural adapter can query the same
``positions_at`` interface the OAMD timeline exposes.
"""
def __init__(self, positions):
array = np.asarray(positions, dtype=np.float64)
if array.shape != (15, 3):
raise ValueError(f"fixed positions must be (15,3), got {array.shape}")
if not np.all(np.isfinite(array)):
raise ValueError("fixed positions must be finite")
self._positions = array.copy()
self.payload_count = 0
self.transition_count = 0
def positions_at(self, sample):
del sample
return self._positions
+13 -7
View File
@@ -6,7 +6,7 @@ from pathlib import Path
import numpy as np
from binaural_metadata import OamdPositionTimeline
from binaural_metadata import FixedPositionTimeline, OamdPositionTimeline
from public_filterbank import ANALYSIS_SYNTHESIS_LATENCY_SAMPLES
@@ -48,7 +48,8 @@ class JochrtfBinauralRenderer:
object_delay_samples: int = 1473,
tail_seconds: float = 5.0,
chunk_frames: int = 64,
bed_channels=None):
bed_channels=None,
fixed_positions=None):
required_interface = (
"source_count", "default_profile", "set_source", "process",
"finish", "finish_output_capacity", "info")
@@ -79,9 +80,12 @@ class JochrtfBinauralRenderer:
from bed_layout import bed_object_positions
from sofa_metadata import SofaPositionTimeline
timeline_type = SofaPositionTimeline if getattr(backend, "fixed_reference", False) else OamdPositionTimeline
self.timeline = timeline_type(
15, bed_positions=bed_object_positions(bed_channels or ()))
if fixed_positions is not None:
self.timeline = FixedPositionTimeline(fixed_positions)
else:
timeline_type = SofaPositionTimeline if getattr(backend, "fixed_reference", False) else OamdPositionTimeline
self.timeline = timeline_type(
15, bed_positions=bed_object_positions(bed_channels or ()))
self._input_buffer = np.empty(
(self.chunk_samples, SOURCE_CHANNELS), dtype=np.float64)
@@ -101,7 +105,8 @@ class JochrtfBinauralRenderer:
output_gain: float = 1.0,
chunk_frames: int = 64,
bed_channels=None,
room: bool = False) -> "JochrtfBinauralRenderer":
room: bool = False,
fixed_positions=None) -> "JochrtfBinauralRenderer":
from jochrtf_backend import JochrtfBackend
source = resolve_compiled_hrtf_cache(cache)
backend = JochrtfBackend.from_compiled_cache(
@@ -116,7 +121,8 @@ class JochrtfBinauralRenderer:
object_delay_samples=object_delay_samples,
tail_seconds=tail_seconds,
chunk_frames=chunk_frames,
bed_channels=bed_channels)
bed_channels=bed_channels,
fixed_positions=fixed_positions)
@property
def finish_capacity_samples(self) -> int:
+285
View File
@@ -0,0 +1,285 @@
"""Render ordinary 2.0 / 5.1 / 7.1 PCM WAV to binaural audio.
The binaural renderer is a JOC-object renderer: it expects sixteen source
channels (LFE plus fifteen objects) with a direction per object. For ordinary
multichannel PCM there is no OAMD, so this module
* maps the layout's channel order to fixed ADM directions,
* turns each non-LFE channel into one synthetic object and the LFE channel
into source 0,
* feeds the same Rosella / jochrtf binaural adapter the JOC path uses.
The HRTF runtime is native 48 kHz. Prefer letting ffmpeg/libsoxr produce a
48 kHz float32 WAV and feed that in directly:
ffmpeg -i INPUT -af "aresample=resampler=soxr:precision=28:osr=48000" \
-c:a pcm_f32le OUT.wav
The module then renders and writes 48 kHz stereo with no further sample-rate
conversion. The supported families are 44.1k (44.1/88.2/176.4) and 48k
(48/96/192), up to 192 kHz; a non-48 kHz input is converted once on the way in,
and the output stays 48 kHz by default. An explicit
non-48k output rate is possible but adds a second conversion.
"""
from __future__ import annotations
import argparse
import math
import sys
from pathlib import Path
import numpy as np
from scipy import signal
from scipy.io import wavfile
from binaural_renderer import JochrtfBinauralRenderer
from rosella_binaural_renderer import (DEFAULT_PERSONALIZED_HEADPHONE,
RosellaBinauralRenderer)
from rosella_bank import DEFAULT_FILTERBANK
TARGET_RATE = 48000
FRAME_SAMPLES = 1536
SOURCE_CHANNELS = 16
# WAV channel order follows the ffmpeg layout definitions:
# 2.0 = FL FR
# 5.1 = FL FR FC LFE BL BR
# 7.1 = FL FR FC LFE BL BR SL SR
# BL/BR are the rear pair, SL/SR the side pair.
LAYOUTS = {
"2.0": (
("L", (-1.0, 1.0, 0.0)),
("R", (1.0, 1.0, 0.0)),
),
"5.1": (
("L", (-1.0, 1.0, 0.0)),
("R", (1.0, 1.0, 0.0)),
("C", (0.0, 1.0, 0.0)),
("LFE", None),
("BL", (-1.0, -1.0, 0.0)),
("BR", (1.0, -1.0, 0.0)),
),
"7.1": (
("L", (-1.0, 1.0, 0.0)),
("R", (1.0, 1.0, 0.0)),
("C", (0.0, 1.0, 0.0)),
("LFE", None),
("BL", (-1.0, -1.0, 0.0)),
("BR", (1.0, -1.0, 0.0)),
("SL", (-1.0, 0.0, 0.0)),
("SR", (1.0, 0.0, 0.0)),
),
}
LAYOUT_CHANNELS = {"2.0": 2, "5.1": 6, "7.1": 8}
def detect_layout(channels: int) -> str:
for name, count in LAYOUT_CHANNELS.items():
if count == int(channels):
return name
raise ValueError(
f"cannot infer a binaural layout for {channels} channels; "
f"supported layouts: 2.0 (2), 5.1 (6), 7.1 (8)")
def object_positions(layout: str) -> np.ndarray:
"""Return the 15 synthetic object directions for one layout."""
if layout not in LAYOUTS:
raise ValueError(f"unknown layout {layout!r}")
positions = np.zeros((15, 3), dtype=np.float64)
slot = 0
for label, position in LAYOUTS[layout]:
if position is None:
continue
if slot >= 15:
raise ValueError(f"layout {layout} needs more than 15 object slots")
positions[slot] = position
slot += 1
return positions
def pcm_to_objects(pcm: np.ndarray, layout: str) -> np.ndarray:
"""Map interleaved layout PCM ``[samples, channels]`` to 16 JOC sources."""
pcm = np.asarray(pcm, dtype=np.float64)
if pcm.ndim != 2 or pcm.shape[1] != LAYOUT_CHANNELS[layout]:
raise ValueError(
f"{layout} expects {LAYOUT_CHANNELS[layout]} channels, got {pcm.shape}")
objects = np.zeros((len(pcm), SOURCE_CHANNELS), dtype=np.float64)
slot = 0
for channel, (label, position) in enumerate(LAYOUTS[layout]):
if position is None:
if label != "LFE":
raise ValueError(f"only LFE may omit a direction, got {label}")
objects[:, 0] = pcm[:, channel]
continue
objects[:, 1 + slot] = pcm[:, channel]
slot += 1
return objects
def _rate_ratio(source_rate: int, target_rate: int) -> tuple[int, int]:
common = math.gcd(int(source_rate), int(target_rate))
return int(target_rate) // common, int(source_rate) // common
def resample(data: np.ndarray, source_rate: int, target_rate: int) -> np.ndarray:
"""Resample ``[samples, channels]`` with a polyphase anti-alias filter."""
if int(source_rate) == int(target_rate):
return np.asarray(data, dtype=np.float64)
if int(source_rate) <= 0 or int(target_rate) <= 0:
raise ValueError("sample rates must be positive")
up, down = _rate_ratio(source_rate, target_rate)
result = signal.resample_poly(
np.asarray(data, dtype=np.float64), up, down, axis=0,
window=("kaiser", 10.0))
expected = int(round(len(data) * float(target_rate) / float(source_rate)))
if len(result) > expected:
result = result[:expected]
elif len(result) < expected:
pad = np.zeros((expected - len(result), result.shape[1]), dtype=result.dtype)
result = np.concatenate((result, pad), axis=0)
return result
def read_wav(path: str | Path) -> tuple[int, np.ndarray]:
rate, data = wavfile.read(str(path))
if data.ndim == 1:
data = data[:, None]
if np.issubdtype(data.dtype, np.integer):
scale = float(np.iinfo(data.dtype).max)
data = data.astype(np.float64) / scale
else:
data = data.astype(np.float64)
return int(rate), data
def write_wav(path: str | Path, rate: int, data: np.ndarray) -> None:
target = Path(path)
target.parent.mkdir(parents=True, exist_ok=True)
wavfile.write(str(target), int(rate), np.asarray(data, dtype=np.float32))
def _make_renderer(*, backend: str, model, compiled_hrtf, mode: str,
filterbank: int, tail_seconds: float,
fixed_positions: np.ndarray):
if backend == "rosella":
return RosellaBinauralRenderer(
model, mode=mode, filterbank=filterbank,
tail_seconds=tail_seconds, fixed_positions=fixed_positions)
if backend == "jochrtf":
if not compiled_hrtf:
raise ValueError("--backend jochrtf requires --compiled-hrtf PATH")
return JochrtfBinauralRenderer.from_compiled_cache(
compiled_hrtf, mode=mode, tail_seconds=tail_seconds,
fixed_positions=fixed_positions)
raise ValueError(f"unknown binaural backend {backend!r}")
def render_file(input_path, output_path, *, layout="auto",
backend="rosella", model=None, compiled_hrtf=None,
mode="mid", filterbank: int = DEFAULT_FILTERBANK,
tail_seconds: float = 2.0, output_rate=48000) -> dict:
"""Decode a PCM WAV, synthesize objects and render it binaurally."""
input_rate, pcm = read_wav(input_path)
channels = pcm.shape[1]
resolved = detect_layout(channels) if layout == "auto" else layout
if resolved not in LAYOUTS:
raise ValueError(f"unsupported layout {resolved!r}")
if channels != LAYOUT_CHANNELS[resolved]:
raise ValueError(
f"layout {resolved} expects {LAYOUT_CHANNELS[resolved]} channels, "
f"WAV has {channels}")
input_resampled = input_rate != TARGET_RATE
internal = pcm if not input_resampled else resample(
pcm, input_rate, TARGET_RATE)
objects = pcm_to_objects(internal, resolved)
padded = np.zeros(
((len(objects) + FRAME_SAMPLES - 1) // FRAME_SAMPLES * FRAME_SAMPLES,
SOURCE_CHANNELS), dtype=np.float64)
padded[:len(objects)] = objects
positions = object_positions(resolved)
renderer = _make_renderer(
backend=backend, model=model, compiled_hrtf=compiled_hrtf, mode=mode,
filterbank=filterbank, tail_seconds=tail_seconds,
fixed_positions=positions)
chunks = []
for start in range(0, len(padded), FRAME_SAMPLES):
chunks.append(renderer.render_frame(padded[start:start + FRAME_SAMPLES]))
chunks.append(renderer.finish())
stereo = np.concatenate([chunk for chunk in chunks if len(chunk)], axis=0)
if output_rate in (48000, "48000", "48k"):
target_rate = TARGET_RATE
elif output_rate == "input":
target_rate = input_rate
else:
target_rate = int(output_rate)
if target_rate != TARGET_RATE:
stereo = resample(stereo, TARGET_RATE, target_rate)
write_wav(output_path, target_rate, stereo)
return {
"input": str(Path(input_path).resolve()),
"output": str(Path(output_path).resolve()),
"layout": resolved,
"input_channels": channels,
"input_rate": input_rate,
"input_resampled": input_resampled,
"render_rate": TARGET_RATE,
"output_rate": target_rate,
"input_samples": len(pcm),
"output_samples": len(stereo),
"backend": backend,
"mode": mode,
}
def main(argv=None) -> int:
parser = argparse.ArgumentParser(
description="Render 2.0/5.1/7.1 PCM WAV files binaurally")
parser.add_argument("input", type=Path, help="interleaved PCM WAV")
parser.add_argument("-o", "--output", type=Path)
parser.add_argument("--layout", default="auto",
choices=("auto", "2.0", "5.1", "7.1"))
parser.add_argument("--backend", default="rosella",
choices=("rosella", "jochrtf"))
parser.add_argument("--model", type=Path, default=None,
help="Rosella .personalized_headphone model")
parser.add_argument("--compiled-hrtf", type=Path, default=None,
help="JOC .jochrtf compiled cache")
parser.add_argument("--binaural-mode", default="mid",
choices=("near", "mid", "far"))
parser.add_argument("--filterbank", type=int, default=DEFAULT_FILTERBANK)
parser.add_argument("--tail-seconds", type=float, default=2.0)
parser.add_argument("--output-rate", default="48000",
help="48k (default, native HRTF rate) or an explicit rate; "
"non-48k output adds a second resampling pass")
parser.add_argument("--list-layouts", action="store_true")
args = parser.parse_args(argv)
if args.list_layouts:
for name, channels in LAYOUT_CHANNELS.items():
print(f"{name}: {channels} channels")
return 0
output = args.output or Path(str(args.input) + ".binaural.wav")
model = args.model or DEFAULT_PERSONALIZED_HEADPHONE
info = render_file(
args.input, output, layout=args.layout, backend=args.backend,
model=model, compiled_hrtf=args.compiled_hrtf,
mode=args.binaural_mode, filterbank=args.filterbank,
tail_seconds=args.tail_seconds, output_rate=args.output_rate)
for key, value in info.items():
print(f"{key}: {value}")
if info["input_resampled"]:
print(
"warning: input was not 48 kHz and was converted once internally; "
"prefer ffmpeg/libsoxr to produce a 48 kHz float32 WAV first, e.g. "
"ffmpeg -i INPUT -af \"aresample=resampler=soxr:precision=28:osr=48000\" "
"-c:a pcm_f32le OUT.wav",
file=sys.stderr)
return 0
if __name__ == "__main__":
sys.exit(main())
+8 -4
View File
@@ -15,7 +15,7 @@ from pathlib import Path
import numpy as np
from bed_layout import bed_object_positions
from binaural_metadata import OamdPositionTimeline
from binaural_metadata import FixedPositionTimeline, OamdPositionTimeline
from rosella_bank import (DEFAULT_FILTERBANK, FILTERBANK_CHOICES, FILTERBANK_NAMES,
RosellaBank)
from rosella_core import RosellaRenderer
@@ -68,7 +68,8 @@ class RosellaBinauralRenderer:
output_gain: float = 1.0,
chunk_frames: int = 64,
room_impulse_slots: int = 4096,
bed_channels=None):
bed_channels=None,
fixed_positions=None):
if mode not in BINAURAL_PROFILE_NAMES:
raise ValueError("binaural mode must be near, mid, or far")
if filterbank not in FILTERBANK_CHOICES:
@@ -117,8 +118,11 @@ class RosellaBinauralRenderer:
room_impulse_slots=room_impulse_slots)
self.hybrid_synthesis = self.bank.hybrid_synthesis
self.qmf_synthesis = self.bank.qmf_synthesis
self.timeline = OamdPositionTimeline(
15, bed_positions=bed_object_positions(bed_channels or ()))
if fixed_positions is not None:
self.timeline = FixedPositionTimeline(fixed_positions)
else:
self.timeline = OamdPositionTimeline(
15, bed_positions=bed_object_positions(bed_channels or ()))
self._input_buffer = np.empty(
(self.chunk_samples, SOURCE_CHANNELS), dtype=np.float64)
+25 -25
View File
@@ -152,22 +152,22 @@ _RAW_LAYOUTS = {'20': {'out_ch_config': 0,
'speaker_bitfield': 15,
'channels': ('L', 'R', 'C', 'LFE', 'Ls', 'Rs'),
'internal_to_standard': (0, 1, 2, 3, 4, 5),
'regions': ({'coordinates_q15': ((0, 0, 0), (32767, 0, 0), (16384, 0, 0), (0, 16384, 0), (32767, 16384, 0)),
'regions': ({'coordinates_q15': ((0, 0, 0), (32767, 0, 0), (16384, 0, 0), (0, 32767, 0), (32767, 32767, 0)),
'speaker_ids': (0, 1, 2, 4, 5),
'axis0_groups': ((0, 2, 1), (3, 4)),
'axis1_groups': (),
'mode': 2},
{'coordinates_q15': ((0, 0, 0), (32767, 0, 0), (16384, 0, 0), (0, 16384, 0), (32767, 16384, 0)),
{'coordinates_q15': ((0, 0, 0), (32767, 0, 0), (16384, 0, 0), (0, 32767, 0), (32767, 32767, 0)),
'speaker_ids': (0, 1, 2, 4, 5),
'axis0_groups': ((0, 2, 1), (3, 4)),
'axis1_groups': (),
'mode': 2},
{'coordinates_q15': ((0, 0, 0), (32767, 0, 0), (16384, 0, 0), (0, 16384, 0), (32767, 16384, 0)),
{'coordinates_q15': ((0, 0, 0), (32767, 0, 0), (16384, 0, 0), (0, 32767, 0), (32767, 32767, 0)),
'speaker_ids': (0, 1, 2, 4, 5),
'axis0_groups': ((0, 2, 1), (3, 4)),
'axis1_groups': (),
'mode': 2},
{'coordinates_q15': ((16384, 0, 0), (0, 16384, 0), (32767, 16384, 0)),
{'coordinates_q15': ((16384, 0, 0), (0, 32767, 0), (32767, 32767, 0)),
'speaker_ids': (2, 4, 5),
'axis0_groups': ((0,), (1, 2)),
'axis1_groups': (),
@@ -177,7 +177,7 @@ _RAW_LAYOUTS = {'20': {'out_ch_config': 0,
'axis0_groups': ((0, 2, 1),),
'axis1_groups': (),
'mode': 1},
{'coordinates_q15': ((0, 16384, 0), (32767, 16384, 0)),
{'coordinates_q15': ((0, 32767, 0), (32767, 32767, 0)),
'speaker_ids': (4, 5),
'axis0_groups': ((0, 1),),
'axis1_groups': (),
@@ -239,8 +239,8 @@ _RAW_LAYOUTS = {'20': {'out_ch_config': 0,
'regions': ({'coordinates_q15': ((0, 0, 0),
(32767, 0, 0),
(16384, 0, 0),
(0, 16384, 0),
(32767, 16384, 0),
(0, 32767, 0),
(32767, 32767, 0),
(7928, 16384, 32767),
(24840, 16384, 32767)),
'speaker_ids': (0, 1, 2, 4, 5, 6, 7),
@@ -250,8 +250,8 @@ _RAW_LAYOUTS = {'20': {'out_ch_config': 0,
{'coordinates_q15': ((0, 0, 0),
(32767, 0, 0),
(16384, 0, 0),
(0, 16384, 0),
(32767, 16384, 0),
(0, 32767, 0),
(32767, 32767, 0),
(7928, 16384, 32767),
(24840, 16384, 32767)),
'speaker_ids': (0, 1, 2, 4, 5, 6, 7),
@@ -261,8 +261,8 @@ _RAW_LAYOUTS = {'20': {'out_ch_config': 0,
{'coordinates_q15': ((0, 0, 0),
(32767, 0, 0),
(16384, 0, 0),
(0, 16384, 0),
(32767, 16384, 0),
(0, 32767, 0),
(32767, 32767, 0),
(7928, 16384, 32767),
(24840, 16384, 32767)),
'speaker_ids': (0, 1, 2, 4, 5, 6, 7),
@@ -270,8 +270,8 @@ _RAW_LAYOUTS = {'20': {'out_ch_config': 0,
'axis1_groups': ((5, 6),),
'mode': 3},
{'coordinates_q15': ((16384, 0, 0),
(0, 16384, 0),
(32767, 16384, 0),
(0, 32767, 0),
(32767, 32767, 0),
(7928, 16384, 32767),
(24840, 16384, 32767)),
'speaker_ids': (2, 4, 5, 6, 7),
@@ -287,8 +287,8 @@ _RAW_LAYOUTS = {'20': {'out_ch_config': 0,
'axis0_groups': ((0, 2, 1),),
'axis1_groups': ((3, 4),),
'mode': 3},
{'coordinates_q15': ((0, 16384, 0),
(32767, 16384, 0),
{'coordinates_q15': ((0, 32767, 0),
(32767, 32767, 0),
(7928, 16384, 32767),
(24840, 16384, 32767)),
'speaker_ids': (4, 5, 6, 7),
@@ -307,8 +307,8 @@ _RAW_LAYOUTS = {'20': {'out_ch_config': 0,
'regions': ({'coordinates_q15': ((0, 0, 0),
(32767, 0, 0),
(16384, 0, 0),
(0, 16384, 0),
(32767, 16384, 0),
(0, 32767, 0),
(32767, 32767, 0),
(7928, 7928, 32767),
(24840, 7928, 32767),
(7928, 24840, 32767),
@@ -320,8 +320,8 @@ _RAW_LAYOUTS = {'20': {'out_ch_config': 0,
{'coordinates_q15': ((0, 0, 0),
(32767, 0, 0),
(16384, 0, 0),
(0, 16384, 0),
(32767, 16384, 0),
(0, 32767, 0),
(32767, 32767, 0),
(7928, 7928, 32767),
(24840, 7928, 32767),
(7928, 24840, 32767),
@@ -333,8 +333,8 @@ _RAW_LAYOUTS = {'20': {'out_ch_config': 0,
{'coordinates_q15': ((0, 0, 0),
(32767, 0, 0),
(16384, 0, 0),
(0, 16384, 0),
(32767, 16384, 0),
(0, 32767, 0),
(32767, 32767, 0),
(7928, 7928, 32767),
(24840, 7928, 32767),
(7928, 24840, 32767),
@@ -344,8 +344,8 @@ _RAW_LAYOUTS = {'20': {'out_ch_config': 0,
'axis1_groups': ((5, 6), (7, 8)),
'mode': 3},
{'coordinates_q15': ((16384, 0, 0),
(0, 16384, 0),
(32767, 16384, 0),
(0, 32767, 0),
(32767, 32767, 0),
(7928, 7928, 32767),
(24840, 7928, 32767),
(7928, 24840, 32767),
@@ -365,8 +365,8 @@ _RAW_LAYOUTS = {'20': {'out_ch_config': 0,
'axis0_groups': ((0, 2, 1),),
'axis1_groups': ((3, 4), (5, 6)),
'mode': 3},
{'coordinates_q15': ((0, 16384, 0),
(32767, 16384, 0),
{'coordinates_q15': ((0, 32767, 0),
(32767, 32767, 0),
(7928, 7928, 32767),
(24840, 7928, 32767),
(7928, 24840, 32767),
+3 -3
View File
@@ -80,9 +80,9 @@ def _fold_vector(calc, final, warp_mode, vector):
def bed_object_targets(bed_channels) -> dict[int, tuple[float, float, float]]:
"""JOC 对象槽 → 固定方位 ``(u, v, w)``;只包含 bed 声道。
bed 声道的方位由声道标签定义(ETSI TS 103 420 Table B.10),与目标扬声器布局
无关:同一个声道无论输出哪种布局都落在同一个源位置,再交给与动态对象相同的
点声源渲染路径。LFE 不占对象槽,单独处理。
bed 声道的方位由声道标签定义,与目标扬声器布局无关:同一个声道无论输出哪种
布局都落在同一个源位置,再交给与动态对象相同的点声源渲染路径。LFE 不占对象
槽,单独处理。
"""
from bed_layout import adm_xyz_to_render_coordinates, bed_object_positions