Page 1 of 1
beeps in linux
Posted: Tue Sep 19, 2023 2:20 pm
by Jeromyal
How could I go about a simple way to make linux beep?
light weight out of the box code to add to a project preferred.
I have come across unfavorable solutions such as additional added files or messing with permissions with exiting system files and there is no way I want that.
perhaps a small data section that can be read or something? I am not sure.
Re: beeps in linux
Posted: Tue Sep 19, 2023 3:00 pm
by Jeromyal
Okay I have found a solution I accept now that I solved the issue I was having.
I did an includebinary with a catchsound.
My issue was, that I was never hearing it before the tool exited. I did a soundstatus with while/wend and I am satisfied.
However anybody with alternate ideas feel free to chime in if you would like.
Re: beeps in linux
Posted: Tue Sep 19, 2023 9:17 pm
by Janni
I think you have found the easiest way to be honest. The built in libraries for sound/music can playback almost all kind of audio formats.
Re: beeps in linux
Posted: Wed Sep 20, 2023 5:16 am
by Olli
Is WAV format all right ?
(dupplicated code)
Code: Select all
structure wav
array w.w(21)
endStructure
initSound()
*wav.wav = allocateMemory(sizeOf(wav) )
initializeStructure(*wav, wav)
base64decoder("UklGRgAAAABXQVZFZm10IBAAAAABAAEARKwAAIhYAQACABAAZGF0YQ", @*wav\w(0), 40)
with *wav
wMax = 62800
reDim \w(wMax + 22)
size = (wMax + 23) * 2
PokeL(@\w(2), size - 8)
PokeL(@\w(20), size - 44)
ampli.d = 800
for i = 0 to wMax
\w(i + 22) = cos(i / (7 - sin(t.d) ) ) * ampli
ampli * 0.999
t + 0.00015
next
snd = catchSound(#pb_any, @\w(0) )
repeat
playSound(snd, #pb_sound_multiChannel)
delay(400)
until inputRequester("", "Just press enter to play", "")
endWith
Re: beeps in linux
Posted: Wed Sep 20, 2023 9:04 pm
by Jeromyal
Olli wrote: Wed Sep 20, 2023 5:16 am
Is WAV format all right ?
(dupplicated code)
Code: Select all
structure wav
array w.w(21)
endStructure
initSound()
*wav.wav = allocateMemory(sizeOf(wav) )
initializeStructure(*wav, wav)
base64decoder("UklGRgAAAABXQVZFZm10IBAAAAABAAEARKwAAIhYAQACABAAZGF0YQ", @*wav\w(0), 40)
with *wav
wMax = 62800
reDim \w(wMax + 22)
size = (wMax + 23) * 2
PokeL(@\w(2), size - 8)
PokeL(@\w(20), size - 44)
ampli.d = 800
for i = 0 to wMax
\w(i + 22) = cos(i / (7 - sin(t.d) ) ) * ampli
ampli * 0.999
t + 0.00015
next
snd = catchSound(#pb_any, @\w(0) )
repeat
playSound(snd, #pb_sound_multiChannel)
delay(400)
until inputRequester("", "Just press enter to play", "")
endWith
That is rather clever. Wav works in Linux.
I hear a very brief beep that I think is a pleasant sound. Very low volume though.
Thank you for this. I think I will put it into my snippet collection fiddle with it sometime and see what I can do with it.
Re: beeps in linux
Posted: Wed Sep 20, 2023 11:56 pm
by Olli
jeromyal wrote:[...]Very low volume though.[...]
I am surprised. Could you check if your volume settings are not set a little bit too light ? (<10% in ex)
Re: beeps in linux
Posted: Thu Sep 21, 2023 12:43 am
by Jeromyal
Olli wrote: Wed Sep 20, 2023 11:56 pm
jeromyal wrote:[...]Very low volume though.[...]
I am surprised. Could you check if your volume settings are not set a little bit too light ? (<10% in ex)
Yeah I have pulse audio at 100% and all other sounds are loud and clear. I am assuming it may be the duration of the sound you generated?
Re: beeps in linux
Posted: Thu Sep 21, 2023 11:04 pm
by Olli
I ignore it. Normally, no problem of duration. I tested it on W10. Two things occur in my mind.
1) maybe a volume difference between Linux and Windows
2) I do not know how to compare the decibels count finally generated between Windows and Linux....