Module music in my programm.

SGDK only sub forum

Moderator: Stef

Post Reply
alko
Very interested
Posts: 172
Joined: Thu Aug 07, 2014 9:31 am
Location: Russian Federation

Module music in my programm.

Post by alko » Sat Mar 26, 2016 11:52 am

Whether there is a module player compatible with SGDK ?

For now I found only injectror, which allows to replace the standard music to custom.
http://oerg866.tototek.com/toy.html
Image

Nainain
Interested
Posts: 14
Joined: Sat Oct 11, 2014 3:34 pm

Re: Module music in my programm.

Post by Nainain » Tue Aug 23, 2016 8:16 am


Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Re: Module music in my programm.

Post by Stef » Tue Aug 23, 2016 11:33 am

I think he's looking for a real MOD player for Megadrive. And except the one borrowed from ToyStory game i don't know any other.

alko
Very interested
Posts: 172
Joined: Thu Aug 07, 2014 9:31 am
Location: Russian Federation

Re: Module music in my programm.

Post by alko » Tue Aug 23, 2016 1:09 pm

Stef wrote:And except the one borrowed from ToyStory game i don't know any other.
And this -> http://www.pouet.net/prod.php?which=64438
Image

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Re: Module music in my programm.

Post by Stef » Tue Aug 23, 2016 5:56 pm

As far I can tell this is just a simple music player for Megadrive with Megadrive designed musics, nothing common with MOD musics.

Mask of Destiny
Very interested
Posts: 616
Joined: Thu Nov 30, 2006 6:30 am

Re: Module music in my programm.

Post by Mask of Destiny » Wed Aug 24, 2016 6:42 pm

Stef wrote:As far I can tell this is just a simple music player for Megadrive with Megadrive designed musics, nothing common with MOD musics.
Stuck Somewhere in Time uses an actual MOD player, the caveat is that it runs almost entirely on the 68K (and chews up a fair bit of CPU time IIRC) with the Z80 only handling delivery of samples to the DAC from a buffer in its RAM.

EDIT: Here's the Spritesmind thread about it.

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Re: Module music in my programm.

Post by Stef » Thu Aug 25, 2016 8:01 am

Oh i completely forgot it was a MOD player :p 26 Khz playback, that is definitely interesting.
About having it running on the 68k, well i believe it would be hard to have it running on the Z80 only anyway, the best we can do is to share the work: maybe using 20% of 68k time to pre compute some parts then send final mixing operations to Z80.

Mask of Destiny
Very interested
Posts: 616
Joined: Thu Nov 30, 2006 6:30 am

Re: Module music in my programm.

Post by Mask of Destiny » Thu Aug 25, 2016 8:28 pm

Stef wrote:About having it running on the 68k, well i believe it would be hard to have it running on the Z80 only anyway,
Yeah, it's really hard to resample and mix more than 2 channels simultaneously on just the Z80 at any reasonable sample rate.
Stef wrote:the best we can do is to share the work: maybe using 20% of 68k time to pre compute some parts then send final mixing operations to Z80.
Yeah, mixing 4 channels is obviously possible since you've done it. I imagine volume should be possible to do on the Z80 side as well. I do wonder if you can reasonably keep the 68K time down to 20% though. Hard to push samples through efficiently when you can only pause the Z80 for a relatively short period at a time without overly interfering with playback.

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Re: Module music in my programm.

Post by Stef » Fri Aug 26, 2016 7:17 am

In fact I have a driver doing 4pcm mixing + volume/envelop (16 levels) but it supports envelop change once per frame and I'm not sure that enough to produce acceptable ADSR env reproduction.
About 68k <---> Z80 communication, you always have the SRAM possibility. To be honest I never tried it but I see no reason why it wouldn't work :-)

alko
Very interested
Posts: 172
Joined: Thu Aug 07, 2014 9:31 am
Location: Russian Federation

Re: Module music in my programm.

Post by alko » Mon Aug 29, 2016 6:26 am

Z80 qualitatively mixes samples

ZX-spectrum 48k (3 channel's 4 bit's):

https://youtu.be/3MNHP-hBMLI?t=46
Image

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Re: Module music in my programm.

Post by Stef » Mon Aug 29, 2016 8:18 am

Does it really mix samples ? 3x4 bit channel sounds like it's using the AY channels (which make sense of course). We could also do that on MD (use the PSG) to lower Z80 CPU usage.

Mask of Destiny
Very interested
Posts: 616
Joined: Thu Nov 30, 2006 6:30 am

Re: Module music in my programm.

Post by Mask of Destiny » Tue Aug 30, 2016 12:08 am

It does seem likely that it's using the AY hardware to handle the mixing. That said, mixing isn't all that expensive compared to the other stuff you need to do. The problem we have on the Gen/MD is that it's rather expensive to switch banks and you have to avoid doing any access to the 68K's bus while DMA is running. If you don't mind to limiting yourself to what will fit in the meager RAM of the Z80, then I suspect you could resample and mix 3 channels without too much trouble.

Post Reply