Post by sega16 on Oct 20, 2011 19:47:06 GMT -5
Do you need a good way to play high quality audio using little space then I would recommend using Tadpcm. The z80 driver is not my work I just put together a bex example
Edit new download link
www.mediafire.com/download/0q0yxab5gdm77ic/tadpcm%20bex.zip
Step 1:
go to were all the bex files are stored and in the root directory create a folder called "pcm"
Step 2: extract all the files in the attached zip file into the new folder
Step 3: converting a song to tadpcm. To add a song you must first convert it to tadpcm so save anything you want as a headerless wav MUST BE 16-BIT MONO in your audio editing program (.snd in goldwave or .raw in alot of programs) or you could always just save as wave and hex edit out header.Now to convert the uncompressed file to tadpcm you must right click on compress.bat and replace what is in the double quotes to what you are converting you way get something like this:
pcm2tadpcm "input.snd" "output.snd"
Now run the batch file and you will get the compressed music file
Step 4: adding the asm code for song. Now that you converted the song you must add the song to pcm_player.asm
so first of all below
add
not the value by cmpi.b is a hex-decimal value
and now find
copy paste all this and paste it below:
you will have 2 labels that say
remove 1 of them
once you did that on the new copy change:
to
(I replaced the labels that say 2 and changed them to 3)
now change:
to:
(changed song2 to song3 and changed song3 to song4)
also you can change the sample rate based on the song by changing this:
now find:
and change it to
step 5:playing the sample
now to add tadpcm to your project just add that code below to the bottom of your project:
and to play a song just simply put
or if you want to play song 2 do
Edit new download link
www.mediafire.com/download/0q0yxab5gdm77ic/tadpcm%20bex.zip
Step 1:
go to were all the bex files are stored and in the root directory create a folder called "pcm"
Step 2: extract all the files in the attached zip file into the new folder
Step 3: converting a song to tadpcm. To add a song you must first convert it to tadpcm so save anything you want as a headerless wav MUST BE 16-BIT MONO in your audio editing program (.snd in goldwave or .raw in alot of programs) or you could always just save as wave and hex edit out header.Now to convert the uncompressed file to tadpcm you must right click on compress.bat and replace what is in the double quotes to what you are converting you way get something like this:
pcm2tadpcm "input.snd" "output.snd"
Now run the batch file and you will get the compressed music file
Step 4: adding the asm code for song. Now that you converted the song you must add the song to pcm_player.asm
so first of all below
cmpi.b #$02,d0
beq.w Playsong2
add
cmpi.b #$03,d0
beq.w Playsong3
not the value by cmpi.b is a hex-decimal value
and now find
Playsong2:
jsr PCMDriverLoad
move.w #$100,($A11100).l ;Stop the Z80
WaitZ80_02:
btst #0,($A11100).l
bne.s WaitZ80_02 ;Wait for z80 to stop
move.b #(((song2)&$FF0000)>>16),($a00042).l ;location high byte
move.b #(((song2)&$FF00)>>8),($a00041).l ;location mid byte
move.b #((song2)&$FF),($a00040).l ;location low byte
move.b #(((song3-song2)&$FF0000)>>16),($a00045).l ;length high byte
move.b #(((song3-song2)&$FF00)>>8),($a00044).l ;length mid byte
move.b #((song3-song2)&$FF),($a00043).l ;length low byte
move.b #$C0,($a0004d).l ;pan center
move.b #$FF,($a0004e).l ;play how many times
move.b #$00,($a0004f).l ;pause = 0
move.b #$01,($a00050).l ;sample rate (NEW!);0D=11khz 04=16KHZ 22KHZ=01 8khz=15 7khz=1A 6khz=20 5khz=28
move.w #$0,($A11100).l ;Start the Z80
goback:
rts
copy paste all this and paste it below:
goback:
rts
you will have 2 labels that say
goback:
remove 1 of them
once you did that on the new copy change:
Playsong2:
jsr PCMDriverLoad
move.w #$100,($A11100).l ;Stop the Z80
WaitZ80_02:
btst #0,($A11100).l
bne.s WaitZ80_02 ;Wait for z80 to stop
to
Playsong3:
jsr PCMDriverLoad
move.w #$100,($A11100).l ;Stop the Z80
WaitZ80_03:
btst #0,($A11100).l
bne.s WaitZ80_03 ;Wait for z80 to stop
(I replaced the labels that say 2 and changed them to 3)
now change:
move.b #(((song2)&$FF0000)>>16),($a00042).l ;location high byte
move.b #(((song2)&$FF00)>>8),($a00041).l ;location mid byte
move.b #((song2)&$FF),($a00040).l ;location low byte
move.b #(((song3-song2)&$FF0000)>>16),($a00045).l ;length high byte
move.b #(((song3-song2)&$FF00)>>8),($a00044).l ;length mid byte
move.b #((song3-song2)&$FF),($a00043).l ;length low byte
to:
move.b #(((song3)&$FF0000)>>16),($a00042).l ;location high byte
move.b #(((song3)&$FF00)>>8),($a00041).l ;location mid byte
move.b #((song3)&$FF),($a00040).l ;location low byte
move.b #(((song4-song3)&$FF0000)>>16),($a00045).l ;length high byte
move.b #(((song4-song3)&$FF00)>>8),($a00044).l ;length mid byte
move.b #((song4-song3)&$FF),($a00043).l ;length low byte
(changed song2 to song3 and changed song3 to song4)
also you can change the sample rate based on the song by changing this:
move.b #$01,($a00050).l ;sample rate (NEW!);0D=11khz 04=16KHZ 22KHZ=01 8khz=15 7khz=1A 6khz=20 5khz=28
now find:
song2:
incbin "pcm\The Brentwoods - Billy Maysc.snd"
align 2
song3:
and change it to
song2:
incbin "pcm\The Brentwoods - Billy Maysc.snd"
align 2
song3:
incbin "pcm\Lights_out_rick_astleyc.snd"
align 2
song4:
step 5:playing the sample
now to add tadpcm to your project just add that code below to the bottom of your project:
asm
include "pcm\pcm_player.asm"
end asm
and to play a song just simply put
asm
move.b #$01,d0
jsr Playtadpcm
end asm
or if you want to play song 2 do
asm
move.b #$02,d0
jsr Playtadpcm
end asm