commit 4962dce8228dfcd203edfc48724a875fe95afe6f
parent 7519e4d59043d1f9bf201024043912d43b47b737
Author: rbckman <rob@tarina.org>
Date: Tue, 20 May 2025 01:08:33 +0100
sox fix all channel issues
Diffstat:
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/gonzopi.py b/gonzopi.py
@@ -4513,8 +4513,8 @@ def renderaudio(audiofiles, filename, dubfiles, dubmix):
pass
os.system('cp ' + filename + '.wav ' + filename + '_tmp.wav')
#Fade and make stereo
- run_command('sox -V0 -G ' + d + ' /dev/shm/fade.wav fade ' + str(round(i[2],1)) + ' 0 ' + str(round(i[3],1)))
- run_command('sox -V0 -G -m -v ' + str(round(i[0],1)) + ' /dev/shm/fade.wav -v ' + str(round(i[1],1)) + ' ' + filename + '_tmp.wav ' + filename + '.wav trim 0 ' + str(audiolength))
+ run_command('sox -V0 -b 16 -G ' + d + ' -c 2 /dev/shm/fade.wav fade ' + str(round(i[2],1)) + ' 0 ' + str(round(i[3],1)))
+ run_command('sox -V0 -b 16 -G -m -v ' + str(round(i[0],1)) + ' /dev/shm/fade.wav -v ' + str(round(i[1],1)) + ' ' + filename + '_tmp.wav -c 2 ' + filename + '.wav trim 0 ' + str(audiolength))
try:
os.remove(filename + '_tmp.wav')
os.remove('/dev/shm/fade.wav')
@@ -5910,21 +5910,21 @@ def audiotrim(filename, where, dub):
#trim from end or beginning and put a 0.01 in- and outfade
if where == 'end':
if dub:
- run_command('sox -V0 ' + dub[:-4] + '.wav ' + dub[:-4] + '_temp.wav trim 0 -' + str(int(audiosync)/1000))
+ run_command('sox -V0 ' + dub[:-4] + '.wav -c 2 ' + dub[:-4] + '_temp.wav trim 0 -' + str(int(audiosync)/1000))
else:
- run_command('sox -V0 ' + filename + '.wav ' + filename + '_temp.wav trim 0 -' + str(int(audiosync)/1000))
+ run_command('sox -V0 ' + filename + '.wav -c 2 ' + filename + '_temp.wav trim 0 -' + str(int(audiosync)/1000))
if where == 'beginning':
if dub:
logger.info('trimming from beginning at: '+str(int(audiosync)/1000))
- run_command('sox -V0 ' + dub[:-4] + '.wav ' + dub[:-4] + '_temp.wav trim ' + str(int(audiosync)/1000))
+ run_command('sox -V0 ' + dub[:-4] + '.wav -c 2 ' + dub[:-4] + '_temp.wav trim ' + str(int(audiosync)/1000))
else:
logger.info('trimming from beginning at: '+str(int(audiosync)/1000))
- run_command('sox -V0 ' + filename + '.wav ' + filename + '_temp.wav trim ' + str(int(audiosync)/1000))
+ run_command('sox -V0 ' + filename + '.wav -c 2 ' + filename + '_temp.wav trim ' + str(int(audiosync)/1000))
if dub:
- run_command('sox -V0 -G ' + dub[:-4] + '_temp.wav ' + dub[:-4] + '.wav fade 0.01 0 0.01')
+ run_command('sox -V0 -G ' + dub[:-4] + '_temp.wav -c 2 ' + dub[:-4] + '.wav fade 0.01 0 0.01')
os.remove(dub[:-4] + '_temp.wav')
else:
- run_command('sox -V0 -G ' + filename + '_temp.wav ' + filename + '.wav fade 0.01 0 0.01')
+ run_command('sox -V0 -G ' + filename + '_temp.wav -c 2' + filename + '.wav fade 0.01 0 0.01')
os.remove(filename + '_temp.wav')
#if int(audiosync) > 400:
# writemessage('WARNING!!! VIDEO FRAMES DROPPED!')
@@ -5948,11 +5948,11 @@ def audiotrim(filename, where, dub):
#make delay file
print(str(int(audiosync)/1000))
if dub:
- run_command('sox -V0 -r '+soundrate+' -c 2 '+dub[:-4]+'.wav '+dub[:-4]+'_temp.wav trim 0.0 pad 0 ' + str(int(audiosync)/1000))
- run_command('sox -V0 -G ' + dub[:-4] + '_temp.wav ' + dub[:-4] + '.wav fade 0.01 0 0.01')
+ run_command('sox -V0 -b 16 -r '+soundrate+' '+dub[:-4]+'.wav -c 2 '+dub[:-4]+'_temp.wav trim 0.0 pad 0 ' + str(int(audiosync)/1000))
+ run_command('sox -V0 -b 16 -G ' + dub[:-4] + '_temp.wav -c 2 ' + dub[:-4] + '.wav fade 0.01 0 0.01')
else:
- run_command('sox -V0 -r '+soundrate+' -c 2 '+filename+'.wav '+filename+'_temp.wav trim 0.0 pad 0 ' + str(int(audiosync)/1000))
- run_command('sox -V0 -G ' + filename + '_temp.wav ' + filename + '.wav fade 0.01 0 0.01')
+ run_command('sox -V0 -b 16 -r '+soundrate+' '+filename+'.wav -c 2 '+filename+'_temp.wav trim 0.0 pad 0 ' + str(int(audiosync)/1000))
+ run_command('sox -V0 -b 16 -G ' + filename + '_temp.wav -c 2 ' + filename + '.wav fade 0.01 0 0.01')
#add silence to end
#run_command('sox -V0 /dev/shm/silence.wav ' + filename + '_temp.wav')
#run_command('cp '+filename+'.wav '+filename+'_temp.wav')