Author Topic: stop sound  (Read 4917 times)

0 Members and 1 Guest are viewing this topic.

Offline +KZ

  • Newbie
  • Posts: 21
  • an ugly avatar :)
    • View Profile
stop sound
« 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 i cant stop this with "SOUND 0, 0"


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


im not qbasic expert
« Last Edit: May 12, 2020, 07:07:43 pm by +KZ »
google translate :0

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: stop sound
« Reply #1 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

Offline TerryRitchie

  • Seasoned Forum Regular
  • Posts: 495
  • Semper Fidelis
    • View Profile
Re: stop sound
« Reply #2 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.
In order to understand recursion, one must first understand recursion.

Offline +KZ

  • Newbie
  • Posts: 21
  • an ugly avatar :)
    • View Profile
Re: stop sound
« Reply #3 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
« Last Edit: May 13, 2020, 10:00:15 pm by +KZ »
google translate :0

Offline TerryRitchie

  • Seasoned Forum Regular
  • Posts: 495
  • Semper Fidelis
    • View Profile
Re: stop sound
« Reply #4 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.
In order to understand recursion, one must first understand recursion.

Offline +KZ

  • Newbie
  • Posts: 21
  • an ugly avatar :)
    • View Profile
Re: stop sound
« Reply #5 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
google translate :0

Offline TerryRitchie

  • Seasoned Forum Regular
  • Posts: 495
  • Semper Fidelis
    • View Profile
Re: stop sound
« Reply #6 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
« Last Edit: May 14, 2020, 07:09:15 pm by TerryRitchie »
In order to understand recursion, one must first understand recursion.

Offline +KZ

  • Newbie
  • Posts: 21
  • an ugly avatar :)
    • View Profile
Re: stop sound
« Reply #7 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!
google translate :0