Playing sample sound on plain ST with GFA

GFA BASIC-related articles in here please

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

Playing sample sound on plain ST with GFA

Postby BoNuS » Sat Jun 16, 2012 10:47 am

This is probably the biggest noob question I'll ever ask, but I can't find on my disks a file that helps.

What I want is to play a sample on an normal Atari ST on 12,5 Khz, I have a perfectly working routine
for the STE/TT and Falcon but that doesn't seem to work on the normal ST. Since I'm working
on a game project I would like it to work on all Atari's this time.
And also I want to see if the sample is still playing or not, would probably bee a peek of somekind...

I had such a routine in the Batman Classic demo, but due a harddisk crash years ago (and I really mean
yearsssss ago ;) ) that source is lost. The last few projects have always been on the Falcon so I'm
a bit of a lose.

So does anybody has a piece of code , preferable with good comments, that can help me out ?
In .GFA or .LST format :wink:
http://bonus.home.xs4all.nl/
2 x Falcon 030 - a mint Atari TT - Mega STE - 2x STE - 1x Mega 2 - 2x STFM - 1 x STF - 3x SC1224 - 2x SM124 - 1x SM125 2x Portofolio+interface
- 3x 1435 monitor - 1 x Ult.Ripper cardridge - Mega 1,2,and 4 ( just to much Atari stuff)
User avatar
BoNuS
Atari Super Hero
Atari Super Hero
 
Posts: 622
Joined: Mon Jan 19, 2009 12:45 pm
Location: The Netherlands

Re: Playing sample sound on plain ST with GFA

Postby charles » Sat Jun 16, 2012 10:54 am

the name is called xbios sound
there is a replay routine included on one of the coverdisks from the magazine st format

i think googling stformat replay will bring it up

charles
atari is my lifestyle,not a hobby.
User avatar
charles
10 GOTO 10
10 GOTO 10
 
Posts: 1853
Joined: Tue Aug 17, 2004 12:11 am
Location: ont. Canada

Re: Playing sample sound on plain ST with GFA

Postby Mug UK » Sat Jun 16, 2012 11:11 am

Xbios Sound is for YM sounds Charles.

Bonus - I'll look in my big pot of GFA Source code and see what I can find. I'm guessing you'll want it as some INLINE routine you can call that runs on interrupts etc.?
Having sold 99.9% of my 1300+ collection of originals, I'm taking a bit of a back seat on the forum. I'll still do the front-of-house admin tasks as and when they're required but, for now, I'm enjoying my Xbox 360 time too much :)

Image
User avatar
Mug UK
Administrator
Administrator
 
Posts: 10986
Joined: Thu Apr 29, 2004 7:16 pm
Location: Heaton Chapel (UK)

Re: Playing sample sound on plain ST with GFA

Postby simonsunnyboy » Sat Jun 16, 2012 11:28 am

Maybe there is something within the Spriteworks package?
I remember that I was on the lookout for such routine aswell, years ago, and as I didn'T find anything that wouldn't kill too many resources or had other drawbacks, I never used a sample replay for STFM yet.
Simon Sunnyboy/Paradize - http://paradize.atari.org/ - STOT: http://www.npoi.de/stot/

Stay cool, stay Atari!

1x2600jr, 1x1040STFm, 1x1040STE 4MB+TOS2.06+SatanDisk, 1xF030 14MB+FPU+NetUS-Bee

Jabber: simonsunnyboy@atari-jabber.org
User avatar
simonsunnyboy
Moderator
Moderator
 
Posts: 4305
Joined: Wed Oct 23, 2002 4:36 pm
Location: Friedrichshafen, Germany

Re: Playing sample sound on plain ST with GFA

Postby simonsunnyboy » Sat Jun 16, 2012 11:32 am

I had a quick look and it seems Spriteworks has what you are looking for:

(manual quoted)

Code: Select all
FILE:       SAMPLAY.INL
SETUP:      INLINE sam_play%,2662
            sam_stop%=sam_play%+4
            sam_wait%=sam_play%+8
            sam_convert%=sam_play%+12
            sam_playing%=sam_play%+16
SYNTAX:     ~C:sam_play%(L:sample,L:length,frequency,loop)
            ~C:sam_stop%()
            ~C:sam_wait%()
            ~C:sam_convert%(L:sample,L:length)
            play=C:sam_playing%()
ARGUMENTS:
sample      (L) start address of sample
length      (L) length of sample
frequency   (W) playback frequency 2500-16000Hz
loop        (W) 0=play once, 1=repeat sample
RETURNS:
play        (L) 0=not playing, otherwise address of current sample

SAM_PLAY is used to play samples.  The first time the command is called
the interrupt Timer A is set up,  each successive call will only change
the  sample pointers without having to reinitialise Timer  A.  While  a
sample is playing the rest of the program will continue to run,  but if
you  wish  to halt the program until the sample has finished  then  use
SAM_WAIT.  This is the newest version of the sample player which allows
you  to specify exactly what speed the playback should be for  accurate
control instead of the old table of fixed playback speeds.

When  the samples have been finished with or the program  has  finished
then you must use SAM_STOP to stop the interrupt otherwise the  program
will be likely to crash on exit.

This sample player plays signed samples, if a sample sounds terrible on
playback it is probably an unsigned sample.  Use SAM_CONVERT to convert
from one format to the other.

This  version  of the sample player uses less processor time  than  the
original  and so gives more time for the processor to execute your  own
code.  It does have one disadvantage though, the routine will overshoot
the  end  of the sample,  from between 50 to  300 bytes*  (depending  on
playback frequency).  This may result in the sample 'clicking' when  it
has finished. To solve the problem you can either make sure that zeroes
follow the sample,  or tell the sample player that the sample is a  100
bytes or so shorter in length.

*  The  maximum  number  of bytes that a sample  can  overshoot  by  is
frequency/50.

By  using the SAM_PLAYING command it is possible to see what sample  is
currently playing. A value of zero is returned if no sample is playing,
otherwise the first address of the sample playing is returned.

It  is actually possible to play samples AND have border  removal,  but
not with this routine.  You will need to use SAMPLAY+ which is not only
compatible  with  the  border  removal  but  also  uses  slightly  less
processor time,  so even if you aren't using border removal but wish to
squeeze some more CPU time out of the computer then this is the command
for you.


As always with samples on STFM, without tight m68k integration, you normally can't use other interrupts that much together with it, e.q. border killers or rasters.
You do not have the required permissions to view the files attached to this post.
Simon Sunnyboy/Paradize - http://paradize.atari.org/ - STOT: http://www.npoi.de/stot/

Stay cool, stay Atari!

1x2600jr, 1x1040STFm, 1x1040STE 4MB+TOS2.06+SatanDisk, 1xF030 14MB+FPU+NetUS-Bee

Jabber: simonsunnyboy@atari-jabber.org
User avatar
simonsunnyboy
Moderator
Moderator
 
Posts: 4305
Joined: Wed Oct 23, 2002 4:36 pm
Location: Friedrichshafen, Germany

Re: Playing sample sound on plain ST with GFA

Postby Mug UK » Sat Jun 16, 2012 12:10 pm

Beat me to it SSB - Spriteworks was going to be my first port of call :)
Having sold 99.9% of my 1300+ collection of originals, I'm taking a bit of a back seat on the forum. I'll still do the front-of-house admin tasks as and when they're required but, for now, I'm enjoying my Xbox 360 time too much :)

Image
User avatar
Mug UK
Administrator
Administrator
 
Posts: 10986
Joined: Thu Apr 29, 2004 7:16 pm
Location: Heaton Chapel (UK)

Re: Playing sample sound on plain ST with GFA

Postby BoNuS » Sat Jun 16, 2012 12:13 pm

Great guys, thanks for the very quick response !!!
Will try this one :)
http://bonus.home.xs4all.nl/
2 x Falcon 030 - a mint Atari TT - Mega STE - 2x STE - 1x Mega 2 - 2x STFM - 1 x STF - 3x SC1224 - 2x SM124 - 1x SM125 2x Portofolio+interface
- 3x 1435 monitor - 1 x Ult.Ripper cardridge - Mega 1,2,and 4 ( just to much Atari stuff)
User avatar
BoNuS
Atari Super Hero
Atari Super Hero
 
Posts: 622
Joined: Mon Jan 19, 2009 12:45 pm
Location: The Netherlands

Re: Playing sample sound on plain ST with GFA

Postby lp » Sat Jun 16, 2012 1:02 pm

Another options is GFA's built in commands for playing samples. You need a DMA sound equipped machine, like an STE or TT. Have a look at the commands DAMCONTROL and DMASOUND. The only catch is the samples must be in a format compatible with the DMA sound hardware.
User avatar
lp
Atari God
Atari God
 
Posts: 1747
Joined: Wed Nov 12, 2003 11:09 pm
Location: My desk

Re: Playing sample sound on plain ST with GFA

Postby BoNuS » Sat Jun 16, 2012 3:44 pm

lp wrote:Another options is GFA's built in commands for playing samples. You need a DMA sound equipped machine, like an STE or TT. Have a look at the commands DAMCONTROL and DMASOUND. The only catch is the samples must be in a format compatible with the DMA sound hardware.


Welll on the STE, TT and Falcon my routine works, but on the ST it didn't so thats why I was looking :)
But the Spriteworks routine seems to do the job, it works and the samples sound exactly the same now
as on the other machines. So it seems "Problem solved, next...."
http://bonus.home.xs4all.nl/
2 x Falcon 030 - a mint Atari TT - Mega STE - 2x STE - 1x Mega 2 - 2x STFM - 1 x STF - 3x SC1224 - 2x SM124 - 1x SM125 2x Portofolio+interface
- 3x 1435 monitor - 1 x Ult.Ripper cardridge - Mega 1,2,and 4 ( just to much Atari stuff)
User avatar
BoNuS
Atari Super Hero
Atari Super Hero
 
Posts: 622
Joined: Mon Jan 19, 2009 12:45 pm
Location: The Netherlands

Re: Playing sample sound on plain ST with GFA

Postby charles » Sat Jun 16, 2012 11:35 pm

ok samples is not my area of expertise
but i know there is a coverdisk(st format) with a sample replay routine on it.

it has a c gfa and basic include file

maybe classic computer archive has so not st format?????dunno?

there was a sample of a macine gun , and the file was called gunshot.spl

cool?

charles
atari is my lifestyle,not a hobby.
User avatar
charles
10 GOTO 10
10 GOTO 10
 
Posts: 1853
Joined: Tue Aug 17, 2004 12:11 am
Location: ont. Canada

Re: Playing sample sound on plain ST with GFA

Postby BoNuS » Sun Jun 17, 2012 8:50 am

The Spriteworks, which we are talking about here, is it a package I can download ?
Just did a search on the forum and it is there is a lot of talk about it but can't seem
to find "the" package (if there is any :) )
Seems that even an old GFA programmer like myself can learn a lot from it and
even use some of the routines.

That brings up another question: Are there any copyright on it ? Or is it PD
or other ?

The sample routine works okay for me but in the end I end up with a beeeeep
which stay on until I click a key or the mouse button. Haven't really sorted it out
indepth but might just be my fault...
Sofar my project seems to be saved also for the ST, so not onlt STE/TT and Falcon.

I'm off coding again ;)
http://bonus.home.xs4all.nl/
2 x Falcon 030 - a mint Atari TT - Mega STE - 2x STE - 1x Mega 2 - 2x STFM - 1 x STF - 3x SC1224 - 2x SM124 - 1x SM125 2x Portofolio+interface
- 3x 1435 monitor - 1 x Ult.Ripper cardridge - Mega 1,2,and 4 ( just to much Atari stuff)
User avatar
BoNuS
Atari Super Hero
Atari Super Hero
 
Posts: 622
Joined: Mon Jan 19, 2009 12:45 pm
Location: The Netherlands

Re: Playing sample sound on plain ST with GFA

Postby lp » Sun Jun 17, 2012 10:17 am

I don't have a memory map in front of me, but you could try shutting off the key-click before the sample starts and flip it back on after its done.
User avatar
lp
Atari God
Atari God
 
Posts: 1747
Joined: Wed Nov 12, 2003 11:09 pm
Location: My desk

Re: Playing sample sound on plain ST with GFA

Postby Klapauzius » Sun Jun 17, 2012 10:23 am

BoNuS wrote:The sample routine works okay for me but in the end I end up with a beeeeep
which stay on until I click a key or the mouse button. Haven't really sorted it out
indepth but might just be my fault...


You can also inline this little code at the end of your routine to tell the PSG to shut up: ;-)

Code: Select all
lea      $ffff8800.w,a0
move.l   #$08080000,(a0)
move.l   #$09090000,(a0)
move.l   #$0a0a0000,(a0)


This just mutes the PSG.
http://www.klapauzius.net
http://dbug.kicks-ass.net/klaz

The tears are welling in my eyes again, I need twenty big buckets to catch them in, twenty pretty girls to carry them down, twenty deep holes to bury them in.
User avatar
Klapauzius
The Klaz
The Klaz
 
Posts: 4298
Joined: Sun Jul 04, 2004 7:55 am
Location: Bavaria

Re: Playing sample sound on plain ST with GFA

Postby Mug UK » Sun Jun 17, 2012 11:05 am

It was in the forum somewhere as I uploaded it from my original disks. If memory serves the developer, Terry King, popped up not long afterwards.

Fantasic library for GFA game developers. Think he also used my GFA Linker too but I can't remember if that was just a recommendation or if he bundled it with the complete package.

I'm in a cafe at the moment but will look for the original post when I get back home.
Having sold 99.9% of my 1300+ collection of originals, I'm taking a bit of a back seat on the forum. I'll still do the front-of-house admin tasks as and when they're required but, for now, I'm enjoying my Xbox 360 time too much :)

Image
User avatar
Mug UK
Administrator
Administrator
 
Posts: 10986
Joined: Thu Apr 29, 2004 7:16 pm
Location: Heaton Chapel (UK)

Re: Playing sample sound on plain ST with GFA

Postby Mug UK » Sun Jun 17, 2012 12:37 pm

Found it ;-)

viewtopic.php?f=69&t=12203


There were a few games released that were developed using it by Terry - including: Bombs Away (which I'd forgotten about and will update the Atari Legend details when I can remember where the background database link is ... it's been a while) and Goin' Down With The Captain (http://www.atarilegend.com/games/games_ ... me_id=3268).
Having sold 99.9% of my 1300+ collection of originals, I'm taking a bit of a back seat on the forum. I'll still do the front-of-house admin tasks as and when they're required but, for now, I'm enjoying my Xbox 360 time too much :)

Image
User avatar
Mug UK
Administrator
Administrator
 
Posts: 10986
Joined: Thu Apr 29, 2004 7:16 pm
Location: Heaton Chapel (UK)

Re: Playing sample sound on plain ST with GFA

Postby BoNuS » Mon Jun 18, 2012 3:20 pm

Great, thanks. Will have a look what it is all about...
http://bonus.home.xs4all.nl/
2 x Falcon 030 - a mint Atari TT - Mega STE - 2x STE - 1x Mega 2 - 2x STFM - 1 x STF - 3x SC1224 - 2x SM124 - 1x SM125 2x Portofolio+interface
- 3x 1435 monitor - 1 x Ult.Ripper cardridge - Mega 1,2,and 4 ( just to much Atari stuff)
User avatar
BoNuS
Atari Super Hero
Atari Super Hero
 
Posts: 622
Joined: Mon Jan 19, 2009 12:45 pm
Location: The Netherlands

Re: Playing sample sound on plain ST with GFA

Postby BoNuS » Sun Jul 29, 2012 3:18 pm

