Skip to content

Instantly share code, notes, and snippets.

View digizimm's full-sized avatar
👾

Danny digizimm

👾
View GitHub Profile
@digizimm
digizimm / audio_format.py
Created August 29, 2024 13:55 — 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):