Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # 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.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
- # Merge downlink recording with microphone recording (necessary when using headphones only)
- # Time of the filename should be given as first parameter in Year-Month-Day-Hours-Minutes-Seconds format YYYYmmddHHMMSS
- # Delay in milliseconds should be given as second parameter (1000 should be fine but may be increased when plugging headphones during call recording)
- # 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=$2:all=1,volume=50dB[a1];[0:a][a1]amix" ${1}_merged.wav
- # get_recordings.sh
- #!/bin/bash
- # Get recordings and free space from the modem, necessary when using headphones only but recommended to always save downlink sound to modem in case we 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 -
- 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;
Advertisement
Add Comment
Please, Sign In to add comment