Python: How to use pydub (playback)

How to play with pydub.

play.py


#! /usr/bin/python
#
#	play.py
#
#						Oct/06/2020
#
# ------------------------------------------------------------------
import sys
from pydub import AudioSegment
from pydub.playback import play

# ------------------------------------------------------------------
sys.stderr.write("***start***\n")
#
file_in = sys.argv[1]

audio_aa = AudioSegment.from_wav(file_in)
play(audio_aa)
#
sys.stderr.write("***End***\n")
# ------------------------------------------------------------------

Execution method

./play.py input.wav

Recommended Posts

Python: How to use pydub (playback)
Python: How to use pydub
python3: How to use bottle (2)
[Python] How to use list 1
[Python] How to use checkio
[Python] How to use input ()
How to use Python lambda
[Python] How to use virtualenv
python3: How to use bottle (3)
python3: How to use bottle
How to use Python bytes
Python: How to use async with
[Python] How to use Pandas Series
How to use Mysql in python
How to use OpenPose's Python API
How to use ChemSpider in Python
How to use FTP with Python
How to use PubChem in Python
How to use python zip function
[Python] How to use Typetalk API
[Python] Summary of how to use pandas
[Introduction to Python] How to use class in Python?
How to install and use pandas_datareader [Python]
[python] How to use __command__, function explanation
[Python] How to use import sys sys.argv
Memorandum on how to use gremlin python
[Python2.7] Summary of how to use unittest
python: How to use locals () and globals ()
How to use __slots__ in Python class
How to use "deque" for Python data
How to use Python zip and enumerate
[Python] Understand how to use recursive functions
Summary of how to use Python list
How to use regular expressions in Python
[Python2.7] Summary of how to use subprocess
How to use is and == in Python
[Blender x Python] How to use modifiers
[Question] How to use plot_surface of python
How to use xml.etree.ElementTree
How to use Python-shell
How to use tf.data
How to use virtualenv
How to use Seaboan
How to use image-match
How to install Python
How to use Pandas 2
How to use Virtualenv
How to use pytest_report_header
How to install python
How to use Bio.Phylo
How to use SymPy
How to use x-means
How to use WikiExtractor.py
How to use IPython
How to use virtualenv
How to use Matplotlib
How to use iptables
How to use numpy
How to use TokyoTechFes2015
How to use venv
How to use dictionary {}