[Solved] Sound advise

Post your Gambas programming questions here.
AndyGable
Posts: 363
Joined: Wednesday 2nd December 2020 12:11am
Location: Northampton, England
Contact:

Re: Sound advise

Post by AndyGable »

vuott wrote: Monday 2nd October 2023 2:43pm Uhmmm... some time ago, stevedee proposed using the "Screen" Class of "gb.ncurses" Component.
Try:
Public Sub Main()

  Screen.Beep()

End
I have tried your recommendation but I kept getting a error

ERROR: #63: '&1.&2' is incorrectly overridden in class '&3'|Screen|Height|Screen

If I remove the gb.ncurses the application runs with no issues.
vuott
Posts: 263
Joined: Wednesday 5th April 2017 6:07pm
Location: European Union

Re: Sound advise

Post by vuott »

AndyGable wrote: Monday 2nd October 2023 3:26pm ERROR: #63: '&1.&2' is incorrectly overridden in class '&3'|Screen|Height|Screen
You have to use "gb.ncurses" with a command line interface project (no graphics Components):
Public Sub Main()
Europaeus sum !

Amare memorentes atque deflentes ad mortem silenter labimur.
AndyGable
Posts: 363
Joined: Wednesday 2nd December 2020 12:11am
Location: Northampton, England
Contact:

Re: Sound advise

Post by AndyGable »

No I was using it with a GUI qt5
vuott
Posts: 263
Joined: Wednesday 5th April 2017 6:07pm
Location: European Union

Re: Sound advise

Post by vuott »

...and by using a command line interface project (with gb.ncurses obviously) ?
Does it work ?
Europaeus sum !

Amare memorentes atque deflentes ad mortem silenter labimur.
User avatar
thatbruce
Posts: 168
Joined: Saturday 4th September 2021 11:29pm

Re: Sound advise

Post by thatbruce »

AndyGable wrote: Monday 2nd October 2023 1:49pm
thatbruce wrote: Monday 2nd October 2023 2:15am Try:
play -V3 -n synth 0.1 sine 880 vol 0.4

vol 5 means 5 times the normal volume which clips to a DC voltage.
I tried this one and I got the following show up in the console of the Gambas enveroment.

play WARN alsa: can't encode 0-bit Unknown or not applicable
play:      SoX v14.4.2
play INFO nulfile: sample rate not specified; using 48000

Input File     : '' (null)
Channels       : 1
Sample Rate    : 48000
Precision      : 32-bit


Output File    : 'default' (alsa)
Channels       : 1
Sample Rate    : 48000
Precision      : 32-bit
Sample Encoding: 32-bit Signed Integer PCM
Endian Type    : little
Reverse Nibbles: no
Reverse Bits   : no

play INFO sox: effects chain: input        48000Hz  1 channels
play INFO sox: effects chain: synth        48000Hz  1 channels
play INFO sox: effects chain: vol          48000Hz  1 channels
play INFO sox: effects chain: output       48000Hz  1 channels


and no sound
OK, That's almost exactly what I get, with the beep very audible. The only difference is
Output File : 'default' (pulseaudio)
Do you have pulseaudio installed. (I have no idea why it should be needed, btw)
tb

OOPS! I also get this at the end:
In:0.00% 00:00:00.17 [00:00:00.00] Out:4.80k [ -====|====- ] Clip:0
Done.
Have you ever noticed that software is never advertised using the adjective "spreadable".
User avatar
thatbruce
Posts: 168
Joined: Saturday 4th September 2021 11:29pm

Re: Sound advise

Post by thatbruce »

BTW, A4 is one of the most annoying sounds in the universe.
Try C3 523.25Hz
;)
Have you ever noticed that software is never advertised using the adjective "spreadable".
User avatar
BruceSteers
Posts: 1579
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Re: Sound advise

Post by BruceSteers »

How about installing beep?

sudo apt install beep


beep
If at first you don't succeed , try doing something differently.
BruceS
AndyGable
Posts: 363
Joined: Wednesday 2nd December 2020 12:11am
Location: Northampton, England
Contact:

Re: Sound advise

Post by AndyGable »

BruceSteers wrote: Tuesday 3rd October 2023 8:22pm How about installing beep?

sudo apt install beep


beep
Yea I did that and and it worked but it was the quietest beep ever lol

I need to work out how to beep the Dynakey built in speaker and not the one on the motherboard now I can make the beep sound.
User avatar
BruceSteers
Posts: 1579
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Re: Sound advise

Post by BruceSteers »

AndyGable wrote: Sunday 1st October 2023 5:20pm
cogier wrote: Sunday 1st October 2023 12:42pm
Dim SpeakerData As String = Null
SpeakerData = "speaker-test -t sine -f 1000 -l 1 & sleep .2 && kill -9 $!"
Shell SpeakerData 
There is no need for = Null, you could have just followed the equal sign with "speaker - test -t.....". Better still: -
Shell "speaker-test -t sine -f 1000 -l 1 & sleep .2 && kill -9 $!"

Which works for me
************************************
shell "play -n synth 0.1 sine 880 vol 5"
You are correct, it doesn't work, and I have no idea why.
The problem with the above is the systems I am using do not have any sound cards on them they only have the PC speaker.
Did you miss my post? It requires stdout or the play command does not exit so use "&" or "For Output" when using gambas Shell process then it can continue

Shell "play -n synth 0.1 sine 880 &"

or
Shell "play -n synth 0.1 sine 880" For Output

They both work fine here

Shell "play -n synth 0.1 sine 880 2>/dev/null &"

if you want to divert the text output (stderr) to null
If at first you don't succeed , try doing something differently.
BruceS
AndyGable
Posts: 363
Joined: Wednesday 2nd December 2020 12:11am
Location: Northampton, England
Contact:

Re: Sound advise

Post by AndyGable »

BruceSteers wrote: Wednesday 4th October 2023 12:49pm
AndyGable wrote: Sunday 1st October 2023 5:20pm
cogier wrote: Sunday 1st October 2023 12:42pm

There is no need for = Null, you could have just followed the equal sign with "speaker - test -t.....". Better still: -
Shell "speaker-test -t sine -f 1000 -l 1 & sleep .2 && kill -9 $!"

Which works for me
************************************


You are correct, it doesn't work, and I have no idea why.
The problem with the above is the systems I am using do not have any sound cards on them they only have the PC speaker.
Did you miss my post? It requires stdout or the play command does not exit so use "&" or "For Output" when using gambas Shell process then it can continue

Shell "play -n synth 0.1 sine 880 &"

or
Shell "play -n synth 0.1 sine 880" For Output

They both work fine here

Shell "play -n synth 0.1 sine 880 2>/dev/null &"

if you want to divert the text output (stderr) to null
Sorry Bruce I did miss your post

and it works perfectly

NOW If I am reading this information right
Speaker

The 5953 includes a built‐in speaker. By default, it sounds key clicks, but it can
be programmed to sound tones under control of the application program.

The speaker is tied to the speaker control of the host terminal so that whenever the
terminal speaker sounds, so does the 5953 speaker


I should not have to worry about the DynaKey Speaker it should work with the current Shell "play -n synth 0.1 sine 880" For Output. I will have to test this in the morning when I am near my NCR machine again and I will let you all know.

this is the NCR Dynakey Manual (https://manualzz.com/doc/55220224/ncr-r ... manual#p15)
Post Reply