Extension:Phonos
Phonos Release status: beta |
|
---|---|
Implementation | Tag |
Description | Text to speech parser |
Author(s) | Community Tech Team |
Latest version | 0.1.0 |
Compatibility policy | Master maintains backward compatibility. |
MediaWiki | >= 1.42 |
Database changes | No |
License | GNU General Public License 2.0 or later |
Download | README |
Help | Help:Extension:Phonos |
|
|
{{#phonos:}} |
|
Quarterly downloads | Lua error in Module:Extension at line 172: bad argument #1 to 'inNamespace' (unrecognized namespace name 'skin'). |
Public wikis using | Lua error in Module:Extension at line 172: bad argument #1 to 'inNamespace' (unrecognized namespace name 'skin'). |
Translate the Phonos extension if it is available at translatewiki.net | |
Issues | Open tasks · Report a bug |
The Phonos extension is a Community Tech project for implementing the Audio links that play on click wish, and later the IPA Audio Renderer wish, from the 2022 Community Wishlist Survey.
Installation
- <translate> [[<tvar name=2>Special:ExtensionDistributor/Phonos</tvar>|Download]] and move the extracted <tvar name=name>
Phonos
</tvar> folder to your <tvar name=ext>extensions/
</tvar> directory.</translate>
<translate> Developers and code contributors should install the extension [[<tvar name=git>Special:MyLanguage/Download from Git</tvar>|from Git]] instead, using:</translate>cd extensions/
git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/Phonos - <translate> Only when installing from Git, run <tvar name=composer>Composer</tvar> to install PHP dependencies, by issuing <tvar name=code>
composer install --no-dev
</tvar> in the extension directory.</translate> <translate> (See <tvar name=phab><translate> task <tvar name=1>T173141</tvar></translate></tvar> for potential complications.)</translate> - <translate> Add the following code at the bottom of your <tvar name=1>LocalSettings.php </tvar> file:</translate>
wfLoadExtension( 'Phonos' );
- If you're using the eSpeak or Larnyx engines, you will need to install Lame on your system, and set
$wgPhonosLame
accordingly. - File:OOjs UI icon check-constructive.svg <translate> Done</translate> – <translate> Navigate to <tvar name=special>Special:Version</tvar> on your wiki to verify that the extension is successfully installed.</translate>
Configuration parameters
- $wgPhonosEngine
- Which engine to use. One of
espeak
(default),larynx
, orgoogle
. - $wgPhonosApiEndpointLarynx
- The API endpoint to use for the Larynx engine.
- $wgPhonosApiEndpointGoogle
- The API endpoint to use for the Google engine.
- $wgPhonosApiKeyGoogle
- The API key for the Google engine.
- $wgPhonosApiProxy
- HTTP proxy to use for API requests. If not set, $wgHTTPProxy will be used.
- $wgPhonosFileBackend
- Which file backend to use for caching. Defaults to a custom Phonos backend using FSFileBackend.
- $wgPhonosFileBackendDirectory
- Which directory to use for file caching, if $wgPhonosFileBackend is
false
. Defaults to $wgUploadDirectory. - $wgPhonosEspeak
- Path to the eSpeak executable. Defaults to
/usr/bin/espeak
- $wgPhonosLame
- Path to the Lame executable used for converting WAV to MP3. Defaults to
/usr/bin/lame
- $wgPhonosPath
- Relative URL path to where Phonos files are publicly available. Defaults to
"$wgUploadPath/$wgDBname-phonos"
- $wgPhonosWikibaseUrl
- The URL to a Wikibase installation, including the $wgArticlePath and trailing slash.
- $wgPhonosWikibaseProperties
- An object containing the following:
- wikibasePronunciationAudioProp: Property for pronunciation audio.
- wikibaseLangNameProp: Property for language of work or name.
- wikibaseIETFLangTagProp: Property for IETF language tag.
- $wgPhonosCommonsMediaUrl
- URL to Special:FilePath on a shared media repository including the trailing slash.
- $wgPhonosInlineAudioPlayerMode
- Disables IPA rendering and only allows playing of existing audio from Commons
Usage
For all usage information, see the extension's help page.
Maintenance
Phonos does not automatically delete files that have become orphaned. Over time, these files can build up and needlessly occupy space on your file system. To assist with this problem, Phonos offers two maintenance scripts:
countOrphanedFiles.php
This script will count orphaned files. You can pass the --delete
flag to also delete the files.
On wiki farms you can use the --wikis
flag to specify which wikis to process, passing in the global IDs (database names).
If not provided, the script will loop through all wikis as specified in the sites table, and process any where Phonos is installed.
If the sites table is not populated,[1] the script will act only on the current wiki.
deleteOldPhonosFiles.php
This script will delete all Phonos files created before the date specified with the --date
option. This is useful if you for instance changed the engine, and want to force recreation of Phonos files.
Adding a new TTS engine to Phonos
Phonos was designed to be agnostic to the engine used. The only requirement for TTS engines is that they accept SSML.
Create a new subclass of Engine
and implement the required methods. Note that Engine::getSupportedLanguages()
returns null
by default. If there is a way to programmatically fetch (or even hard code) the list of languages, this method should be overridden in the new subclass.
If the engine doesn't produce output in MP3 format, then Lame should be used to convert the file to MP3,[2] such that getAudioData()
returns only raw MP3 data. That method should also be responsible for persisting the file to disk using Engine::persistAudio()
.
Metrics and instrumentation
Various metrics are collected and stored in statsv, while errors in Phonos processing are stored with statsd:
- https://w.wiki/6Zno – production dashboard
- https://w.wiki/6Znm – beta cluster
The click and replay events are logged by PhonosButton.prototype.track()
, which can be used to track more things as desired. See phab:T315091 for more details.
On the backend, anything that throws a PhonosException
during processing will be captured and recorded on the above dashboards. The responsible pages are also categorized in the category "⧼phonos-error-category⧽", as specified by the MediaWiki:Phonos-error-category interface page.
Notes
- ↑ See Manual:addSite.php and managing the sites table for more information
- ↑ You can use
Engine::convertWavToMp3()
which despite the name should work for a number of formats and not just WAV.
File:Wikimedia-logo black.svg | <translate> This {{<tvar name=1>#ifeq:Extension|Extension</tvar>|extension|skin}} is being used on one or more [[<tvar name=2>m:Special:MyLanguage/Wikimedia projects</tvar>|Wikimedia projects]].</translate> <translate> This probably means that the {{<tvar name=1>#ifeq:Extension|Extension</tvar>|extension|skin}} is stable and works well enough to be used by such high-traffic websites.</translate> <translate> Look for this {{<tvar name=1>#ifeq:Extension|Extension</tvar>|extension's|skin's}} name in Wikimedia's <tvar name=2>CommonSettings.php</tvar> and <tvar name=3>InitialiseSettings.php</tvar> configuration files to see where it's installed.</translate> <translate> A full list of the {{<tvar name=1>#ifeq:Extension|Extension</tvar>|extensions|skins}} installed on a particular wiki can be seen on the wiki's <tvar name=ver>Special:Version</tvar> page.</translate> |
- Pages with script errors
- Pages with broken file links
- Beta status extensions
- Extensions without an image
- Tag extensions
- Extensions with master compatibility policy
- GPL licensed extensions
- Extensions in Wikimedia version control
- ParserFirstCallInit extensions
- All extensions
- Extensions used on Wikimedia
- Audio player extensions