Skip to content

Voice isolation — separating clean speech from background noise and mixed audio.

Python
1.2 KB
Raw Blame
# Copyright 2026 Inworld AI
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Demo tests import demo/*.py as plain modules."""

import os
import sys
import wave

import pytest

REPO = os.path.dirname(
    os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
sys.path.insert(0, os.path.join(REPO, "demo"))


@pytest.fixture
def example_directory(tmp_path):
    """A folder holding one synthetic WAV."""
    directory = tmp_path / "examples"
    directory.mkdir()
    path = directory / "synthetic_silence.wav"
    with wave.open(str(path), "wb") as audio:
        audio.setnchannels(1)
        audio.setsampwidth(2)
        audio.setframerate(48000)
        audio.writeframes(b"\0\0" * 2400)
    return directory