Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
70c5767
remove unused import
tomjnixon Dec 15, 2022
7f51851
support regular layouts with no defined allocentric positions
tomjnixon Dec 7, 2022
5a2b6d1
remove development config file mechanism
tomjnixon Dec 12, 2022
a8654d6
fix whitespace
tomjnixon Dec 14, 2022
2b9733d
fix whitespace
tomjnixon Dec 14, 2022
ea7ba36
fix comment
tomjnixon Dec 14, 2022
84cdea7
fix ambiguous name warning
tomjnixon Dec 15, 2022
e227ede
fix indent
tomjnixon Dec 15, 2022
8cd8663
remove unused imports
tomjnixon Dec 15, 2022
2a68322
move noqa labels to correct line
tomjnixon Dec 14, 2022
67f761f
support regular layouts with no defined allocentric positions
tomjnixon Dec 7, 2022
f124d5a
direct speakers: extract screen edge lock code
tomjnixon Dec 13, 2022
8d270f4
use multipledispatch for python 3.7 compatibility
tomjnixon Dec 15, 2022
7435371
add num_channels to Layout
tomjnixon Dec 14, 2022
6055fef
use layout.num_channels
tomjnixon Dec 14, 2022
609b25a
direct speakers: extract speaker label handling for re-use
tomjnixon Dec 14, 2022
36cddb9
direct speakers: allow overloading panner for other formats
tomjnixon Dec 14, 2022
2382348
objects: allow overloading renderer for other formats
tomjnixon Dec 14, 2022
e983d08
HOA: allow overloading decoder design for other formats
tomjnixon Dec 14, 2022
f9795cb
add renderer overloads for HOA output
tomjnixon Dec 14, 2022
452e750
document HOA output on command line
tomjnixon Dec 14, 2022
12234bb
fixup: add HOA warnings
tomjnixon Dec 15, 2022
d5d66b0
test scenebased
tomjnixon Dec 15, 2022
67435f4
improve sph_harm docs
tomjnixon Dec 15, 2022
bfc844d
test directspeakers hoa
tomjnixon Dec 15, 2022
95e0202
test objectbased hoa
tomjnixon Dec 15, 2022
4bb403c
objectbased hoa: correct decorrelation normalisation
tomjnixon Dec 16, 2022
5fa9797
objectbased hoa: rework decorrelator application
tomjnixon Dec 16, 2022
510d55b
make decorrelator size configurable and default to 512 samples
tomjnixon Dec 16, 2022
2c731ba
fixup unused
tomjnixon Dec 16, 2022
5217132
add tests for decorrelators and convolution matrix
tomjnixon Dec 16, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

### Changed
- Added a warning for audioBlockFormats which have a duration but no rtime; previously these were fixed silently. See [#54].
- Removed the development config file mechanism, as it is no longer required and was not used.

## [2.1.0] - 2022-01-26

Expand Down
19 changes: 0 additions & 19 deletions ear/cmdline/dev_config.py

This file was deleted.

37 changes: 33 additions & 4 deletions ear/cmdline/render_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import scipy.sparse
from itertools import chain
from ..core import bs2051, layout, Renderer
from ..core import hoa_overloads # noqa: F401
from ..core.hoa_adapter import HOAFormat
from ..core.monitor import PeakMonitor
from ..core.metadata_processing import preprocess_rendering_items, convert_objects_to_cartesian, convert_objects_to_polar
from ..core.select_items import select_rendering_items
Expand All @@ -12,6 +14,7 @@
from ..fileio.bw64.chunks import FormatInfoChunk
from ..fileio.adm import timing_fixes
import logging
import textwrap
from .error_handler import error_handler


Expand All @@ -37,13 +40,34 @@ class OfflineRenderDriver(object):

blocksize = 8192

@classmethod
def get_systems_help(cls):
formats_string = ", ".join(bs2051.layout_names)

from ..core import hoa
norm_names = ", ".join(hoa.norm_functions)

text = f"""\
output system, accoring to ITU-R BS.2051

available systems:
{formats_string}

HOA output can be specified as "hoa_norm_order_n" or "ambix_n" where:
- norm is the normalization style, one of {norm_names}
- order is the channel order, currently only ACN
- n is the maximum order (e.g. 1 for first-order)

ambix_n is equivalent to hoa_SN3D_ACN_n
"""

return textwrap.dedent(text)

@classmethod
def add_args(cls, parser):
"""Add arguments to an ArgumentParser that can be used by from_args."""
formats_string = ", ".join(bs2051.layout_names)
parser.add_argument("-s", "--system", required=True, metavar="target_system",
help="Target output system, accoring to ITU-R BS.2051. "
"Available systems are: {}".format(formats_string))
help=cls.get_systems_help())

