How to make a beep [SOLVED]

Post

Posted
Rating:
#1 (In Topic #1017)
Regular
JumpyVB is in the usergroup ‘Regular’
 Is there an easy way to make a beep sound in Gambas? The gb.ncurses component seems to have Screen.Beep() but I couldn't make it work. Besides I am working on a Graphical application.
Online now: No Back to the top

Post

Posted
Rating:
#2
Avatar
Guru
cogier is in the usergroup ‘Guru’
This is the way I do it. You need gb.sdl2.audio. You then load a music file and play it. This can be a 'beep' or a 2-hour concert. I have attached a 'beep.ogg' file for you to put in your program's main folder.

Code (gambas)

  1. ''Needs gb.sdl2.audio
  2.  
  3. Public Sub Form_Open()
  4.  
  5.   Music.Load(Application.Path &/ "beep.ogg")
  6.   Music.Play
  7.  

Attachment
Online now: No Back to the top

Post

Posted
Rating:
#3
Regular
vuott is in the usergroup ‘Regular’
Sometimes this question about the beep comes up. Out of curiosity, I'm reporting the discussions, opened in some Gambas forums, related to that topic:

Gambas One - Gambas ONE
Ist gb stumm? - Der Gambas Club
https://foro.gambas-es.org/viewtopic.php?f=5&t=6884
Fare BIIIIIP
Eseguire onde sonore con Alsa - Gambas-it.org - Wikipedia

Europaeus sum !

<COLOR color="#FF8000">Amare memorentes atque deflentes ad mortem silenter labimur.</COLOR>
Online now: No Back to the top

Post

Posted
Rating:
#4
Regular
JumpyVB is in the usergroup ‘Regular’

vuott said

Sometimes this question about the beep comes up. Out of curiosity, I'm reporting the discussions, opened in some Gambas forums, related to that topic:

Gambas One - Gambas ONE
Ist gb stumm? - Der Gambas Club
https://foro.gambas-es.org/viewtopic.php?f=5&t=6884
Fare BIIIIIP
Eseguire onde sonore con Alsa - Gambas-it.org - Wikipedia

Very interesting.
Online now: No Back to the top

Post

Posted
Rating:
#5
Regular
JumpyVB is in the usergroup ‘Regular’

cogier said

This is the way I do it. You need gb.sdl2.audio.

Code (gambas)

  1. Public Sub Form_Open()
  2.   Music.Load(Application.Path &/ "beep.ogg")
  3.   Music.Play
This works for me. Thank you.

Also found some alternative sound files to use from /usr/share/mint-artwork/sounds/
Online now: No Back to the top

Post

Posted
Rating:
#6
Avatar
Regular
thatbruce is in the usergroup ‘Regular’
Thanks from me too Cogier. I have some daily jobs that run for some time, enough time for a couple of games of solitaire or so. So I made your code into a little component with a static function to play a "nice" beep when the job completes. Very simple and works like a charm.

Online now: No Back to the top
1 guest and 0 members have just viewed this.