Product Chat / Simple, simple request.

Author
Message
GubbyBlips
5
Years of Service
User Offline
Joined: 14th Jan 2019
Location:
Posted: 5th Aug 2019 20:57
Developers, Lee, etc.
Please consider implementing the following simple function
into GG soon!

PlayTone(val, dur)
Plays a sound at frequency of value (1-256) and duration (for beeps, tweets,
blips, etc). There looks like a lot of sound calls in Global -- but only for files-
if I'm not mistaken? This would be really handy-- very handy!
For example I need 8-9 sounds for one entity, (only 5 are available) and this
would fill in that need not only quicker and more conveniently than creating a file.
Thanks!
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 5th Aug 2019 21:05 Edited at: 5th Aug 2019 23:10
Frequency 1-256? Is your game for Elephants?

Use Global sounds, you can have as many of those as you want!

Btw, this may be a simple request assuming that the function is already available in DX11 sound handling, if not then it is about as far from simple as you can get!

You could simply use a single tone sample and change the pitch and duration from Lua to achieve the same effect.
Been there, done that, got all the T-Shirts!
PM
GubbyBlips
5
Years of Service
User Offline
Joined: 14th Jan 2019
Location:
Posted: 5th Aug 2019 21:54
Well, Basic had this way back in DOS era, so it "sounded" simple.
I'll look into the globals. I didn't see tones when I glanced in there.

Back in the day again (90's?), I used this in QBasic and discovered a fun trick
to find your memory values currently residing in the computer, and
play a sound with this to create "computer" speech.
This isn't what I need to do today-- but you never know!

You are right, maybe the number was 1-32767 not 256!
http://www.schoolfreeware.com/QBasic_Tutorial_25_-_Sound_And_Music_-_QB64.html

Globals:
LoadGlobalSound: LoadGlobalSound ( filename, iID ) -- where iID is an index greater than zero and filename points to a WAV file in your game installation
DeleteGlobalSound: DeleteGlobalSound ( iID ) -- where iID is the index of the sound loaded in the load command
PlayGlobalSound: PlayGlobalSound ( iID ) -- where iID is the index of the sound to be played
LoopGlobalSound: LoopGlobalSound ( iID ) -- where iID is the index of the sound to be looped
StopGlobalSound: StopGlobalSound ( iID ) -- where iID is the index of the sound to be stopped
SetGlobalSoundSpeed: SetGlobalSoundSpeed ( iID, speed ) -- where iID is the index of the sound to change the speed of
SetGlobalSoundVolume: SetGlobalSoundVolume ( iID, volume ) -- where iID is the index of the sound to change the volume of
GetGlobalSoundExist: GetGlobalSoundExist ( iID ) -- where iID is the index of the sound to check existence of
GetGlobalSoundPlaying: GetGlobalSoundPlaying ( iID ) -- where iID is the index of the sound to check if playing
GetGlobalSoundLooping: GetGlobalSoundLooping ( iID ) -- where iID is the index of the sound to check if looping
PM
Teabone
Forum Support
17
Years of Service
User Offline
Joined: 8th Jun 2006
Location: Earth
Posted: 6th Aug 2019 16:35 Edited at: 6th Aug 2019 16:36
Closest you can get with what we already have:

SetGlobalSoundSpeed: SetGlobalSoundSpeed ( iID, speed )

If using a tone sound as reference. You can use a custom variable for speed for say 'health' or anything really that can be read from GG via LUA. Even the time of day. etc. Closest you can get for detecting computer specifications is probably checking the FPS. By changing the speed value you can essentially change the pitch.

Pretty much as Amen says:
Quote: "You could simply use a single tone sample and change the pitch and duration from Lua to achieve the same effect"
Store Assets - Store Link

i7 -2600 CPU @ 3.40GHz - Windows 7 - 8GB RAM - Nivida GeForce GTX 960
Mr Love
18
Years of Service
User Offline
Joined: 9th Jun 2005
Location: Sweden
Posted: 6th Aug 2019 18:46
What exactly are You going to use this for? If it is computers with different "blip" sounds just use a sound-editor and make it ONE file. Im getting a little bit curious what You want to do?
Guess what Aiko and I did this weekend...
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 6th Aug 2019 18:53
yh it really isn't needed, just use a normal sound file like you would anything else then you can use the sound commands to control it... though if you're really set on using default windows sounds it may be possible to use lua to play a windows sound using the os.execute? google says this may work
os.execute("echo \7")
or
os.execute("echo \a")
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
GubbyBlips
5
Years of Service
User Offline
Joined: 14th Jan 2019
Location:
Posted: 6th Aug 2019 21:24
Well, thanks everyone for the reply's, though I must ask...
Nobody finds value in a function to call straight from lua- a sound with
digital frequency and duration?! The sky is the limit after that!
You could have a million sounds (an orchestra!) through one script!
In fact artificial speech is simply the tight control of just such a system.
Not that I'm hardly trying to go that far right now, but that's where it starts.
Hmmmm.... constraints must be a habit.
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 6th Aug 2019 22:06
You would think that if it were that simple and that useful then operating systems would do it that way but strangely they all use sound samples, I wonder why that might be?
Been there, done that, got all the T-Shirts!
PM
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 7th Aug 2019 18:51
Quote: "Well, thanks everyone for the reply's, though I must ask...
Nobody finds value in a function to call straight from lua- a sound with
digital frequency and duration?! The sky is the limit after that!
You could have a million sounds (an orchestra!) through one script!
In fact artificial speech is simply the tight control of just such a system.
Not that I'm hardly trying to go that far right now, but that's where it starts.
Hmmmm.... constraints must be a habit. "

unless i'm missing something this is not the same as what you suggested in the first post, to make an orchestra or voice system you would be using more than the preloaded sounds that come with windows (unless we have access to the cortana sound files that i don't know about?)
if you're asking for GG to just include some basic sounds by default then i misunderstood the original question but the advice given is still valid, it's perfectly fine to use the global sounds to create your own little sound functions.
so
PlayTone(id,pitch)

