Talk:Voicenote

From Openmoko

(Difference between revisions)
Jump to: navigation, search
(change framerate + mono)
m (enable job control)
Line 19: Line 19:
 
Result :
 
Result :
  
#!/bin/bash
+
#!/bin/bash
# Exit on error
+
# Exit on error
# Enable job control
+
# Enable job control
set -em
+
set -em
zenity --question --title="Voice-note" --text="Click Validate to START
+
zenity --question --title="Voice-note" --text="Click Validate to START recording"; gostart=$?
recording"; gostart=$?
+
 
+
if [ "$gostart" = 1 ]
if [ "$gostart" = 1 ]
+
    then
  then
+
        echo "Operation canceled"
      echo "Operation canceled"
+
        exit 1
      exit 1
+
    else
  else
+
        echo "Recording..."
      echo "Recording..."
+
fi
fi
+
alsactl -f /usr/share/openmoko/scenarios/voip-handset.state restore
alsactl -f /usr/share/openmoko/scenarios/voip-handset.state restore
+
arecord -D hw -f cd  -v -t wav ~/rec-$(date +%Y-%m-%d-%H-%M).wav &
arecord -D hw -f cd  -v -t wav ~/rec-$(date +%Y-%m-%d-%H-%M).wav &
+
zenity --info --title="Voice-note" --text="Click Validate to STOP recording"
zenity --info --title="Voice-note" --text="Click Validate to STOP recording"
+
 
+
# Kill arecord
# Kill arecord
+
kill %1
kill %1
+
alsactl -f /usr/share/openmoko/scenarios/gsmhandset.state restore
alsactl -f /usr/share/openmoko/scenarios/gsmhandset.state restore
+
zenity --info --title="Voice note" --text="Your voice-note has been recorded"
zenity --info --title="Voice note" --text="Your voice-note has been
+
recorded"
+
#END OF FILE
 
+
#END OF FILE
+
 
+
  
 
== other ? ==
 
== other ? ==

Revision as of 13:27, 21 February 2009

Please add any idea / comment / code sample here

I (kimaidou) copy/paste the comments I had on the community mailing list

change framerate + mono

I think 44100 Hz is overkill for something like this. 8 kHz ought to be enough and would save a lot of disk space. I would have also suggested a mono recording, but I'm not sure that is supported.

--> the solution is just the man :) man page

enable job control

You should use "kill %1" instead, this will only kill the instance you just started (and TERM is the default). For that, you need to enable job control (set -m) + remove the &

Result :

#!/bin/bash
# Exit on error
# Enable job control
set -em
zenity --question --title="Voice-note" --text="Click Validate to START recording"; gostart=$?

if [ "$gostart" = 1 ]
   then
       echo "Operation canceled"
       exit 1
   else
       echo "Recording..."
fi
alsactl -f /usr/share/openmoko/scenarios/voip-handset.state restore
arecord -D hw -f cd  -v -t wav ~/rec-$(date +%Y-%m-%d-%H-%M).wav &
zenity --info --title="Voice-note" --text="Click Validate to STOP recording"

# Kill arecord
kill %1
alsactl -f /usr/share/openmoko/scenarios/gsmhandset.state restore
zenity --info --title="Voice note" --text="Your voice-note has been recorded"

#END OF FILE

other ?

Personal tools

Please add any idea / comment / code sample here

I (kimaidou) copy/paste the comments I had on the community mailing list

change framerate + mono

I think 44100 Hz is overkill for something like this. 8 kHz ought to be enough and would save a lot of disk space. I would have also suggested a mono recording, but I'm not sure that is supported.

--> the solution is just the man :) man page

enable job control

You should use "kill %1" instead, this will only kill the instance you just started (and TERM is the default). For that, you need to enable job control (set -m) + remove the &

Result :

  1. !/bin/bash
  2. Exit on error
  3. Enable job control

set -em zenity --question --title="Voice-note" --text="Click Validate to START recording"; gostart=$?

if [ "$gostart" = 1 ]

  then
      echo "Operation canceled"
      exit 1
  else
      echo "Recording..."

fi alsactl -f /usr/share/openmoko/scenarios/voip-handset.state restore arecord -D hw -f cd -v -t wav ~/rec-$(date +%Y-%m-%d-%H-%M).wav & zenity --info --title="Voice-note" --text="Click Validate to STOP recording"

  1. Kill arecord

kill %1 alsactl -f /usr/share/openmoko/scenarios/gsmhandset.state restore zenity --info --title="Voice note" --text="Your voice-note has been recorded"

  1. END OF FILE


other ?