GRUB

From ThorxWiki
Revision as of 12:39, 22 May 2012 by Nemo (Talk | contribs)

Jump to: navigation, search

Some GRUB_INIT_TUNE themes I've found online in various places... this is a fragment from my debian:/etc/default/grub file

# Uncomment to get a beep at grub start
# The format unless a file is named is: "tempo [pitch1 duration1] [pitch2 duration2] ..."
# Warning: The menu will not be displayed until the tone is finished

#GRUB_INIT_TUNE="480 440 1"

# Close Encounters/5 Tone:
#GRUB_INIT_TUNE="480 900 2 1000 2 800 2 400 2 600 3"

# Fur Elise (note long):
#GRUB_INIT_TUNE="480 420 1 400 1 420 1 400 1 420 1 315 1 370 1 335 1 282 3 180 1 215 1 282 1 315 3 213 1 262 1 315 1 335 3 213 1 420 1 400 1 420 1 400 1 420 1 315 1 370 1 335 1 282 3 180 1 215 1 282 1 315 3 213 1 330 1 315 1 282 3"

# Super Mario
#GRUB_INIT_TUNE="1000 334 1 334 1 0 1 334 1 0 1 261 1 334 1 0 1 392 2 0 4 196 2"

# Star Wars Imperial Death March:
#GRUB_INIT_TUNE="480 440 4 440 4 440 4 349 3 523 1 440 4 349 3 523 1 440 8 659 4 659 4 659 4 698 3 523 1 415 4 349 3 523 1 440 8"

# Wolfenstein 3D
GRUB_INIT_TUNE="300 131 1 196 1 196 1 196 1 294 1 196 1 294 1 196 1 131 1"


This tip which converts a GRUB_INIT_TUNE to a audio file which sox will play through the soundcard... http://ubuntuforums.org/showthread.php?t=1739495

Based on this script, I've concoted the following, which converts a GRUB_INIT_TUNE into a beep(1) command, to play it through the PC speaker - as grub intended.

 #!/bin/bash

 if [ $# -lt 3 ]; then
     echo "Usage: $0 tempo freq dur [freq dur freq dur...]" >&2
     exit 1
 fi

 tempo=$1; shift

 while [ -n "$*" ]; do
     freq=$1; shift
     [ $freq -eq 0 ] && freq=1  # beep will fail if $freq is 0
     dur=$1;  shift
     dur=$((60000*$dur/$tempo))
     # ie, 60 (bpm) * 1000 (for milliseconds) * duration / tempo
     # Note: on one of my systems, i had to double it (ie, 12000*). I don't
     # know why, but it makes some of the tunes I've collected sound right.
     # (note: I have not tested all tunes in GRUB)
     #
     # You can generate a single beep command here, but I prefer to step it
     # out since [a] sounds slightly closer to GRUB implementation
     # and [b] easier to debug an off-note
     # BEEPOPTS="$BEEPOPTS $NEXT -f
     # $freq -l $dur"
#     NEXT="-n"
     echo "beep -f $freq -l $dur"
     beep -f $freq -l $dur
 done

#echo "playing beep $BEEPOPTS"

#beep $BEEPOPTS
Personal tools
Namespaces

Variants
Actions
Navigation
meta navigation
More thorx
Tools