how can i do music on megadrive?

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

Moderator: BigEvilCorporation

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

Post by TmEE co.(TM) »

I almost finished my 2ch driver and the result was like 6KHz or so :cry:
Then I made it into 1ch driver and started to optimize it. Now the single channel stuff runs at blazing 37KHz 8) . There are some thing left to do (commands, sample end detection), but I'll upload it on Monday. I won't give out the source yet (little messed up, even I don't understand it).
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 »

TmEE co.(TM) wrote:
Stef wrote:Using signed 8 bits sample permit to keep the quality of 8 bits sample and have only an extra "add $80" instruction.
Which is faster, shift or add ?
A simple add or shift take 4 cycles (if working on register only).
If you need shift x 2 then you're on 8 cycles. I'm doing a ADD $80 which take 7/8 cycle also. In fact the 7 bits unsigned sample seems as the best solution :)
Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef »

TmEE co.(TM) wrote:I almost finished my 2ch driver and the result was like 6KHz or so :cry:
Then I made it into 1ch driver and started to optimize it. Now the single channel stuff runs at blazing 37KHz 8) . There are some thing left to do (commands, sample end detection), but I'll upload it on Monday. I won't give out the source yet (little messed up, even I don't understand it).
6 Khz isn't that bad to start with. I started mine with a bit more then i optimised up to 14 Khz :) Congrats anyway for making it, that's not easy to deal with ;)
37 Khz is very fast, actually too much for the DAC !
TmEE co.(TM)
Very interested
Posts: 2452
Joined: Tue Dec 05, 2006 1:37 pm
Location: Estonia, Rapla City
Contact:

Post by TmEE co.(TM) »

Anyway I've uploaded it
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 »

TmEE co.(TM) wrote:Anyway I've uploaded it
Very nice tune =) Sound like sort of amiga Turrican.
TmEE co.(TM)
Very interested
Posts: 2452
Joined: Tue Dec 05, 2006 1:37 pm
Location: Estonia, Rapla City
Contact:

Post by TmEE co.(TM) »

Stef wrote:Very nice tune =) Sound like sort of amiga Turrican.

Actually its a tune from Mega Turrican :wink: I chose it, because it does 2ch mixing aswell @ 15KHz like yours :D
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 »

TmEE co.(TM) wrote:
Stef wrote:Very nice tune =) Sound like sort of amiga Turrican.

Actually its a tune from Mega Turrican :wink: I chose it, because it does 2ch mixing aswell @ 15KHz like yours :D
Mega Turrican ? the genesis version one ? well strange i didn't recognized it... I almost know all MT tune :D
Also i didn't know it was doing 15 Khz 2 ch mixing :p
I'll try to improve mine to reach the famous 16 Khz, it would be nice =)
Pascal
Very interested
Posts: 200
Joined: Wed Nov 29, 2006 11:29 am
Location: Belgium
Contact:

Post by Pascal »

well it's nice to have more khz :) but more khz mean more rom space :s my game is 200ko for 2.2 mo of audio samples :s
TmEE co.(TM)
Very interested
Posts: 2452
Joined: Tue Dec 05, 2006 1:37 pm
Location: Estonia, Rapla City
Contact:

Post by TmEE co.(TM) »

Pascal wrote:well it's nice to have more khz :) but more khz mean more rom space :s my game is 200ko for 2.2 mo of audio samples :s
I NEED more KHz, because cymbals(vital part of metal) don't sound very good if not playedback at high sample rate.
You may also want to experiment with FM synth to get SFX if you're not doing so already. YM2612 can do really cool sounds :wink: .

Anyway, I managed to improve my soon to be 2ch player, and now it plays @ 41 KHz 8) !!!

Stef, I noticed lots of JRs in your code, JR slower than JP (I'm not sure if in all cases) on Z80. AS maybe optimizing those to JPs but I'm not sure. I lost 1KHz :shock: if I changed just one JR to JP !!!
You change bank for every sample, that just kills sampling rate in my driver implementation :( 41KHz turns to 18... how fast does your driver go if you play only one channel (2nd disabled) and change bank only if required ???
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 »

Pascal wrote:well it's nice to have more khz :) but more khz mean more rom space :s my game is 200ko for 2.2 mo of audio samples :s
Actually i want to add a variable sample rate feature (as the one channel player) but first i want to optimise the 2ch player a bit, having a maximum of 16 Khz would be pretty nice :)

Anyway, I managed to improve my soon to be 2ch player, and now it plays @ 41 KHz 8) !!!

Stef, I noticed lots of JRs in your code, JR slower than JP (I'm not sure if in all cases) on Z80. AS maybe optimizing those to JPs but I'm not sure. I lost 1KHz :shock: if I changed just one JR to JP !!!
JR are faster when the branchement isn't taken, it's why i reorganised my code to avoid branchement when possible. When i can't avoid them, i'm using JP :)
You change bank for every sample, that just kills sampling rate in my driver implementation :( 41KHz turns to 18... how fast does your driver go if you play only one channel (2nd disabled) and change bank only if required ???
I did 2 different driver :
My 2ch player plays at a stable 14 Khz whatever you're doing. It set bank each time for each sample even when they aren't playing...
My single channel player can play up to 56 Khz in fastest mode but with variable bit rate feature, it can play up to 40 Khz, which is anyway more than enough :)
Last edited by Stef on Mon Feb 26, 2007 7:05 pm, edited 2 times in total.
Fonzie
Genny lover
Posts: 323
Joined: Tue Aug 29, 2006 11:17 am
Contact:

Post by Fonzie »

or maybe you can do one channel at 8 khz and one at 16 ;)
Even better and faster :P
Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef »

Fonzie wrote:or maybe you can do one channel at 8 khz and one at 16 ;)
Even better and faster :P
It's an idea but i guess it wouldn't be easy to use it ;)
Fonzie
Genny lover
Posts: 323
Joined: Tue Aug 29, 2006 11:17 am
Contact:

Post by Fonzie »

Well, i don't know... It seems viable to me.. using one channel for sfx and the other for bgm ^^ :P
Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef »

Fonzie wrote:Well, i don't know... It seems viable to me.. using one channel for sfx and the other for bgm ^^ :P
Well, you're right, it can be quite usefull in this view. Implement it not will be that easy tough ;)
TmEE co.(TM)
Very interested
Posts: 2452
Joined: Tue Dec 05, 2006 1:37 pm
Location: Estonia, Rapla City
Contact:

Post by TmEE co.(TM) »

8 and 16KHz, sounds interesting, but changing banks is still a real sample rate killer...

My idea: play 1 sample alone, no mixing, play 2nd sample and mix it with one from another channel. Then you can have 2 channels, which one plays at half speed.
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
Post Reply