Skip to content

Commit

Permalink
Merge pull request #464 from Renumics/fix/pyav-breaking-changes
Browse files Browse the repository at this point in the history
Fix/pyav breaking changes
  • Loading branch information
neindochoh authored Nov 13, 2024
2 parents 2819384 + 4d6da91 commit 0319725
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 70 deletions.
78 changes: 19 additions & 59 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ pandas = "*"
importlib_resources = "<5.8.0"
scikit-image = "*"
imagecodecs = [{ version = "*", markers = 'platform_machine != "arm64"' }]
av = "<13.0.0"
av = "*"
validators = "*"
ipywidgets = "*"
jinja2 = "*"
Expand Down Expand Up @@ -107,7 +107,6 @@ types-requests = "^2.27.20"
black = "^24.1.1"
pytest = "^7.4.2"
ipython = "^8.10.0"
jupyter = "^1.0.0"
watchdog = "^2.1.7"
argh = "^0.26.2"
typed-ast = "^1.5.3"
Expand All @@ -129,6 +128,7 @@ check-wheel-contents = "^0.6.0"
torch = { version = "^2.1.1+cpu, <=2.4.1+cpu", source = "torch-cpu" }
ray = {extras = ["data"], version = "==2.9.3"}
soxr = "*"
notebook = "*"

[tool.poetry.group.playbook.dependencies]
annoy = "^1.17.2"
Expand Down
16 changes: 7 additions & 9 deletions renumics/spotlight/io/audio.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,17 @@ def _channel_num_to_layout(channel_num: int) -> str:
if channel_num == 2:
return "stereo"
if channel_num == 3:
return "3.0"
return "2.1"
if channel_num == 4:
return "4.0"
return "3.1"
if channel_num == 5:
return "5.0"
return "4.1"
if channel_num == 6:
return "6.0"
return "5.1"
if channel_num == 7:
return "7.0"
if channel_num == 8:
return "7.1"
return "6.1"
raise ValueError(
f"Only channel number from 1 to 8 are supported, but {channel_num} received."
f"Only channel number from 1 to 7 supported, but value {channel_num} received."
)


Expand Down Expand Up @@ -151,7 +149,7 @@ def write_audio(
frame = av.audio.AudioFrame.from_ndarray(data, data_format, layout)
frame.rate = sampling_rate
with av.open(file, "w", format_) as container:
stream = container.add_stream(codec, sampling_rate, channels=num_channels) # type: ignore[call-arg]
stream = container.add_stream(codec, sampling_rate, layout=layout) # type: ignore[call-arg]
container.mux(stream.encode(frame)) # type: ignore[attr-defined]
container.mux(stream.encode(None)) # type: ignore[attr-defined]

Expand Down

0 comments on commit 0319725

Please sign in to comment.