Breaking the silence
You may have noticed that there's one thing melonDS 0.1 lacks sorely: sound. It's an integral part of the gaming experience.

It's also one of the big items in the TODO list, so let's do this.


Getting basic sound playback going wasn't too difficult. The DS sound hardware is pretty simple: 16 channels that can play sound data encoded in PCM8, PCM16 or IMA-ADPCM. Channels 8 to 13 also support rectangular waves (PSG), and channels 14 and 15 can produce white noise.

I first worked on PSG as it's pretty simple, there would be less things that could go wrong. And indeed, the issues I got were mostly dumb little things like forgetting to clear intermediate buffers. Once that was working, I completed it with support for the remaining sound formats.


And there it was, sound in melonDS. That thing finally begins resembling a DS emulator :)

The sound core in melonDS is synchronous. The major downside is that it sounds like shit if emulation isn't running fullspeed. But it's been stated that the goal of melonDS is to do things right. There are other reasons why it has to be synchronous, too; the main one is sound capture.


The DS has two sound capture units, which can record audio output and write it to memory. Those are used in some games to apply a surround effect to the audio output, or to do reverb. The idea is to send the mixer output to the capture units instead of outputting directly, then use channels 1 and 3 to output the captured audio data after it's been altered by software.

Setups using sound capture expect that capture buffers will be filled at a fixed interval. This breaks apart if your sound core is asynchronous, because there is no guarantee that it will produce sound at a regular rate. What if you end up producing more sound than the game's buffer can hold? In these situations, the best way is to ignore those effects entirely. Same reason why the old HLE audio implementation of Dolphin didn't support reverb effects.


Anyway, sound output is still in the works, but it's fairly promising so far.


Oh by the way, have I mentioned that there are other DS emulators being worked on? Check out medusa!
naknow says:
Apr 9th 2017
medusa seems cool, and I'll definitely be checking it out soon.

However, medusa is aiming to emulate more than one console, the other two being the GameBoy, and the GameBoy Advance.
The way that I see it, due to the fact it's trying to emulate more than one console, the development will be much slower than that of melonDS. What if endrift was to work on the GameBoy portion first, leaving the DS portion's development to come to a halt?

Personally, I do not need a GameBoy emulator at this moment. With that in mind, melonDS's production will be reduced more than medusa. Not to mention, the development of medusa has only begun now, whilst melonDS's development began almost a year ago.

With that in mind, I believe the development of melonDS is currently at a higher level than medusa's and I will hereby stick with this emulator.

I hope my wording makes a point on why I will support development of melonDS more than I do with medusa.

Post a comment
Name:
DO NOT TOUCH