Files
@ 5c8b6cd330da
Branch filter:
Location: light9/bin/musicPad - annotation
5c8b6cd330da
1.2 KiB
text/plain
fix artnet setup
Ignore-this: b6a4f26b87bb2e61e3391d620c5d1462
Ignore-this: b6a4f26b87bb2e61e3391d620c5d1462
d8202a0a7fd5 f5b01841587f f5b01841587f f5b01841587f f5b01841587f f5b01841587f 46d319974176 94039df5cdd9 f5b01841587f f5b01841587f f5b01841587f f5b01841587f 7772cc48e016 f5b01841587f 94039df5cdd9 94039df5cdd9 f5b01841587f 64eeba960168 f5b01841587f f5b01841587f f5b01841587f f5b01841587f f5b01841587f 7772cc48e016 f5b01841587f 64eeba960168 f5b01841587f f5b01841587f f5b01841587f f5b01841587f 7772cc48e016 64eeba960168 f5b01841587f 64eeba960168 f5b01841587f f5b01841587f | #!bin/python
"""
rewrite all the songs with silence at the start and end
"""
import sys, wave, logging, os
sys.path.append(".")
from light9 import showconfig
from light9.ascoltami.playlist import Playlist
logging.basicConfig(level=logging.INFO)
log = logging.getLogger()
introPad = 4
postPad = 9 # 5 + autostop + 4
playlist = Playlist.fromShow(showconfig.getGraph(), showconfig.showUri())
for p in playlist.allSongPaths():
log.info("read %s", p)
inputWave = wave.open(p, 'rb')
outputDir = os.path.join(os.path.dirname(p), "pad")
try:
os.makedirs(outputDir)
except OSError:
pass # exists
outputPath = os.path.join(outputDir, os.path.basename(p))
outputWave = wave.open(outputPath, 'wb')
outputWave.setparams(inputWave.getparams())
bytesPerSecond = (inputWave.getnchannels() * inputWave.getsampwidth() *
inputWave.getframerate())
outputWave.writeframesraw(b"\x00" * (bytesPerSecond * introPad))
outputWave.writeframesraw(inputWave.readframes(inputWave.getnframes()))
outputWave.writeframesraw(b"\x00" * (bytesPerSecond * postPad))
outputWave.close()
log.info("wrote %s", outputPath)
|