Answers for "add sound in python"

6

Play sound in python

import winsound

winsound.PlaySound('sound.wav', winsound.SND_FILENAME)
Posted by: Guest on May-04-2021
0

Create Sound with Python

import os
import glob
from pydub import AudioSegment

video_dir = 'D:/Movies/Urdu Songs/New folder'  # Path where the videos are located
extension_list = ('*.mp4', '*.flv')

os.chdir(video_dir)
for extension in extension_list:
    for video in glob.glob(extension):
        mp3_filename = os.path.splitext(os.path.basename(video))[0] + '.mp3'
        AudioSegment.from_file(video).export(mp3_filename, format='mp3')
Posted by: Guest on August-08-2021

Browse Popular Code Answers by Language