Advertisement
Guest User

sampleconvert.bat

a guest
Aug 5th, 2017
815
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.94 KB | None | 0 0
  1. @echo off
  2. REM Enter location of your sox.exe file here:
  3. set sox="C:\Program Files (x86)\sox-14-4-2\sox.exe"
  4.  
  5. :menu
  6. cls
  7. echo This is a script to convert all samples in the batch file's directory and its subdirectories to Akai MPC1000 format (44 100 hz, 16 bit) or custom formats using SoX. See http://sox.sourceforge.net/ for more info.
  8. echo You must have SoX 14-4-2 installed to the directory "C:\Program Files (x86)\sox-14-4-2\sox.exe" or alternatively edit the directory to the sox binary at the top of the batch file to reflect your install directory/sox version.
  9. echo Once you have created the converted sample library it will be stored in a folder called "Converted" in the same directory as this batch file.
  10. echo WARNING: BE VERY CAREFUL with this script. Always keep a backup of your sample library, I am not responsible for any damages caused to your system/files/intellectual property.
  11. echo:
  12. echo:
  13. echo MENU
  14. echo:
  15. echo 1. Create MPC1000 compatible sample library (44100hz, 16bit)
  16. echo 2. Create custom sample library (you set the sample rate/bit depth) ( beta )
  17. echo 3. Delete previously converted sample library
  18. echo 4. PC to MPC ( beta )
  19. echo q. Quit
  20. echo:
  21.  
  22. set /p choice="Enter your choice: "
  23. if "%choice%"=="1" goto one
  24. if "%choice%"=="2" goto two
  25. if "%choice%"=="3" goto three
  26. if "%choice%"=="4" goto four
  27. if "%choice%"=="q" exit
  28.  
  29. :one
  30. REM Clean any unremoved conversions out of the original library. (incase it crashed the first time you ran it)
  31. for /R "%~dp0" %%f in (*___MPC.wav) do (
  32. del "%%f"
  33. )
  34.  
  35. REM Carry out conversion.
  36. for /R "%~dp0" %%f in (*.wav *.aif *.aiff *.mp3) do (
  37. %sox% "%%f" -G -V -r 44100 -b 16 "%%~df%%~pf%%~nf___MPC.wav"
  38. )
  39.  
  40. REM Move the converted samples to a mirrored library.
  41. rmdir /q /s "%~dp0Converted"
  42. mkdir "%~dp0Converted"
  43. robocopy "%~dp0\" "%~dp0Converted\\" *___MPC.wav /MIR /E /MOV
  44. rmdir /s /q "%~dp0Converted\Converted"
  45.  
  46. echo Operation complete!
  47. goto menu
  48.  
  49.  
  50. :two
  51.  
  52. set /p samp="Enter sample rate (one integer no spaces or commas): "
  53.  
  54. set /p bit="Enter bit depth(one integer no spaces or commas): "
  55.  
  56. REM Clean any unremoved conversions out of the original library. (incase it crashed the first time you ran it)
  57. for /R "%~dp0" %%f in (*___MPC.wav) do (
  58. del "%%f"
  59. )
  60.  
  61. REM Carry out conversion.
  62. for /R "%~dp0" %%f in (*.wav *.aif *.aiff *.mp3) do (
  63. %sox% "%%f" -G -V -r %samp% -b %bit% "%%~df%%~pf%%~nf___MPC.wav"
  64. )
  65.  
  66. REM Move the converted samples to a mirrored library.
  67. rmdir /q /s "%~dp0Converted"
  68. mkdir "%~dp0Converted"
  69. robocopy "%~dp0\" "%~dp0Converted\\" *___MPC.wav /MIR /E /MOV
  70. rmdir /s /q "%~dp0Converted\Converted"
  71.  
  72. echo Operation complete!
  73. goto menu
  74.  
  75. :three
  76. rmdir /q /s "%~dp0Converted"
  77. for /R "%~dp0" %%f in (*___MPC.wav) do (
  78. del "%%f"
  79. )
  80. goto menu
  81.  
  82. :four
  83. set /p drivelet="Enter the path to sample folder on your MPC (ie. H:\Samples): "
  84. robocopy "%~dp0Converted\\" "%drivelet%" /XN /E
  85. goto menu
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement