VOGONS


FLAC support

Topic actions

First post, by Taiyoumaru

User metadata
Rank Newbie
Rank
Newbie

So I recently purchased the entire Heroes of Might and Magic collection off of GOG and decided to fire up the latest enhanced DOSBox compiled by yesterplay88 that I managed to integrate with D-Fend. As I was playing some HoMM2 it dawned on me that the music quality wasn't quite up to par with the original redbook audio that is, as far as I know, an old but lossless format for playing music, which was the standard back then for audio CDs.

This was the reason why HoMM CDs were so large and yet the game installs themselves were smaller than 200 MB. Now I dug around in the game files and I noticed GOG replaced the need for booting the game with the original CD by including the soundtrack of the game as .ogg in a separate folder and having a file that points to that folder act as the CD image that is mounted in DOSBox prior to running the game exe, since DOSBox can play .ogg.

Now .ogg is a lossy format, that loses quality when it is being converted from lossless formats, which is noticeable to me, so I proceeded to rip the soundtrack from an old disk I had lying around in the FLAC format (using EAC and stringent settings recommended by audiophiles on a certain site) and replaced the files in the music folder with my rips. Now the situation is that DOSBox doesn't want to play these files, I guess due to the fact that it doesn't recognize the format. I dug around the forums a bit and all I could find was an old thread describing some issues with the playback of flac when applying a patch. Re: FLAC playback in DOSBox

Now my question is, is there any plan, regardless of how far in the future is, to include flac support in DOSBox?

Last edited by Taiyoumaru on 2016-09-20, 00:43. Edited 1 time in total.

Reply 1 of 34, by PhilsComputerLab

User metadata
Rank l33t++
Rank
l33t++

Just convert them to WAV, then burn yourself a mixed mode CD or create yourself new BIN / CUE image files.

YouTube, Facebook, Website

Reply 2 of 34, by keenmaster486

User metadata
Rank l33t
Rank
l33t

Could you redo the CD with ogg files at an insane bitrate that's pretty much guaranteed to sound the same as lossless?

World's foremost 486 enjoyer.

Reply 3 of 34, by PhilsComputerLab

User metadata
Rank l33t++
Rank
l33t++
keenmaster486 wrote:

Could you redo the CD with ogg files at an insane bitrate that's pretty much guaranteed to sound the same as lossless?

Yes that's also a great idea!

YouTube, Facebook, Website

Reply 4 of 34, by Taiyoumaru

User metadata
Rank Newbie
Rank
Newbie

While it is true that either solution would work, and thank you for them hehe, it would still be better for the collection if I could use flacs since they are still smaller than wavs or insane bitrate oggs, good for storing for the future. So in essence when building that perfect DOS game collection it would be awesome to have them.

Reply 5 of 34, by Yesterplay80

User metadata
Rank Oldbie
Rank
Oldbie

To be honest, I don't see any necessity for FLAC support. I convert my games that have redbook audio to OGG files with a fixed bitrate of 320 KByte/s (GOG only uses 256 or maybe even 192 kbyte/s) and I don't hear absolutely any difference between those and the CD audio. I'm pretty sure most of us wouldn't hear the difference either, so in my opinion that's good enough for background music for games.

Btw., you can encapsulate FLAC in the OGG file format, maybe this will work? https://xiph.org/flac/ogg_mapping.html

My full-featured DOSBox SVN builds for Windows & Linux: Vanilla DOSBox and DOSBox ECE (Google Drive Mirror)

Reply 6 of 34, by James-F

User metadata
Rank Oldbie
Rank
Oldbie

OGG in 160 kbps (q5) for me.
A whole disc is less than 60mb, quite enough for dos games I think, and I don't hear a difference.

Heroes 2 from GOG uses 85 kbps on the ogg tracks, nobody complained yet. 😀


my important / useful posts are here

Reply 7 of 34, by Yesterplay80

User metadata
Rank Oldbie
Rank
Oldbie
James-F wrote:

Heroes 2 from GOG uses 85 kbps on the ogg tracks, nobody complained yet. 😀

Really? That bitrate is so low that one definitely must hear the difference (unless you're half deaf 😉) Is it a variable bitrate? In that case, you can't always trust what is shown in it's properties because it changes constantly throughout the playback.

My full-featured DOSBox SVN builds for Windows & Linux: Vanilla DOSBox and DOSBox ECE (Google Drive Mirror)

Reply 8 of 34, by James-F

User metadata
Rank Oldbie
Rank
Oldbie

The player shows an average bitrate for the entire track if it is variable.
Some are 100 kbps some are even 40 kbps, definitely variable, I assume it depends on the high frequency content of the specific track.


my important / useful posts are here

Reply 9 of 34, by Taiyoumaru

User metadata
Rank Newbie
Rank
Newbie

I have for years listened to various bitrates of various formats and I can safely say to me the difference between a lossy format regardless of bitrate (well ofc, up until around a constant 320) and a lossless format like flac, there is a noticeable difference. As well, the various audiophile sites I frequent ban formats like ogg and only accept mp3s in either constant 320 bitrate or variable0 bitrate (with very stringent ripping/transcoding requirements). Unfortunately I cannot link to such sites due to how exclusive they are to get into and forum rules. Suffice to say, depending on the equipment that you're intending on playing the format on, there is a noticeable difference between lossy and lossless formats.

As I dabble in audio sampling as well, I can safely say that anything below a 320 bitrate has noticeable quality issues in my case. Ofc in such cases it is a matter of how every person perceives audio based on their hearing capacities, which is a genetic thing in the end.

It is also a question of future-proofing for the next generations. Ultimately having a lossless format to listen to, transcode and sample from is the optimal way of preserving audio videogame history. There really is no reason not to support the superior format considering the ever increasing hdd space available to people. Transcoding from lossy formats into other lossy formats produces further loss of quality, which is highly undesirable.

I cannot agree with the statement that because some or even most people do not notice a quality difference, it is not needed to implement such a feature. It's a classic "it doesn't happen to me, so it must not be relevant/true" logical fallacy.

Reply 10 of 34, by Yesterplay80

User metadata
Rank Oldbie
Rank
Oldbie
Taiyoumaru wrote:

It is also a question of future-proofing for the next generations. Ultimately having a lossless format to listen to, transcode and sample from is the optimal way of preserving audio videogame history. There really is no reason not to support the superior format considering the ever increasing hdd space available to people. Transcoding from lossy formats into other lossy formats produces further loss of quality, which is highly undesirable.

You have to take into consideration that DOSbox is a multi platform software and, as such, runs on platforms that don't even have hdds, like smartphones and tablets with Android for example. It quickly makes a difference if a game needs 200 MB or 500 MB of space there, especially on the low- to mid-priced devices that have only 8, 16, maybe 32 GByte of total storage capacity.

The price drop on SSDs also often caused a decrease in storage capacity, many people switched to SSDs with less space than the old HDDs before.

Further you should consider the equipment that is used for playback of the game music: Without having exact values, I'd assume that most gamers nowadays just use the onboard sound chip of their PC, with speakers, headsets or headphones in a price range of much less than 1000 US$. So we're not exactly talking HiFi here, which makes the use of losless codecs even less necessary, because the equipment itself lessens the quality of the sound to a degree the differences between losless and high quality lossy codecs practically vanishes.

Finally, DOSBox already being an emulator of older systems, makes the whole point of future proofness totally moot. As long as older systems have to be emulated, you might as well keep supporting older file formats.

Taiyoumaru wrote:

It's a classic "it doesn't happen to me, so it must not be relevant/true" logical fallacy.

I think it is more a "it might happen to others, but those are so few in numbers that it just isnt worth the effort" argument.

Conclusion: Though it is, of course, always nicer to have a feature more than one less, I wouldn't hold my breath for FLAC support. There just isn't enough reason to implement it at the moment, otherwise it surely would have happened already. So either you come up with your own implementation or you'll just have to be patient enough to wait for someone else to do it.

Out of curiosity: What sound equipment do you have in your PC that actually allows you to hear such a small difference as in FLAC/OGG320?

My full-featured DOSBox SVN builds for Windows & Linux: Vanilla DOSBox and DOSBox ECE (Google Drive Mirror)

Reply 11 of 34, by Taiyoumaru

User metadata
Rank Newbie
Rank
Newbie

Forgot I was part of a discussion, my apologies. It is true that SSDs have led to a decrease in available memory generally, but I still use magnetic drives for most of my storage since they're still huge. SSDs should primarily be used on your operating system and any applications you may run frequently, but I'm just spewing common knowledge here.

I don't follow the logic behind the DOSBox being an emulator of older systems and therefore should only support older formats. In that case it shouldn't have had support for image scalers and other non-DOS features like image mounting. I wasn't arguing for the removal of .ogg support, so those older systems that are being emulated have no reason to fear removal.

My idea of futureproofing was solely for my own collection, it would be nice to leave my sons with a giant DOS archive with as much high quality material as I possibly can (such as high quality manual/box art scans, high quality OST folders (even GOG have started offering some flac OSTs with their game purchase here and there), accurate ISO rips. I wouldn't want to leave my kids lossy formats, they might one day start using 8 bit music samples if they ever become musicians and having a lossy format to sample and transcode from would just be in poor taste. I wouldn't want to impose FLAC as the default standard for every person's collection, but only for myself where I can control the ripping process and then proceed to use those FLAC files to set-up a personal, sharable, working out-of-the-box DOSBox environment that has the highest quality files I can attain and makes use of said files during emulation. I am sure most people are just fine using lossy formats, but the perfectionist in me just won't have it.

There are even differences between ogg 320 and mp3 320. In particular speaking of one of the sites I frequent, they have banned any form of .ogg, only allowing the following lossy formats: MP3, AAC, AC3, DTS, for audio uploads. Their reasoning was that .ogg was archaic and hasn't kept up with recent trends and upgrades to other lossy formats, particularly mp3 and the rise of AAC to popularity due to the itunes store, where AAC is the default for lossy and ALAC(apple lossless) for lossless, and apple's equipment, which takes any lossy format and transcodes it into AAC when you upload tracks to your iphone, loses more quality in the process.

Really the primary reason for supporting FLAC isn't for people like me that have "been blessed with better hearing" (which honestly I believe has just as much to do with training your hearing to spot the differences) as some would say in these neverending debates but because they would be attractive for collecting soundtracks (particularly from games that made use of mt-32 and other such hardware) and using those soundtracks (particularly from games that made use of mt-32 and other such hardware) in DOSBox would just be a huge benefit that would encourage more people to build their own lossless collections, even if niche. We live in an age where we have the capacity to preserve our digital history but the drive to do so by most people just isn't there, which is a giant shame. This is why I have so much respect for people who create emulators since it allows us to preserve old hardware and software and show our children what it was like in the old days, where it all came from, enabling them to taste such a richness for themselves.

FLAC also adds awesome metadata support not present anywhere else (Vorbis tags, pretty much unlimited possibilities), checksums, ReplayGain etc. In terms of relevancy to video gaming and the experience derived, when you are listening to FLAC you are actually listening to the source file just as it was, bit by bit, only very efficiently compressed. The PCM data being sent to your DAC is identical to what was on the original CD.

Finally, at the moment I don't have the luxury of decent audio equipment, as my main PC only has an onboard Realtek high-def audio soundcard and some middlerange microlab 5.1 speakers, but even with just these, I can swear I can hear a difference between FLAC and constant 320, even if I recognize that in some cases it might be just being a snob and/or delusional, and ofc the source material is important. I do plan on getting some higher grade audio equipment in the future.

Reply 12 of 34, by gdjacobs

User metadata
Rank l33t++
Rank
l33t++
Taiyoumaru wrote:

In particular speaking of one of the sites I frequent, they have banned any form of .ogg, only allowing the following lossy formats: MP3, AAC, AC3, DTS, for audio uploads. Their reasoning was that .ogg was archaic and hasn't kept up with recent trends and upgrades to other lossy formats, particularly mp3 and the rise of AAC to popularity due to the itunes store, where AAC is the default for lossy and ALAC(apple lossless) for lossless, and apple's equipment, which takes any lossy format and transcodes it into AAC when you upload tracks to your iphone, loses more quality in the process.

While the issue with support on iDevices is valid, they are totally off base wrt ogg vorbis (which is certainly as good as MP3) and ogg opus (which destroys AAC and everything else).

Here's a large sample size listening test:
http://listening-test.coresv.net/results.htm

All hail the Great Capacitor Brand Finder

Reply 13 of 34, by Yesterplay80

User metadata
Rank Oldbie
Rank
Oldbie
Taiyoumaru wrote:

I don't follow the logic behind the DOSBox being an emulator of older systems and therefore should only support older formats.

I think you got we wrong here: I didn't mean to say DOSBox should only support old file formats for compressed audio. Actually, FLAC (v1.0 released 2001) is even older that OGG Vorbis (V1.0 released 2002). I just meant to say that supporting only OGG doesn't make DOSBox less future proof than supporting other formats as well.

However, I played around a bit. I added the FLAC libraries to my MinGW environment, compiled sdl_sound with FLAC support and compiled DOSBox adding the same "-lflac" parameter to the LIBS when configuring. The resulting DOSBox build obviously accepts FLAC files as compressed audio, so there's no mscdex error any longer. But the music in a game just is silent, there's either no playback at all or the playback is muted. There's no static neither, just plain silence. The status windows shows no errors, so I assume the music just muted somehow. Maybe someone has an idea why?

UPDATE: Trying out a CD player for DOS I just noticed that the tracks are played, but they seem to be played at an insane speed, so the whole disc is played back in a second: https://youtu.be/O2wORDQxDl0

Last edited by Yesterplay80 on 2016-09-22, 09:18. Edited 1 time in total.

My full-featured DOSBox SVN builds for Windows & Linux: Vanilla DOSBox and DOSBox ECE (Google Drive Mirror)

Reply 14 of 34, by PhilsComputerLab

User metadata
Rank l33t++
Rank
l33t++

One more case for BIN / CUE, which uses WAV, is that you can quickly burn it onto disc, mount it in a virtual CD drive as well as in DOSBox. But yes, it does use more space, but IMO storage is so cheap and plenty, I wonder if it's such a big deal?

YouTube, Facebook, Website

Reply 15 of 34, by Yesterplay80

User metadata
Rank Oldbie
Rank
Oldbie
PhilsComputerLab wrote:

One more case for BIN / CUE, which uses WAV, is that you can quickly burn it onto disc, mount it in a virtual CD drive as well as in DOSBox. But yes, it does use more space, but IMO storage is so cheap and plenty, I wonder if it's such a big deal?

As I said earlier:

YesterPlay80 wrote:

You have to take into consideration that DOSbox is a multi platform software and, as such, runs on platforms that don't even have hdds, like smartphones and tablets with Android for example. It quickly makes a difference if a game needs 200 MB or 500 MB of space there, especially on the low- to mid-priced devices that have only 8, 16, maybe 32 GByte of total storage capacity.

Besides: Who wants his games to waste more capacity than needed? More free space, more games. 😀

My full-featured DOSBox SVN builds for Windows & Linux: Vanilla DOSBox and DOSBox ECE (Google Drive Mirror)

Reply 16 of 34, by PhilsComputerLab

User metadata
Rank l33t++
Rank
l33t++

Fair enough 😀

Although I myself can't relate to DOSBox on phones and tablets, but even my DOS Super Socket 7 PC has a 120 GB hard drive. But I can see how space can be a priority.

YouTube, Facebook, Website

Reply 17 of 34, by Dominus

User metadata
Rank DOSBox Moderator
Rank
DOSBox Moderator

Thanks Yesterplay for trying with Flac enabled SDL_sound, when reading through the start of this discussion, this was the first thing that came to my mind.
@Taiyoumaru: this means you need to get coding and implement this and file a patch here. You can argue all you want about whether it is needed or not, eventually you would need to convince someone to code it for you or get coding yourself.
Unfortunately, the first rule of open source...

Windows 3.1x guide for DOSBox
60 seconds guide to DOSBox
DOSBox SVN snapshot for macOS (10.4-11.x ppc/intel 32/64bit) notarized for gatekeeper

Reply 18 of 34, by collector

User metadata
Rank l33t
Rank
l33t

I for one would like to have FLAC support. For me BIN/CUE is not a solution as I have never found a small and free command line ripper that can do BIN/CUE that I can include in my installers. I would like to give my users a choice in audio quality. I am able to do this with the games that I setup in ScummVM with my installers. However I prefer to use DOSBox unless there is a compelling reason to use ScummVM instead, like for the Windows version of KQ6.

As to quality I can most certainly hear a difference between FLAC and OGG/MP3, even with a constant bit rate at 320. But then my setup has a 24bit audio output fed into a real receiver and high end speakers. Disk space is a moot point on modern systems with such cheap drives measured in multiple terabytes.

In the end it is a matter of choice and not all situations are the same. Someone on a netbook or a tablet might have drive space concerns and will hear no difference from their internal speakers. These limitations are not present for many desktops.

@Yesterplay80, I would love to see you be able to get it working, but no rush.

The Sierra Help Pages -- New Sierra Game Installers -- Sierra Game Patches -- New Non-Sierra Game Installers

Reply 19 of 34, by NewRisingSun

User metadata
Rank Oldbie
Rank
Oldbie

My build of DOSBox includes SDL_sound and thus theoretical supports FLAC files. I had to modify CDROM_Interface_Image::AudioFile::getLength() to return the proper length of a FLAC file by replacing the strange "seeking until failure" method with a simple call to Sound_GetDuration, but the playback still skips, as was reported in an older thread. The reason for the skipping is that the FLAC decoder in SDL_Sound always decodes an entire frame at once, which for most files amounts to 16,384 bytes at once. DOSBox on the other hand wants just one audio CD sector decoded at once, amounting to 2,352 bytes, meaning that 14,032 bytes get skipped. I have modified SDL_Sound's FLAC.C file to return only as many bytes as the caller desires.