how can i do music on megadrive?

For anything related to sound (YM2612, PSG, Z80, PCM...)

Moderator: BigEvilCorporation

Post Reply
KanedaFr
Administrateur
Posts: 1139
Joined: Tue Aug 29, 2006 10:56 am
Contact:

Post by KanedaFr » Fri Feb 02, 2007 1:07 pm

Stef wrote:FXaddr++ ? are you coding the Z80 in C ? that explain some stuff :)
Maybe your Z80 C compiler isn't a good optimiser...
of course not!!! :)
it was a simple to write the full code....
I checked TmEE z80WAV code, he did the same...
too bad :(

I optimized some code reading z80 optimisation trick on the web+some rewriting...
I'm now at 8.1KHz ;)

TmEE co.(TM)
Very interested
Posts: 2440
Joined: Tue Dec 05, 2006 1:37 pm
Location: Estonia, Rapla City
Contact:

Post by TmEE co.(TM) » Fri Feb 02, 2007 1:13 pm

Is your modded KMod available ?

That new feature is really useful.
Mida sa loed ? Nagunii aru ei saa ;)
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen

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

Post by Stef » Fri Feb 02, 2007 1:18 pm

TmEE co.(TM) wrote:Why do you need to access YM2612 with 68K and z80 at the same time ?
Because i'm using the Z80 to play sample and i don't want to interrupt it to keep a good playback quality.
We can use the 68000 to handle MIDI YM2612 playing and the Z80 for DAC playing but if we need to halt the Z80 during 68000 YM2612 access, there is no more point of doing that :-/

KanedaFr
Administrateur
Posts: 1139
Joined: Tue Aug 29, 2006 10:56 am
Contact:

Post by KanedaFr » Fri Feb 02, 2007 1:26 pm

TmEE co.(TM) wrote:Is your modded KMod available ?

That new feature is really useful.
well, it's a hybrid version badly coded from 0.6_beta
you could download it from
http://www.spritesmind.net/share/gens_DACFreq.zip
look at where the DAC value was written, it's now the frequency (so you loose the DAC value..)


I'll delete it when I'll release next KMod (I hope next week)

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

Post by Stef » Fri Feb 02, 2007 1:58 pm

KanedaFr wrote:
TmEE co.(TM) wrote:Is your modded KMod available ?

That new feature is really useful.
well, it's a hybrid version badly coded from 0.6_beta
you could download it from
http://www.spritesmind.net/share/gens_DACFreq.zip
look at where the DAC value was written, it's now the frequency (so you loose the DAC value..)


I'll delete it when I'll release next KMod (I hope next week)
Thanks ! very nice feature !
It's good to spy the DAC rate used in each game :) and even more usefull for our dev ;)

TmEE co.(TM)
Very interested
Posts: 2440
Joined: Tue Dec 05, 2006 1:37 pm
Location: Estonia, Rapla City
Contact:

Post by TmEE co.(TM) » Fri Feb 02, 2007 2:08 pm

KanedaFr wrote:
TmEE co.(TM) wrote:Is your modded KMod available ?

That new feature is really useful.
well, it's a hybrid version badly coded from 0.6_beta
you could download it from
http://www.spritesmind.net/share/gens_DACFreq.zip
look at where the DAC value was written, it's now the frequency (so you loose the DAC value..)


I'll delete it when I'll release next KMod (I hope next week)
Badly coded or not, still better than nothing. I don't care about the DAC value so no problem.
Mida sa loed ? Nagunii aru ei saa ;)
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen

TmEE co.(TM)
Very interested
Posts: 2440
Joined: Tue Dec 05, 2006 1:37 pm
Location: Estonia, Rapla City
Contact:

Post by TmEE co.(TM) » Fri Feb 02, 2007 2:19 pm

I guess 2 PCM channels mixed together are enough. My future (distant future) music driver will do 2 Ch, 1 for drums, 1 for sfx and drums (sfx have priority). I need 2 ch because I'm going to make metal like music and metal consists of heavy drum and cymbal action, just drums are not that good.
Mida sa loed ? Nagunii aru ei saa ;)
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen

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

Post by Stef » Fri Feb 02, 2007 2:35 pm

Yep 2 channels isn't bad after all.
But i had a quick look on genesis games (Thanks again Kaneda :p), it appears that beats and/or drums often need a high rate, i saw some 22 Khz rate used here and there... it would be very difficult to maintain 22 Khz with 2 samples played at the same time !

KanedaFr
Administrateur
Posts: 1139
Joined: Tue Aug 29, 2006 10:56 am
Contact:

Post by KanedaFr » Sat Feb 03, 2007 2:19 am

I'm suprised looking at Mick & Mack...the freq change a lot during fx....
some kind of delta ???

TmEE co.(TM)
Very interested
Posts: 2440
Joined: Tue Dec 05, 2006 1:37 pm
Location: Estonia, Rapla City
Contact:

Post by TmEE co.(TM) » Sat Feb 03, 2007 10:24 am

Stef wrote:Yep 2 channels isn't bad after all.
But i had a quick look on genesis games (Thanks again Kaneda :p), it appears that beats and/or drums often need a high rate, i saw some 22 Khz rate used here and there... it would be very difficult to maintain 22 Khz with 2 samples played at the same time !
I need at least 11KHz because cymbals don't sound good if lower sampling rate. 11KHz (or more) can be achieved very well, if all the samples you use are in the same 32K segment so you need to change bank only once.
Mida sa loed ? Nagunii aru ei saa ;)
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen

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

Post by Stef » Sat Feb 03, 2007 11:46 am

Actually my code just handle 2 samples at 11 Khz (and not 8 Khz as i first though) =) but i've to do some changes since when only 1 sample is played, it's played at 14 Khz (i've to add a wait loop somewhere).

TmEE co.(TM)
Very interested
Posts: 2440
Joined: Tue Dec 05, 2006 1:37 pm
Location: Estonia, Rapla City
Contact:

Post by TmEE co.(TM) » Sat Feb 03, 2007 4:41 pm

I would mix dummy bytes together not sit in delayloop. How do you mix stuff ? My method is (Byte1+Byte2)/2 but two 8 bit values overflow the register. (Byte1/2)+(Byte2/2) is an option too, now I'm thinking, that all PCM data should be less than 128 so no shifts need to be done.
Mida sa loed ? Nagunii aru ei saa ;)
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen

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

Post by Stef » Sat Feb 03, 2007 8:59 pm

For now i'm doing (byte + byte) and i don't check for carry.
The normal way is just (byte + byte) then limit result if carry happen.
Using / 2 will limit your maximum volume for each channel, that give too quiet sound.
I'm also mixing dummy bytes but i bypass some others part as address increment... anyway not very difficult to fix ;)

TmEE co.(TM)
Very interested
Posts: 2440
Joined: Tue Dec 05, 2006 1:37 pm
Location: Estonia, Rapla City
Contact:

Post by TmEE co.(TM) » Mon Feb 05, 2007 6:36 am

Ok, no shifting at all
Mida sa loed ? Nagunii aru ei saa ;)
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen

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

Post by Stef » Mon Feb 05, 2007 3:22 pm

nope =)
but normally you should check for carry occuring and fixe value if happened.

Post Reply