beeps in linux

Just starting out? Need help? Post your questions and find answers here.
Jeromyal
Enthusiast
Enthusiast
Posts: 216
Joined: Wed Jul 17, 2013 8:49 am

beeps in linux

Post 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.
Jeromyal
Enthusiast
Enthusiast
Posts: 216
Joined: Wed Jul 17, 2013 8:49 am

Re: beeps in linux

Post 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.
User avatar
Janni
Enthusiast
Enthusiast
Posts: 127
Joined: Mon Feb 21, 2022 5:58 pm
Location: Norway

Re: beeps in linux

Post 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.
Spec: Linux Mint 20.3 Cinnamon, i7-3770K, 16GB RAM, RTX 2070 Super
Olli
Addict
Addict
Posts: 1242
Joined: Wed May 27, 2020 12:26 pm

Re: beeps in linux

Post 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
Jeromyal
Enthusiast
Enthusiast
Posts: 216
Joined: Wed Jul 17, 2013 8:49 am

Re: beeps in linux

Post 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.
Olli
Addict
Addict
Posts: 1242
Joined: Wed May 27, 2020 12:26 pm

Re: beeps in linux

Post 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)
Jeromyal
Enthusiast
Enthusiast
Posts: 216
Joined: Wed Jul 17, 2013 8:49 am

Re: beeps in linux

Post 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?
Olli
Addict
Addict
Posts: 1242
Joined: Wed May 27, 2020 12:26 pm

Re: beeps in linux

Post 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....
Post Reply