Page loading

Share your opinion
What do you think about gambaslinux.fr?
 
Interesting
It miss some informations
Excellent website
Results
WIDGETS GAMBAS
GAMBAS 3 SOFTWARES
TUTORIALS
Library
Gambas 2 - gb.sdl.sound
GB.SDL.SOUND



Hye,
Today we explain the gb.sdl.sound component who play a sound from Gambas.


SOUND
To play a sound with this command use this code :

mysound = NEW Sound("/home/user/yeah.wav")
mysound.play

the first line load sound in the mysound variable.
The second line play to the soundcard the sound.
Well, there is a problem. It is impossible to stop the sound while you play it. And we don't know which channel play. We don't have to code as this.


CHANNELS
this is the channel which you plaay the sound. There is 32 channels. It is easy to play the sound qith this code :

mysound = NEW Sound("/home/user/yeah.wav")
Channels[3].Play(mysound, 0)

The first line preload the wav sound in the mysound variable and the second line play the sound on the channel 3 and repeat it 1 time(0 number)


If you want to repeat in loop, put  -1
If you want to repeat 1 time, put 0, 2 time put 1 etc...
The advantage to code with this method, you can drive correctly your sound :

PAUSE, PLAY STOP, et VOLUME
example :

Channels[3].Pause
Channels[3].Stop
Channels[3].Volume = 0.12

 volumemust be from 0.1 to 1as from 1 to 100%


MUSIC
this command play some MP3 from direct to disk without preload in memory :

Music.Load("/home/user/essai.mp3")
Music.Play



CDROM

You can drive CDROM unit with this command in the same thing as MUSIC command

regards

information : Per haps, you have the ERROR 11. this is a ubuntu bug and not a gambas bug.




Creation date : 11/01/2011 @ 20:15
Last update : 01/03/2011 @ 10:13
Category : Gambas 2
Page read 4918 times


Print the article Print the article


react.gifReactions to this article


Reaction #3 

by spheris 03/05/2011 @ 18:22

Autant pour moi je n'avais pas vu la fréquence !
1000Hz correspond à 1 milliseconde, ce qui est bien trop rapide pour gambas.

Il te faut passer par un circuit externe à brancher sur le pc (genre arduino, pic etc...) toujours dans le cas où tu veux utiliser Gambas bien entendu.
wink

Reaction #2 

by spheris 03/05/2011 @ 18:19

Guy,
il te suffit de mettre sur ta feuille un Timer  et dans ton timer tu demande a jouer un son comme ceci :

Timer1_timer()
dim mysound as sound
mysound = sound("/home/user/monson.wav")
play mysound
End

bien sur n'oublie pas d'activer ton timer par timer1.enabled = true

A bientôt
wink


Reaction #1 

by guyvdv 28/04/2011 @ 12:41

Bj,
Je me demande si tu peut m'aider.
Je veut ecrire un program qui m'aidera a tester mon morse.
Alors soit en gambas soi en php je veut un signal d'environ 1000Hz que je peut couper en petit morceaux les dit's et les Dah's

mais je n'ai pas trouver un beep programmable comme en VB

merci de m'aider

guy van der velden

QUICK MENU
SEARCH




LANGUAGE
COMPONENTS
Other
LANGUAGE
Where, who?
VISITS

   visitors

   visitors online

ARCHIVES GAMBAS 1/2
^ Top ^