Looking for an App to Play Beeps at Random Intervals

0
45
Asked By SunnyDaze42 On

Hey everyone! I'm on the hunt for an app that can generate short beeps at random intervals. Ideally, I'd like to set it up to play a beep anywhere between 4 to 6 minutes apart. Is there a solution out there that allows for this sort of functionality? Thanks in advance!

3 Answers

Answered By ScriptingPro On

Another approach could involve `shuf` for generating your random intervals and tones. Here's an example:

```bash
#!/bin/bash

minSleepTime=240
maxSleepTime=360

while true; do
randomSleepTime=$(shuf -i$minSleepTime-$maxSleepTime -n1)
play -n synth 0.1 tri 1000 # Consistent beep
sleep $randomSleepTime
done
```
This keeps the tone consistent while varying the interval as you wanted!

UserFeedback02 -

This looks great! I think this method is exactly what I'm looking for. Thanks for breaking it down!

Answered By CodeNinja99 On

You might want to check out using `speaker-test`, which is usually included with alsa-utils. You can create a simple bash script that continuously plays a random tone at a random interval. It can vary both the time and the frequency, depending on what you need. Here's a quick example:

```bash
#!/bin/bash

while true; do
interval=$((RANDOM % 120 + 240)) # Random interval between 4 and 6 minutes
frequency=$((RANDOM % 3000 + 100)) # Random frequency
speaker-test --nloops 1 --test sine -f $frequency
sleep $interval
done
```
This way, you'll have a beep at random times! If you want the tone to stay the same, let me know, and I can adjust that for you!

MusicLover23 -

I actually prefer a more specific setup where the interval is random but the tone stays the same. Just a short beep at varying times. Can you help me tweak that?

Answered By TechGuru77 On

Definitely, you can write a bash script for this! Here's a variant:

```bash
#!/bin/bash

while :; do
duration=$((1+$RANDOM/8192))
frequency=1000 # Set your preferred consistent tone
sox -n -b 16 -c 2 -t wav synth $duration sin $frequency vol -10dB | aplay -q
sleep $((240+$RANDOM/273)) # Random wait between 240 and 360 seconds
done
```
Make sure you have `sox` installed. It provides a nice sine wave sound for your beeps!

Related Questions

Online Audio Cleanup Tool

Extract Audio From Video File

Compress MP3 File

Online Audio Converter

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.