TerryCavanagh / VVVVVV

The source code to VVVVVV! http://thelettervsixtim.es/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Audio speedup/slowdown bug still exists in some form

Daaaav opened this issue · comments

Don't yet know the circumstances, but opening Vungeon the first time in a session the music has normal speed, exiting and reloading the level, it's sped up:

2023-11-28_02-44-05-reenc.mp4

Some more details from file and ffmpeg -i for the second audio (song+voiceover, it's the expected 44100 Hz...):

$ file song16.ogg 
song16.ogg: Ogg data, Vorbis audio, stereo, 44100 Hz, ~160000 bps, created by: Xiph.Org libVorbis I
$ ffmpeg -i song16.ogg 
ffmpeg version 4.4.2-0ubuntu0.22.04.1 Copyright (c) 2000-2021 the FFmpeg developers
  built with gcc 11 (Ubuntu 11.2.0-19ubuntu1)
  configuration: --prefix=/usr --extra-version=0ubuntu0.22.04.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-librsvg --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  libavutil      56. 70.100 / 56. 70.100
  libavcodec     58.134.100 / 58.134.100
  libavformat    58. 76.100 / 58. 76.100
  libavdevice    58. 13.100 / 58. 13.100
  libavfilter     7.110.100 /  7.110.100
  libswscale      5.  9.100 /  5.  9.100
  libswresample   3.  9.100 /  3.  9.100
  libpostproc    55.  9.100 / 55.  9.100
Input #0, ogg, from 'song16.ogg':
  Duration: 00:02:43.60, start: 0.000000, bitrate: 133 kb/s
  Stream #0:0: Audio: vorbis, 44100 Hz, stereo, fltp, 160 kb/s
    Metadata:
      DATE            : 20190605
      purl            : https://www.youtube.com/watch?v=CNTLKAoIvlU
      synopsis        : MY LINKS: ●Main channel: https://www.youtube.com/c/AacroX ●Backup music channel: https://www.youtube.com/channel/UCv3dAPelazVSfQVOKB0y8Pw ●Support me with Brave: https://brave.com/aac728 ●Twitter: https://twitter.com/aacro_x ●Instagram: https://
      Software        : Lavf59.30.101
      comment         : MY LINKS: ●Main channel: https://www.youtube.com/c/AacroX ●Backup music channel: https://www.youtube.com/channel/UCv3dAPelazVSfQVOKB0y8Pw ●Support me with Brave: https://brave.com/aac728 ●Twitter: https://twitter.com/aacro_x ●Instagram: https://
      TITLE           : Bowser Jr.'s Mad - Mario Party 9 Music Extended
      ARTIST          : Aacro Xtensions
At least one output file must be specified

Here's the ogg in question:
song16.ogg.zip

Probably the song before it also matters (which is 48000), so here that is as well:

$ file 3potentialforanything.ogg
3potentialforanything.ogg: Ogg data, Vorbis audio, stereo, 48000 Hz, ~160000 bps, created by: Xiph.Org libVorbis I
$ ffmpeg -i 3potentialforanything.ogg
ffmpeg version 4.4.2-0ubuntu0.22.04.1 Copyright (c) 2000-2021 the FFmpeg developers
  built with gcc 11 (Ubuntu 11.2.0-19ubuntu1)
  configuration: --prefix=/usr --extra-version=0ubuntu0.22.04.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-librsvg --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  libavutil      56. 70.100 / 56. 70.100
  libavcodec     58.134.100 / 58.134.100
  libavformat    58. 76.100 / 58. 76.100
  libavdevice    58. 13.100 / 58. 13.100
  libavfilter     7.110.100 /  7.110.100
  libswscale      5.  9.100 /  5.  9.100
  libswresample   3.  9.100 /  3.  9.100
  libpostproc    55.  9.100 / 55.  9.100
Input #0, ogg, from '3potentialforanything.ogg':
  Duration: 00:01:55.24, start: 0.000000, bitrate: 173 kb/s
  Stream #0:0: Audio: vorbis, 48000 Hz, stereo, fltp, 160 kb/s
    Metadata:
      ARTIST          : Valter Abreu
      TITLE           : Wald's Big Adventure!
      purl            : https://www.youtube.com/watch?v=l7kyoPzzaXA
      synopsis        : Provided to YouTube by Routenote  Wald's Big Adventure! · Valter Abreu  Gaming Music Collection  ℗ Valter Abreu  Released on: 2018-11-21  Auto-generated by YouTube.
      comment         : Provided to YouTube by Routenote  Wald's Big Adventure! · Valter Abreu  Gaming Music Collection  ℗ Valter Abreu  Released on: 2018-11-21  Auto-generated by YouTube.
      Software        : Lavf59.30.101
      DATE            : 20221026
      ALBUM           : Gaming Music Collection
At least one output file must be specified

3potentialforanything.ogg.zip

Likely a gap where SetSourceSampleRate should be... this check does seem mildly suspicious though:

https://github.com/TerryCavanagh/VVVVVV/blob/master/desktop_version/src/Music.cpp#L440

It might be worth it to always halt and restart, rather than try to recycle the voice, state shadowing will probably be leaky and recreating the source voice each time shouldn't be expensive to do.

Looks like you're right - always halting and restarting there seems to fix this! Will PR it in a bit.