speechsynthesizednetcast

Generates speech audio versions of each post in multiple audio codecs. Packages them up as netcast/podcast feeds.

To install, run nikola plugin -i speechsynthesizednetcast

Records a text-to-speech synthesized version of each post in every language. Can be embedded using the HTML5 audio element with three fallback formats, or subscribed to as a netcast/podcast.

Supports Opus, Vorbis, and optionally MP3s. Offering full web browser-support and support with every netcast aggregator. One feed is generated per format per language. Uses the FEED_LENGTH option to determine how many files to include in the netcast feeds, but audio files are generated for all posts.

Speech synthesis powered by Espeak. Pronunciation is understandable in most languages. As a free and open-source program, you can add a new or improve a language fairly easily.

Installation

System level dependencies:

  • espeak (with voice data for desired languages)
  • sox
  • flac
  • opus-tools
  • vorbis-tools

Optionally:

  • lame (see MP3 below)

Netcast

The RSS feeds for the netcasts will be available in output/netcast.{format}.rss[.lang] where format is one of the NETCAST_AUDIO_FORMATS options and .lang corespond to your TRANSLATIONS option.

HTML5 audio element

The below code example can optionally be used inside a Mako template to add an audio player on your posts.

<audio controls="controls">
  <source src="${post.permalink(lang=lang, extension='.opus')}" type="audio/opus">
  <source src="${post.permalink(lang=lang, extension='.oga')}" type="audio/ogg" codecs="vorbis">
  <source src="${post.permalink(lang=lang, extension='.mp3')}" type="audio/mpeg">
  <source src="${post.permalink(lang=lang, extension='.flac')}" type="audio/flac">
  <p>Your browser does not support audio. Download the
    <a href="${post.permalink(lang=lang, extension='.oga')}">audio file</a> locally instead.</p>
</audio>

MP3

MP3 files are not generated by default. MP3 is the audio file format with the widest support among web browsers and netcast aggregators.

Optional MP3 support in Speech Synthesized Netcast for Nikola is powered by the LAME encoder.

The below IS NOT legal advice, just a strong warning to seek it.

Virtually any distribution of MP3 files may require a paid license in your jurisdiction. These fees are for patents related to the MP3 technologies. Please seek legal counsel before beginning to distribute MP3 files. The “MP3 patents” expired in most countries in December 2012. Two notable exceptions is the United States and Japan, where they should expire by May 2017 and November 2021.

It is recommended to use the free Opus and Vorbis formats instead of MP3. At least, offer one of the free alternatives so that MP3 eventually can be put to rest. Learn more at PlayOgg.

Suggested Configuration:

# Set NETCAST_INTRO (translatable) and NETCAST_OUTRO (translatable) to configure
# the introduction and outro texts read before and after each recording. Take care
# to configure the correct languages for your site and posts. Otherwise, pronunciation
# will be terrible. The following options are available in these strings:
#     {title} -     Post title (translated)
#     {date} -      Post date
#     {author} -    Post author (translated)
#     {permalink} - Post link (without scheme due to readability)

NETCAST_INTRO = {
    DEFAULT_LANG: (
        "Hello. Now reading the blog post titled, {title}. By {author}. Published on {date}."
    ),
    "nb" = "Hallo. Leser nå bloggposten, {title}. Av {author}. Publisert på {date}."
}

NETCAST_OUTRO = {
    DEFAULT_LANG: (
        "Thank you for listening. The written version of this program is available at {permalink} . Where you might find additional visual content, reader commentary, and more."
    ),
    "nb" = "Takk for å du hørte på. En skriftlig utgave av dette programmet er tilgjengelig på {permalink} . Hvor du kan finne ekstra visuelt innhold, leserkommentarer, og mer."
}

# Produce the following audio formats and feeds. Available options are Opus,
# oga (Ogg Vorbis), and MP3. Be sure to review the MP3 section in the README file
# before enabling MP3 support.
NETCAST_AUDIO_FORMATS = ["opus", "oga"]

Issues? Questions?

You can report issues with this plugin and request help via GitHub Issues.