Skip to content

Instantly share code, notes, and snippets.

@HenryPaik1
HenryPaik1 / audio_format.py
Created August 10, 2022 06:49 — forked from HudsonHuang/audio_format.py
Convert audio data of PCM16/float32 to byte, and vice versa.
"""Helper functions for working with audio files in NumPy."""
"""some code borrowed from https://github.com/mgeier/python-audio/blob/master/audio-files/utility.py"""
import numpy as np
import contextlib
import librosa
import struct
import soundfile
def float_to_byte(sig):