audio_quality

Source code: audio_quality.py

Audio Quality Test the use audio fixture.

Description

This test case is used to communicate with audio fixture and parse the result of CLIO which is audio quality analysis software. DUT will connect to 2 subnets, one is for factory server and the other is for fixture.

This pytest starts a socket server listening on port 8888 (can be overridden by argument network_setting). Third party fixture will connect to this port and communicate with this pytest in a special protocol. See HandleConnection and setupLoopHandler for more details.

The test flow is controlled by the third party fixture, this pytest is command driven, it does whatever third party fixture asks it to do.

Test Procedure

This test does not require operator interaction.

  1. Connect DUT with fixture.

  2. Press SPACE to start testing.

  3. The test will judge PASS / FAIL result by itself.

Dependency

No extra dependency.

Examples

Here is an example, set your audio card name in test list constants or device data:

{
  "pytest_name": "audio_quality",
  "label": "Audio Quality",
  "related_components": [
    "test_tags.TestCategory.AUDIOCODEC",
    "test_tags.TestCategory.SMART_SPEAKER_AMPLIFIER",
    "test_tags.TestCategory.SPEAKERAMPLIFIER"
  ],
  "args": {
    "input_dev": [
      "eval! device.component.audio_card_name or constants.audio.card_name",
      "99"
    ],
    "output_dev": [
      "eval! device.component.audio_card_name or constants.audio.card_name",
      "0"
    ],
    "wav_file": "/usr/local/factory/third_party/SPK48k.wav"
  }
}

(Optional) Use pytest download_from_factory_drive.py to download parameters from factory server.

See audio_loop.py for more details about how to set output_dev.

Test Arguments

Name

Type

Description

initial_actions

list

(optional; default: []) List of [card, actions], and card can be card index number or card name

input_dev

list

(optional; default: ['0', '0']) Input ALSA device. [card_name, sub_device].For example: [“audio_card”, “0”].

output_dev

list

(optional; default: ['0', '0']) Output ALSA device. [card_name, sub_device].For example: [“audio_card”, “0”].

loop_type

str

(optional; default: 'sox') Audio loop type: sox, looptest, tinyloop, hwloop

use_multitone

bool

(optional; default: False) Use multitone

loop_buffer_count

int

(optional; default: 10) Count of loop buffer

fixture_param

list

(optional; default: ['audio/audio_md5', 'audio/audio.zip']) Fixture parameters

network_setting

dict

(optional; default: {}) Network setting to define local_ip, port, gateway_ip

audio_conf

str, None

(optional; default: None) Audio config file path

wav_file

str, None

(optional; default: None) Wav file path for playback_wav_file command.

keep_raw_logs

bool

(optional; default: True) Whether to attach the log by Testlog.