k60 is online

@k60@soundhunte.rs


Sitehttps://www.k60.in

13 following, 2 followers

0 ★ 0 ↺

[?]k60 is online » 💔 🌐
@k60@soundhunte.rs

today I wanted to make an audio file that sounds like an old mysterious tape and contains a real program as part of a gag for a future event announcement.

step one. you need a compiler. thanks to @boriel@mastodon.social, there is ZX Basic that just works. it's awesome. you just do ../zxbc.py -f tap -a --BASIC jingle.bas and that's it.

step two. you need an emulator. yay—I thought— has libretro-fuse that's even packaged for Alpine. it worked strange, displayed a lot of weird stuff and looked too complicated. so I resorted to JSSpeccy3, which runs in a browser. it was okay, but I got tired of switching between the compiler and my browser, uploading the file, checking it out, etc.

I gave retroarch one more shot, spent some time researching why on earth the audio was not working, even though the retroarch menus had it. one strace later it became clear that libretro-fuse does not use retroarch's sound system, but the ALSA sequencer. okay, modprobe snd_seq, done. now i can iterate much faster, by compiling my program and loading it into the emulator with a single command. neat!

step three. you need a way to convert your tape image to an audio file. the original FUSE emulator (not to be confused with FUSE-the-filesystem-in-userspace-thing! damn it, google) contains some utilities, and among them there is tape2wav, which does exactly what you need. to get tape2wav you just need to compile libspectrum, then fuse-utils. sources are available for both, it's really almost as simple as: ./configure && make && doas make install. alas, tape2wav won't build without a warning, if your system's libaudiofile is broken. Alpine's package seem to be exactly this, so I had to check out the original source code, figure out the exact way to build the thing, since READMEs were updated almost never it seems, and, finally I've built everything and had my tape2wav working.

step four. you may want to check that your audio file can be loaded correctly. I thought the audio2tape program from the same fuse-utils suite would do exactly that. alas, it does not support the turbo-encoded tapes that it's sibling tape2wav produces, and there's no way to turn the turbo encoding off in the latter. the retroarch's libretro-fuse won't load wav files either, it just ignores them. so I thought to give the original fuse a shot. after doing apk add gtk+2.0-dev and having some pleasant nostalgic flashbacks, fuse compiled successfully, and — finally — i got my wav played and loaded.

step five. you may want to make the audio file sound like a real tape recording. for this I went to my studio computer, loaded the wav in Logic Pro, dubbed the file along a sample of a running reel-to-reel motor (I know, right), added the flutter effect to make pitches a bit wobbly just like they are on some bad tape recordings, finally normalized the volume et voila. one last thing was to make sure FUSE would load the resulting file. which it did!

step six. you may want to compress the audio. the announcement is to be published on the web. so the 11 megabyte wav was no okay. converting it to MP3 completely ruins the data integrity, no matter what parameters you use. so did changing the sample rate. so did mono conversion. so did channel remapping for some reason too.

so I had to use . doing pcm_s16 → pcm_s8 before converting the file to FLAC makes the file almost three times smaller, and 10x smaller when compared to the original wav. and by the way, FLAC is supported by all major web browsers, even the worst browser ever, i.e. iOS Safari would play it just fine, or so I'm told by the can-i-use portal.

soon the announcement will go live, and I'll post the result here.

it was fun! nothing much, really, but a deep dive nonetheless.

    History