This file contains hidden or 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 collections | |
| import contextlib | |
| import sys | |
| import wave | |
| import webrtcvad | |
| def read_wave(path): | |
| """Reads a .wav file. | |
| Takes the path, and returns (PCM audio data, sample rate). |
This file contains hidden or 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 os | |
| from pydub import AudioSegment | |
| import glob | |
| # if "audio" folder not exists, it will create | |
| if not os.path.isdir("audio"): | |
| os.mkdir("audio") | |
| # Grab the Audio files in "audio" folder | |
| wavfiles = glob.glob("./audio/*.wav") |
This file contains hidden or 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
| from vad import VoiceActivityDetector | |
| # import json | |
| # Input file | |
| audiofile = "abc.wav" | |
| plotaudiosignal = VoiceActivityDetector(audiofile) | |
| # Plotting the Audio signals, so that we can identify when it is having silence in audio |
This file contains hidden or 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 packages | |
| from pydub import AudioSegment | |
| from pydub.playback import play | |
| # Play audio | |
| playaudio = AudioSegment.from_file("bala.wav", format="wav") | |
| play(playaudio) |
NewerOlder