Ring the school bell at home on your Linux computer

Bring familiar sounds from school to your virtual students with these Linux tools.
73 readers like this.

Matteo Ianeselli. Modified by Opensource.com. CC-BY-3.0.

Many students are used to the bell ringing to signal the beginning of each school day, class changes, and dismissal time. There's no feeling quite like that last bell at the end of last period telling you are free to leave the building. But virtual and homeschool students probably don't get to hear that familiar ring and may even miss it. We're all trying to restore a bit of normalcy these days for the kids who may be longing for the sights, smells, and sounds of their school building.

There is a simple way to use a Linux computer to ring that bell. The project has only three steps: First, download a sound file for a bell, tone, or sound of your choice. Second, locate or install a simple audio player. Finally, enter your child's schedule into a cron configuration.

The bell

The first task is to locate a good bell sound. I found an MP3 file from the Free Sounds Library, where all the sound files are under the Creative Commons license. I downloaded and saved the file to my home directory:

$ unzip short-school-bell-sound-effect.zip
Archive:  short-school-bell-sound-effect.zip
  inflating: Read.txt                
  inflating: short-school-bell-sound-effect.mp3

The player

There are several command-line tools for playing audio from the Linux command prompt. So, this might be an area of user preference since everyone has a favorite.

I wanted an audio player that would be very simple and not output anything to standard out (stdout). The SDL Library includes the playsound command, which is very easy to use. So, I installed the SDL_sound package.

I installed it on my Fedora 32 workstation, along with several required dependencies, using dnf:

$ sudo dnf install SDL_sound
[sudo] password for alan:
Dependencies resolved.
 Package         Architecture       Version          Repository    Size
 SDL_sound       x86_64             1.0.3-25.fc32    fedora        113 k
Installing dependencies:
 SDL             x86_64             1.2.15-43.fc32   fedora        213 k
 libmikmod       x86_64     fedora        154 k
 physfs          x86_64             3.0.2-3.fc32     fedora         85 k

Transaction Summary
Install  4 Packages

One nice thing is these are small files, much smaller than the feature-rich GUI audio players such as Rhythmbox and Audacious.

After installing SDL_sound, I quickly tested the capability to play the bell sound MP3 file. Turn up your volume!

$ playsound short-school-bell-sound-effect.mp3

The schedule

The last step uses the Linux cron scheduler, using commands that coincide with the school schedule. For example, suppose that the school bell rings Monday through Friday at 8:15am to signal the beginning of classes, then hourly for class period changes, and finally at 2:30pm to end the day.

Use the command crontab -e to edit the configuration. Cron does not interpret the commented lines; they only clarify how each line tells cron to behave:

# Once at 8:15AM, Monday thru Friday
15 8 * * 1-5 playsound ~/short-school-bell-sound-effect.mp3
# Hourly from 9:00AM thru 2:00PM, Monday thru Friday
00 9-14/1 * * 1-5 playsound ~/short-school-bell-sound-effect.mp3
# Once at 2:30PM, Monday thru Friday
30 14 * * 1-5 playsound ~/short-school-bell-sound-effect.mp3

Tailor the configuration for your student's schedule.

The syntax used by the cron scheduling mechanism can take some time to learn. You can check out this online assistant for help.

Once you save the configuration, you can view it with the command crontab -l, which produces output exactly as it appears above.

That's it!

The bell will now ring throughout your virtual student's day, just like if they were sitting in their classroom.

What to read next
Alan Formy-Duval Opensource.com Correspondent
Alan has 20 years of IT experience, mostly in the Government and Financial sectors. He started as a Value Added Reseller before moving into Systems Engineering. Alan's background is in high-availability clustered apps. He wrote the 'Users and Groups' and 'Apache and the Web Stack' chapters in the Oracle Press/McGraw Hill 'Oracle Solaris 11 System Administration' book.


I need a bit of help, I am a newbie, I have Ubuntu MATE OS and the "$ sudo dnf install SDL_sound" dnf is not recognised as a command.

I tried the obvious "$ sudo apt-get install SDL_sound" but unable to locate package was the response.

Is there a way I can install the SDL_sound software?

Sabastian, I didn't specifically check MATE, but I did check Ubuntu and have found a small player. It's called splay. So, in this case, different distributions might have different packages. Give it a try:
$ sudo apt install splay
Then just replace each reference to playsound above with splay, example:
$ splay short-school-bell-sound-effect.mp3

In reply to by SabastianWheatabix

Creative Commons LicenseThis work is licensed under a Creative Commons Attribution-Share Alike 4.0 International License.