QB64.org Forum

Active Forums => QB64 Discussion => Topic started by: +KZ on May 12, 2020, 07:04:00 pm

Title: stop sound
Post by: +KZ on May 12, 2020, 07:04:00 pm
i need to know how to stop the sound that is being played, as i see in https://www.qb64.org/wiki/SOUND (https://www.qb64.org/wiki/SOUND) i cant stop this with "SOUND 0, 0"


or it can also helps me to "replace" the sound being played


im not qbasic expert
Title: Re: stop sound
Post by: bplus on May 12, 2020, 08:46:41 pm
Hi +KZ

I am no expert on Sound but I looked in Wiki under keywords by Usage > Sound and found this: https://www.qb64.org/wiki/SNDSTOP
Title: Re: stop sound
Post by: TerryRitchie on May 12, 2020, 09:07:08 pm
Welcome to the forum!

The _SNDSTOP command is used to stop sounds that were loaded in.

http://www.qb64sourcecode.com/task14.html#SNDSTOP

Feel free to view the entire tutorial on sound as well.

The SOUND 0,0 command will not stop a current SOUND as stated in the Wiki:

"Note: SOUND 0, 0 will not stop previous QB64 sounds like it did in Qbasic!"

The SOUND command is very primitive. I suggest you check out the PLAY command or even better _SNDLOAD and _SNDPLAY.
Title: Re: stop sound
Post by: +KZ on May 13, 2020, 09:58:53 pm

The SOUND command is very primitive. I suggest you check out the PLAY command or even better _SNDLOAD and _SNDPLAY.

if really here is a way to make "_SNDSTOP" Stop all sound playing on program (instead of stopping the sound loaded from file), then it can help me

I suggest you check out the PLAY command


"PLAY" command have a way to stop?

to clarify the problem: since in qb64 the sounds are not interrupted with "SOUND 0,0", in the program the sounds are delayed
Title: Re: stop sound
Post by: TerryRitchie on May 13, 2020, 10:58:13 pm
Perhaps if you could share a bit of code to show what is happening.

The SOUND command will halt all program execution until it is finished playing. In QuickBasic it was possible to use SOUND 0,0 to stop sound, however with QB64 this will not work.

With the PLAY command it also be hard to control when it stops unless you control each note given to it one by one in a loop. Very tedious and not worth it.

I suggest making your sounds utilizing .WAV, .MP3, or .OGG files. This way you can start them with _SNDPLAY and stop them any time you like with _SNDSTOP. The new QB64 sound commands are far superior to anything that QuickBasic had to offer.
Title: Re: stop sound
Post by: +KZ on May 14, 2020, 06:22:42 pm
thanks, although that would be a lot of trouble searching for mp3 to make simples "beeps"on this program



I hope the qb64 team fix this thing
Title: Re: stop sound
Post by: TerryRitchie on May 14, 2020, 07:08:04 pm
thanks, although that would be a lot of trouble searching for mp3 to make simples "beeps"on this program



I hope the qb64 team fix this thing

Here is a web site that will let you generate your own tones and download them. Coupled with the frequency chart on the SOUND Wiki page you can generate any sound you wish.

Sound page --> https://www.audiocheck.net/audiofrequencysignalgenerator_sinetone.php

SOUND Wiki here --> http://www.qb64.org/wiki/SOUND
Title: Re: stop sound
Post by: +KZ on May 14, 2020, 09:04:28 pm
Here is a web site that will let you generate your own tones and download them. Coupled with the frequency chart on the SOUND Wiki page you can generate any sound you wish.

Sound page --> https://www.audiocheck.net/audiofrequencysignalgenerator_sinetone.php

SOUND Wiki here --> http://www.qb64.org/wiki/SOUND

oh thanks!