I've busy for a while now again and made good progress. Also found out that combining the GFA sample routine for the
Atari ST and the .SNDH player don't work together (well nog on a plain ST that is). Also on a Falcon the .SNDH routine and
the samples don't work together stable. They work but crash after a while ;(

So that means for me that the game wil only have sampled sounds and no ingame music which is a shame...
But better just sampled sound then no sound at all of instable (you don't want to crash it during a game)

Now I have to figur out the best way to find out what kind of machine I'm running on so I can select
the right code for example switching resolution.
XBIOS(3) and XBIOS(4) work okay on a normal ST, STE and TT but on a Falcon they are missing parameters.
XBIOS(88) will do it on a Falcon but calling it on a normal ST will crash (I tried that).
Also I will have to sample routines, one for the ST and another for the rest...
http://bonus.home.xs4all.nl/
2 x Falcon 030 - a mint Atari TT - Mega STE - 2x STE - 1x Mega 2 - 2x STFM - 1 x STF - 3x SC1224 - 2x SM124 - 1x SM125 2x Portofolio+interface
- 3x 1435 monitor - 1 x Ult.Ripper cardridge - Mega 1,2,and 4 ( just to much Atari stuff)
User avatar
BoNuS
Atari Super Hero
Atari Super Hero
 
Posts: 622
Joined: Mon Jan 19, 2009 12:45 pm
Location: The Netherlands

Re: Playing sample sound on plain ST with GFA

Postby simonsunnyboy » Sun Jul 29, 2012 3:29 pm

I normally have DMA sound samples and SNDH music on STE and Falcon.

It is pretty obvious that running both a STFM sample player and concurrent SNDH will interfere. The sample will update the Ym registers with several 6kHz but the SNDH mostly with 200Hz or slower (so in the best case the music will be lost).

How about a configurable option:
STF: either music OR samples
STE/Falcon: music OR musics and samples via DMA

?
Simon Sunnyboy/Paradize - http://paradize.atari.org/ - STOT: http://www.npoi.de/stot/

Stay cool, stay Atari!

1x2600jr, 1x1040STFm, 1x1040STE 4MB+TOS2.06+SatanDisk, 1xF030 14MB+FPU+NetUS-Bee

Jabber: simonsunnyboy@atari-jabber.org
User avatar
simonsunnyboy
Moderator
Moderator
 
Posts: 4305
Joined: Wed Oct 23, 2002 4:36 pm
Location: Friedrichshafen, Germany

Re: Playing sample sound on plain ST with GFA

Postby BoNuS » Sun Jul 29, 2012 5:20 pm

simonsunnyboy wrote:I normally have DMA sound samples and SNDH music on STE and Falcon.

It is pretty obvious that running both a STFM sample player and concurrent SNDH will interfere. The sample will update the Ym registers with several 6kHz but the SNDH mostly with 200Hz or slower (so in the best case the music will be lost).

How about a configurable option:
STF: either music OR samples
STE/Falcon: music OR musics and samples via DMA

?


Well it was worth trying on the ST :) I used the GWEN player from you site btw.
STF:But indeed, probably a option to choose. I don't have music yet, the samples are ready.
STE/Falcon/TT : Well I'm using the DMA for the samples AFAIK, ( &HFFFF8900 and so on) or am I doing something wrong ?
http://bonus.home.xs4all.nl/
2 x Falcon 030 - a mint Atari TT - Mega STE - 2x STE - 1x Mega 2 - 2x STFM - 1 x STF - 3x SC1224 - 2x SM124 - 1x SM125 2x Portofolio+interface
- 3x 1435 monitor - 1 x Ult.Ripper cardridge - Mega 1,2,and 4 ( just to much Atari stuff)
User avatar
BoNuS
Atari Super Hero
Atari Super Hero
 
Posts: 622
Joined: Mon Jan 19, 2009 12:45 pm
Location: The Netherlands


Return to GFA BASIC

Who is online

Users browsing this forum: CommonCrawl [Bot] and 0 guests