HE_music_extractor.py
def write_pcm_to_file(
            output_path: Path, payload: bytes, samplerate: int,
            output_options: List[str] = None
    ):
        """
        Write unsigned 8-bit audio data to an audio file.

        :param output_path: path to write audio file
        :param payload: raw PCM samples
        :param samplerate: samplerate of the audio data
        :param output_options: ffmpeg options for output file
        """

        output_options = output_options or []
        ffmpeg = Popen([
            'ffmpeg', '-hide_banner', '-loglevel', 'error',
            '-f', 'u8', '-ar', str(samplerate), '-i', 'pipe:',
            *output_options,
            str(output_path.resolve())
        ], stdin=PIPE)
        logger.info(f"Writing file {output_path.name}")
        out, err = ffmpeg.communicate(payload)
        if err:
            print(f"ffmpeg returned with error ({err})")
        return out

        Write unsigned 8-bit audio data to an audio file.

        :param output_path: path to write audio file
        :param payload: raw PCM samples
        :param samplerate: samplerate of the audio data
        :param output_options: ffmpeg options for output file
        
Write unsigned 8-bit audio data to an audio file.
Write unsigned 8 - bit audio data to an audio file .
def write_pcm_to_file(
            output_path: Path, payload: bytes, samplerate: int,
            output_options: List[str] = None
    ):
        output_options = output_options or []
        ffmpeg = Popen([
            'ffmpeg', '-hide_banner', '-loglevel', 'error',
            '-f', 'u8', '-ar', str(samplerate), '-i', 'pipe:',
            *output_options,
            str(output_path.resolve())
        ], stdin=PIPE)
        logger.info(f"Writing file {output_path.name}")
        out, err = ffmpeg.communicate(payload)
        if err:
            print(f"ffmpeg returned with error ({err})")
        return out
def write_pcm_to_file ( output_path : Path , payload : bytes , samplerate : int , output_options : List [ str ] = None ) : output_options = output_options or [ ] ffmpeg = Popen ( [ 'ffmpeg' , '-hide_banner' , '-loglevel' , 'error' , '-f' , 'u8' , '-ar' , str ( samplerate ) , '-i' , 'pipe:' , * output_options , str ( output_path . resolve ( ) ) ] , stdin = PIPE ) logger . info ( f"Writing file {output_path.name}" ) out , err = ffmpeg . communicate ( payload ) if err : print ( f"ffmpeg returned with error ({err})" ) return out
Write unsigned 8-bit audio data to an audio file.
Write unsigned 8 - bit audio data to an audio file .
"""
        Write unsigned 8-bit audio data to an audio file.

        :param output_path: path to write audio file
        :param payload: raw PCM samples
        :param samplerate: samplerate of the audio data
        :param output_options: ffmpeg options for output file
        """
output_path
Path
path to write audio file
path to write audio file
payload
bytes
raw PCM samples
raw PCM samples
samplerate
int
samplerate of the audio data
samplerate of the audio data
output_options
List[str]
ffmpeg options for output file
ffmpeg options for output file