Skip to content

Instantly share code, notes, and snippets.

View relativeflux's full-sized avatar

relativeflux

  • PRiSM (Practice and Research in Science and Music, RNCM)
  • Manchester, UK
View GitHub Profile
@relativeflux
relativeflux / concat_wav.py
Last active June 4, 2020 22:33
Concatenates .wav files from in a directory
'''
Concatenates .wav files from a directory. Sample rate, bit depth and channel count
of the output are inferred from the first source file.
Source files can be shuffled by passing the --shuffle argument.
'''
from __future__ import print_function
import argparse
import os
@relativeflux
relativeflux / auto-empty-google-drive-trash.md
Last active March 23, 2025 08:23
Automatically Empty Google Drive Trash

Automatically Empty Google Drive Trash

Adapted from https://www.amixa.com/blog/2019/04/05/automatically-empty-google-drive-trash/

  1. Make sure you use Google's Chrome web browser for best results.
  2. Open Chrome and go to www.google.com.
  3. Make sure you are signed into your Google account. If not, sign in.
  4. You should obviously have Google Drive account up and running.
  5. Visit https://script.google.com/home and click NEW PROJECT
  6. Clear out the default code that appears in the next window, and paste in the following:
@relativeflux
relativeflux / augment_audio.py
Last active October 25, 2020 19:17
Data augmentation for audio using audiomentations
import os
import fnmatch
import numpy as np
import argparse
import librosa
import soundfile as sf
from audiomentations import (Compose, AddGaussianNoise, TimeStretch, PitchShift, Shift)
def get_arguments():
@relativeflux
relativeflux / Audio Feature Extraction.py
Created October 18, 2021 21:54 — forked from gvyshnya/Audio Feature Extraction.py
Audio Feature Extraction from Audio Files using Librosa
def extract_feature_means(audio_file_path: str) -> pd.DataFrame:
# config settings
number_of_mfcc = c.NUMBER_OF_MFCC
# 1. Importing 1 file
y, sr = librosa.load(audio_file_path)
# Trim leading and trailing silence from an audio signal (silence before and after the actual audio)
signal, _ = librosa.effects.trim(y)