parser.add_argument("-l", "--layout", type=argparse.FileType("r"), metavar="layout_file",
help="Layout config file")
Expand Down Expand Up @@ -83,6 +107,10 @@ def load_output_layout(self):
upmix (sparse array or None): optional matrix to apply after rendering
n_channels (int): number of channels required in output file
"""
spkr_layout = HOAFormat.parse_or_none(self.target_layout)
if spkr_layout is not None:
return spkr_layout, None, spkr_layout.num_channels

spkr_layout = bs2051.get_layout(self.target_layout)

if self.speakers_file is not None:
Expand Down Expand Up @@ -215,7 +243,7 @@ def run(self, input_file, output_file):


def make_parser():
parser = argparse.ArgumentParser(description="EBU ADM renderer")
parser = argparse.ArgumentParser(description="EBU ADM renderer", formatter_class=argparse.RawTextHelpFormatter)

parser.add_argument("-d", "--debug",
help="print debug information when an error occurs",
Expand Down Expand Up @@ -245,5 +273,6 @@ def main():
with error_handler(logger, debug=args.debug, strict=args.strict):
OfflineRenderDriver.from_args(args).run(args.input_file, args.output_file)


if __name__ == "__main__":
main()
13 changes: 13 additions & 0 deletions ear/core/allocentric.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ def _screen_spk_position_to_cart(position):
return pos_left * [np.sign(position.azimuth), 1.0, 1.0]


def positions_defined(layout) -> bool:
"""are allocentric positions defined for the given layout?"""
return layout.name in _allo_positions


def positions_for_layout(layout):
layout_positions = _allo_positions[layout.name]

Expand All @@ -52,6 +57,14 @@ def get_position(channel):
for channel in layout.channels])


def positions_for_layout_if_defined(layout):
"""get allocentric positions for layout if they are defined, or None
otherwise
"""
if positions_defined(layout):
return positions_for_layout(layout)


def get_excluded(channel_positions, is_excluded):
is_excluded = np.copy(is_excluded)

Expand Down
3 changes: 2 additions & 1 deletion ear/core/bs2051.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pkg_resources
from ..compatibility import load_yaml
from .geom import PolarPosition
from .layout import Channel, Layout
from .layout import Channel, Layout, LayoutStyle


def _dict_to_channel(d):
Expand All @@ -23,6 +23,7 @@ def _dict_to_layout(d):
return Layout(
name=d["name"],
channels=list(map(_dict_to_channel, d["channels"])),
style=LayoutStyle.__members__[d.get("style", "ITU")],
)


Expand Down
8 changes: 8 additions & 0 deletions ear/core/data/N003_M6_Octa.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
3
6
1 0 0
0 1 0
0 0 1
-1 0 0
0 -1 0
0 0 -1
14 changes: 14 additions & 0 deletions ear/core/data/N005_M12_Ico.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
3
12
0.8506508083520399 0.5257311121191336 0
0.8506508083520399 -0.5257311121191336 0
-0.8506508083520399 0.5257311121191336 0
-0.8506508083520399 -0.5257311121191336 0
0 0.8506508083520399 0.5257311121191336
0 0.8506508083520399 -0.5257311121191336
0 -0.8506508083520399 0.5257311121191336
0 -0.8506508083520399 -0.5257311121191336
0.5257311121191336 0 0.8506508083520399
-0.5257311121191336 0 0.8506508083520399
0.5257311121191336 0 -0.8506508083520399
-0.5257311121191336 0 -0.8506508083520399
26 changes: 26 additions & 0 deletions ear/core/data/N007_M24_Octa.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
3
24
0.86624681811 0.42251865376 0.26663540152
0.86624681811 0.26663540152 -0.42251865376
-0.26663540152 0.42251865376 0.86624681811
0.42251865376 -0.86624681811 0.26663540152
0.86624681811 -0.26663540152 0.42251865376
0.26663540152 0.42251865376 -0.86624681811
-0.42251865376 0.86624681811 0.26663540152
0.42251865376 0.26663540152 0.86624681811
0.42251865376 -0.26663540152 -0.86624681811
-0.42251865376 -0.26663540152 0.86624681811
-0.42251865376 0.26663540152 -0.86624681811
0.26663540152 0.86624681811 0.42251865376
-0.26663540152 0.86624681811 -0.42251865376
0.26663540152 -0.86624681811 -0.42251865376
-0.26663540152 -0.86624681811 0.42251865376
0.86624681811 -0.42251865376 -0.26663540152
-0.86624681811 0.42251865376 -0.26663540152
-0.86624681811 -0.42251865376 0.26663540152
0.42251865376 0.86624681811 -0.26663540152
-0.42251865376 -0.86624681811 -0.26663540152
-0.86624681811 0.26663540152 0.42251865376
-0.86624681811 -0.26663540152 -0.42251865376
0.26663540152 -0.42251865376 0.86624681811
-0.26663540152 -0.42251865376 -0.86624681811
50 changes: 50 additions & 0 deletions ear/core/data/N009_M48_Octa.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
3
48
0.70684169771 0.63974009862 0.30184005797
0.35354218892 0.9333646932 0.061953774232
0.70684169771 0.30184005797 -0.63974009862
0.35354218892 0.061953774232 -0.9333646932
-0.30184005797 0.63974009862 0.70684169771
-0.061953774232 0.9333646932 0.35354218892
0.63974009862 -0.70684169771 0.30184005797
0.9333646932 -0.35354218892 0.061953774232
0.70684169771 -0.30184005797 0.63974009862
0.35354218892 -0.061953774232 0.9333646932
0.30184005797 0.63974009862 -0.70684169771
0.061953774232 0.9333646932 -0.35354218892
-0.63974009862 0.70684169771 0.30184005797
-0.9333646932 0.35354218892 0.061953774232
0.63974009862 0.30184005797 0.70684169771
0.9333646932 0.061953774232 0.35354218892
0.63974009862 -0.30184005797 -0.70684169771
0.9333646932 -0.061953774232 -0.35354218892
-0.63974009862 -0.30184005797 0.70684169771
-0.9333646932 -0.061953774232 0.35354218892
-0.63974009862 0.30184005797 -0.70684169771
-0.9333646932 0.061953774232 -0.35354218892
0.30184005797 0.70684169771 0.63974009862
0.061953774232 0.35354218892 0.9333646932
-0.30184005797 0.70684169771 -0.63974009862
-0.061953774232 0.35354218892 -0.9333646932
0.30184005797 -0.70684169771 -0.63974009862
0.061953774232 -0.35354218892 -0.9333646932
-0.30184005797 -0.70684169771 0.63974009862
-0.061953774232 -0.35354218892 0.9333646932
0.70684169771 -0.63974009862 -0.30184005797
0.35354218892 -0.9333646932 -0.061953774232
-0.70684169771 0.63974009862 -0.30184005797
-0.35354218892 0.9333646932 -0.061953774232
-0.70684169771 -0.63974009862 0.30184005797
-0.35354218892 -0.9333646932 0.061953774232
0.63974009862 0.70684169771 -0.30184005797
0.9333646932 0.35354218892 -0.061953774232
-0.63974009862 -0.70684169771 -0.30184005797
-0.9333646932 -0.35354218892 -0.061953774232
-0.70684169771 0.30184005797 0.63974009862
-0.35354218892 0.061953774232 0.9333646932
-0.70684169771 -0.30184005797 -0.63974009862
-0.35354218892 -0.061953774232 -0.9333646932
0.30184005797 -0.63974009862 0.70684169771
0.061953774232 -0.9333646932 0.35354218892
-0.30184005797 -0.63974009862 -0.70684169771
-0.061953774232 -0.9333646932 -0.35354218892
72 changes: 72 additions & 0 deletions ear/core/data/N011_M70_C5.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
3
70
0.34697401547 0.92871517263 0.13075611159
0.30826763892 0.86359439267 -0.39896840445
0.19846719975 -0.64131193892 0.74116784038
0.0055580704907 0.98569909422 -0.16842328672
-0.53557664796 0.83430239928 -0.13075611159
0.73865905916 -0.65269931117 0.16842328672
0.87676666988 0.1789933757 0.44636484857
0.84933311523 -0.34562620217 0.39896840445
0.61802851007 -0.2621278183 -0.74116784038
-0.18511501171 -0.275682451 -0.94325586065
-0.71379207496 -0.010481253665 0.70027924219
0.082409348656 0.70909638429 -0.70027924219
-0.32890958018 0.045682265894 0.94325586065
0.71771459795 0.5344568999 -0.44636484857
0.9904814841 -0.043003127119 0.13075611159
0.91658701382 -0.026314603177 -0.39896840445
-0.54859416094 -0.38692981141 0.74116784038
0.9391730849 0.2993117323 -0.16842328672
0.62796644739 0.76717728084 -0.13075611159
-0.39249573074 -0.90420169091 0.16842328672
0.44116861743 -0.77854265969 0.44636484857
-0.066251685284 -0.91456816391 0.39896840445
-0.058317057073 -0.66878199231 -0.74116784038
-0.31939327598 0.090864275742 -0.94325586065
-0.23054214621 0.67561771866 0.70027924219
0.69985662619 0.14074688535 -0.70027924219
-0.058192233229 0.326928196 0.94325586065
0.73008472521 -0.51743088039 -0.44636484857
0.26517720693 -0.95529256681 0.13075611159
0.25821428927 -0.87985771183 -0.39896840445
-0.53751703724 0.40217616421 0.74116784038
0.5748828173 -0.80071427043 -0.16842328672
0.92368125624 -0.36016076432 -0.13075611159
-0.9812347612 0.093871933508 0.16842328672
-0.60410946954 -0.66015920108 0.44636484857
-0.89027890855 -0.21960800816 0.39896840445
-0.65407043346 -0.15120218401 -0.74116784038
-0.012280888625 0.33183966177 -0.94325586065
0.57130919276 0.4280359672 0.70027924219
0.35012583358 -0.62211002533 -0.70027924219
0.29294480216 0.15637047111 0.94325586065
-0.26649742311 -0.85424677081 -0.44636484857
-0.82659295717 -0.54740014837 0.13075611159
-0.75700180667 -0.517467368 -0.39896840445
0.2163903624 0.63548835036 0.74116784038
-0.58387596426 -0.7941803667 -0.16842328672
-0.057100036259 -0.98976887461 -0.13075611159
-0.21394070262 0.96221773641 0.16842328672
-0.81452880253 0.37054183544 0.44636484857
-0.48397093966 0.77884295067 0.39896840445
-0.34592070184 0.57533390341 -0.74116784038
0.3118032694 0.11422391405 -0.94325586065
0.58363064542 -0.41107694253 0.70027924219
-0.4834669607 -0.52523202575 -0.70027924219
0.23924207779 -0.23028593001 0.94325586065
-0.8947891906 -0.01052265875 -0.44636484857
-0.77603974933 0.61698066967 0.13075611159
-0.72606713534 0.56004529034 -0.39896840445
0.67125363604 -0.0094227642326 0.74116784038
-0.93573800843 0.30988381061 -0.16842328672
-0.9589710194 -0.25155004119 -0.13075611159
0.8490121354 0.50081133217 0.16842328672
0.10070298476 0.88916664964 0.44636484857
0.59116841827 0.70095942357 0.39896840445
0.44027968231 0.5067780912 -0.74116784038
0.20498590692 -0.26124540056 -0.94325586065
-0.21060561702 -0.68209548967 0.70027924219
-0.64892484773 0.29749878144 -0.70027924219
-0.14508506654 -0.29869500299 0.94325586065
-0.28651270945 0.84774341005 -0.44636484857
Loading