Answers for "Create Sound with Python"

15

play music from python

from playsound import playsound
playsound('audio.mp3')
Posted by: Guest on May-06-2020
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
15

play music from python

from playsound import playsound
playsound('audio.mp3')
Posted by: Guest on May-06-2020
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

Python Answers by Framework

Browse Popular Code Answers by Language