News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu
avatar_Shining

Sample-Playback on Plus-DMA question

Started by Shining, 17:25, 22 February 19

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

keith56

Great! Thanks for everyone's feedback,I've got my sample code working, and I think I have this understood well enough to do my tutorial!

I'll be covering playing a WAV on everything from the Speccy to the Gameboy, including the CPC/CPC+ so it should be quite fun!
Chibi Akumas: Comedy-Horror 8-bit Bullet Hell shooter!
Learn ARM, 8086, Z80, 6502 or 68000 with my tutorials: www.assemblytutorial.com
My Assembly programming book is available now on amazon!

Ast

Quote from: keith56 on 15:25, 27 February 19
But am I right in saying the PPR only slows down PAUSE commands? I did try values from 0-200, and if there are no pause commands in the stream, there was no noticeable speed difference (unless I'm using it wrong)
So to use the PPR to slow down playback, I may have to add PAUSE commands where they were not otherwise needed?


Yes, you are right !
_____________________

Ast/iMP4CT. "By the power of Grayskull, i've the power"

http://amstradplus.forumforever.com/index.php
http://impdos.wikidot.com/
http://impdraw.wikidot.com/

All friends are welcome !

Shining

By the way. I heavily use packers like exomizer in my productions but are such packers/depackers able to depack data like a stream ?
So that I can fill a buffer out of depacked data?


The sample, I want to play is targeting GX4000/464 64KB and is still too big...
TGS is back

Download my productions at:
cpc.scifinet.org

Docent

Quote from: Shining on 20:18, 28 February 19
By the way. I heavily use packers like exomizer in my productions but are such packers/depackers able to depack data like a stream ?
So that I can fill a buffer out of depacked data?


The sample, I want to play is targeting GX4000/464 64KB and is still too big...
I haven't heard about a packer for cpc with streaming support.
You can easily adapt any packer for such purpose - split source sample into chunks of replay buffer size and pack each chunk separately, add a byte at the beginning of packed chunk with the size of packed data and write all chunks sequentially to file. Depack single chunk when a buffer is available to fill and you'll get some sort of streaming.

Ast

Instead of replaying 15khz samples data, you could try to use 8khz ?
Try to use more and more loop, that's the key!

_____________________

Ast/iMP4CT. "By the power of Grayskull, i've the power"

http://amstradplus.forumforever.com/index.php
http://impdos.wikidot.com/
http://impdraw.wikidot.com/

All friends are welcome !

dthrone

Just chiming in with what I've found practical.  My (far from optimised) player sends 4k samples to the 3 channels and stores 2 frames-worth of DMA list per channel in the RAM.  It buffers in new lists every frame and that process takes 15-20% of frame time in total for the 3 channels.  I can live with that processing time and the hit on the RAM is minimal. 


Big hit is on the storage but like Ast says, if you use loops, have good compression and unpack routine etc. and most importantly, are using a 512k cart, it's feasible to have all your sfx in samples.


Sound quality of the 4k samples really isn't too bad!

Ast

#31
Quote from: dthrone on 10:32, 01 March 19
Big hit is on the storage but like Ast says, if you use loops, have good compression and unpack routine etc. and most importantly, are using a 512k cart, it's feasible to have all your sfx in samples.


Best example is Eerie Forest by Overflow/Logon -> http://www.pouet.net/prod.php?which=72271
As you can see, it's Possible to do really cool things !
_____________________

Ast/iMP4CT. "By the power of Grayskull, i've the power"

http://amstradplus.forumforever.com/index.php
http://impdos.wikidot.com/
http://impdraw.wikidot.com/

All friends are welcome !

Shining

Im already using looping and when I use 8kHz, I need pause-commands but I'll consider that. At the moment I'm using the complete data in the cart but when I'll do something like dthrone, I think, I'll get the size down to what I want.


So by using a buffer instead of the complete list, I do not need the 8kHz pause command in the list (in cart) and I can save two 4-bit values in one byte..
TGS is back

Download my productions at:
cpc.scifinet.org

dthrone

#33
Quote from: Shining on 12:29, 03 March 19

So by using a buffer instead of the complete list, I do not need the 8kHz pause command in the list (in cart) and I can save two 4-bit values in one byte..


Exactly, you only need to update the details of each (buffer) list each frame in the RAM, not the structure that is static.


I've not analysed the Eerie Forest code, they've probably got a really smart way of doing it  8)

Docent

Quote from: dthrone on 00:39, 04 March 19

Exactly, you only need to update the details of each (buffer) list each frame in the RAM, not the structure that is static.
Or trigger an interrupt at the end of dma list to refill the list with new audio data and restart playing it.
You can change the size of the list and the interrupt will be triggered at the right time.
btw: this is what I suggested earlier as double buffered interrupt driven replay routine.
 

Ast

Quote from: Docent on 12:53, 04 March 19
Or trigger an interrupt at the end of dma list to refill the list with new audio data and restart playing it.



Of course, you could do it !  ;D
_____________________

Ast/iMP4CT. "By the power of Grayskull, i've the power"

http://amstradplus.forumforever.com/index.php
http://impdos.wikidot.com/
http://impdraw.wikidot.com/

All friends are welcome !

Powered by SMFPacks Menu Editor Mod