Skip to content

Instantly share code, notes, and snippets.

Screen width based styles can be applied to most classes. They are

-ns (not small > 48em)

-m (medium >48em <64em)

-l (large >64em).

Tachyons is mobile-first and small is left out as it's the default.

@hadware
hadware / bytes_to_wav.py
Last active April 26, 2024 10:50
Convert wav in bytes for to numpy ndarray, then back to bytes
from scipy.io.wavfile import read, write
import io
## This may look a bit intricate/useless, considering the fact that scipy's read() and write() function already return a
## numpy ndarray, but the BytesIO "hack" may be useful in case you get the wav not through a file, but trough some websocket or
## HTTP Post request. This should obviously work with any other sound format, as long as you have the proper decoding function
with open("input_wav.wav", "rb") as wavfile:
input_wav = wavfile.read()