• The forum software that supports hummy.tv has been upgraded to XenForo 2.1!

    This upgrade brings a number of improvements including the ability to bookmark posts to come back to later. Please bear with us as we continue to tweak things and open a new thread for any questions, issues or suggestions in Site/Forum Issues.

MP3 Sample Rate Tweaking

Black Hole

May contain traces of nut
I'm having difficulty framing a satisfactory google search for this, so perhaps somebody on here has a clue where to look.

Idea: adjust the pitch/tempo for the playback of an MP3 file by forcing the player to reproduce it at a different sample rate than the original, by tweaking the relevant field in the MP3 file headers. This is deliberately not the same as reading the audio into an editor and exporting a new MP3 resampled at the desired rate - that would incur loss of quality (and end up at the same pitch/tempo unless the waveform was stretched in the editor first).

Possible? If so, how to access the metadata and make the tweak? Is a non-standard sample rate field going to crash the player (try it and see!)?
 
Last edited:
OP
Black Hole

Black Hole

May contain traces of nut
Thanks for the reference, it looks like the sample rate can only be certain predefined values :(
 

MontysEvilTwin

Well-Known Member
This might not be what you are looking for, but it is possible to alter the tempo of an audio track using the atempo filter in ffmpeg. The option in Webif to convert the main audio track from a recording to an mp3 file uses a command something like this (128 kbps bitrate):
Code:
ffmpeg -i input.ts -b:a 128k output.mp3
Using the atempo filter allows the tempo to be altered, for example:
Code:
ffmpeg -i input.ts -filter:a "atempo=1.10" -b:a 128k output.mp3
This will speed up the audio to 110% of the original tempo. Changing the tempo at the same time as converting the audio should preserve the audio quality. However, changing the tempo of an audio track which has already been converted from ts (m2ts) to mp3 will lead to some loss of quality.
 
OP
Black Hole

Black Hole

May contain traces of nut
Thanks

The source material is already MP3, so adjustment in the manner you describe (with a 44.1kHz input and output sampling frequency) would involve decoding, resampling, and re-encoding. I can use VLC to play the MP3 at any tempo I like (in 1% increments/decrements), but it is fiddly and I was looking for a way to "tag" the existing MP3 to play at a different tempo by default. That's what I hoped to achieve if the sample frequency tag was a variable field rather than a few select options.
 
Top