sezero/mikmod

xm files play at double speed (double sampling?) on macOS 14.1 on Apple Silicon over bluetooth?

Closed this issue ยท 12 comments

I just brew installed mikmod 3.2.8 on my M3 macbook pro with some classic airpods pro connected, and tuned into some of my old favorite xm modules. They played glitchilly at double speed, indicating to me that every other sample was being discarded or something like that.

Now that I'm trying to replicate with wired headphones, they sound fine. Changing back to bluetooth breaks it again. The timer ticks at two seconds per second of wall time. There are lots of glitchy discontinuities, which is why I think it's dropping samples rather than playing at double sample rate.

That you mention going between headphones and bluetooth unbreaks and breaks it, I think the issue may be with the very obsolete coreaudio driver included in the library. I will be updating the coreaudio driver in a few days and will report back here.

OK, I pushed the initial coreaudio driver update as of a2ac759

@nevyn: Can you test? I can build for you too if you want (but I cannot
sign/notarize them: you'll need to run xattr -r -d com.apple.quarantine
on them.)

TODO:

  • Report more (better) errors. Update its error strings?
  • xmp doesn't set the upper limit for latency option and I arbitarrily
    chose it as 1024. Anything better?

@AliceLR: Can you please review? Any gotchas? (Commit diff for drv_osx.c
is unreadable, just read the code as is, maybe compare to xmp-cli.)

Thanks.

Forgot to note: It refuses to work in mono or 8bit mode: only works
in 16bit signed or 32bit floating point stereo mode. (I don't think
anyone would want mono or 8bit mode on macosx, anyway...)

OK, will test soon and get back to you.

TODO:

. Report more (better) errors. Update its error strings?

Handled this in commits 22b2dea and 727eb22

Also pushed 7e63c58 to fix a minor warning from old gcc

Some simple testing with the initial commit and with the updates seems fine to me. I wasn't able to find any errors comparing against xmp. (High Sierra tested, will also try Snow Leopard.)

Some simple testing with the initial commit and with the updates seems fine to me. I wasn't able to find any errors comparing against xmp. (High Sierra tested, will also try Snow Leopard.)

Thank you.

@nevyn ?

@sezero Wow!! Didn't expect this to be handled within 24 hours, thank you for the dedication :D

Unfortunately, it doesn't seem to have helped. Here's exactly what I did:

$ git clone --recursive https://github.com/sezero/mikmod.git
$ git log # we're at 727eb22d7c0686797571f555266899a4ef77fc19
$ mkdir build; cd build
$ cmake ..
$ make mikmod
$ ./src/mikmod ~/Music/MODs/megaXM/*.xm

and I still get double-speed playback when playing back on my Bluetooth headphones, but perfect playback on computer's built-in speakers.

(also, README said to call ../configure, but there's no file in the repo, so I went for the cmake. README also says there's a macosx/README file, but there isn't :) )

@nevyn : Did you remove the brew version before building mikmod? I think you are linking to libmikmod from brew.

I suggest building like the following, after cloning the repo:

cd <mikmod-git-whereever>
mkdir -p libmikmod/build mikmod/build

## build libmikmod library first: the changes are in there:
cmake -S libmikmod -B libmikmod/build -DCMAKE_BUILD_TYPE=Release
cmake --build libmikmod/build/ --config Release

## now build mikmod player against it:
CMAKE_PREFIX_PATH=./libmikmod:./libmikmod/build cmake -S mikmod -B mikmod/build -DCMAKE_BUILD_TYPE=Release
# watch the line saying "-- Found MikMod: ..." it should point to the new libmikmod build
cmake --build mikmod/build/ --config Release

## now try the new mikmod player build:
./mikmod/build/src/mikmod ....

@sezero ah how silly! yes ofc it had picked up the homebrew libmikmod. Building with your instructions worked great. Bug fixed! ๐Ÿคฉ well done!!

ps. maybe that script should be in the root of the repo? ๐Ÿ˜…

@sezero ah how silly! yes ofc it had picked up the homebrew libmikmod. Building with your instructions worked great. Bug fixed! ๐Ÿคฉ well done!!

Great! Thank you for testing.

ps. maybe that script should be in the root of the repo? ๐Ÿ˜…

Done: 4d2c998

Closing as fixed.