Last active
November 12, 2021 18:20
-
-
Save ketanhdoshi/9de725d230d6602aa5742f1f78c03c9b to your computer and use it in GitHub Desktop.
Audio Util
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math, random | |
import torch | |
import torchaudio | |
from torchaudio import transforms | |
from IPython.display import Audio | |
class AudioUtil(): | |
# ---------------------------- | |
# Load an audio file. Return the signal as a tensor and the sample rate | |
# ---------------------------- | |
@staticmethod | |
def open(audio_file): | |
sig, sr = torchaudio.load(audio_file) | |
return (sig, sr) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment