Skip to content

Instantly share code, notes, and snippets.

View naweka's full-sized avatar
🧐
Learning some things...

naweka naweka

🧐
Learning some things...
View GitHub Profile
@naweka
naweka / spectralRotation.py
Created May 19, 2024 04:01 — forked from ravarcheon/spectralRotation.py
rotates an audio file by 90 degrees in the spectrum while being a reversible process with minimal loss (only floating point errors which are like -150 dB but thats literally silence ahaha~)
import numpy as np
import soundfile as sf
from scipy.fftpack import fft, ifft
def rotateSignal(signal,flip):
if flip:
signal = signal[::-1]
x = np.concatenate((signal, signal[1:][::-1])) # concatenating the array with a reverse of itself makes it such that the fourier transform doesn't layer over a reversed version of itself in the inverse fft
rotSig = ifft(x)
@naweka
naweka / svgs_into_pdf.py
Created December 17, 2024 05:07 — forked from hellpanderrr/svgs_into_pdf.py
Convert a list of svg files into one pdf document
from PyPDF2 import PdfFileMerger
from svglib.svglib import svg2rlg
from reportlab.graphics import renderPDF
def svgs_to_pdf(file_paths=[r'C:\1.svg',r'C:\2.svg',r'C:\3.svg'], output_folder='tmp', pdf_name='test.pdf'):
"""
Convert svg files into pdfs, save pdfs in output_folder, merge them in one pdf file.
@param file_paths: full paths to svg files
@param output_folder: path to folder for saving temporary pdfs
@param pdf_name: name for resulting pdf file.