Recording phonecalls

m (Category Typo)
Line 66: Line 66:
[[Category:Power users]]
[[Category:Power users]]
[[Category:Multimedia]]
[[Category:Multimedia]]
-
[[Category:Howto]]
+
[[Category:HowTo]]

Revision as of 01:34, 16 January 2010

This page describes a method for recording calls from an N900, using pulseaudio command line tools to stream audio from input & output devices, which requires command line tinkering.

This method was inspired by a blog entry detailing how to record from pulseaudio, and documented by iKneaDough on Talk.maemo.org.

Contents

Install pulseaudio-utils

First you will need to get the pulseaudio-utils package. You can install this either from the online Fremantle repository, or by enabling the tools repository and running

apt-get install pulseaudio-utils

You can enable the tools repository by following [Documentation/devtools/maemo5#Installation | the instructions for installing devtools].

The pulseaudio-utils package provides two applications which can be used to record audio in scripts: parec to record raw audio streams, and pacat to play back raw audio streams.

The streams involved are: sink.hw0.monitor for incoming sounds and source.hw0 for outgoing sounds when using the phone handset, and sink.hw1.monitor for incoming sounds and source.hw1 for outgoing sounds when using a bluetooth headset.

Creating scripts

Create the following shell scripts in your home directory:

  1. Put the following in a script called simpleRec.sh, which you can run to record a call using the handset:
NOW=`date +%F-%H-%M-%S` 
echo $NOW > simpleDateTime
parec -d "sink.hw0.monitor" > MyDocs/tmp/$NOW.pulse.in.raw &
parec -d "source.hw0" > MyDocs/tmp/$NOW.pulse.out.raw
  1. Put the following in a script called simpleRec.sh, which you can run to record a call using a Bluetooth headset:
NOW=`date +%F-%H-%M-%S` 
echo $NOW > simpleDateTime
parec -d "sink.hw1.monitor" > MyDocs/tmp/$NOW.pulse.in.raw &
parec -d "source.hw1" > MyDocs/tmp/$NOW.pulse.out.raw

These scrips will create two files, one for the input stream and one for the output stream, in the directory MyDocs/tmp, with a name which contains the month, day, hour and minute of the phone call.

For example, a phone call on the 13th of November, at 09:15, will be stored in the two files 11-13-09-15.pulse.in.raw and 11-13-09-15.pulse.out.raw

Playing back phonecalls

  1. To play back the most recent recorded call, use the following script (call it simpleLastPlay.sh) :
LAST=`cat simpleDateTime`
pacat MyDocs/tmp/$LAST.pulse.in.raw &
pacat -v MyDocs/tmp/$LAST.pulse.out.raw
  1. To play back an older call using a unique date or time, use the following script (call it simplePlay.sh) :
pacat MyDocs/tmp/*$1*pulse.in.raw &
pacat -v MyDocs/tmp/*$1*pulse.out.raw

for example if you know you recorded a call on Dec 1 at 12:00 am, you could run ' ./simplePlay.sh 12-01-00-00 ' or any part of the date or time that you can remember, as long as it is unique.

To stop recording or playback just press ctrl+c.

Here is another useful script to stop any recording or playback if you can't get back to its original terminal window, called 'simpleStop.sh' :

killall parec
killall pacat

Disclaimer

Please use this only where it is legal to do so, and please do not use it for any nefarious purpose.