Blitter sound routine

GFA, ASM, STOS, ...

Moderators: simonsunnyboy, Mug UK, Zorro 2, Moderator Team

User avatar
npomarede
Atari God
Atari God
Posts: 1237
Joined: Sat Dec 01, 2007 7:38 pm
Location: France

Re: Using blitter for sound mixing

Postby npomarede » Thu May 17, 2018 10:08 am

Hi
yes, that's the idea :)

working with a larger buffer (triple or even more) is a good alternative too, because you don't have to change the number of generated sample per VBL, you just have to stop generating samples at one point when the buffer is too much "in advance" (this is similar to how Hatari internaly generate emulated sound samples for the OS, using a circular 16 KB buffer, with one pointer to write new data and one pointer to read data and push them to the OS).
A larger buffer will create a small latency (2 VBL in your case with triple buffer), but that's unnoticeable in the case of a demo.

User avatar
troed
Atari God
Atari God
Posts: 1380
Joined: Mon Apr 30, 2012 6:20 pm
Location: Sweden

Re: Using blitter for sound mixing

Postby troed » Thu May 17, 2018 1:34 pm

STE base clock is either 8.02 or 8.05 (NTSC models) though.

User avatar
metalages
Obsessive compulsive Atari behavior
Obsessive compulsive Atari behavior
Posts: 115
Joined: Thu Jun 06, 2013 5:14 pm
Location: France
Contact:

Re: Using blitter for sound mixing

Postby metalages » Thu May 17, 2018 2:38 pm

Does this mean something around 50.23 VBL per sec => 996.73 DMA sound samples per sec ?

User avatar
metalages
Obsessive compulsive Atari behavior
Obsessive compulsive Atari behavior
Posts: 115
Joined: Thu Jun 06, 2013 5:14 pm
Location: France
Contact:

Re: Using blitter for sound mixing

Postby metalages » Mon May 21, 2018 6:13 pm

Ok I have something working with de-sync looping-dma and replay routine using 4 buffers.
So no more click indeed.

Drawbacks with this approach are :
- there is a small desync in replay / rythm when I catch up. Can be accpetable as it does not happen so often.
- it would be difficult with this approach to sync STe balance control with score

User avatar
metalages
Obsessive compulsive Atari behavior
Obsessive compulsive Atari behavior
Posts: 115
Joined: Thu Jun 06, 2013 5:14 pm
Location: France
Contact:

Re: Using blitter for sound mixing

Postby metalages » Tue May 22, 2018 9:26 pm

Ok. In order to avoid these problems I went for something like you have proposed in a first time Nicolas :
- DMA in loop mode
- 3 buffers
- chain assignments of dma start / end adresses on buffers (1, 2, 3, 1, 2, 3...) at a point later where I am sure new adresses have been acquired by dma
- monitor read cursor to determine if I need to render a 1000 or 1002 samples on the next frame
- and tune dma end address accordingly

I have something working in C under Hatari. No click, no lag...
Need to port this in ASM now ;)

User avatar
npomarede
Atari God
Atari God
Posts: 1237
Joined: Sat Dec 01, 2007 7:38 pm
Location: France

Re: Using blitter for sound mixing

Postby npomarede » Tue May 22, 2018 9:36 pm

Great ! Hopefully, doing the same in ASM should not be a problem now that you have the logic right in C :)

User avatar
dhedberg
Atari Super Hero
Atari Super Hero
Posts: 700
Joined: Mon Aug 30, 2010 8:36 am
Contact:

Re: Using blitter for sound mixing

Postby dhedberg » Tue May 22, 2018 9:38 pm

Pretty awesome! Please make something with this! Too good to just be put on the shelf!
Daniel, New Beat - http://newbeat.atari.org. Like demos? Have a look at our new Falcon030 demo MORE.

User avatar
metalages
Obsessive compulsive Atari behavior
Obsessive compulsive Atari behavior
Posts: 115
Joined: Thu Jun 06, 2013 5:14 pm
Location: France
Contact:

Re: Using blitter for sound mixing

Postby metalages » Sat May 26, 2018 9:31 pm

Ok it now works in C and ASM perfectly on Hatari :)
Need to check on real hardware now...

User avatar
metalages
Obsessive compulsive Atari behavior
Obsessive compulsive Atari behavior
Posts: 115
Joined: Thu Jun 06, 2013 5:14 pm
Location: France
Contact:

Re: Using blitter for sound mixing

Postby metalages » Sat Jun 02, 2018 9:15 pm

I have tested on STe. Here is the result :

https://youtu.be/ehSvjL8RLo4

It works the same way than in Hatari => nearly no click, but I have the feeling that even with DMA in loop mode,
I have some clicks when running at display time instead of start of VBL (not really a problem as I do not see the point to run it during display)

