Skip to content

Instantly share code, notes, and snippets.

View ngbala6's full-sized avatar
🏠
Data Scientist

Bala Murugan N G ngbala6

🏠
Data Scientist
View GitHub Profile
# Import packages
from pydub import AudioSegment
from pydub.playback import play
# Play audio
playaudio = AudioSegment.from_file("bala.wav", format="wav")
play(playaudio)
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
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")
@ngbala6
ngbala6 / silenceremove.py
Last active October 21, 2022 00:40
Silence Removal using Python
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).
import os
from flask import Flask, flash, request, redirect, render_template
from werkzeug.utils import secure_filename
app=Flask(__name__)
app.secret_key = "secret key"
app.config['MAX_CONTENT_LENGTH'] = 16 * 1024 * 1024
path = os.getcwd()
@ngbala6
ngbala6 / upload.html
Last active September 25, 2021 13:12
<!doctype html>
<title>Python Flask Multiple Files Upload Example</title>
<h2>Select file to upload</h2>
<p>
{% with messages = get_flashed_messages() %}
{% if messages %}
<ul class=flashes>
{% for message in messages %}
<li>{{ message }}</li>
{% endfor %}
import os
from flask import Flask, flash, request, redirect, render_template
from werkzeug.utils import secure_filename
app=Flask(__name__)
app.secret_key = "secret key"
app.config['MAX_CONTENT_LENGTH'] = 16 * 1024 * 1024
# Get current path
<!doctype html>
<title>Python Flask Multiple Files Upload Example</title>
<h2>Select file(s) to upload</h2>
<p>
{% with messages = get_flashed_messages() %}
{% if messages %}
<ul class=flashes>
{% for message in messages %}
<li>{{ message }}</li>
{% endfor %}
import zipfile
import os
from flask import send_file,Flask,send_from_directory
app = Flask(__name__)
@app.route('/download_files')
def download_all():
# Zip file Initialization and you can change the compression type
zipfolder = zipfile.ZipFile('Audiofiles.zip','w', compression = zipfile.ZIP_STORED)
from flask import Flask,send_file,send_from_directory
app = Flask(__name__)
# The absolute path of the directory containing images for users to download
app.config["CLIENT_IMAGES"] = "E:/AudiotoText/Flask_File_Downloads/filedownload/files/image"
# The absolute path of the directory containing CSV files for users to download
app.config["CLIENT_CSV"] = "E:/AudiotoText/Flask_File_Downloads/filedownload/files/csv"