Commit f4e92e74 authored by emerit's avatar emerit
Browse files

clean up and merge with main

parent 3f12ceb4
Loading
Loading
Loading
Loading

5.1.2.512

deleted100644 → 0
−2.93 MiB

File deleted.

7.1.4.512

deleted100644 → 0
−2.93 MiB

File deleted.

7_1_4.512

deleted100644 → 0
−2.93 MiB

File deleted.

HO3_noise_0_0_512kb.bit

deleted100644 → 0
−5.9 MiB

File deleted.

IvasBrirIntExtRenderers.py

deleted100644 → 0
+0 −102
Original line number Diff line number Diff line
#!/usr/bin/env python3

import os
import subprocess

# Set/unset the flags below to activate/deactivate build/encode/decode phases
build = False
encode = True
decode = True

# Variables
fs = 48
ivasPath = './'
ivasEnc = 'IVAS_cod'
ivasDec = 'IVAS_dec'
ivasRend = 'IVAS_rend'
inPath = './in/'
bitPath = './bit/'
outPath = './out/'
hrtfPath = f'{ivasPath}scripts/binauralRenderer_interface/binaural_renderers_hrtf_data/'
# hrtfName = f'HRIR_128_Meth5_IRC_53_Q10_symL_Itrp1_{fs}000'
# brirKern = 'BRIR_Auditorium_S1_R1'
# brirName = f'{brirKern}_Combined_BRIR_{fs}kHz'
# brirFile = f'{hrtfPath}{hrtfName}+{brirName}.bin'
# brirFile = f'{hrtfPath}fastconv_{hrtfName}_{brirKern}.bin'
# brirFile = f'{hrtfPath}ivas_binaural_custom_48kHz.bin'
brirFiles = ['',f'ivas_binaural_{fs}kHz',f'ivas_binaural_custom_{fs}kHz', f'ivas_binaural_custom_no_optim_{fs}kHz', f'ivas_binaural_custom_fabian_hrir_{fs}kHz']
brirPaths = [f'{hrtfPath}{brirFiles[0]}.bin', f'{hrtfPath}{brirFiles[1]}.bin']
bitrates = [32, 80, 256]
# inFormats = ['mc 5_1', 'mc 7_1_4', 'sba 1', 'sba 2', 'sba 3']
# files = {'mc 5_1' : f'5ch_ident_{fs}', 'mc 7_1_4' : f'dirac_714_{fs}k', 'sba 1' : f'dirac_HOA1S_{fs}k' , 'sba 2' : f'dirac_HOA2S_{fs}k' , 'sba 3' : f'dirac_HOA3S_{fs}k' }
# outFormats = {'mc 5_1' : '5_1', 'mc 7_1_4' : '7_1_4', 'sba 1' : 'FOA' , 'sba 2' : 'HOA2' , 'sba 3' : 'HOA3' }
inFormats = ['mc 5_1', 'mc 7_1_4', 'sba 3']
files = {'mc 5_1' : f'5ch_ident_{fs}', 'mc 7_1_4' : f'dirac_714_{fs}k' , 'sba 3' : f'dirac_HOA3S_{fs}k' }
outFormats = {'mc 5_1' : '5_1', 'mc 7_1_4' : '7_1_4', 'sba 1' : 'FOA' , 'sba 3' : 'HOA3' }

testDir = os.getcwd()

# Build phase
if build:
    os.chdir(ivasPath)
    subprocess.run('cmake -D CMAKE_BUILD_TYPE=Release -D TARGET_PLATFORM=x86_64 -D COPY_EXECUTABLES_FROM_BUILD_DIR=true -B build -G "Visual Studio 15 2017 Win64"')
    subprocess.run('cmake --build build --config release --clean-first')
    #subprocess.run('cmake --build build --config release')
    os.chdir(testDir)

#Encode
if encode:
    for b in bitrates:
        for f in inFormats:
            cmd = f'{ivasPath}{ivasEnc} -{f} {b * 1000} {fs} {inPath}{files[f]}.wav {bitPath}{files[f]}-{b}kbps.ivas'
            subprocess.run(cmd,shell=True)

#Decode & Render
# for b in bitrates:
#     for f in inFormats:
#         for brir in brirFiles:
#             ivasFile = f'{bitPath}{files[f]}-{b}kbps.ivas'
#             outFileBase = f'{outPath}{files[f]}-{b}kbps'
#             # Decode and render binaural
#             cmd = f'{ivasPath}{ivasDec} -hrtf {hrtfPath}{brir}.bin BINAURAL {fs} {ivasFile} {outFileBase}-dec-bin-{brir}.wav'
#             subprocess.run(cmd,shell=True)

#             # Decode and render binaural IR
#             cmd = f'{ivasPath}{ivasDec} -hrtf {hrtfPath}{brir}.bin BINAURAL_ROOM_IR {fs} {ivasFile} {outFileBase}-dec-brir-{brir}.wav'
#             subprocess.run(cmd,shell=True)

#             # Decode and render binaural reverb
#             cmd = f'{ivasPath}{ivasDec} -hrtf {hrtfPath}{brir}.bin BINAURAL_ROOM_REVERB {fs} {ivasFile} {outFileBase}-dec-rev-{brir}.wav'
#             subprocess.run(cmd,shell=True)

#             # Decode pass-through
#             cmd = f'{ivasPath}{ivasDec} {outFormats[f]} {fs} {ivasFile} {outFileBase}-dec-ext.wav'
#             subprocess.run(cmd,shell=True)

#             # Render binaural
#             cmd = f'{ivasPath}{ivasRend} -i {outFileBase}-dec-ext.wav -if {outFormats[f]} -o {outFileBase}-ext-bin-{brir}.wav -of BINAURAL -fs {fs} -hrtf {hrtfPath}{brir}.bin'
#             subprocess.run(cmd,shell=True)

#             # Render binaural IR
#             cmd = f'{ivasPath}{ivasRend} -i {outFileBase}-dec-ext.wav -if {outFormats[f]} -o {outFileBase}-ext-brir-{brir}.wav -of BINAURAL_ROOM_IR -fs {fs} -hrtf {hrtfPath}{brir}.bin'
#             subprocess.run(cmd,shell=True)

#             # Render binaural reverb
#             cmd = f'{ivasPath}{ivasRend} -i {outFileBase}-dec-ext.wav -if {outFormats[f]} -o {outFileBase}-ext-rev-{brir}.wav -of BINAURAL_ROOM_REVERB -fs {fs}'
#             subprocess.run(cmd,shell=True)
            
for f in inFormats:
    outFileBase = f'{outPath}{files[f]}'
    for brir in brirFiles:

        # Render binaural
        cmd = f'{ivasPath}{ivasRend} -i {inPath}{files[f]}.wav  -if {outFormats[f]} -o {outFileBase}-rend-bin-{brir}.wav -of BINAURAL -fs {fs} -hrtf {hrtfPath}{brir}.bin'
        subprocess.run(cmd,shell=True)

        # Render binaural IR
        cmd = f'{ivasPath}{ivasRend} -i {inPath}{files[f]}.wav -if {outFormats[f]} -o {outFileBase}-rend-brir-{brir}.wav -of BINAURAL_ROOM_IR -fs {fs} -hrtf {hrtfPath}{brir}.bin -g 8'
        subprocess.run(cmd,shell=True)
        
        # Render binaural reverb
        cmd = f'{ivasPath}{ivasRend} -i  {inPath}{files[f]}.wav -if {outFormats[f]} -o {outFileBase}-rend-rev-{brir}.wav -of BINAURAL_ROOM_REVERB -fs {fs} -hrtf {hrtfPath}{brir}.bin'
        subprocess.run(cmd,shell=True)            
Loading