Posts: 12,706
Joined: Nov 2003
Reputation:
129
spiff
Team-Kodi Member
Posts: 12,706
the xbox can only output 48khz audio.
most audio isnt 48khz. so processing (upsampling) is a neccesity.
Posts: 32
Joined: Oct 2006
Reputation:
0
gbox70
Junior Member
Posts: 32
It sounds as the xbox is doing mere than upsampling though. To my ears there is an algorith that is doing something pretty extreme to the audio. Is there any block diagram that shows the actual blocks(proceses) that the audio travels through?
Posts: 26,215
Joined: Oct 2003
Reputation:
187
1. Decode (most to PCM, some (mp3, mpc) to float)
2. Convert to 32bit float if it's PCM.
3. Apply any replaygaining (pure scaling).
4. Resample to 48kHz, 16bit using SSRC and output.
The only non-lossless stage is step 4, which is unavoidable (unless you have 48kHz 16bit audio, then it's lossless).
Note that the "output" section could have whatever processing you enable, such as output to all speakers, which converts to AC3.
Cheers,
Jonathan
Posts: 32
Joined: Oct 2006
Reputation:
0
gbox70
Junior Member
Posts: 32
Thanks, All these steps are done from paplayer or mplayer?
I assume the decoding is done with the players. right?
Is there anyway to disable the "pure scaling"
maybe I'll take a 48K audio file and see what it sounds like, but that should be the least likely culprit. Generally losses only occur in downsampling especially in 24bit to 16bit. However ther may be a HF cut filter before or after the upsampling.
Posts: 26,215
Joined: Oct 2003
Reputation:
187
The scaling is not applied if no replaygaining is performed.
The decoding for almost all music playback is done in paplayer.
Posts: 32
Joined: Oct 2006
Reputation:
0
gbox70
Junior Member
Posts: 32
Is there a way to disable the replay gaining? IIRC I only saw dB increments to shoose from.
Posts: 26,215
Joined: Oct 2003
Reputation:
187
You can completely disable it by turning it off, and setting the preamp gain for non-gained files to 89dB (the default).
Posts: 32
Joined: Oct 2006
Reputation:
0
gbox70
Junior Member
Posts: 32
OK, I see, I had it off and still found the sound unaceptable. do you know what PAPlayer does in it's decoding? I checked out the site and the player seems to tout itself as "psychoacoustic". Maybe there are some comands to keep it from processing too much.
Posts: 26,215
Joined: Oct 2003
Reputation:
187
Feel free to look at the code. The only processing performed is what I detailed before.
SSRC is the resampler we use - it's a reasonably fast, good quality resampler.
Cheers,
Jonathan
Posts: 32
Joined: Oct 2006
Reputation:
0
gbox70
Junior Member
Posts: 32
I am not a programmer, so the code would mean nothing to me.
I read a bit about SSRC and saw it has dithering cabilities. Is it necessary to make the jump from 16 bit to 32 bit? Maybe I am wrong but in stage one for mp3 it would be decoded from 16bit to 32 bit-float right?
did you get the paplayer decoding code from GPL code?
Posts: 26,215
Joined: Oct 2003
Reputation:
187
Yes, the majority of the code used in XBMC is GPL'd code from popular decoding libraries - the wiki page on paplayer shows where it's all from.
MP3 is not inherently 16bit - indeed, it has no bitdepth. The original source was most likely 16bit audio, but once it's encoded, the concept of bitdepth is meaningless. XBMC uses MAD to decode to 32bit floats.
Posts: 32
Joined: Oct 2006
Reputation:
0
gbox70
Junior Member
Posts: 32
Good, since it uses MAD we can cross the decoding off the list I guess, as long as the impementation of MAD is generic. -sorry I missed the wikki references.
Have you played around with the 48K conversion variables? Going from 32 bit to 16 bit is a huge jump too.