On 64-bit systems (observed on amd64 but based on the cause I expect the same problem anywhere 'long' is wider than 32 bits), sid2wav (from sidplay) writes broken WAV files.
Fixing the fixed-width integer typedefs it's getting from libsidplay fixes the problem. Index: Makefile =================================================================== RCS file: /cvs/ports/audio/libsidplay/Makefile,v retrieving revision 1.23 diff -u -p -r1.23 Makefile --- Makefile 8 Mar 2022 14:27:50 -0000 1.23 +++ Makefile 13 Aug 2022 20:29:50 -0000 @@ -1,7 +1,7 @@ COMMENT= C64 music player and SID chip emulator library DISTNAME= libsidplay-1.36.57 -REVISION= 7 +REVISION= 8 CATEGORIES= audio SHARED_LIBS += sidplay 2.0 # .1.3 Index: patches/patch-src_mytypes_h =================================================================== RCS file: patches/patch-src_mytypes_h diff -N patches/patch-src_mytypes_h --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-src_mytypes_h 13 Aug 2022 20:29:50 -0000 @@ -0,0 +1,37 @@ +Un-break sid2wav's output files on 64-bit systems + +Index: src/mytypes.h +--- src/mytypes.h.orig ++++ src/mytypes.h +@@ -6,6 +6,8 @@ + #define SIDPLAY1_MYTYPES_H + + ++#include <stdint.h> ++ + #include "compconf.h" + + // A ``bool'' type for compilers that don't (yet) support one. +@@ -23,16 +25,16 @@ + + + // Wanted: 8-bit signed/unsigned. +-typedef signed char sbyte; +-typedef unsigned char ubyte; ++typedef int8_t sbyte; ++typedef uint8_t ubyte; + + // Wanted: 16-bit signed/unsigned. +-typedef signed short int sword; +-typedef unsigned short int uword; ++typedef int16_t sword; ++typedef uint16_t uword; + + // Wanted: 32-bit signed/unsigned. +-typedef signed long int sdword; +-typedef unsigned long int udword; ++typedef int32_t sdword; ++typedef uint32_t udword; + + + // Some common type shortcuts. -- Dave Vandervies dj3va...@terse.ca Plan your future! Make God laugh!