Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resample mp3 in 32000Hz #13959

Merged
merged 3 commits into from
Jan 24, 2021
Merged

Resample mp3 in 32000Hz #13959

merged 3 commits into from
Jan 24, 2021

Conversation

sum2012
Copy link
Collaborator

@sum2012 sum2012 commented Jan 22, 2021

Helps #5213

Hope merge in v1.11 so that chinese people 1 more reason to update

@sum2012 sum2012 added MP3 Issue involves sceMp3 features. Audio labels Jan 22, 2021
@unknownbrackets
Copy link
Collaborator

unknownbrackets commented Jan 23, 2021

Does this fix it or is it just theoretical? What is the sample rate of the mp3s included in the game?

Looks backwards to me; this is the sample rate of the data. We want it to resample to 44.1kHz always, presumably. This line seems to assume the input is always 44.1kHz:

Au->decoder = new SimpleAudio(Au->audioType);

But my tests had shown that non-44.1kHz mp3s were rejected by sceMp3 anyway.

	if (ctx->SamplingRate == -1) {
		return hleDelayResult(hleReportError(ME, ERROR_AVCODEC_INVALID_DATA, "invalid sample rate v%d l%d rate %02x", versionBits, layerBits, (header >> 10) & 0x3), "mp3 init", PARSE_DELAY_MS);
	} else if (ctx->SamplingRate != 44100) {
		// TODO: Should return 0x80671302 (unsupported sample rate?)
		WARN_LOG_REPORT(ME, "sceMp3Init: invalid data: not 44.1kHz");
	}

https://report.ppsspp.org/logs/kind/1036

-[Unknown]

@sum2012
Copy link
Collaborator Author

sum2012 commented Jan 23, 2021

The second sound is old woman but "current master is male and the sound like robot"
This patch is really fix it.

48:09:122 user_main N[ME]: HLE\sceMp3.cpp:411 sceMp3Init(): channels=1, samplerate=32000Hz, bitrate=48kbps

How about only resample for channels==1 ?

@sum2012
Copy link
Collaborator Author

sum2012 commented Jan 23, 2021

Read again my jpcsptrace
https://gist.github.com/sum2012/e2d513c55342c40f5e12
This game's SamplingRate (32000Hz) is not rejected
Your test is something wrong

@hrydgard
Copy link
Owner

hrydgard commented Jan 23, 2021

Leave the 48000 check in place but also allow 32000 for now then... So that we don't change what gets called for the 44100 case. Until we can figure out why the resampling seems backwards but still works, and what is actually allowed...

@sum2012 sum2012 changed the title Resample all mp3 Resample mp3 in 32000Hz Jan 23, 2021
@hrydgard hrydgard merged commit a8a60d3 into hrydgard:master Jan 24, 2021
@hrydgard hrydgard added this to the v1.11.0 milestone Jan 24, 2021
@sum2012 sum2012 deleted the mp3_minor branch January 24, 2021 09:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Audio MP3 Issue involves sceMp3 features.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants