Page 1 of 1

Simple Beeps [Solved]

Posted: Tue Aug 15, 2023 1:11 pm
by waspentalive
[Solved ] I have no VERA experience and I must make sounds!

I need a routine to add to a basic program that will accept a number between 1 and 20, and produce a short nice beep with a frequency related to the number provided. Someone with some musical background would be nice as this program will be producing random beeps that relate to the x,y coordinates where the action is happening - so any combination of two 1-20 numbers can be beeped each time.

If the routine can accept both the x and the y numbers and produce a chord that would be even nicer, otherwise single beeps, one for x and one for y is fine - then the routine can simply accept one number.

Thanks

Thanks for your help @ahenry3068

Re: Simple Beeps

Posted: Tue Aug 15, 2023 1:27 pm
by ahenry3068
fmplay or psgplay...... Check the BASIC docs.

print chr$(7) also does a beep but its loud and theres no frequency control

https://github.com/X16Community/x16-doc ... 20BASIC.md

Re: Simple Beeps

Posted: Tue Aug 15, 2023 8:35 pm
by waspentalive
Is there some way for my program to wait until the last fmplay command is completed?

Does fmplay block until it has played out it's string? -update Nevermind I found the actual info I needed in another part of the documentation - fmplay does block.

At first, I was issuing fmplay commands for x and y and the value in grid(x,y) but I would not always get 3 sounds.

Then instead of playing the sounds as I come to them I built a string and at the proper time played that. The same thing still happened. Sometimes I would only hear 2 of the three chimes - sometimes only 1, sometimes all 3. When I built the string, I added a rest at the end so there should be a clear break between sounds.

Re: Simple Beeps

Posted: Tue Aug 15, 2023 9:20 pm
by ahenry3068
FmPlay does block. It doesn't return until it finishes the string.
You are calling FMINIT first, right. ?


Theres also an FMFREQ. That might work better for you....... I'm not sure.

Re: Simple Beeps

Posted: Tue Aug 15, 2023 11:57 pm
by waspentalive
oops, I had not.

I also had to mess with the code that broke out the strings from my list of pre-setup tones.

I generate a long string with notes A to F in each of the 4 octaves.
That string was generated correctly, but when I was grabbing octave-and-note strings from it I was off by one.

Now I am getting all three each time.
Now I have to find out how to set a faster tempo.

Re: Simple Beeps

Posted: Wed Aug 16, 2023 12:09 am
by ahenry3068
Best way to learn is by doing.............. Cool