Author Topic: Sample-Playback on Plus-DMA question  (Read 3621 times)

0 Members and 1 Guest are viewing this topic.

Offline keith56

  • ちび悪魔!
  • Supporter
  • 6128 Plus
  • *
  • Posts: 573
  • Country: jp
  • Part Ma, Part Aku... All Chibi!
    • Chibi Akumas Assembly tutorials
  • Liked: 928
  • Likes Given: 211
Re: Sample-Playback on Plus-DMA question
« Reply #25 on: 05:20, 28 February 19 »
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 Livestreaming Channel: ChibiAkimas Live

Offline Ast

  • 6128 Plus
  • ******
  • Posts: 1.105
  • Country: fr
    • Amstrad cpc Website of Ast/iMPACT
  • Liked: 1004
  • Likes Given: 745
Re: Sample-Playback on Plus-DMA question
« Reply #26 on: 13:49, 28 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"


Amstrad Plus French Forum

All friends are welcomed !

Offline Shining

  • Supporter
  • CPC6128
  • *
  • Posts: 278
  • Country: de
    • Shinings little CPC page
  • Liked: 381
  • Likes Given: 185
Re: Sample-Playback on Plus-DMA question
« Reply #27 on: 21: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...
TGS is back

Download my productions at:
cpc.scifinet.org

Offline Docent

  • CPC6128
  • ****
  • Posts: 166
  • Country: pl
  • Liked: 108
  • Likes Given: 0
Re: Sample-Playback on Plus-DMA question
« Reply #28 on: 22:27, 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.

Offline Ast

  • 6128 Plus
  • ******
  • Posts: 1.105
  • Country: fr
    • Amstrad cpc Website of Ast/iMPACT
  • Liked: 1004
  • Likes Given: 745
Re: Sample-Playback on Plus-DMA question
« Reply #29 on: 22:36, 28 February 19 »
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"


Amstrad Plus French Forum

All friends are welcomed !

Offline dthrone

  • CPC6128
  • ****
  • Posts: 211
  • Country: gb
    • SOHDE
  • Liked: 156
  • Likes Given: 217
Re: Sample-Playback on Plus-DMA question
« Reply #30 on: 11:32, 01 March 19 »
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!

Offline Ast

  • 6128 Plus
  • ******
  • Posts: 1.105
  • Country: fr
    • Amstrad cpc Website of Ast/iMPACT
  • Liked: 1004
  • Likes Given: 745
Re: Sample-Playback on Plus-DMA question
« Reply #31 on: 13:48, 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 !
« Last Edit: 13:50, 01 March 19 by Ast »
_____________________

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


Amstrad Plus French Forum

All friends are welcomed !

Offline Shining

  • Supporter
  • CPC6128
  • *
  • Posts: 278
  • Country: de
    • Shinings little CPC page
  • Liked: 381
  • Likes Given: 185
Re: Sample-Playback on Plus-DMA question
« Reply #32 on: 13:29, 03 March 19 »
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

Offline dthrone

  • CPC6128
  • ****
  • Posts: 211
  • Country: gb
    • SOHDE
  • Liked: 156
  • Likes Given: 217
Re: Sample-Playback on Plus-DMA question
« Reply #33 on: 01:39, 04 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)
« Last Edit: 01:47, 04 March 19 by dthrone »

Offline Docent

  • CPC6128
  • ****
  • Posts: 166
  • Country: pl
  • Liked: 108
  • Likes Given: 0
Re: Sample-Playback on Plus-DMA question
« Reply #34 on: 13:53, 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.
 

Offline Ast

  • 6128 Plus
  • ******
  • Posts: 1.105
  • Country: fr
    • Amstrad cpc Website of Ast/iMPACT
  • Liked: 1004
  • Likes Given: 745
Re: Sample-Playback on Plus-DMA question
« Reply #35 on: 20:00, 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"


Amstrad Plus French Forum

All friends are welcomed !