GRUB

From ThorxWiki
(Difference between revisions)
Jump to: navigation, search
(updated script)
m (.)
Line 18: Line 18:
   
 
# Star Wars Imperial Death March:
 
# 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
+
#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"
659 4 659 4 698 3 523 1 415 4 349 3 523 1 440 8"
 
   
 
# Wolfenstein 3D
 
# Wolfenstein 3D

Revision as of 17:55, 21 May 2012

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=$((120000*$dur/$tempo))
    # ie, 2 * 60 (bpm) * 1000 (for milliseconds) * duration / tempo
    # No, I don't know why that 2* has to be there initially, but it makes it sound right to beep a
t least
    BEEPOPTS="$BEEPOPTS $NEXT -f $freq -l $dur"
    NEXT="-n"
done

beep $BEEPOPTS
Personal tools
Namespaces

Variants
Actions
Navigation
meta navigation
More thorx
Tools