diff --git a/ear/cmdline/ambix_to_bwf.py b/ear/cmdline/ambix_to_bwf.py index b6ccebc..471204c 100644 --- a/ear/cmdline/ambix_to_bwf.py +++ b/ear/cmdline/ambix_to_bwf.py @@ -8,7 +8,7 @@ from ..fileio.adm.generate_ids import generate_ids from ..fileio.adm.xml import adm_to_xml from ..fileio import openBw64 -from ..fileio.bw64.chunks import ChnaChunk, FormatInfoChunk +from ..fileio.bw64.chunks import ChnaChunk def add_args(subparsers): @@ -105,15 +105,8 @@ def ambix_to_bwf(args): chna = ChnaChunk() populate_chna_chunk(chna, adm) - fmtInfo = FormatInfoChunk( - formatTag=1, - channelCount=infile.channels, - sampleRate=infile.sampleRate, - bitsPerSample=infile.bitdepth, - ) - with openBw64( - args.output, "w", chna=chna, formatInfo=fmtInfo, axml=axml + args.output, "w", chna=chna, formatInfo=infile.formatInfo, axml=axml ) as outfile: while True: samples = infile.read(1024) diff --git a/ear/cmdline/utils.py b/ear/cmdline/utils.py index e2648d3..d2cfe50 100644 --- a/ear/cmdline/utils.py +++ b/ear/cmdline/utils.py @@ -4,7 +4,7 @@ import sys from ..compatibility import write_bytes_to_stdout from ..fileio import openBw64 -from ..fileio.bw64.chunks import FormatInfoChunk, ChnaChunk +from ..fileio.bw64.chunks import ChnaChunk import warnings from . import ambix_to_bwf from . import generate_test_file @@ -23,9 +23,6 @@ def replace_axml_command(args): axml = axml_file.read() with openBw64(args.input) as infile: - formatInfo = FormatInfoChunk(channelCount=infile.channels, - sampleRate=infile.sampleRate, - bitsPerSample=infile.bitdepth) if args.gen_chna: adm = adm_xml.parse_string(axml) adm_chna.guess_track_indices(adm) @@ -39,8 +36,9 @@ def replace_axml_command(args): "not have a CHNA chunk. Either specify '-g', or use an input " + "file with a CHNA chunk.") - with openBw64(args.output, 'w', formatInfo=formatInfo, - axml=axml, chna=chna) as outfile: + with openBw64( + args.output, "w", formatInfo=infile.formatInfo, axml=axml, chna=chna + ) as outfile: while True: samples = infile.read(2048) if not len(samples): @@ -82,10 +80,6 @@ def regenerate_command(args): import lxml.etree with openBw64(args.input) as infile: - formatInfo = FormatInfoChunk(channelCount=infile.channels, - sampleRate=infile.sampleRate, - bitsPerSample=infile.bitdepth) - adm = ADM() load_common_definitions(adm) @@ -109,20 +103,22 @@ def regenerate_command(args): chna = ChnaChunk() adm_chna.populate_chna_chunk(chna, adm) - with openBw64(args.output, 'w', formatInfo=formatInfo, - axml=axml, chna=chna) as outfile: + with openBw64( + args.output, "w", formatInfo=infile.formatInfo, axml=axml, chna=chna + ) as outfile: for samples in infile.iter_sample_blocks(2048): outfile.write(samples) def rewrite_command(args): with openBw64(args.input) as infile: - formatInfo = FormatInfoChunk(channelCount=infile.channels, - sampleRate=infile.sampleRate, - bitsPerSample=infile.bitdepth) - - with openBw64(args.output, 'w', formatInfo=formatInfo, - axml=infile.axml, chna=infile.chna) as outfile: + with openBw64( + args.output, + "w", + formatInfo=infile.formatInfo, + axml=infile.axml, + chna=infile.chna, + ) as outfile: while True: samples = infile.read(2048) if not len(samples):