Last active
March 1, 2026 22:07
-
-
Save baptx/03b8bd181a87cd1a3f02ef29bdb51a1a to your computer and use it in GitHub Desktop.
PinePhone call recording scripts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # PinePhone call recording scripts (not using the custom modem firmware due to issues: https://github.com/the-modem-distro/pinephone_modem_sdk/issues/259) | |
| # Information to enable ADB on the original modem firmware: | |
| # https://github.com/Biktorgj/quectel_eg25_recovery/issues/26 | |
| # https://xnux.eu/devices/feature/modem-pp.html#toc-unlock-adb-access | |
| # https://xnux.eu/devices/feature/qadbkey-unlock.c | |
| # record_call_start.sh | |
| # selecting "Make a phone call" in Phosh sound settings before making a new call is recommended to prevent empty recording (maybe related to call crashing or phone reboot) | |
| #echo 'AT+QAUDRD=1,"'$(date +%Y%m%d%H%M%S)'_uplink.wav",13,0' | sudo atinout - /dev/ttyUSB2 - | |
| time=$(date +%Y%m%d%H%M%S) # use date command only once to have the same recording time in both filenames | |
| echo 'AT+QAUDRD=1,"'$time'_downlink.wav",13,1' | sudo atinout - /dev/ttyUSB2 - | |
| pw-record ~/Documents/recordings/$time.wav # both microphone and speaker are recorded if not using headphones | |
| echo 'AT+QAUDRD=0' | sudo atinout - /dev/ttyUSB2 - # stop call recording on modem after pressing Ctrl+C for pw-record command | |
| # trying to record both uplink and downlink from modem (not working correctly with headphones) | |
| #echo 'AT+QAUDRD=1,"'$(date +%Y%m%d%H%M%S)'.wav",13' | sudo atinout - /dev/ttyUSB2 - | |
| # recording_merge.sh (necessary when using headphones only) | |
| # https://trac.ffmpeg.org/wiki/AudioVolume | |
| #ffmpeg -i ${1}.wav -filter:a "volume=50dB" ${1}_amplified.wav | |
| # https://superuser.com/questions/644768/how-to-merge-audio-using-ffmpeg-not-concat/645238#645238 | |
| #ffmpeg -i ${1}_downlink.wav -i ${1}_amplified.wav -filter_complex amix ${1}_merged.wav | |
| # https://stackoverflow.com/questions/65488904/merge-both-audio-with-delay-use-ffmpeg/65496856#65496856 | |
| #ffmpeg -i ${1}_downlink.wav -i ${1}_amplified.wav -filter_complex "[1:a]adelay=1000:all=1[a1];[0:a][a1]amix" ${1}_merged.wav | |
| # https://stackoverflow.com/questions/64729433/ffmpeg-how-to-add-volume-to-filter-complex/64731319#64731319 | |
| ffmpeg -i ${1}_downlink.wav -i ${1}.wav -filter_complex "[1:a]adelay=1000:all=1,volume=50dB[a1];[0:a][a1]amix" ${1}_merged.wav | |
| # get_recordings.sh (necessary when using headphones only but recommended to always save downlink sound to modem in case you plug headphones during a recorded call, adapted from the script in the repository https://github.com/the-modem-distro/pinephone_modem_sdk/issues/241) | |
| # After enabling ADB, you may see an error when trying to pull files: "adb: error: remote object '...' does not exist" | |
| # It can be fixed by rebooting the modem: echo 'AT+CFUN=1,1' | sudo atinout - /dev/ttyUSB2 - | |
| #!/bin/bash | |
| TARGETPATH=~/Documents/recordings/ | |
| FILESPERSIST=`adb shell ls /data/ufs/` | |
| mkdir -p $TARGETPATH | |
| cd $TARGETPATH | |
| for file in $FILESPERSIST; do | |
| if [[ $file =~ .*\.(wav) ]]; then | |
| THISFILE=$(echo $file|tr -d '\n'|tr -d '\r') | |
| echo "Pulling "$THISFILE | |
| adb pull /data/ufs/${THISFILE} && adb shell rm /data/ufs/${THISFILE} | |
| fi | |
| done; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment