Advertisement
metalx1000

FFMPEG Create Robot Voice

Jul 21st, 2023
1,514
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.47 KB | None | 0 0
  1. #!/bin/bash
  2. ######################################################################
  3. #Copyright (C) 2023  Kris Occhipinti
  4. #https://filmsbykris.com
  5.  
  6. #This program is free software: you can redistribute it and/or modify
  7. #it under the terms of the GNU General Public License as published by
  8. #the Free Software Foundation version 3 of the License.
  9.  
  10. #This program is distributed in the hope that it will be useful,
  11. #but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13. #GNU General Public License for more details.
  14.  
  15. #You should have received a copy of the GNU General Public License
  16. #along with this program.  If not, see <http://www.gnu.org/licenses/>.
  17. ######################################################################
  18.  
  19. #Creates a Robot Voice from Audio File
  20.  
  21. [[ $1 ]] && audio="$*" || audio=$(fzf --prompt="Select an Audio File: ")
  22. [[ $audio ]] || exit
  23.  
  24. tmp_file_1="robotvoice_tmp_01.ogg"
  25. tmp_file_2="robotvoice_tmp_02.ogg"
  26. pitch_01="0.9"
  27. pitch_02="1.2"
  28.  
  29. #Create a lower and higher pitch copy of voice
  30. ffmpeg -i "$audio" -af "asetrate=44100*$pitch_01,aresample=44100,atempo=1/$pitch_01" $tmp_file_1
  31. ffmpeg -i "$audio" -af "asetrate=44100*$pitch_02,aresample=44100,atempo=1/$pitch_02" $tmp_file_2
  32.  
  33. #merge all 3 together
  34. ffmpeg -i "$audio" -i $tmp_file_1 -i $tmp_file_2 -filter_complex "[0:a][1:a][2:a]amix=3[a]" -ac 2 -map "[a]"  "voice_$audio"
  35.  
  36. rm "$tmp_file_1" "$tmp_file_2"
  37. mpv "voice_$audio"
  38.  
Tags: ffmpeg
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement