diff --git a/test/sbc/data/sine-stereo.sbc b/test/sbc/data/sine-stereo.sbc new file mode 100644 index 000000000..5e9589183 Binary files /dev/null and b/test/sbc/data/sine-stereo.sbc differ diff --git a/test/sbc/data/sine-stereo.wav b/test/sbc/data/sine-stereo.wav index 398250d85..35309cc47 100644 Binary files a/test/sbc/data/sine-stereo.wav and b/test/sbc/data/sine-stereo.wav differ diff --git a/test/sbc/sbc.py b/test/sbc/sbc.py index c5880806c..560e1ab46 100644 --- a/test/sbc/sbc.py +++ b/test/sbc/sbc.py @@ -221,7 +221,7 @@ class SBCFrame: levels = np.zeros(shape=(2, 8), dtype = np.int32) - def __init__(self, nr_blocks=16, nr_subbands=4, nr_channels=1, bitpool=31, sampling_frequency=44100, allocation_method = 0): + def __init__(self, nr_blocks=16, nr_subbands=4, nr_channels=1, bitpool=31, sampling_frequency=44100, allocation_method = 0, force_channel_mode = 0): self.nr_blocks = nr_blocks self.nr_subbands = nr_subbands self.nr_channels = nr_channels @@ -229,6 +229,7 @@ class SBCFrame: self.bitpool = bitpool self.allocation_method = allocation_method self.init(nr_blocks, nr_subbands, nr_channels) + self.channel_mode = force_channel_mode return def init(self, nr_blocks, nr_subbands, nr_channels): diff --git a/test/sbc/sbc_encoder.py b/test/sbc/sbc_encoder.py index 3d8a5a015..ad72fae8e 100755 --- a/test/sbc/sbc_encoder.py +++ b/test/sbc/sbc_encoder.py @@ -140,7 +140,6 @@ if __name__ == "__main__": nr_blocks = 0 nr_subbands = 0 - print len(sys.argv) if (len(sys.argv) < 7): print(usage) sys.exit(1) @@ -151,6 +150,7 @@ if __name__ == "__main__": sys.exit(1) msbc_enabled = int(sys.argv[7]) + print("msbc_enabled %d"%msbc_enabled) if msbc_enabled: sbcfile = infile.replace('.wav', '-encoded.msbc') else: @@ -161,12 +161,9 @@ if __name__ == "__main__": bitpool = int(sys.argv[4]) allocation_method = int(sys.argv[5]) - force_channel_mode = 0 - if len(sys.argv) == 6: - force_channel_mode = int(sys.argv[6]) - if force_channel_mode != 2 or force_channel_mode != 3: - print(usage) - sys.exit(1) + force_channel_mode = int(sys.argv[6]) + print("force_channel_mode %d"%force_channel_mode) + fin = wave.open(infile, 'rb') nr_channels = fin.getnchannels() @@ -188,9 +185,10 @@ if __name__ == "__main__": fout = open(sbcfile, 'wb') while audio_frame_count < nr_audio_frames: if subband_frame_count % 200 == 0: - print("== Frame %d ==" % (subband_frame_count)) + print("== Frame %d == " % (subband_frame_count)) - sbc_encoder_frame = SBCFrame(nr_blocks, nr_subbands, nr_channels, bitpool, sampling_frequency, allocation_method) + sbc_encoder_frame = SBCFrame(nr_blocks, nr_subbands, nr_channels, bitpool, sampling_frequency, allocation_method, force_channel_mode) + if subband_frame_count == 0: print sbc_encoder_frame fetch_samples_for_next_sbc_frame(fin, sbc_encoder_frame)