would really just be calling some global sound functions
function PlayTone(id,pitch)
LoadGlobalSound ( "tone.wav", id )
PlayGlobalSound(id)
SetGlobalSoundSpeed ( id, pitch)
end
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 7th Aug 2019 19:02
Once upon a time it was quite common for machines to contain sound synthesis hardware but when CPU's and bus speeds became fast enough to play digital sound samples that hardware went the way of the dinosaur.

I don't know enough about DX11 to say whether it has any synthesiser capabilities built in, if so GG could probably be 'tweaked' to make use of them but as it is far easier to use samples I don't quite see the point of doing so! (and can think of at least a dozen other things I would add first!)
Been there, done that, got all the T-Shirts!
PM
GubbyBlips
5
Years of Service
User Offline
Joined: 14th Jan 2019
Location:
Posted: 7th Aug 2019 23:12
Pre- loaded? Well, what I imagine happens is that the QBasic line just sends
a signal to the speakers (possibly through the sound card) at 'f' frequency,
and 'd' duration. There would be no files involved. I guess without having
seen it, maybe it's hard to imagine what I am speaking of.

I'm wondering, since AGK is more aligned to "arcade" style games and a variety
of game types, if it has some kind of PlaySound function of which I am referring to?

Similarly like in QBasic where you could simply draw a line on screen with
Line(x,y,a,b,color) or Circle(x,y,radius,color). Fun ways to produce simple stuff.
But probably not much conducive to a First Person Shooting environment.....?!?

We are in a different era these days I am sure!
https://www.qbasic.net/en/reference/qb11/Statement/SOUND.htm
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 7th Aug 2019 23:21
So just create your game in QBasic?

Been there, done that, got all the T-Shirts!
PM
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 8th Aug 2019 03:51
Quote: "I'm wondering, since AGK is more aligned to "arcade" style games and a variety
of game types, if it has some kind of PlaySound function of which I am referring to?"

No. AGK is very limited in this regard. Didn't see any commands to change frequency in AGK At least not in the version I have (V2). I highly doubt the new version has any improvements. I wanted to play about with a very basic music program and was stonewalled when I found no real sound commands available

Dark Basic could do it though I imagine. It had a decent set of commands in comparison. I was quite disappointed to find AGK had such a limited range of sound commands. I suppose for general game stuff it is adequate. No way to alter frequency that I found though. If anyone knows differently please enlighten me
SPECS: Ryzen 1700 CPU. Nvidia 970GTX. 16 Gig Memory. Win 10.
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 8th Aug 2019 10:26
Quote: "I was quite disappointed to find AGK had such a limited range of sound commands"

uhm text to speech, recording and even creating sounds from file is limited? what would you consider an expanded range?
though no there isn't any way to adjust the frequency aside from doing it manually using the create file from sound and editing the memblock/file
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 8th Aug 2019 15:58
@smallg. DB Pro had a bigger range many years before it. I find AGK a little limiting in comparison. If DB Pro didn't have odd issues with Windows 10 I'd still be using it.
I also wanted a way to check the pixel colours of the screen, which again DB had a simple command for, AGK does not So both of my little project ideas didn't get far off the ground. Although I could have swore it used to have that sort of ability when it was first launched (the original version, not V2).
I used memblocks back in DB Pro. Mostly for media free things. I did consider them when I found no frequency command, but ended up just forgetting it. If I have a goal in mind I can be impatient to get to the meat of it, I find distractions like this just kill my creative flow
SPECS: Ryzen 1700 CPU. Nvidia 970GTX. 16 Gig Memory. Win 10.

Login to post a reply

Server time is: 2024-03-29 07:35:51
Your offset time is: 2024-03-29 07:35:51