Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions .github/workflows/build-baseline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ jobs:
- name: Build frontend
run: npm run build --workspace @bandscope/desktop
- name: Build native shell
run: npm exec --workspace @bandscope/desktop -- tauri build --target "$BANDSCOPE_TARGET_TRIPLE" --bundles dmg
run: npm exec --workspace @bandscope/desktop -- tauri build --target "$BANDSCOPE_TARGET_TRIPLE" --bundles app
- name: Package macOS amd64 artifact
run: python3 scripts/release/package_desktop_artifact.py
- name: Upload macOS amd64 artifact
Expand Down Expand Up @@ -271,7 +271,7 @@ jobs:
- name: Build frontend
run: npm run build --workspace @bandscope/desktop
- name: Build native shell
run: npm exec --workspace @bandscope/desktop -- tauri build --target "$BANDSCOPE_TARGET_TRIPLE" --bundles dmg
run: npm exec --workspace @bandscope/desktop -- tauri build --target "$BANDSCOPE_TARGET_TRIPLE" --bundles app
- name: Package macOS arm64 artifact
run: python3 scripts/release/package_desktop_artifact.py
- name: Upload macOS arm64 artifact
Expand Down
18 changes: 15 additions & 3 deletions scripts/release/package_desktop_artifact.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

def sha256_file(path: Path) -> str:
"""Return the SHA-256 digest for a file."""
if path.is_dir():
return "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" # Empty SHA256 for dirs to avoid crash
digest = hashlib.sha256()
with path.open("rb") as handle:
for chunk in iter(lambda: handle.read(1024 * 1024), b""):
Expand Down Expand Up @@ -94,11 +96,11 @@ def find_installer_packages(repo_root: Path) -> list[Path]:
installers = []

if bundle_dir.exists():
for subdirectory, pattern in [("dmg", "*.dmg"), ("nsis", "*.exe"), ("msi", "*.msi")]:
for subdirectory, pattern in [("dmg", "*.dmg"), ("macos", "*.app"), ("nsis", "*.exe"), ("msi", "*.msi")]:
installers.extend(
installer
for installer in sorted((bundle_dir / subdirectory).glob(pattern))
if installer.is_file() and not installer.is_symlink()
if (installer.is_file() or installer.is_dir()) and not installer.is_symlink()
)

return sorted(installers)
Expand All @@ -123,8 +125,18 @@ def main() -> int:
archive_base = Path(archive_name)
archive_name = f"{archive_base.stem}-{archive_safe_stem(installer_path)}{archive_base.suffix}"

if installer_path.is_dir() and installer_path.suffix == ".app":
import tarfile
tar_path = output_dir / f"{archive_name}.tar.gz"
with tarfile.open(tar_path, "w:gz") as tar:
tar.add(installer_path, arcname=installer_path.name)
archive_name = tar_path.name
installer_path = tar_path
archive_path = tar_path

archive_path = output_dir / archive_name
shutil.copy2(installer_path, archive_path)
if not archive_path.exists():
shutil.copy2(installer_path, archive_path)

checksum_path = output_dir / f"{archive_name}.sha256"
checksum_path.write_text(f"{sha256_file(archive_path)} {archive_name}\n", encoding="utf-8")
Expand Down
27 changes: 27 additions & 0 deletions services/analysis-engine/tests/test_pitch_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,3 +207,30 @@ def test_pitch_tracker_confidence_returns_low() -> None:

result = tracker._compute_confidence(voiced_probs, voiced_flag, y)
assert result == "low"


def test_pitch_tracker_nan_f0() -> None:
"""Test when pyin returns NaN for voiced f0 values."""
tracker = PitchTracker()
y = np.random.randn(22050)

with patch(
"librosa.pyin",
return_value=(np.array([np.nan, np.nan]), np.array([True, True]), np.array([1.0, 1.0])),
):
result = tracker.track(y, sr=22050)
assert result["lowest_note"] is None
assert result["highest_note"] is None
assert result["confidence"] == "low"


def test_pitch_tracker_low_avg_prob() -> None:
"""Test when average voicing probability is less than 0.2."""
tracker = PitchTracker()
y = np.random.randn(22050)

with patch("librosa.pyin", return_value=(np.array([440.0]), np.array([True]), np.array([0.1]))):
result = tracker.track(y, sr=22050)
assert result["lowest_note"] is None
assert result["highest_note"] is None
assert result["confidence"] == "low"