#!/bin/sh echo " Welcome to the " echo "" echo " ****************" echo " * BEEP MACHINE *" echo " ****************" echo "" echo " An amazing way of musical entertainment !" if [ $# != 1 ] then echo usage : ./$0 fichier_partition exit fi rm paroles 2> /dev/null partition=$1 bpm=`sed -n '1p' $partition` timeUnit=`echo "60000 / $bpm" | bc -l` #60*1000 / $bpm pour avoir le temps unitaire en milliseconde #i=0 #compteur pour le débug en cas de souci sur la partition, pou rretrouver la fausse note while read instr do case $instr in #permet de ne lire que les lignes avec des virgules *,*,* ) if [ `echo $instr | grep -o "," | grep -c ,` -gt 2 ] then echo -en $instr | cut -f4 -d',' >> paroles; clear cat paroles fi note=`echo $instr | cut -f1 -d','` freq=`grep $note ./freq_notes | cut -f2 -d' '` duree=`echo $instr | cut -f2 -d','` length=`echo "$duree * $timeUnit" | bc -l` silence=`echo $instr | cut -f3 -d','` delay=`echo "$silence * $timeUnit" | bc -l` beep -f $freq -l $length -D $delay #--verbose # echo $i ;; esac # i=$(($i + 1)) done < $partition rm paroles 2> /dev/null exit 0