Simple Beeps [Solved]

Talk about your programs in progress. Discuss how to implement features, etc.
Forum rules
This section is for testing Commander X16 programs and programs related to the CX16 for other platforms (compilers, data conversion tools, etc.)

Feel free to post works in progress, test builds, prototypes, and tech demos.

Finished works go in the Downloads category. Don't forget to add a hashtag (#) and the version number your program was meant to run on. (ie: #R41).
Post Reply
waspentalive
Posts: 24
Joined: Fri Jun 17, 2022 5:51 pm
Location: Sacramento, CA

Simple Beeps [Solved]

Post 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
Last edited by waspentalive on Wed Aug 16, 2023 2:07 am, edited 2 times in total.
User avatar
ahenry3068
Posts: 1028
Joined: Tue Apr 04, 2023 9:57 pm

Re: Simple Beeps

Post 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
waspentalive
Posts: 24
Joined: Fri Jun 17, 2022 5:51 pm
Location: Sacramento, CA

Re: Simple Beeps

Post 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.
User avatar
ahenry3068
Posts: 1028
Joined: Tue Apr 04, 2023 9:57 pm

Re: Simple Beeps

Post 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.
waspentalive
Posts: 24
Joined: Fri Jun 17, 2022 5:51 pm
Location: Sacramento, CA

Re: Simple Beeps

Post 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.
User avatar
ahenry3068
Posts: 1028
Joined: Tue Apr 04, 2023 9:57 pm

Re: Simple Beeps

Post by ahenry3068 »

Best way to learn is by doing.............. Cool
Post Reply