Page MenuHomePhabricator

Larnyx engine gives a WAV file with a MP3 extension
Closed, ResolvedPublic3 Estimated Story PointsBUG REPORT

Description

Steps to replicate the issue:

  1. Make sure you're using the Larnyx engine as set with $wgPhonosEngine = 'larynx';. Note that Patch Demo uses Larynx by default.
  2. Add a simple example such as <phonos ipa="flaΙͺΜ―" text="Fly" />
  3. Right-click on the play button to locate and save the linked file to your local

What happens?:
The file downloaded will either have a .wav extension (maybe depends on your browser?), but even if it is .mp3 you'll notice the MIME type is still audio/x-wav when it should be audio/mpeg.

What should have happened instead?:
It should have a .mp3 extension and an audio/mpeg mime type.

Software version (skip for WMF-hosted wikis like Wikipedia):
Phonos @ 496ad094

Event Timeline

This bug was cut from the QA feedback for T315119: Use MP3 instead of WAV for all engines except Larnyx. I investigated and can't figure out why this isn't working for Larnyx, specifically. Using eSpeak, the MP3 conversion using Lame seems to work just fine, so I'm not sure why it's at all different for Larynx.

TheresNoTime added a subscriber: TheresNoTime.

Taking a look:

{
	"GET": {
		"scheme": "http",
		"host": "192.168.1.158",
		"filename": "/images/phonos/d/g/dg7ub2u8ekvsjz77d85ftr6w24aovf6.mp3",
		"remote": {
			"Address": "192.168.1.158:80"
		}
	}
}
{
	"Response Headers (338 B)": {
		"headers": [
			{
				"name": "Accept-Ranges",
				"value": "bytes"
			},
			{
				"name": "Connection",
				"value": "Keep-Alive"
			},
			{
				"name": "Content-Length",
				"value": "30764"
			},
			{
				"name": "Content-Range",
				"value": "bytes 0-30763/30764"
			},
			{
				"name": "Content-Type",
				"value": "audio/mpeg"
			},
			{
				"name": "Date",
				"value": "Wed, 05 Oct 2022 11:55:06 GMT"
			},
			{
				"name": "ETag",
				"value": "\"782c-5ea235b3750d3\""
			},
			{
				"name": "Keep-Alive",
				"value": "timeout=5, max=100"
			},
			{
				"name": "Last-Modified",
				"value": "Mon, 03 Oct 2022 15:54:18 GMT"
			},
			{
				"name": "Server",
				"value": "Apache/2.4.54 (Debian)"
			}
		]
	}
}

Of note is the Content-Type apparently being audio/mpeg in the response headers..?

Navigating directly to /images/phonos/d/g/dg7ub2u8ekvsjz77d85ftr6w24aovf6.mp3 causes dg7ub2u8ekvsjz77d85ftr6w24aovf6.wav to download.

Using mediainfo confirms this is a wav file:

General
Complete name                            : dg7ub2u8ekvsjz77d85ftr6w24aovf6.wav
Format                                   : Wave
File size                                : 30.0 KiB
Duration                                 : 697 ms
Overall bit rate mode                    : Constant
Overall bit rate                         : 353 kb/s
FileExtension_Invalid                    : act at9 wav

Audio
Format                                   : PCM
Format settings                          : Little / Signed
Codec ID                                 : 1
Duration                                 : 697 ms
Bit rate mode                            : Constant
Bit rate                                 : 352.8 kb/s
Channel(s)                               : 1 channel
Sampling rate                            : 22.05 kHz
Bit depth                                : 16 bits
Stream size                              : 30.0 KiB (100%)

And running mediainfo on the file in-place (/images/phonos/d/g/dg7ub2u8ekvsjz77d85ftr6w24aovf6.mp3) also shows a wav file.

Renaming this file to a .wav and running lame images/phonos/d/g/dg7ub2u8ekvsjz77d85ftr6w24aovf6.wav images/phonos/d/g/dg7ub2u8ekvsjz77d85ftr6w24aovf6-test.mp3 results in an actual mp3:

General
Complete name                            : images/phonos/d/g/dg7ub2u8ekvsjz77d85ftr6w24aovf6-test.mp3
Format                                   : MPEG Audio
File size                                : 2.96 KiB
Duration                                 : 757 ms
Overall bit rate mode                    : Constant
Overall bit rate                         : 32.0 kb/s
Writing library                          : LAME3.100UUUUUUUUUUL

Audio
Format                                   : MPEG Audio
Format version                           : Version 2
Format profile                           : Layer 3
Duration                                 : 758 ms
Bit rate mode                            : Constant
Bit rate                                 : 32.0 kb/s
Channel(s)                               : 1 channel
Sampling rate                            : 22.05 kHz
Frame rate                               : 38.281 FPS (576 SPF)
Compression mode                         : Lossy
Stream size                              : 2.96 KiB (100%)
Writing library                          : LAME3.100UUUUUUUUUUL

Change 838792 had a related patch set uploaded (by Samtar; author: Samtar):

[mediawiki/extensions/Phonos@master] LarynxEngine: Return MP3 data in getAudioData()

https://gerrit.wikimedia.org/r/838792

TheresNoTime set the point value for this task to 3.Oct 5 2022, 12:38 PM

Change 838792 merged by jenkins-bot:

[mediawiki/extensions/Phonos@master] LarynxEngine: Return MP3 data in getAudioData()

https://gerrit.wikimedia.org/r/838792

Test wiki created on Patch demo by GMikesell-WMF using patch(es) linked to this task:
https://patchdemo.wmflabs.org/wikis/34377c5aff/w

@TheresNoTime Thanks for the steps so I can replicate the issue! Please see the screenshots below for Chrome, IE, and Firefox when saving locally. Also let me know if you want me to test anything else out or if can I move this to Product sign-off. Thanks!

Chrome - Mp3 Audio File(VLC) (*.mp3)

T319242_Fly_Chrome.png (631Γ—1 px, 98 KB)

Firefox- MPEG Audio (*.mp3)

T319242_Fly_FF.png (411Γ—896 px, 55 KB)

Internet Explorer- MP3 File (*.mp3)

T319242_Fly_IE.png (533Γ—851 px, 59 KB)

Mime Types for each browser

T319242_MIME Types.png (200Γ—484 px, 25 KB)

Patch Demo link used: https://patchdemo.wmflabs.org/wikis/34377c5aff/wiki/Main_Page
Change ID: I5403fa891a76e3e6194d0e5eab6508a1379e4a51
OS: Chrome, Firefox, IE

@GMikesell-WMF thanks for linking to the patch demo!
Great work Sammy!