Commit 02b494f0 authored by Ripinder Singh's avatar Ripinder Singh
Browse files

Remove soundfile, replace with audiofile from pyaudio3dtools

parent f4a2db31
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -3,4 +3,3 @@ pytest-xdist>=1.31.0
scipy>=1.5.2
numpy>=1.19.2
bitstring>=4.3.1
soundfile>=0.13
+23 −4
Original line number Diff line number Diff line
@@ -31,7 +31,24 @@ the United Nations Convention on Contracts on the International Sales of Goods.
"""

__doc__ = """
To configure test modules.
This test does the following procedure:-

DECODER TEST
============
* Encode a input for given format, bitrate and dtx info using IVAS Encoder to g192
* Generate random PI data to be used for RTP packaging
* Use g192 and random PI data to pack a stream into RTPDump stream using the reference rtp packer implementation in python
* Provide the rtpdump stream to IVAS decoder to decode the stream and generate a PI data dump in a JSON file
* Decode G192 stream using IVAS decoder and compare against output of RTPdump for bit-exactness
* Validate dumped JSON agains original random PI data to check for similar data after deocde

ENCODER TEST
============
* Encode the input for given format, bitrate and dtx info using IVAS Encoder to rtpdump directly
* Validate the generated rtp dump using reference python implementation of RTP depacker for following:-
    * RTP Header consistency (Timestamp, seq number, etc)
    * IVAS Payload (no of frames in packet, bitrate indicated, bitexactness of frames in packet)
    * PI Data verification (Timestamp, Pidata Type, similarity of PI data)
"""

import pytest
@@ -43,8 +60,8 @@ import random
from tempfile import TemporaryDirectory
from pathlib import Path
from ivasrtp import *
import soundfile as sf
import numpy as np
from pyaudio3dtools.audiofile import readfile

ROOT_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), "../.."))
sys.path.append(ROOT_DIR)
@@ -433,8 +450,10 @@ def run_rtp_bitstream_tests (
            add_option_list= ["-VOIP_HF_ONLY=1", "-PiDataFile", str(piDataOutJson)]
        )

        decAudio, fs = sf.read(pcmOut)
        g192Audio, Fs = sf.read(pcmOutG192)
        decAudio, fs = readfile(pcmOut)
        g192Audio, Fs = readfile(pcmOutG192)
        decAudio /= 32768.0 # readfile reuturns 16 bit int
        g192Audio /= 32768.0 # readfile reuturns 16 bit int
        decAudio = decAudio[4*960:]
        assert abs(decAudio.shape[0] - g192Audio.shape[0]) <= (4 * 960), "Decoded PCM Audio is not same length as input"
        minSamples = min(decAudio.shape[0], g192Audio.shape[0])