
wavelist = []
for p in range(48):
    for s in range(24):
        wave = {'method': 'PUT', 'url': 'http://localhost:3520/scenes/_current'}
        wave['name'] = 'P{0:02}-S{1:02}'.format(p + 1, s + 1)
        wave['data'] = {'id': p * 24 + s}
        wavelist.append(wave)

import json
import struct

for wave in wavelist:

    reqdata = '\n'.join((wave['method'], wave['url'], json.dumps(wave['data'])))
    reqlen = len(reqdata)
    if reqlen % 2 == 1:
        reqdata += '\n'
        reqlen += 1

    filelen = 36 + 8 + reqlen

    riffchunk = struct.pack('<4sL4s', 'RIFF'.encode(), filelen, 'WAVE'.encode())
    fmtchunk = struct.pack('<4sL2H2L2H', 'fmt '.encode(), 16, 1, 1, 22050, 44100, 2, 16)
    datachunk = struct.pack('<4sL', 'data'.encode(), 0)
    reqchunk = struct.pack('<4sL', 'req '.encode(), reqlen) + reqdata.encode()

    with open(wave['name'] + '.wav', 'wb') as f:
        f.write(riffchunk + fmtchunk + datachunk + reqchunk)



import struct


wavelist = []
for s in range(12):
    wave = {'method': 'POST'}
    wave['url'] = 'http://localhost:3520/scenes/{0}/_load'.format(s + 1)
    wave['name'] = 'Scene {0:02}'.format(s + 1)
    wave['data'] = ''
    wavelist.append(wave)


for wave in wavelist:

    reqdata = '\n'.join((wave['method'], wave['url'], wave['data']))
    reqlen = len(reqdata)
    if reqlen % 2 == 1:
        reqdata += '\n'
        reqlen += 1

    filelen = 36 + 8 + reqlen

    riffchunk = struct.pack('<4sL4s', 'RIFF'.encode(), filelen, 'WAVE'.encode())
    fmtchunk = struct.pack('<4sL2H2L2H', 'fmt '.encode(), 16, 1, 1, 22050, 44100, 2, 16)
    datachunk = struct.pack('<4sL', 'data'.encode(), 0)
    reqchunk = struct.pack('<4sL', 'req '.encode(), reqlen) + reqdata.encode()

    with open(wave['name'] + '.wav', 'wb') as f:
        f.write(riffchunk + fmtchunk + datachunk + reqchunk)

Update format of wave file generator.
Update format of wave file generator.

+ 
+ 
+ import struct
+ 
  
  wavelist = []
- for p in range(48):
-     for s in range(24):
+ for s in range(12):
-         wave = {'method': 'PUT', 'url': 'http://localhost:3520/scenes/_current'}
-         wave['name'] = 'P{0:02}-S{1:02}'.format(p + 1, s + 1)
-         wave['data'] = {'id': p * 24 + s}
+     wave = {'method': 'POST'}
+     wave['url'] = 'http://localhost:3520/scenes/{0}/_load'.format(s + 1)
+     wave['name'] = 'Scene {0:02}'.format(s + 1)
+     wave['data'] = ''
-         wavelist.append(wave)
+     wavelist.append(wave)
  
- import json
- import struct
  
  for wave in wavelist:
  
-     reqdata = '\n'.join((wave['method'], wave['url'], json.dumps(wave['data'])))
+     reqdata = '\n'.join((wave['method'], wave['url'], wave['data']))
      reqlen = len(reqdata)
      if reqlen % 2 == 1:
          reqdata += '\n'
          reqlen += 1
  
      filelen = 36 + 8 + reqlen
  
      riffchunk = struct.pack('<4sL4s', 'RIFF'.encode(), filelen, 'WAVE'.encode())
      fmtchunk = struct.pack('<4sL2H2L2H', 'fmt '.encode(), 16, 1, 1, 22050, 44100, 2, 16)
      datachunk = struct.pack('<4sL', 'data'.encode(), 0)
      reqchunk = struct.pack('<4sL', 'req '.encode(), reqlen) + reqdata.encode()
  
      with open(wave['name'] + '.wav', 'wb') as f:
          f.write(riffchunk + fmtchunk + datachunk + reqchunk)
  
Update format of wave file generator.
## Code Before:

wavelist = []
for p in range(48):
    for s in range(24):
        wave = {'method': 'PUT', 'url': 'http://localhost:3520/scenes/_current'}
        wave['name'] = 'P{0:02}-S{1:02}'.format(p + 1, s + 1)
        wave['data'] = {'id': p * 24 + s}
        wavelist.append(wave)

import json
import struct

for wave in wavelist:

    reqdata = '\n'.join((wave['method'], wave['url'], json.dumps(wave['data'])))
    reqlen = len(reqdata)
    if reqlen % 2 == 1:
        reqdata += '\n'
        reqlen += 1

    filelen = 36 + 8 + reqlen

    riffchunk = struct.pack('<4sL4s', 'RIFF'.encode(), filelen, 'WAVE'.encode())
    fmtchunk = struct.pack('<4sL2H2L2H', 'fmt '.encode(), 16, 1, 1, 22050, 44100, 2, 16)
    datachunk = struct.pack('<4sL', 'data'.encode(), 0)
    reqchunk = struct.pack('<4sL', 'req '.encode(), reqlen) + reqdata.encode()

    with open(wave['name'] + '.wav', 'wb') as f:
        f.write(riffchunk + fmtchunk + datachunk + reqchunk)

## Instruction:
Update format of wave file generator.
## Code After:


import struct


wavelist = []
for s in range(12):
    wave = {'method': 'POST'}
    wave['url'] = 'http://localhost:3520/scenes/{0}/_load'.format(s + 1)
    wave['name'] = 'Scene {0:02}'.format(s + 1)
    wave['data'] = ''
    wavelist.append(wave)


for wave in wavelist:

    reqdata = '\n'.join((wave['method'], wave['url'], wave['data']))
    reqlen = len(reqdata)
    if reqlen % 2 == 1:
        reqdata += '\n'
        reqlen += 1

    filelen = 36 + 8 + reqlen

    riffchunk = struct.pack('<4sL4s', 'RIFF'.encode(), filelen, 'WAVE'.encode())
    fmtchunk = struct.pack('<4sL2H2L2H', 'fmt '.encode(), 16, 1, 1, 22050, 44100, 2, 16)
    datachunk = struct.pack('<4sL', 'data'.encode(), 0)
    reqchunk = struct.pack('<4sL', 'req '.encode(), reqlen) + reqdata.encode()

    with open(wave['name'] + '.wav', 'wb') as f:
        f.write(riffchunk + fmtchunk + datachunk + reqchunk)
