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
from pydub import AudioSegment
import os
if not os.path.isdir("splitaudio"):
os.mkdir("splitaudio")
audio = AudioSegment.from_file("audio123.gsm")
lengthaudio = len(audio)
print("Length of Audio File", lengthaudio)
from pydub import AudioSegment
sound = AudioSegment.from_file("chunk.wav")
def speed_change(sound, speed):
sound_with_altered_frame_rate = sound._spawn(sound.raw_data, overrides={
"frame_rate": int(sound.frame_rate * speed)
})
from pydub import AudioSegment
sound = AudioSegment.from_file("chunk.wav")
print("----------Before Conversion--------")
print("Frame Rate", sound.frame_rate)
print("Channel", sound.channels)
print("Sample Width",sound.sample_width)
# Change Frame Rate
sound = sound.set_frame_rate(16000)
# Loading the Libraries
from scipy.io.wavfile import read
import numpy as np
import matplotlib.pyplot as plt
# Read the Audiofile
samplerate, data = read('6TU5302374.wav')
# Frame rate for the Audio
print(samplerate)
@ngbala6
ngbala6 / image_to_pixel_convert_and_store_csv.py
Created April 1, 2021 01:09
Pixel to Image Converter and Image to Pixel Converter and Store it to CSV
import numpy as np
import cv2
import pandas as pd
w =48
h = 48
# Load image
img = cv2.imread('1_0.jpg',0)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.