Skip to content

Instantly share code, notes, and snippets.

@BenMcLean
Last active June 22, 2023 07:33
Show Gist options
  • Save BenMcLean/09e2dcf1c62c3fd9bb4c4eaf41ecb7d4 to your computer and use it in GitHub Desktop.
Save BenMcLean/09e2dcf1c62c3fd9bb4c4eaf41ecb7d4 to your computer and use it in GitHub Desktop.
Teenage Engineering PO-33 Pocket Operator KO Sampler/Sequencer Kit Maker
@ECHO ON
cd %~dp0
set /a missing=F
if "%~2" == "" (
set missing=T
) else (
if "%~1" == "" ( set missing=T )
)
if "%missing%" == "T" (
echo At least two input files must be specified.
@PAUSE
exit /b
)
if not exist ffmpeg.exe (
echo ffmpeg.exe not found!
@PAUSE
exit /b
)
if not exist KnockOutKitMaker-SILENCE.wav (
ffmpeg -f lavfi -i anullsrc=channel_layout=stereo:sample_rate=44100 -acodec pcm_s16le -ar 44100 -ac 2 -t 0.2 KnockOutKitMaker-SILENCE.wav
if %ERRORLEVEL% neq 0 (
echo ffmpeg.exe quit while making "KnockOutKitMaker-SILENCE.wav" with error code %ERRORLEVEL%
@PAUSE
exit /b
)
)
if exist KnockOutKitMaker.txt del KnockOutKitMaker.txt
set number=0
goto skip
:again
echo file 'KnockOutKitMaker-SILENCE.wav'>>KnockOutKitMaker.txt
:skip
echo file 'KnockOutKitMaker%number%.wav'>>KnockOutKitMaker.txt
if exist KnockOutKitMaker%number%.wav del KnockOutKitMaker%number%.wav
rem ffmpeg -i "%~1" -filter:a loudnorm=print_format=summary:linear=true:dual_mono=true -acodec pcm_s16le -ar 44100 -ac 2 KnockOutKitMaker%number%.wav
ffmpeg -i "%~1" -acodec pcm_s16le -ar 44100 -ac 2 KnockOutKitMaker%number%.wav
if %ERRORLEVEL% neq 0 (
echo ffmpeg.exe quit while processing "%~1" with error code %ERRORLEVEL%
@PAUSE
exit /b
)
set /a number = number + 1
shift
if "%~1" neq "" goto again
if exist KnockOutKitMaker.flac del KnockOutKitMaker.flac
ffmpeg -f concat -safe 0 -i KnockOutKitMaker.txt KnockOutKitMaker.flac
if %ERRORLEVEL% neq 0 (
echo ffmpeg.exe quit while making "KnockOutKitMaker.flac" error code %ERRORLEVEL%
@PAUSE
exit /b
)
del KnockOutKitMaker-SILENCE.wav
for /L %%i in (0, 1, %number%) do del KnockOutKitMaker%%i.wav
del KnockOutKitMaker.txt
if exist ffplay.exe ffplay -autoexit KnockOutKitMaker.flac
@PAUSE
@BenMcLean
Copy link
Author

I feel like I should get into the market myself by making an open source device that actually does what the Knockout claims it does in the same <$100 range. But I'm not a hardware guy: I'm a software guy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment