Recording phonecalls

(wikify slightly)
 
(6 intermediate revisions not shown)
Line 1: Line 1:
-
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.
+
'''A desktop widget to record phone calls is now available from Maemo Extras. Search for [http://maemo.org/downloads/product/Maemo5/recaller/ "recaller"] using your Application Manager.'''
 +
 
 +
This page describes a method for recording calls from an [[Nokia N900|N900]], using pulseaudio command line tools to stream audio from input & output devices, which requires command line tinkering.
This method was inspired by [http://www.outflux.net/blog/archives/2009/04/19/recording-from-pulseaudio/ a blog entry detailing how to record from pulseaudio], and [http://talk.maemo.org/showpost.php?p=441501&postcount=41 documented] by [http://talk.maemo.org/member.php?u=13228 iKneaDough on Talk.maemo.org].
This method was inspired by [http://www.outflux.net/blog/archives/2009/04/19/recording-from-pulseaudio/ a blog entry detailing how to record from pulseaudio], and [http://talk.maemo.org/showpost.php?p=441501&postcount=41 documented] by [http://talk.maemo.org/member.php?u=13228 iKneaDough on Talk.maemo.org].
Line 9: Line 11:
  apt-get install pulseaudio-utils
  apt-get install pulseaudio-utils
-
You can enable the tools repository by following [Documentation/devtools/maemo5#Installation | the instructions for installing devtools].
+
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 pulseaudio-utils package provides two applications which can be used to record audio in scripts: <code>parec</code> to record raw audio streams, and <code>pacat</code> 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.
+
The streams involved are: <code>sink.hw0.monitor</code> for incoming sounds and <code>source.hw0</code> for outgoing sounds when using the phone handset, and <code>sink.hw1.monitor</code> for incoming sounds and <code>source.hw1</code> for outgoing sounds when using a bluetooth headset.
== Creating scripts ==
== Creating scripts ==
Line 19: Line 21:
Create the following shell scripts in your home directory:
Create the following shell scripts in your home directory:
-
# Put the following in a script called '''simpleRec.sh''', which you can run to record a call using the handset:
+
<ol>
 +
<li>
 +
Put the following in a script called <code>simpleRec.sh</code>, which you can run to record a call using the handset:
-
NOW=`date +%F-%H-%M-%S`  
+
<source lang="bash">
-
echo $NOW > simpleDateTime
+
NOW=`date +%F-%H-%M-%S`  
-
parec -d "sink.hw0.monitor" > MyDocs/tmp/$NOW.pulse.in.raw &
+
echo $NOW > simpleDateTime
-
parec -d "source.hw0" > MyDocs/tmp/$NOW.pulse.out.raw
+
parec -d "sink.hw0.monitor" > MyDocs/tmp/$NOW.pulse.in.raw &
 +
parec -d "source.hw0" > MyDocs/tmp/$NOW.pulse.out.raw
 +
</source>
 +
</li>
 +
<li>
 +
Put the following in a script called <code>simpleRec.sh</code>, which you can run to record a call using a Bluetooth headset:
-
# Put the following in a script called '''simpleRec.sh''', which you can run to record a call using a Bluetooth headset:
+
<source lang="bash">
-
 
+
NOW=`date +%F-%H-%M-%S`  
-
NOW=`date +%F-%H-%M-%S`  
+
echo $NOW > simpleDateTime
-
echo $NOW > simpleDateTime
+
parec -d "sink.hw1.monitor" > MyDocs/tmp/$NOW.pulse.in.raw &
-
parec -d "sink.hw1.monitor" > MyDocs/tmp/$NOW.pulse.in.raw &
+
parec -d "source.hw1" > MyDocs/tmp/$NOW.pulse.out.raw
-
parec -d "source.hw1" > MyDocs/tmp/$NOW.pulse.out.raw
+
</source>
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.
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'''
+
For example, a phone call on the 13th of November, at 09:15, will be stored in the two files <code>11-13-09-15.pulse.in.raw</code> and  <code>11-13-09-15.pulse.out.raw</code>
 +
</li>
 +
</ol>
== Playing back phonecalls ==
== Playing back phonecalls ==
-
# To play back the most recent recorded call, use the following script (call it '''simpleLastPlay.sh''') :
+
<ol>
 +
<li>
 +
To play back the most recent recorded call, use the following script (call it <code>simpleLastPlay.sh</code>):
-
LAST=`cat simpleDateTime`
+
<source lang="bash">
-
pacat MyDocs/tmp/$LAST.pulse.in.raw &
+
LAST=`cat simpleDateTime`
-
pacat -v MyDocs/tmp/$LAST.pulse.out.raw
+
pacat MyDocs/tmp/$LAST.pulse.in.raw &
-
 
+
pacat -v MyDocs/tmp/$LAST.pulse.out.raw
-
# To play back an older call using a unique date or time, use the following script (call it '''simplePlay.sh''') :
+
</source>
 +
</li>
 +
<li>
 +
To play back an older call using a unique date or time, use the following script (call it <code>simplePlay.sh</code>):
 +
<source lang="bash">
  pacat MyDocs/tmp/*$1*pulse.in.raw &
  pacat MyDocs/tmp/*$1*pulse.in.raw &
  pacat -v MyDocs/tmp/*$1*pulse.out.raw
  pacat -v MyDocs/tmp/*$1*pulse.out.raw
 +
</source>
-
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.
+
for example if you know you recorded a call on Dec 1 at 12:00 am, you could run:
 +
<pre>
 +
./simplePlay.sh 12-01-00-00
 +
</pre>
 +
or any part of the date or time that you can remember, as long as it is unique.
 +
</li>
 +
</ol>
To stop recording or playback just press ctrl+c.
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' :
+
Here is another useful script to stop any recording or playback if you cannot get back to its original terminal window, called <code>simpleStop.sh</code>:
-
killall parec
+
<source lang="bash">
-
killall pacat
+
killall parec
 +
killall pacat
 +
</source>
== Disclaimer ==
== Disclaimer ==
Please use this only where it is legal to do so, and please do not use it for any nefarious purpose.
Please use this only where it is legal to do so, and please do not use it for any nefarious purpose.
-
 
[[Category:Power users]]
[[Category:Power users]]
-
[[Category:Multimedia]]
+
[[Category:Media]]
-
[[Category:Howto]]
+
[[Category:HowTo]]
 +
[[Category:N900]]

Latest revision as of 12:05, 4 October 2010

A desktop widget to record phone calls is now available from Maemo Extras. Search for "recaller" using your Application Manager.

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

[edit] 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 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.

[edit] 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
  2. 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

[edit] 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
  2. 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 cannot get back to its original terminal window, called simpleStop.sh:

killall parec
killall pacat

[edit] Disclaimer

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