Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

BEEP to PLAY conversion?

2 views
Skip to first unread message

zxbruno

unread,
Oct 28, 2009, 2:17:32 AM10/28/09
to
Does anyone know of a BASIC or machine code routine that can process a
list of BEEP commands and display what would be the equivalent if
using the PLAY command in 128K BASIC? I think I know how to do it but
my method would be in BASIC and it would probably be done the hard
way. I would probably read all BEEP commands on a BASIC listing and
output 1 string that could be viewed and saved, or maybe it would read
all BEEP commands if they were on DATA statements, and it would
probably get a little bit more complicated if I had to interpret PAUSE
commands between BEEPs. :|

Maybe something was already done and published on your favorite
Sinclair magazine back in the day. One can only hope. :)

zxbruno

unread,
Oct 28, 2009, 2:57:53 AM10/28/09
to

Ok, some type of progress has been made...

BEEP---------PLAY

0--------------------c
1------------------#c
2--------------------d
3------------------#d
4--------------------e
5--------------------f
6------------------#f
7--------------------g
8------------------#g
9--------------------a
10------------------#a
11-------------------b

Which makes me ask a few more questions.

How would I go about figuring out which Octave BEEP is using just by
consering the pitch value? For example, BEEP .05,0 translates as PLAY
"c", but BEEP .05,12 is PLAY "O6c". Is there a mathematical way to
determine which PLAY octave the BEEP pitch belongs too? The only way I
can think of is by doing this:

LET O=(5 AND N>=0 AND N<=11)+(6 AND N>=12 AND N<=23), etc.

Secondly, if PAUSE was used to create the BEEP tune, what would be the
best way to translate this to what PLAY uses?

And thirdly, I still have to come up with a table of BEEP durations
and their corresponding 9 possible note lenghts when using PLAY.

I think these three things will probably be enough for a decent
conversion. Will post more as this gets developed.

Brian Gaff

unread,
Oct 28, 2009, 5:12:17 AM10/28/09
to
There was a program like this back in the day, but as its been a long time I
cannot recall it. Was it not part of a commercial product?
The big problem is though, you would need to do it correctly, so you would
really have to merge a line in with the beeps, and read the data using the
sysvar nextlin presumably and try to decode the floating point versions of
numbers and the keyword tokens in the line.

Brian

--
Brian Gaff - bri...@blueyonder.co.uk
Note:- In order to reduce spam, any email without 'Brian Gaff'
in the display name may be lost.
Blind user, so no pictures please!
"zxbruno" <zxspec...@gmail.com> wrote in message
news:b428f812-f6a3-4d6c...@y10g2000prg.googlegroups.com...

Matthew Westcott

unread,
Oct 28, 2009, 5:50:02 AM10/28/09
to
zxbruno wrote:
> Is there a mathematical way to
> determine which PLAY octave the BEEP pitch belongs too? The only way I
> can think of is by doing this:
>
> LET O=(5 AND N>=0 AND N<=11)+(6 AND N>=12 AND N<=23), etc.

Would LET O=INT (N/12)+5 work?

Fred

unread,
Oct 28, 2009, 7:53:03 AM10/28/09
to
zxbruno wrote:
> Is there a mathematical way to
> determine which PLAY octave the BEEP pitch belongs too?

Don't know, but Beta Basic 4.0 has interrupt driven AY sound in the
BEEP! command which puts data directly into the AY registers.

The Beta Basic 4.0 manual says:
> The old BEEP numbers and the [AY] tone period are related like this:
> Tone Period=INT (125.95/2^((Beep Number-9)/12)+.5)

I think you could use that to derive the data required by an interrupt
driven playback routine rather than PLAY.

zxbruno wrote:
> Secondly, if PAUSE was used to create the BEEP tune, what would be the
> best way to translate this to what PLAY uses?

Still a slight tangent, but the Beta Basic manual suggests using a 0
tone period for this for its BEEP! command (which is not what PLAY uses
obviously).

On topic, the Spectrum 128 manual says:
> A rest (no note playing) is specified by a & and has the same length
> as the current note. For example
>
> 10 LET a$="7A&B&C&D&E"
>
> is five minims with equal pauses between them.

So you would set the note duration to match the PAUSE and use an "&".

Hope that helps,
Fred

OwenBot

unread,
Oct 28, 2009, 8:10:46 AM10/28/09
to
You've already got enough info to write an AY playback routine for
GarageBEEP. But why would you? You should really give Vortex Tracker
II a go. It's really very easy to use.
0 new messages