Home >Backend Development >Python Tutorial >How to convert PDF to MP3 with Python.

How to convert PDF to MP3 with Python.

王林
王林forward
2023-05-09 10:16:082160browse

一、PDF转为MP3 

我们平常看到很多文件都是PDF格式,网上的各类书籍多为此格式。有时候不方便阅读,或者怕费眼睛伤颈椎,那么有没有一种方法可以把它变为音频,这样上下班路上也就可以听一听。

这里做个科普,什么是TTS?TTS(Text To Speech,文本转语音)是语音合成应用的一种,它将储存于电脑中的文件,如帮助文件或者网页,转换成自然语音输出。edge-tts就是将微软的语音合成技术,他是将edge浏览器里提供的tts打包成Python第三方包,这样就可以免费调用微软的语音合成技术。

二、准备工作

将PDF转为音频MP3文件,需要两步。第一步,将pdf转为txt文本;第二步,将txt转为音频。所以我们需要以下两个库。

1. 安装pdfplumber包,用于将pdf转为txt

(base) C:\Users\Administrator>pip install pdfplumber
Collecting pdfplumber
  Downloading pdfplumber-0.9.0-py3-none-any.whl (46 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 46.1/46.1 kB 385.4 kB/s eta 0:00:00
Collecting pdfminer.six==20221105
  Downloading pdfminer.six-20221105-py3-none-any.whl (5.6 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 5.6/5.6 MB 8.1 MB/s eta 0:00:00
Collecting Wand>=0.6.10
  Downloading Wand-0.6.11-py2.py3-none-any.whl (143 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.6/143.6 kB ? eta 0:00:00
Requirement already satisfied: Pillow>=9.1 in d:\programdata\anaconda3\lib\site-packages (from pdfplumber) (9.4.0)
Requirement already satisfied: charset-normalizer>=2.0.0 in d:\programdata\anaconda3\lib\site-packages (from pdfminer.six==20221105->pdfplumber) (2.0.4)
Requirement already satisfied: cryptography>=36.0.0 in d:\programdata\anaconda3\lib\site-packages (from pdfminer.six==20221105->pdfplumber) (39.0.1)
Requirement already satisfied: cffi>=1.12 in d:\programdata\anaconda3\lib\site-packages (from cryptography>=36.0.0->pdfminer.six==20221105->pdfplumber) (1.15.1)
Requirement already satisfied: pycparser in d:\programdata\anaconda3\lib\site-packages (from cffi>=1.12->cryptography>=36.0.0->pdfminer.six==20221105->pdfplumber) (2.21)
Installing collected packages: Wand, pdfminer.six, pdfplumber
Successfully installed Wand-0.6.11 pdfminer.six-20221105 pdfplumber-0.9.0

2. 安装edge-tts包,用于将txt转为音频

(base) C:\Users\Administrator>pip install edge-tts
Collecting edge-tts
  Downloading edge_tts-6.1.5-py3-none-any.whl (27 kB)
Requirement already satisfied: aiohttp>=3.8.0 in d:\programdata\anaconda3\lib\site-packages (from edge-tts) (3.8.4)
Requirement already satisfied: yarl=1.0 in d:\programdata\anaconda3\lib\site-packages (from aiohttp>=3.8.0->edge-tts) (1.8.2)
Requirement already satisfied: multidict=4.5 in d:\programdata\anaconda3\lib\site-packages (from aiohttp>=3.8.0->edge-tts) (6.0.4)
Requirement already satisfied: frozenlist>=1.1.1 in d:\programdata\anaconda3\lib\site-packages (from aiohttp>=3.8.0->edge-tts) (1.3.3)
Requirement already satisfied: attrs>=17.3.0 in d:\programdata\anaconda3\lib\site-packages (from aiohttp>=3.8.0->edge-tts) (22.1.0)
Requirement already satisfied: async-timeout=4.0.0a3 in d:\programdata\anaconda3\lib\site-packages (from aiohttp>=3.8.0->edge-tts) (4.0.2)
Requirement already satisfied: aiosignal>=1.1.2 in d:\programdata\anaconda3\lib\site-packages (from aiohttp>=3.8.0->edge-tts) (1.3.1)
Requirement already satisfied: charset-normalizer=2.0 in d:\programdata\anaconda3\lib\site-packages (from aiohttp>=3.8.0->edge-tts) (2.0.4)
Requirement already satisfied: idna>=2.0 in d:\programdata\anaconda3\lib\site-packages (from yarl=1.0->aiohttp>=3.8.0->edge-tts) (3.4)
Installing collected packages: edge-tts
Successfully installed edge-tts-6.1.5

三、代码很简单

# -*- coding: utf-8 -*-

import pdfplumber
import asyncio  
import os
import edge_tts  
from edge_tts import VoicesManager  

async def txt2mp3(txt,mp3,announcer='Microsoft Server Speech Text to Speech Voice (zh-CN, XiaoxiaoNeural)') -> None:
    # 将文本转换为mp3音频
    communicate = edge_tts.Communicate(txt, announcer)  
    await communicate.save(mp3)

async def get_announcer(Gender="Female", Language="zh"):
    voices = await VoicesManager.create()  
    voice = voices.find(Gender=Gender, Language=Language)
    print(voice)

if __name__ == "__main__":  

    rootdir = 'd:\\python_csdn\\files\\'
    filename = '道德经.pdf'
    pdf_path = rootdir+filename
    announcer='Microsoft Server Speech Text to Speech Voice (zh-CN, XiaoxiaoNeural)'

    if 0:
        # 查看可用播音角色(性别女性,语言为中文)
        asyncio.run(get_announcer(Gender="Female", Language="zh"))
        
    if 1:
        # 读取pdf并提取文本到txt文件,并将其内容转为mp3音频文件。
        page_num = 0
        with pdfplumber.open(pdf_path) as pdf:
            for page in pdf.pages:
                textdata = page.extract_text().replace("\n", "")#提取文字后删除末尾换行,以免转音频卡顿
                page_num += 1
                txt_path = pdf_path.split(".")[0]+"{:03d}".format(page_num)+'.txt'
                if len(textdata)>0:
                    with open(txt_path ,'a',encoding='utf-8') as txt:
                        txt.write(textdata)
                        print('第'+str(page_num)+'页:',textdata)
                        mp3_path = txt_path.split(".")[0]+'.mp3'
                        asyncio.run(txt2mp3(textdata,mp3_path))
                        print('第'+str(page_num)+'个txt文件已转音频:',mp3_path)
        print('Pdf文件共有'+str(page_num)+'页,已转换完成')

很快就搞定啦,见下图。以后再想听PDF就把上面代码跑起来!

How to convert PDF to MP3 with Python.

四、变更播音员

在以上程序中修改以下代码if条件为1,即可查看可用播音角色。

    if 1:
        # 查看可用播音角色(性别女性,语言为中文),男性Gender="Male"
        asyncio.run(get_announcer(Gender="Female", Language="zh"))

运行后结果为一个list,通过json格式化后,如下所示。变更播音员只需要使用Name值替换前面announcer值即可。是不是很简单?

[{
    'Name': 'Microsoft Server Speech Text to Speech Voice (zh-HK, HiuGaaiNeural)',
    'ShortName': 'zh-HK-HiuGaaiNeural',
    'Gender': 'Female',
    'Locale': 'zh-HK',
    'SuggestedCodec': 'audio-24khz-48kbitrate-mono-mp3',
    'FriendlyName': 'Microsoft HiuGaai Online (Natural) - Chinese (Cantonese Traditional)',
    'Status': 'GA',
    'VoiceTag': {
        'ContentCategories': ['General'],
        'VoicePersonalities': ['Friendly', 'Positive']
    },
    'Language': 'zh'
}, {
    'Name': 'Microsoft Server Speech Text to Speech Voice (zh-HK, HiuMaanNeural)',
    'ShortName': 'zh-HK-HiuMaanNeural',
    'Gender': 'Female',
    'Locale': 'zh-HK',
    'SuggestedCodec': 'audio-24khz-48kbitrate-mono-mp3',
    'FriendlyName': 'Microsoft HiuMaan Online (Natural) - Chinese (Hong Kong)',
    'Status': 'GA',
    'VoiceTag': {
        'ContentCategories': ['General'],
        'VoicePersonalities': ['Friendly', 'Positive']
    },
    'Language': 'zh'
}, {
    'Name': 'Microsoft Server Speech Text to Speech Voice (zh-CN, XiaoxiaoNeural)',
    'ShortName': 'zh-CN-XiaoxiaoNeural',
    'Gender': 'Female',
    'Locale': 'zh-CN',
    'SuggestedCodec': 'audio-24khz-48kbitrate-mono-mp3',
    'FriendlyName': 'Microsoft Xiaoxiao Online (Natural) - Chinese (Mainland)',
    'Status': 'GA',
    'VoiceTag': {
        'ContentCategories': ['News', 'Novel'],
        'VoicePersonalities': ['Warm']
    },
    'Language': 'zh'
}, {
    'Name': 'Microsoft Server Speech Text to Speech Voice (zh-CN, XiaoyiNeural)',
    'ShortName': 'zh-CN-XiaoyiNeural',
    'Gender': 'Female',
    'Locale': 'zh-CN',
    'SuggestedCodec': 'audio-24khz-48kbitrate-mono-mp3',
    'FriendlyName': 'Microsoft Xiaoyi Online (Natural) - Chinese (Mainland)',
    'Status': 'GA',
    'VoiceTag': {
        'ContentCategories': ['Cartoon', 'Novel'],
        'VoicePersonalities': ['Lively']
    },
    'Language': 'zh'
}, {
    'Name': 'Microsoft Server Speech Text to Speech Voice (zh-CN-liaoning, XiaobeiNeural)',
    'ShortName': 'zh-CN-liaoning-XiaobeiNeural',
    'Gender': 'Female',
    'Locale': 'zh-CN-liaoning',
    'SuggestedCodec': 'audio-24khz-48kbitrate-mono-mp3',
    'FriendlyName': 'Microsoft Xiaobei Online (Natural) - Chinese (Northeastern Mandarin)',
    'Status': 'GA',
    'VoiceTag': {
        'ContentCategories': ['Dialect'],
        'VoicePersonalities': ['Humorous']
    },
    'Language': 'zh'
}, {
    'Name': 'Microsoft Server Speech Text to Speech Voice (zh-TW, HsiaoChenNeural)',
    'ShortName': 'zh-TW-HsiaoChenNeural',
    'Gender': 'Female',
    'Locale': 'zh-TW',
    'SuggestedCodec': 'audio-24khz-48kbitrate-mono-mp3',
    'FriendlyName': 'Microsoft HsiaoChen Online (Natural) - Chinese (Taiwan)',
    'Status': 'GA',
    'VoiceTag': {
        'ContentCategories': ['General'],
        'VoicePersonalities': ['Friendly', 'Positive']
    },
    'Language': 'zh'
}, {
    'Name': 'Microsoft Server Speech Text to Speech Voice (zh-TW, HsiaoYuNeural)',
    'ShortName': 'zh-TW-HsiaoYuNeural',
    'Gender': 'Female',
    'Locale': 'zh-TW',
    'SuggestedCodec': 'audio-24khz-48kbitrate-mono-mp3',
    'FriendlyName': 'Microsoft HsiaoYu Online (Natural) - Chinese (Taiwanese Mandarin)',
    'Status': 'GA',
    'VoiceTag': {
        'ContentCategories': ['General'],
        'VoicePersonalities': ['Friendly', 'Positive']
    },
    'Language': 'zh'
}, {
    'Name': 'Microsoft Server Speech Text to Speech Voice (zh-CN-shaanxi, XiaoniNeural)',
    'ShortName': 'zh-CN-shaanxi-XiaoniNeural',
    'Gender': 'Female',
    'Locale': 'zh-CN-shaanxi',
    'SuggestedCodec': 'audio-24khz-48kbitrate-mono-mp3',
    'FriendlyName': 'Microsoft Xiaoni Online (Natural) - Chinese (Zhongyuan Mandarin Shaanxi)',
    'Status': 'GA',
    'VoiceTag': {
        'ContentCategories': ['Dialect'],
        'VoicePersonalities': ['Bright']
    },
    'Language': 'zh'
}]

总结

查看所有播音角色,执行命令:>edge-tts --list-voices

(base) C:\Users\Administrator>edge-tts --list-voices
Name: af-ZA-AdriNeural
Gender: Female
Name: af-ZA-WillemNeural
Gender: Male
Name: am-ET-AmehaNeural
Gender: Male
Name: am-ET-MekdesNeural
Gender: Female
Name: ar-AE-FatimaNeural
Gender: Female
Name: ar-AE-HamdanNeural
Gender: Male
Name: ar-BH-AliNeural
Gender: Male
Name: ar-BH-LailaNeural
Gender: Female
Name: ar-DZ-AminaNeural
Gender: Female
Name: ar-DZ-IsmaelNeural
Gender: Male
Name: ar-EG-SalmaNeural
Gender: Female
Name: ar-EG-ShakirNeural
Gender: Male
Name: ar-IQ-BasselNeural
Gender: Male
Name: ar-IQ-RanaNeural
Gender: Female
Name: ar-JO-SanaNeural
Gender: Female
Name: ar-JO-TaimNeural
Gender: Male
Name: ar-KW-FahedNeural
Gender: Male
Name: ar-KW-NouraNeural
Gender: Female
Name: ar-LB-LaylaNeural
Gender: Female
Name: ar-LB-RamiNeural
Gender: Male
Name: ar-LY-ImanNeural
Gender: Female
Name: ar-LY-OmarNeural
Gender: Male
Name: ar-MA-JamalNeural
Gender: Male
Name: ar-MA-MounaNeural
Gender: Female
Name: ar-OM-AbdullahNeural
Gender: Male
Name: ar-OM-AyshaNeural
Gender: Female
Name: ar-QA-AmalNeural
Gender: Female
Name: ar-QA-MoazNeural
Gender: Male
Name: ar-SA-HamedNeural
Gender: Male
Name: ar-SA-ZariyahNeural
Gender: Female
Name: ar-SY-AmanyNeural
Gender: Female
Name: ar-SY-LaithNeural
Gender: Male
Name: ar-TN-HediNeural
Gender: Male
Name: ar-TN-ReemNeural
Gender: Female
Name: ar-YE-MaryamNeural
Gender: Female
Name: ar-YE-SalehNeural
Gender: Male
Name: az-AZ-BabekNeural
Gender: Male
Name: az-AZ-BanuNeural
Gender: Female
Name: bg-BG-BorislavNeural
Gender: Male
Name: bg-BG-KalinaNeural
Gender: Female
Name: bn-BD-NabanitaNeural
Gender: Female
Name: bn-BD-PradeepNeural
Gender: Male
Name: bn-IN-BashkarNeural
Gender: Male
Name: bn-IN-TanishaaNeural
Gender: Female
Name: bs-BA-GoranNeural
Gender: Male
Name: bs-BA-VesnaNeural
Gender: Female
Name: ca-ES-EnricNeural
Gender: Male
Name: ca-ES-JoanaNeural
Gender: Female
Name: cs-CZ-AntoninNeural
Gender: Male
Name: cs-CZ-VlastaNeural
Gender: Female
Name: cy-GB-AledNeural
Gender: Male
Name: cy-GB-NiaNeural
Gender: Female
Name: da-DK-ChristelNeural
Gender: Female
Name: da-DK-JeppeNeural
Gender: Male
Name: de-AT-IngridNeural
Gender: Female
Name: de-AT-JonasNeural
Gender: Male
Name: de-CH-JanNeural
Gender: Male
Name: de-CH-LeniNeural
Gender: Female
Name: de-DE-AmalaNeural
Gender: Female
Name: de-DE-ConradNeural
Gender: Male
Name: de-DE-KatjaNeural
Gender: Female
Name: de-DE-KillianNeural
Gender: Male
Name: el-GR-AthinaNeural
Gender: Female
Name: el-GR-NestorasNeural
Gender: Male
Name: en-AU-NatashaNeural
Gender: Female
Name: en-AU-WilliamNeural
Gender: Male
Name: en-CA-ClaraNeural
Gender: Female
Name: en-CA-LiamNeural
Gender: Male
Name: en-GB-LibbyNeural
Gender: Female
Name: en-GB-MaisieNeural
Gender: Female
Name: en-GB-RyanNeural
Gender: Male
Name: en-GB-SoniaNeural
Gender: Female
Name: en-GB-ThomasNeural
Gender: Male
Name: en-HK-SamNeural
Gender: Male
Name: en-HK-YanNeural
Gender: Female
Name: en-IE-ConnorNeural
Gender: Male
Name: en-IE-EmilyNeural
Gender: Female
Name: en-IN-NeerjaExpressiveNeural
Gender: Female
Name: en-IN-NeerjaNeural
Gender: Female
Name: en-IN-PrabhatNeural
Gender: Male
Name: en-KE-AsiliaNeural
Gender: Female
Name: en-KE-ChilembaNeural
Gender: Male
Name: en-NG-AbeoNeural
Gender: Male
Name: en-NG-EzinneNeural
Gender: Female
Name: en-NZ-MitchellNeural
Gender: Male
Name: en-NZ-MollyNeural
Gender: Female
Name: en-PH-JamesNeural
Gender: Male
Name: en-PH-RosaNeural
Gender: Female
Name: en-SG-LunaNeural
Gender: Female
Name: en-SG-WayneNeural
Gender: Male
Name: en-TZ-ElimuNeural
Gender: Male
Name: en-TZ-ImaniNeural
Gender: Female
Name: en-US-AnaNeural
Gender: Female
Name: en-US-AriaNeural
Gender: Female
Name: en-US-ChristopherNeural
Gender: Male
Name: en-US-EricNeural
Gender: Male
Name: en-US-GuyNeural
Gender: Male
Name: en-US-JennyNeural
Gender: Female
Name: en-US-MichelleNeural
Gender: Female
Name: en-US-RogerNeural
Gender: Male
Name: en-US-SteffanNeural
Gender: Male
Name: en-ZA-LeahNeural
Gender: Female
Name: en-ZA-LukeNeural
Gender: Male
Name: es-AR-ElenaNeural
Gender: Female
Name: es-AR-TomasNeural
Gender: Male
Name: es-BO-MarceloNeural
Gender: Male
Name: es-BO-SofiaNeural
Gender: Female
Name: es-CL-CatalinaNeural
Gender: Female
Name: es-CL-LorenzoNeural
Gender: Male
Name: es-CO-GonzaloNeural
Gender: Male
Name: es-CO-SalomeNeural
Gender: Female
Name: es-CR-JuanNeural
Gender: Male
Name: es-CR-MariaNeural
Gender: Female
Name: es-CU-BelkysNeural
Gender: Female
Name: es-CU-ManuelNeural
Gender: Male
Name: es-DO-EmilioNeural
Gender: Male
Name: es-DO-RamonaNeural
Gender: Female
Name: es-EC-AndreaNeural
Gender: Female
Name: es-EC-LuisNeural
Gender: Male
Name: es-ES-AlvaroNeural
Gender: Male
Name: es-ES-ElviraNeural
Gender: Female
Name: es-GQ-JavierNeural
Gender: Male
Name: es-GQ-TeresaNeural
Gender: Female
Name: es-GT-AndresNeural
Gender: Male
Name: es-GT-MartaNeural
Gender: Female
Name: es-HN-CarlosNeural
Gender: Male
Name: es-HN-KarlaNeural
Gender: Female
Name: es-MX-DaliaNeural
Gender: Female
Name: es-MX-JorgeNeural
Gender: Male
Name: es-NI-FedericoNeural
Gender: Male
Name: es-NI-YolandaNeural
Gender: Female
Name: es-PA-MargaritaNeural
Gender: Female
Name: es-PA-RobertoNeural
Gender: Male
Name: es-PE-AlexNeural
Gender: Male
Name: es-PE-CamilaNeural
Gender: Female
Name: es-PR-KarinaNeural
Gender: Female
Name: es-PR-VictorNeural
Gender: Male
Name: es-PY-MarioNeural
Gender: Male
Name: es-PY-TaniaNeural
Gender: Female
Name: es-SV-LorenaNeural
Gender: Female
Name: es-SV-RodrigoNeural
Gender: Male
Name: es-US-AlonsoNeural
Gender: Male
Name: es-US-PalomaNeural
Gender: Female
Name: es-UY-MateoNeural
Gender: Male
Name: es-UY-ValentinaNeural
Gender: Female
Name: es-VE-PaolaNeural
Gender: Female
Name: es-VE-SebastianNeural
Gender: Male
Name: et-EE-AnuNeural
Gender: Female
Name: et-EE-KertNeural
Gender: Male
Name: fa-IR-DilaraNeural
Gender: Female
Name: fa-IR-FaridNeural
Gender: Male
Name: fi-FI-HarriNeural
Gender: Male
Name: fi-FI-NooraNeural
Gender: Female
Name: fil-PH-AngeloNeural
Gender: Male
Name: fil-PH-BlessicaNeural
Gender: Female
Name: fr-BE-CharlineNeural
Gender: Female
Name: fr-BE-GerardNeural
Gender: Male
Name: fr-CA-AntoineNeural
Gender: Male
Name: fr-CA-JeanNeural
Gender: Male
Name: fr-CA-SylvieNeural
Gender: Female
Name: fr-CH-ArianeNeural
Gender: Female
Name: fr-CH-FabriceNeural
Gender: Male
Name: fr-FR-DeniseNeural
Gender: Female
Name: fr-FR-EloiseNeural
Gender: Female
Name: fr-FR-HenriNeural
Gender: Male
Name: ga-IE-ColmNeural
Gender: Male
Name: ga-IE-OrlaNeural
Gender: Female
Name: gl-ES-RoiNeural
Gender: Male
Name: gl-ES-SabelaNeural
Gender: Female
Name: gu-IN-DhwaniNeural
Gender: Female
Name: gu-IN-NiranjanNeural
Gender: Male
Name: he-IL-AvriNeural
Gender: Male
Name: he-IL-HilaNeural
Gender: Female
Name: hi-IN-MadhurNeural
Gender: Male
Name: hi-IN-SwaraNeural
Gender: Female
Name: hr-HR-GabrijelaNeural
Gender: Female
Name: hr-HR-SreckoNeural
Gender: Male
Name: hu-HU-NoemiNeural
Gender: Female
Name: hu-HU-TamasNeural
Gender: Male
Name: id-ID-ArdiNeural
Gender: Male
Name: id-ID-GadisNeural
Gender: Female
Name: is-IS-GudrunNeural
Gender: Female
Name: is-IS-GunnarNeural
Gender: Male
Name: it-IT-DiegoNeural
Gender: Male
Name: it-IT-ElsaNeural
Gender: Female
Name: it-IT-IsabellaNeural
Gender: Female
Name: ja-JP-KeitaNeural
Gender: Male
Name: ja-JP-NanamiNeural
Gender: Female
Name: jv-ID-DimasNeural
Gender: Male
Name: jv-ID-SitiNeural
Gender: Female
Name: ka-GE-EkaNeural
Gender: Female
Name: ka-GE-GiorgiNeural
Gender: Male
Name: kk-KZ-AigulNeural
Gender: Female
Name: kk-KZ-DauletNeural
Gender: Male
Name: km-KH-PisethNeural
Gender: Male
Name: km-KH-SreymomNeural
Gender: Female
Name: kn-IN-GaganNeural
Gender: Male
Name: kn-IN-SapnaNeural
Gender: Female
Name: ko-KR-InJoonNeural
Gender: Male
Name: ko-KR-SunHiNeural
Gender: Female
Name: lo-LA-ChanthavongNeural
Gender: Male
Name: lo-LA-KeomanyNeural
Gender: Female
Name: lt-LT-LeonasNeural
Gender: Male
Name: lt-LT-OnaNeural
Gender: Female
Name: lv-LV-EveritaNeural
Gender: Female
Name: lv-LV-NilsNeural
Gender: Male
Name: mk-MK-AleksandarNeural
Gender: Male
Name: mk-MK-MarijaNeural
Gender: Female
Name: ml-IN-MidhunNeural
Gender: Male
Name: ml-IN-SobhanaNeural
Gender: Female
Name: mn-MN-BataaNeural
Gender: Male
Name: mn-MN-YesuiNeural
Gender: Female
Name: mr-IN-AarohiNeural
Gender: Female
Name: mr-IN-ManoharNeural
Gender: Male
Name: ms-MY-OsmanNeural
Gender: Male
Name: ms-MY-YasminNeural
Gender: Female
Name: mt-MT-GraceNeural
Gender: Female
Name: mt-MT-JosephNeural
Gender: Male
Name: my-MM-NilarNeural
Gender: Female
Name: my-MM-ThihaNeural
Gender: Male
Name: nb-NO-FinnNeural
Gender: Male
Name: nb-NO-PernilleNeural
Gender: Female
Name: ne-NP-HemkalaNeural
Gender: Female
Name: ne-NP-SagarNeural
Gender: Male
Name: nl-BE-ArnaudNeural
Gender: Male
Name: nl-BE-DenaNeural
Gender: Female
Name: nl-NL-ColetteNeural
Gender: Female
Name: nl-NL-FennaNeural
Gender: Female
Name: nl-NL-MaartenNeural
Gender: Male
Name: pl-PL-MarekNeural
Gender: Male
Name: pl-PL-ZofiaNeural
Gender: Female
Name: ps-AF-GulNawazNeural
Gender: Male
Name: ps-AF-LatifaNeural
Gender: Female
Name: pt-BR-AntonioNeural
Gender: Male
Name: pt-BR-FranciscaNeural
Gender: Female
Name: pt-PT-DuarteNeural
Gender: Male
Name: pt-PT-RaquelNeural
Gender: Female
Name: ro-RO-AlinaNeural
Gender: Female
Name: ro-RO-EmilNeural
Gender: Male
Name: ru-RU-DmitryNeural
Gender: Male
Name: ru-RU-SvetlanaNeural
Gender: Female
Name: si-LK-SameeraNeural
Gender: Male
Name: si-LK-ThiliniNeural
Gender: Female
Name: sk-SK-LukasNeural
Gender: Male
Name: sk-SK-ViktoriaNeural
Gender: Female
Name: sl-SI-PetraNeural
Gender: Female
Name: sl-SI-RokNeural
Gender: Male
Name: so-SO-MuuseNeural
Gender: Male
Name: so-SO-UbaxNeural
Gender: Female
Name: sq-AL-AnilaNeural
Gender: Female
Name: sq-AL-IlirNeural
Gender: Male
Name: sr-RS-NicholasNeural
Gender: Male
Name: sr-RS-SophieNeural
Gender: Female
Name: su-ID-JajangNeural
Gender: Male
Name: su-ID-TutiNeural
Gender: Female
Name: sv-SE-MattiasNeural
Gender: Male
Name: sv-SE-SofieNeural
Gender: Female
Name: sw-KE-RafikiNeural
Gender: Male
Name: sw-KE-ZuriNeural
Gender: Female
Name: sw-TZ-DaudiNeural
Gender: Male
Name: sw-TZ-RehemaNeural
Gender: Female
Name: ta-IN-PallaviNeural
Gender: Female
Name: ta-IN-ValluvarNeural
Gender: Male
Name: ta-LK-KumarNeural
Gender: Male
Name: ta-LK-SaranyaNeural
Gender: Female
Name: ta-MY-KaniNeural
Gender: Female
Name: ta-MY-SuryaNeural
Gender: Male
Name: ta-SG-AnbuNeural
Gender: Male
Name: ta-SG-VenbaNeural
Gender: Female
Name: te-IN-MohanNeural
Gender: Male
Name: te-IN-ShrutiNeural
Gender: Female
Name: th-TH-NiwatNeural
Gender: Male
Name: th-TH-PremwadeeNeural
Gender: Female
Name: tr-TR-AhmetNeural
Gender: Male
Name: tr-TR-EmelNeural
Gender: Female
Name: uk-UA-OstapNeural
Gender: Male
Name: uk-UA-PolinaNeural
Gender: Female
Name: ur-IN-GulNeural
Gender: Female
Name: ur-IN-SalmanNeural
Gender: Male
Name: ur-PK-AsadNeural
Gender: Male
Name: ur-PK-UzmaNeural
Gender: Female
Name: uz-UZ-MadinaNeural
Gender: Female
Name: uz-UZ-SardorNeural
Gender: Male
Name: vi-VN-HoaiMyNeural
Gender: Female
Name: vi-VN-NamMinhNeural
Gender: Male
Name: zh-CN-XiaoxiaoNeural
Gender: Female
Name: zh-CN-XiaoyiNeural
Gender: Female
Name: zh-CN-YunjianNeural
Gender: Male
Name: zh-CN-YunxiNeural
Gender: Male
Name: zh-CN-YunxiaNeural
Gender: Male
Name: zh-CN-YunyangNeural
Gender: Male
Name: zh-CN-liaoning-XiaobeiNeural
Gender: Female
Name: zh-CN-shaanxi-XiaoniNeural
Gender: Female
Name: zh-HK-HiuGaaiNeural
Gender: Female
Name: zh-HK-HiuMaanNeural
Gender: Female
Name: zh-HK-WanLungNeural
Gender: Male
Name: zh-TW-HsiaoChenNeural
Gender: Female
Name: zh-TW-HsiaoYuNeural
Gender: Female
Name: zh-TW-YunJheNeural
Gender: Male
Name: zu-ZA-ThandoNeural
Gender: Female
Name: zu-ZA-ThembaNeural
Gender: Male

The above is the detailed content of How to convert PDF to MP3 with Python.. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:yisu.com. If there is any infringement, please contact admin@php.cn delete