如何用Python将PDF转换为MP3。

一、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<2.0,>=1.0 in d:\programdata\anaconda3\lib\site-packages (from aiohttp>=3.8.0->edge-tts) (1.8.2)
Requirement already satisfied: multidict<7.0,>=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<5.0,>=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<4.0,>=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<2.0,>=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=&#39;Microsoft Server Speech Text to Speech Voice (zh-CN, XiaoxiaoNeural)&#39;) -> 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 = &#39;d:\\python_csdn\\files\\&#39;
    filename = &#39;道德经.pdf&#39;
    pdf_path = rootdir+filename
    announcer=&#39;Microsoft Server Speech Text to Speech Voice (zh-CN, XiaoxiaoNeural)&#39;

    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)+&#39;.txt&#39;
                if len(textdata)>0:
                    with open(txt_path ,&#39;a&#39;,encoding=&#39;utf-8&#39;) as txt:
                        txt.write(textdata)
                        print(&#39;第&#39;+str(page_num)+&#39;页:&#39;,textdata)
                        mp3_path = txt_path.split(".")[0]+&#39;.mp3&#39;
                        asyncio.run(txt2mp3(textdata,mp3_path))
                        print(&#39;第&#39;+str(page_num)+&#39;个txt文件已转音频:&#39;,mp3_path)
        print(&#39;Pdf文件共有&#39;+str(page_num)+&#39;页,已转换完成&#39;)

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

Python怎么实现PDF转MP3

四、变更播音员

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

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

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

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

总结

查看所有播音角色,执行命令:>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

以上就是如何用Python将PDF转换为MP3。的详细内容,更多请关注其它相关文章!