User avatar
metalages
Obsessive compulsive Atari behavior
Obsessive compulsive Atari behavior
Posts: 115
Joined: Thu Jun 06, 2013 5:14 pm
Location: France
Contact:

Re: Using blitter for sound mixing

Postby metalages » Sat Jun 02, 2018 9:34 pm

... and sources + binary released here

https://github.com/gibs75/demOS

User avatar
CiH
Atari God
Atari God
Posts: 1113
Joined: Wed Feb 11, 2004 4:34 pm
Location: Middle Earth (Npton) UK
Contact:

Re: Using blitter for sound mixing

Postby CiH » Sun Jun 03, 2018 6:52 pm

Pretty awesome! I second Daniel. This is too good to be left here.
"Where teh feck is teh Hash key on this Mac?!"

User avatar
metalages
Obsessive compulsive Atari behavior
Obsessive compulsive Atari behavior
Posts: 115
Joined: Thu Jun 06, 2013 5:14 pm
Location: France
Contact:

Re: Using blitter for sound mixing

Postby metalages » Sun Jun 03, 2018 7:06 pm

Code and binaries are on github :)

So it is available for musicians and coders (ask me if you need help)

I think at some point I will find time to make a musik disk if some musicians are interested to collaborate but I am currently quite busy :(

User avatar
metalages
Obsessive compulsive Atari behavior
Obsessive compulsive Atari behavior
Posts: 115
Joined: Thu Jun 06, 2013 5:14 pm
Location: France
Contact:

Re: Using blitter for sound mixing

Postby metalages » Tue Jun 05, 2018 8:32 pm

New release of BLSplay and BLSconvert with support of STe balance (microwire) like described into doc

https://github.com/gibs75/demOS

User avatar
metalages
Obsessive compulsive Atari behavior
Obsessive compulsive Atari behavior
Posts: 115
Joined: Thu Jun 06, 2013 5:14 pm
Location: France
Contact:

Re: Using blitter for sound mixing

Postby metalages » Thu Jun 07, 2018 7:39 pm

BLSplay v1.2.0 submitted => speed up init samples process (was really slow)

User avatar
metalages
Obsessive compulsive Atari behavior
Obsessive compulsive Atari behavior
Posts: 115
Joined: Thu Jun 06, 2013 5:14 pm
Location: France
Contact:

Re: Using blitter for sound mixing

Postby metalages » Tue Jun 19, 2018 8:01 pm

new commit : https://github.com/gibs75/demOS

BLSplay 1.4.0
- add support for delay sample effect (0xEDx)
- on PC : closing the window closes the player
- little optimizations in ASM
- split ASM source (inits / play)
- update unit tests
- update doc

BLSconvert 1.1.0
- add support for delay sample effect (0xEDx)

User avatar
metalages
Obsessive compulsive Atari behavior
Obsessive compulsive Atari behavior
Posts: 115
Joined: Thu Jun 06, 2013 5:14 pm
Location: France
Contact:

Re: Blitter sound routine

Postby metalages » Mon Jun 25, 2018 9:19 pm

new commit : https://github.com/gibs75/demOS

BLSconvert 1.1.1
- fix convertion when different samples have same transposed size

BLSplay 1.5.0
- display v=* when voices are off (optimized)
- little optimization in ASM version

User avatar
dhedberg
Atari Super Hero
Atari Super Hero
Posts: 700
Joined: Mon Aug 30, 2010 8:36 am
Contact:

Re: Blitter sound routine

Postby dhedberg » Mon Jun 25, 2018 9:30 pm

Looks like it's keeping you busy! Any hope for a remote entry at Sommarhack? :wink:
Daniel, New Beat - http://newbeat.atari.org. Like demos? Have a look at our new Falcon030 demo MORE.

User avatar
metalages
Obsessive compulsive Atari behavior
Obsessive compulsive Atari behavior
Posts: 115
Joined: Thu Jun 06, 2013 5:14 pm
Location: France
Contact:

Re: Blitter sound routine

Postby metalages » Mon Jun 25, 2018 9:43 pm

Yep, using it brings me to some necessary adjustements ;)
Too short unfortunately for Sommarhack.
But some design for a musik disk is currently growing in my mind ;)

User avatar
dhedberg
Atari Super Hero
Atari Super Hero
Posts: 700
Joined: Mon Aug 30, 2010 8:36 am
Contact:

Re: Blitter sound routine

Postby dhedberg » Tue Jun 26, 2018 6:06 am

That sounds great as well! Looking forward to get my hands on that music disk! :D
Daniel, New Beat - http://newbeat.atari.org. Like demos? Have a look at our new Falcon030 demo MORE.


Social Media

     

Return to “Coding”

Who is online

Users browsing this forum: No registered users and 6 guests