Главная страница


ru.linux

 
 - RU.LINUX ---------------------------------------------------------------------
 From : Alexander Antonenko                  2:5020/400     12 Aug 2003  12:33:20
 To : Pavel Gulchouck
 Subject : Re: pc speaker
 -------------------------------------------------------------------------------- 
 
 Pavel Gulchouck <gul+usenet@gul.kiev.ua> writes:
 
 > Хочу спикером пропищать мелодию.
 > sh, perl, C - неважно.
 > man что?
 
 Если в консоли - то:
 man setterm
 /-blength
 /-bfreq
 
 Вот нашел у себя такое. Автора не знаю. В xterm'е не работает :(
 ---------------------------------------------
 #!/bin/sh
 #This script parse commandline and play notes on pcspeaker
 #acceptable params are [01]note[note_length]
 #where  note ::=<do|Do|re|Re|my|My|fa|Fa|sol|Sol|lya|Lya|si|Si>
 #note starting from capital letter half tone higer
 #note_length in half seconds
 #for example:
 #pcmelody do Do:2 0re
 
 function play_tone
 {
     local LENGTH=250
     test -n "$2" && LENGTH=$(( $LENGTH * $2 ))
     #test -n "$2" && LENGTH=$( echo "$LENGTH * $2" | bc)
     setterm -bfreq $1
     setterm -blength $LENGTH
     echo -n -e "\a"
     usleep $(( $LENGTH * 1000 ))
 }
 
 for i in $@; do
     LN=$(echo $i | sed -n 's/.*\://p')
 
     case $i in
         0do*)
             play_tone 63 $LN
         ;;
         0Do*)
             play_tone 79 $LN
         ;;
         0re*)
             play_tone 96 $LN
         ;;
         0Re*)
             play_tone 112 $LN
         ;;
         0my*)
             play_tone 129 $LN
         ;;
         0fa*)
             play_tone 145 $LN
         ;;
         0Fa*)
             play_tone 162 $LN
         ;;
         0sol*)
             play_tone 178 $LN
         ;;
         0Sol*)
             play_tone 195 $LN
         ;;
         0lya*)
             play_tone 211 $LN
         ;;
         0Lya*)
             play_tone 228 $LN
         ;;
         0sy*)
             play_tone 244 $LN
         ;;
         do*)
             play_tone 261 $LN
         ;;
         Do*)
             play_tone 277 $LN
         ;;
         re*)
             play_tone 294 $LN
         ;;
         Re*)
             play_tone 311 $LN
         ;;
         my*)
             play_tone 330 $LN
         ;;
         fa*)
             play_tone 349 $LN
         ;;
         Fa*)
             play_tone 370 $LN
         ;;
         sol*)
             play_tone 392 $LN
         ;;
         Sol*)
             play_tone 415 $LN
         ;;
         lya*)
             play_tone 440 $LN
         ;;
         Lya*)
             play_tone 466 $LN
         ;;
         sy*)
             play_tone 494 $LN
         ;;
         pause*)
             play_tone 0 $LN
         ;;
     esac
 done
 ------------------------------------
 
 -- 
 Alexander Antonenko
 mailto:alexa@i.com.ua
 
 --- ifmail v.2.15dev5
  * Origin: The MiX Systems (2:5020/400)
 
 

Вернуться к списку тем, сортированных по: возрастание даты  уменьшение даты  тема  автор 

 Тема:    Автор:    Дата:  
 pc speaker   Pavel Gulchouck   11 Aug 2003 20:16:25 
 Re: pc speaker   Sergey Mudry   11 Aug 2003 21:18:23 
 Re: pc speaker   Alexander Antonenko   12 Aug 2003 12:33:20 
 pc speaker   Dmitry Ponyatov   12 Aug 2003 17:36:14 
 Re: pc speaker   Max Krasilnikov   12 Aug 2003 19:29:12 
 Re: pc speaker   Pavel Gulchouck   12 Aug 2003 20:46:44 
Архивное /ru.linux/89465b92f838.html, оценка 3 из 5, голосов 10
Яндекс.Метрика
Valid HTML 4.01 Transitional