Skip to content

Commit bcbe448

Browse files
Update src/symphonic_joules/audio.py
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Signed-off-by: Misfit <218383634+JaclynCodes@users.noreply.github.com>
1 parent 0ac5f69 commit bcbe448

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/symphonic_joules/audio.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ def save_audio(path: str, y: np.ndarray, sr: int) -> None:
8888
try:
8989
# The docstring should clarify that the expected shape is (n_samples, n_channels).
9090
# The heuristic is removed to prevent data corruption on short, multi-channel signals.
91-
# y = y.T # This should be handled by the caller to ensure correct orientation.
91+
if y.ndim > 1 and y.shape[0] < y.shape[1]: # Heuristic to check if channels are first dimension
92+
y = y.T # Transpose if channels are the first dimension
9293
sf.write(path, y, sr)
9394
except Exception as e:
9495
raise RuntimeError(f"Failed to save audio file {path}: {str(e)}")

0 commit comments

Comments
 (0)