[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Very basic sound programming question
- Subject: Re: Very basic sound programming question
- From: Jim <jim@magrathea.plus.com>
- Date: Tue, 31 Mar 2009 10:10:39 +0100
- Approved: The Culture
- Cancel-lock: sha1:lhe7E+1J7NNw/1NeNFFyt2GCMtE=
- Newsgroups: comp.sys.apple2
- References: <slrngt3n51.2uu1.jim@wotan.magrathea.local>
- User-agent: slrn/0.9.8.1 (FreeBSD)
- Xref: g2news1.google.com comp.sys.apple2:7925
On 2009-03-31, Jim <jim@magrathea.plus.com> wrote:
[snip]
Actually, hold off on that - I just discovered the site
http://8bitsoundandfury.ld8.org/programming.html which seems to have what I
need. From that site:
----------
Not sure where this came from so I can't properly credit it, though I'm sure
I'm not giving away any trade secrets by publishing it here. Basically this
just pokes in a Machine Language tone generator from AppleSoft which can, in
turn, be called from the same AppleSoft program:
10 FOR L = 770 TO 790: READ V: POKE L,V: NEXT L
20 DATA 173,48,192,136,208,5,206,1,3,240,9
30 DATA 202,208,245,174,0,3,76,2,3,96
Now we have the tone generating routine in memory all we have to do is tell
it what note to play and for how long. This is done like so:
40 POKE 768,F: POKE 769,D
In the above line the variable F stands for Frequency and D stands for
Duration. Either variable can be any integer between 0 and 255. Note
duration can be determined [more-or-less] by dividing, so that if a whole
note is equal to a duration of 216, then a half note would be 108 and a
quarter note would be 54, and so on.
----------
I _swear_ I Googled for this and came up blank..:-)
I'll give this a try and see if it does what I want. Hope this is of some
use to other people.
Jim
--
http://www.ursaMinorBeta.co.uk http://twitter.com/GreyAreaUK
Please help save Bletchley Park - sign the petition for
Government funding at: (open to UK residents and ex.pats)
http://petitions.number10.gov.uk/BletchleyPark/ Thank you.