AudiVal (Audio Validation Suite for Linux)
This is an attempt to automate and integrate various audio related tests which can help validate audio on various boards supported by Linaro. Motivation for this project comes from various audio tests listed at: https://wiki.linaro.org/TomGall/LinaroAudioFeatureIndex
The git repo for this project can be cloned from: git://git.linaro.org/people/harshbora/audival.git
Various files required by this script are available in the git repo.
Requesting all to test this script on various boards that you may have access to and share feedback to make it better.
TODO: Add tests for Audio over USB, Bluetooth.
Signed-off-by: Harsh Prateek Bora harsh.bora@linaro.org
diff --git a/AudiVal.py b/AudiVal.py new file mode 100755 index 0000000..7d56c4e --- /dev/null +++ b/AudiVal.py @@ -0,0 +1,247 @@ +#!/usr/bin/env python +# +# Audival : Audio Validation Suite for Linux. +# +# Author: Harsh Prateek Bora +# harsh.bora@linaro.org +# harsh@linux.vnet.ibm.com + +import os +import sys +import getopt +from subprocess import * # for calling external programs +import commands # deprecated since python 2.6, Python 3.0 uses subprocess + +def usage(): + print "=========================================" + print "AudiVal: Audio Validation Suite for Linux" + print "=========================================" + print "Usage:" + print sys.argv[0], "[--check-info]" + print + print "Supported HW: PandaBoard (ES), BeagleBoard (XM), i.MX53, i.MX6, Origen, Snowball" + sys.exit(1) + +SpeakerJack = { + 'GenuineIntel': 'Analog', + 'Panda': 'Headset', + 'Beagle': 'TWL4030', + 'i.MX53': 'HiFi', + 'i.MX6': 'HiFi', + 'ORIGEN': 'Pri_Dai', + 'Snowball': 'Headset' +} + +MicJack = { + 'GenuineIntel': 'Analog', + 'Panda': 'Headset', # not sure though, arecord doesnt work for me! + 'Beagle': 'TWL4030', + 'i.MX53': 'HiFi', + 'i.MX6': 'HiFi', + 'ORIGEN': 'Pri_Dai', + 'Snowball': 'Headset' +} + +# As and when HDMI out/in device string differs, we'll need 2 dictionaries. +HDMI_Audio = { + 'GenuineIntel': 'HDMI', + 'Panda': 'HDMI', + 'Beagle': 'HDMI', + 'i.MX53': 'HDMI', + 'i.MX6': 'HDMI', # audio out only supported, audio in not supported. + 'ORIGEN': 'HDMI', + 'Snowball': 'hdmi' # odd one, lowercase +} + +Audio_Devices = { + 'playback': 'aplay-l.log', + 'capture': 'arecord-l.log' +} + +def get_device_list(logfile): + fobj = open(logfile) + return fobj + +def get_card_device_info_by_name(devicestr, fobj): + """Helper routine to get card, device number by interface name""" + optxt = fobj.readlines() + card = "" + device = "" + for line in optxt: + if devicestr in line: + cardtext, colon, text = line.partition(':') + pre, sep, card = cardtext.partition(' ') + devtext, colon, text = text.partition(':') + pre, sep, device = devtext.partition('device ') + break + hwstr = 'plughw:' + card + ',' + device + if card is "" and device is "": + return None + return hwstr + +def speaker_test_audio_jack(board): + fobj = get_device_list(Audio_Devices['playback']) + print "speaker-test over audio jack .." + headset_jack_id = get_card_device_info_by_name(SpeakerJack[board], fobj) + fobj.close() + if headset_jack_id is None: + print "No Audio Jack found !" + return + call("date > speaker-test-jack.log", shell=True) + cmdstr = "speaker-test -D " + headset_jack_id + " -t s -c 2 -l 1 > speaker-test-jack.log 2>&1" + call(cmdstr, shell=True) + print "If you heard beeps from left and right speaker, test passed." + +def aplay_over_jack(board): + fobj = get_device_list(Audio_Devices['playback']) + headset_jack_id = get_card_device_info_by_name(SpeakerJack[board], fobj) + print "Testing aplay over audio jack .." + fobj.close() + if headset_jack_id is None: + print "No Audio Jack found !" + return + cmdstr = "aplay login.wav -D " + headset_jack_id + call(cmdstr, shell=True) + print "If you heard a stereo sound, test passed." + # Check dmesg to see if there is an error or I2C error + call("dmesg | tail | grep error", shell=True) + print "Note: Error, if any, shall be displayed above." + +def arecord_and_aplay_over_audio_jack(board): + # Record the WAV stream and play it back. + fobj = get_device_list(Audio_Devices['capture']) + mic_jack_id = get_card_device_info_by_name(MicJack[board], fobj) + if mic_jack_id is None: + print "No Mic Jack found !" + return + cmdstr = "arecord -c 2 -f S16_LE -d 10 -r 44100 aud44k16S.wav -D " + mic_jack_id + print "Testing arecord over audio jack .." + print "Started recording audio over jack for 10 seconds (replay follows) .." + call(cmdstr, shell=True) + print "Replaying the recorded audio now .." + call("aplay aud44k16S.wav", shell=True) + # Check dmesg to see if there is an error or I2C error + call("dmesg | tail | grep error", shell=True) + print "If you heard the recorded audio, test passed." + print "Note: Error, if any, shall be displayed above." + fobj.close() + +def speaker_test_over_hdmi(board): + """ speaker-test over HDMI audio interface. """ + fobj = get_device_list(Audio_Devices['playback']) + print "Running speaker-test over HDMI .." + # Automatic detection of card,device number for HDMI interface + hdmi_hw_id = get_card_device_info_by_name(HDMI_Audio[board], fobj) + if hdmi_hw_id is None: + print "No HDMI device found !" + return + cmdstr = "speaker-test -D " + hdmi_hw_id + " -t s -c 2 -l 1 > speaker-test-hdmi.log 2>&1" + print "speaker-test over HDMI .." + call(cmdstr, shell=True) + print "If you heard beeps from left and right speaker, test passed." + fobj.close() + +def arecord_and_aplay_over_hdmi(board): + """ arecord and aplay over HDMI audio interface. """ + fobj = get_device_list(Audio_Devices['capture']) + print "Testing arecord over HDMI .." + # Automatic detection of card,device number for HDMI interface + hdmi_hw_info = get_card_device_info_by_name(HDMI_Audio[board], fobj) + if hdmi_hw_info is None: + print "No HDMI device found !" + sys.exit(1) + return + arecord_cmd = "arecord -D " + hdmi_hw_info + " -c 2 -f S16_LE -d 10 -r 44100 aud44k16S.wav" + aplay_cmd = "aplay -D " + hdmi_hw_info + " aud44k16S.wav" + print "Started recording audio over HDMI for 10 seconds (replay follows).." + call(arecord_cmd, shell=True) + print "Replaying the recorded audio now .." + call(aplay_cmd, shell=True) + # Check dmesg to see if there is an error or I2C error + call("dmesg | tail | grep error", shell=True) + print "If you heard the recorded audio, test passed." + print "Note: Error, if any, shall be displayed above." + fobj.close() + +def mixer_panda(): + # silently setup mixer using -q + call("amixer sset Headset 10 -q", shell=True) + call("amixer sset 'Headset Left Playback' 'HS DAC' -q", shell=True) + call("amixer sset 'Headset Right Playback' 'HS DAC' -q", shell=True) + +def mixer_nop(): + pass # for unknown mixer settings + +MixerSetup = { + 'GenuineIntel': mixer_nop, + 'Panda': mixer_panda, + 'Beagle': mixer_nop, + 'i.MX53': mixer_nop, + 'i.MX6': mixer_nop, + 'ORIGEN': mixer_nop, + 'Snowball': mixer_nop +} + +def audio_tests(board): + MixerSetup[board]() + # minimal speaker test producing a sine wave tone. + speaker_test_audio_jack(board) + + # testing alsa with a stereo sound using aplay over jack + aplay_over_jack(board); + # Record a WAV stream using arecord and play it back over jack. + arecord_and_aplay_over_audio_jack(board) + + # speaker-test over HDMI + speaker_test_over_hdmi(board) # Need to test, dont have HDMI hw ! + # arecord and aplay over HDMI + arecord_and_aplay_over_hdmi(board) # Need to test, dont have HDMI hw ! + + +def check_sound_info(): + print + print "Running alsa-info.sh ..\n" + call("alsa-info.sh --stdout", shell=True) + print "************************************************\n" + +def main(): + cpuinfo = ["Beagle", "Panda", "i.MX6", "i.MX53", "ORIGEN", "Snowball", "GenuineIntel"] + long_options = ["check-info"] + runtest = "" + try: + opts, args = getopt.getopt(sys.argv[1:], "", long_options) + except getopt.GetoptError, err: + # print help information and exit + # will print something like "option -a not recognized" + sys.stderr.writelines(str(err)+"\n") + usage() + + call("aplay -l > aplay-l.log", shell=True) + call("arecord -l > arecord-l.log", shell=True) + + for opt, arg in opts: + if opt == '--check-info': + print "Checking Sound/Audio related info ..." + check_sound_info() + sys.exit(0) + else: + print "unhandled option:", opt + usage() + + cpufile = open("/proc/cpuinfo") + cputext = cpufile.readlines() + + for line in cputext: + for board in cpuinfo: + if board in line: + print "Hardware Detected: %s" % board + print "Running audiotests for %s .." % board + audio_tests(board) + sys.exit(0) + + print "Err, looks like your hardware is not supported." + print "Please report to harsh.bora@linaro.org" + sys.exit(1) + +if __name__ == "__main__": + main() diff --git a/login.wav b/login.wav new file mode 100644 index 0000000..ec06433 Binary files /dev/null and b/login.wav differ
Cool, does this replace the existing e2daudiotest I guess? Also, has it already been shown to work on all of the listed board?
On Tue, May 15, 2012 at 9:00 AM, Harsh Prateek Bora harsh.bora@linaro.orgwrote:
AudiVal (Audio Validation Suite for Linux)
This is an attempt to automate and integrate various audio related tests which can help validate audio on various boards supported by Linaro. Motivation for this project comes from various audio tests listed at: https://wiki.linaro.org/TomGall/LinaroAudioFeatureIndex
The git repo for this project can be cloned from: git://git.linaro.org/people/harshbora/audival.git
Various files required by this script are available in the git repo.
Requesting all to test this script on various boards that you may have access to and share feedback to make it better.
TODO: Add tests for Audio over USB, Bluetooth.
Signed-off-by: Harsh Prateek Bora harsh.bora@linaro.org
diff --git a/AudiVal.py b/AudiVal.py new file mode 100755 index 0000000..7d56c4e --- /dev/null +++ b/AudiVal.py @@ -0,0 +1,247 @@ +#!/usr/bin/env python +# +# Audival : Audio Validation Suite for Linux. +# +# Author: Harsh Prateek Bora +# harsh.bora@linaro.org +# harsh@linux.vnet.ibm.com
+import os +import sys +import getopt +from subprocess import * # for calling external programs +import commands # deprecated since python 2.6, Python 3.0 uses subprocess
+def usage():
- print "========================================="
- print "AudiVal: Audio Validation Suite for Linux"
- print "========================================="
- print "Usage:"
- print sys.argv[0], "[--check-info]"
- print "Supported HW: PandaBoard (ES), BeagleBoard (XM), i.MX53,
i.MX6, Origen, Snowball"
- sys.exit(1)
+SpeakerJack = {
- 'GenuineIntel': 'Analog',
- 'Panda': 'Headset',
- 'Beagle': 'TWL4030',
- 'i.MX53': 'HiFi',
- 'i.MX6': 'HiFi',
- 'ORIGEN': 'Pri_Dai',
- 'Snowball': 'Headset'
+}
+MicJack = {
- 'GenuineIntel': 'Analog',
- 'Panda': 'Headset', # not sure though, arecord doesnt work
for me!
- 'Beagle': 'TWL4030',
- 'i.MX53': 'HiFi',
- 'i.MX6': 'HiFi',
- 'ORIGEN': 'Pri_Dai',
- 'Snowball': 'Headset'
+}
+# As and when HDMI out/in device string differs, we'll need 2 dictionaries. +HDMI_Audio = {
- 'GenuineIntel': 'HDMI',
- 'Panda': 'HDMI',
- 'Beagle': 'HDMI',
- 'i.MX53': 'HDMI',
- 'i.MX6': 'HDMI', # audio out only supported, audio in not
supported.
- 'ORIGEN': 'HDMI',
- 'Snowball': 'hdmi' # odd one, lowercase
+}
+Audio_Devices = {
- 'playback': 'aplay-l.log',
- 'capture': 'arecord-l.log'
+}
+def get_device_list(logfile):
- fobj = open(logfile)
- return fobj
+def get_card_device_info_by_name(devicestr, fobj):
- """Helper routine to get card, device number by interface name"""
- optxt = fobj.readlines()
- card = ""
- device = ""
- for line in optxt:
if devicestr in line:
cardtext, colon, text = line.partition(':')
pre, sep, card = cardtext.partition(' ')
devtext, colon, text = text.partition(':')
pre, sep, device = devtext.partition('device ')
break
- hwstr = 'plughw:' + card + ',' + device
- if card is "" and device is "":
return None
- return hwstr
+def speaker_test_audio_jack(board):
- fobj = get_device_list(Audio_Devices['playback'])
- print "speaker-test over audio jack .."
- headset_jack_id = get_card_device_info_by_name(SpeakerJack[board],
fobj)
- fobj.close()
- if headset_jack_id is None:
print "No Audio Jack found !"
return
- call("date > speaker-test-jack.log", shell=True)
- cmdstr = "speaker-test -D " + headset_jack_id + " -t s -c 2 -l 1 >
speaker-test-jack.log 2>&1"
- call(cmdstr, shell=True)
- print "If you heard beeps from left and right speaker, test passed."
+def aplay_over_jack(board):
- fobj = get_device_list(Audio_Devices['playback'])
- headset_jack_id = get_card_device_info_by_name(SpeakerJack[board],
fobj)
- print "Testing aplay over audio jack .."
- fobj.close()
- if headset_jack_id is None:
print "No Audio Jack found !"
return
- cmdstr = "aplay login.wav -D " + headset_jack_id
- call(cmdstr, shell=True)
- print "If you heard a stereo sound, test passed."
- # Check dmesg to see if there is an error or I2C error
- call("dmesg | tail | grep error", shell=True)
- print "Note: Error, if any, shall be displayed above."
+def arecord_and_aplay_over_audio_jack(board):
- # Record the WAV stream and play it back.
- fobj = get_device_list(Audio_Devices['capture'])
- mic_jack_id = get_card_device_info_by_name(MicJack[board], fobj)
- if mic_jack_id is None:
print "No Mic Jack found !"
return
- cmdstr = "arecord -c 2 -f S16_LE -d 10 -r 44100 aud44k16S.wav -D " +
mic_jack_id
- print "Testing arecord over audio jack .."
- print "Started recording audio over jack for 10 seconds (replay
follows) .."
- call(cmdstr, shell=True)
- print "Replaying the recorded audio now .."
- call("aplay aud44k16S.wav", shell=True)
- # Check dmesg to see if there is an error or I2C error
- call("dmesg | tail | grep error", shell=True)
- print "If you heard the recorded audio, test passed."
- print "Note: Error, if any, shall be displayed above."
- fobj.close()
+def speaker_test_over_hdmi(board):
- """ speaker-test over HDMI audio interface. """
- fobj = get_device_list(Audio_Devices['playback'])
- print "Running speaker-test over HDMI .."
- # Automatic detection of card,device number for HDMI interface
- hdmi_hw_id = get_card_device_info_by_name(HDMI_Audio[board], fobj)
- if hdmi_hw_id is None:
print "No HDMI device found !"
return
- cmdstr = "speaker-test -D " + hdmi_hw_id + " -t s -c 2 -l 1 >
speaker-test-hdmi.log 2>&1"
- print "speaker-test over HDMI .."
- call(cmdstr, shell=True)
- print "If you heard beeps from left and right speaker, test passed."
- fobj.close()
+def arecord_and_aplay_over_hdmi(board):
- """ arecord and aplay over HDMI audio interface. """
- fobj = get_device_list(Audio_Devices['capture'])
- print "Testing arecord over HDMI .."
- # Automatic detection of card,device number for HDMI interface
- hdmi_hw_info = get_card_device_info_by_name(HDMI_Audio[board], fobj)
- if hdmi_hw_info is None:
print "No HDMI device found !"
sys.exit(1)
return
- arecord_cmd = "arecord -D " + hdmi_hw_info + " -c 2 -f S16_LE -d 10
-r 44100 aud44k16S.wav"
- aplay_cmd = "aplay -D " + hdmi_hw_info + " aud44k16S.wav"
- print "Started recording audio over HDMI for 10 seconds (replay
follows).."
- call(arecord_cmd, shell=True)
- print "Replaying the recorded audio now .."
- call(aplay_cmd, shell=True)
- # Check dmesg to see if there is an error or I2C error
- call("dmesg | tail | grep error", shell=True)
- print "If you heard the recorded audio, test passed."
- print "Note: Error, if any, shall be displayed above."
- fobj.close()
+def mixer_panda():
- # silently setup mixer using -q
- call("amixer sset Headset 10 -q", shell=True)
- call("amixer sset 'Headset Left Playback' 'HS DAC' -q", shell=True)
- call("amixer sset 'Headset Right Playback' 'HS DAC' -q", shell=True)
+def mixer_nop():
- pass # for unknown mixer settings
+MixerSetup = {
- 'GenuineIntel': mixer_nop,
- 'Panda': mixer_panda,
- 'Beagle': mixer_nop,
- 'i.MX53': mixer_nop,
- 'i.MX6': mixer_nop,
- 'ORIGEN': mixer_nop,
- 'Snowball': mixer_nop
+}
+def audio_tests(board):
- MixerSetup[board]()
- # minimal speaker test producing a sine wave tone.
- speaker_test_audio_jack(board)
- # testing alsa with a stereo sound using aplay over jack
- aplay_over_jack(board);
- # Record a WAV stream using arecord and play it back over jack.
- arecord_and_aplay_over_audio_jack(board)
- # speaker-test over HDMI
- speaker_test_over_hdmi(board) # Need to test, dont have HDMI hw !
- # arecord and aplay over HDMI
- arecord_and_aplay_over_hdmi(board) # Need to test, dont have HDMI hw !
+def check_sound_info():
- print "Running alsa-info.sh ..\n"
- call("alsa-info.sh --stdout", shell=True)
- print "************************************************\n"
+def main():
- cpuinfo = ["Beagle", "Panda", "i.MX6", "i.MX53", "ORIGEN",
"Snowball", "GenuineIntel"]
- long_options = ["check-info"]
- runtest = ""
- try:
opts, args = getopt.getopt(sys.argv[1:], "", long_options)
- except getopt.GetoptError, err:
# print help information and exit
# will print something like "option -a not recognized"
sys.stderr.writelines(str(err)+"\n")
usage()
- call("aplay -l > aplay-l.log", shell=True)
- call("arecord -l > arecord-l.log", shell=True)
- for opt, arg in opts:
if opt == '--check-info':
print "Checking Sound/Audio related info ..."
check_sound_info()
sys.exit(0)
else:
print "unhandled option:", opt
usage()
- cpufile = open("/proc/cpuinfo")
- cputext = cpufile.readlines()
- for line in cputext:
for board in cpuinfo:
if board in line:
print "Hardware Detected: %s" % board
print "Running audiotests for %s .." % board
audio_tests(board)
sys.exit(0)
- print "Err, looks like your hardware is not supported."
- print "Please report to harsh.bora@linaro.org"
- sys.exit(1)
+if __name__ == "__main__":
- main()
diff --git a/login.wav b/login.wav new file mode 100644 index 0000000..ec06433 Binary files /dev/null and b/login.wav differ
linaro-dev mailing list linaro-dev@lists.linaro.org http://lists.linaro.org/mailman/listinfo/linaro-dev
HI Paul,
On Tue, May 15, 2012 at 4:14 PM, Paul Larson paul.larson@linaro.org wrote:
Cool, does this replace the existing e2daudiotest I guess?
Please consider it as complementary.
Also, has it already been shown to work on all of the listed board?
Yes but that's not to say there aren't issues here and there for a variety of reasons!
Regards, Tom
On Tue, May 15, 2012 at 9:00 AM, Harsh Prateek Bora harsh.bora@linaro.org wrote:
AudiVal (Audio Validation Suite for Linux)
This is an attempt to automate and integrate various audio related tests which can help validate audio on various boards supported by Linaro. Motivation for this project comes from various audio tests listed at: https://wiki.linaro.org/TomGall/LinaroAudioFeatureIndex
The git repo for this project can be cloned from: git://git.linaro.org/people/harshbora/audival.git
Various files required by this script are available in the git repo.
Requesting all to test this script on various boards that you may have access to and share feedback to make it better.
TODO: Add tests for Audio over USB, Bluetooth.
Signed-off-by: Harsh Prateek Bora harsh.bora@linaro.org
diff --git a/AudiVal.py b/AudiVal.py new file mode 100755 index 0000000..7d56c4e --- /dev/null +++ b/AudiVal.py @@ -0,0 +1,247 @@ +#!/usr/bin/env python +# +# Audival : Audio Validation Suite for Linux. +# +# Author: Harsh Prateek Bora +# harsh.bora@linaro.org +# harsh@linux.vnet.ibm.com
+import os +import sys +import getopt +from subprocess import * # for calling external programs +import commands # deprecated since python 2.6, Python 3.0 uses subprocess
+def usage():
- print "========================================="
- print "AudiVal: Audio Validation Suite for Linux"
- print "========================================="
- print "Usage:"
- print sys.argv[0], "[--check-info]"
- print "Supported HW: PandaBoard (ES), BeagleBoard (XM), i.MX53,
i.MX6, Origen, Snowball"
- sys.exit(1)
+SpeakerJack = {
- 'GenuineIntel': 'Analog',
- 'Panda': 'Headset',
- 'Beagle': 'TWL4030',
- 'i.MX53': 'HiFi',
- 'i.MX6': 'HiFi',
- 'ORIGEN': 'Pri_Dai',
- 'Snowball': 'Headset'
+}
+MicJack = {
- 'GenuineIntel': 'Analog',
- 'Panda': 'Headset', # not sure though, arecord doesnt work
for me!
- 'Beagle': 'TWL4030',
- 'i.MX53': 'HiFi',
- 'i.MX6': 'HiFi',
- 'ORIGEN': 'Pri_Dai',
- 'Snowball': 'Headset'
+}
+# As and when HDMI out/in device string differs, we'll need 2 dictionaries. +HDMI_Audio = {
- 'GenuineIntel': 'HDMI',
- 'Panda': 'HDMI',
- 'Beagle': 'HDMI',
- 'i.MX53': 'HDMI',
- 'i.MX6': 'HDMI', # audio out only supported, audio in not
supported.
- 'ORIGEN': 'HDMI',
- 'Snowball': 'hdmi' # odd one, lowercase
+}
+Audio_Devices = {
- 'playback': 'aplay-l.log',
- 'capture': 'arecord-l.log'
+}
+def get_device_list(logfile):
- fobj = open(logfile)
- return fobj
+def get_card_device_info_by_name(devicestr, fobj):
- """Helper routine to get card, device number by interface name"""
- optxt = fobj.readlines()
- card = ""
- device = ""
- for line in optxt:
- if devicestr in line:
- cardtext, colon, text = line.partition(':')
- pre, sep, card = cardtext.partition(' ')
- devtext, colon, text = text.partition(':')
- pre, sep, device = devtext.partition('device ')
- break
- hwstr = 'plughw:' + card + ',' + device
- if card is "" and device is "":
- return None
- return hwstr
+def speaker_test_audio_jack(board):
- fobj = get_device_list(Audio_Devices['playback'])
- print "speaker-test over audio jack .."
- headset_jack_id = get_card_device_info_by_name(SpeakerJack[board],
fobj)
- fobj.close()
- if headset_jack_id is None:
- print "No Audio Jack found !"
- return
- call("date > speaker-test-jack.log", shell=True)
- cmdstr = "speaker-test -D " + headset_jack_id + " -t s -c 2 -l 1 >
speaker-test-jack.log 2>&1"
- call(cmdstr, shell=True)
- print "If you heard beeps from left and right speaker, test passed."
+def aplay_over_jack(board):
- fobj = get_device_list(Audio_Devices['playback'])
- headset_jack_id = get_card_device_info_by_name(SpeakerJack[board],
fobj)
- print "Testing aplay over audio jack .."
- fobj.close()
- if headset_jack_id is None:
- print "No Audio Jack found !"
- return
- cmdstr = "aplay login.wav -D " + headset_jack_id
- call(cmdstr, shell=True)
- print "If you heard a stereo sound, test passed."
- # Check dmesg to see if there is an error or I2C error
- call("dmesg | tail | grep error", shell=True)
- print "Note: Error, if any, shall be displayed above."
+def arecord_and_aplay_over_audio_jack(board):
- # Record the WAV stream and play it back.
- fobj = get_device_list(Audio_Devices['capture'])
- mic_jack_id = get_card_device_info_by_name(MicJack[board], fobj)
- if mic_jack_id is None:
- print "No Mic Jack found !"
- return
- cmdstr = "arecord -c 2 -f S16_LE -d 10 -r 44100 aud44k16S.wav -D " +
mic_jack_id
- print "Testing arecord over audio jack .."
- print "Started recording audio over jack for 10 seconds (replay
follows) .."
- call(cmdstr, shell=True)
- print "Replaying the recorded audio now .."
- call("aplay aud44k16S.wav", shell=True)
- # Check dmesg to see if there is an error or I2C error
- call("dmesg | tail | grep error", shell=True)
- print "If you heard the recorded audio, test passed."
- print "Note: Error, if any, shall be displayed above."
- fobj.close()
+def speaker_test_over_hdmi(board):
- """ speaker-test over HDMI audio interface. """
- fobj = get_device_list(Audio_Devices['playback'])
- print "Running speaker-test over HDMI .."
- # Automatic detection of card,device number for HDMI interface
- hdmi_hw_id = get_card_device_info_by_name(HDMI_Audio[board], fobj)
- if hdmi_hw_id is None:
- print "No HDMI device found !"
- return
- cmdstr = "speaker-test -D " + hdmi_hw_id + " -t s -c 2 -l 1 >
speaker-test-hdmi.log 2>&1"
- print "speaker-test over HDMI .."
- call(cmdstr, shell=True)
- print "If you heard beeps from left and right speaker, test passed."
- fobj.close()
+def arecord_and_aplay_over_hdmi(board):
- """ arecord and aplay over HDMI audio interface. """
- fobj = get_device_list(Audio_Devices['capture'])
- print "Testing arecord over HDMI .."
- # Automatic detection of card,device number for HDMI interface
- hdmi_hw_info = get_card_device_info_by_name(HDMI_Audio[board], fobj)
- if hdmi_hw_info is None:
- print "No HDMI device found !"
- sys.exit(1)
- return
- arecord_cmd = "arecord -D " + hdmi_hw_info + " -c 2 -f S16_LE -d 10
-r 44100 aud44k16S.wav"
- aplay_cmd = "aplay -D " + hdmi_hw_info + " aud44k16S.wav"
- print "Started recording audio over HDMI for 10 seconds (replay
follows).."
- call(arecord_cmd, shell=True)
- print "Replaying the recorded audio now .."
- call(aplay_cmd, shell=True)
- # Check dmesg to see if there is an error or I2C error
- call("dmesg | tail | grep error", shell=True)
- print "If you heard the recorded audio, test passed."
- print "Note: Error, if any, shall be displayed above."
- fobj.close()
+def mixer_panda():
- # silently setup mixer using -q
- call("amixer sset Headset 10 -q", shell=True)
- call("amixer sset 'Headset Left Playback' 'HS DAC' -q", shell=True)
- call("amixer sset 'Headset Right Playback' 'HS DAC' -q", shell=True)
+def mixer_nop():
- pass # for unknown mixer settings
+MixerSetup = {
- 'GenuineIntel': mixer_nop,
- 'Panda': mixer_panda,
- 'Beagle': mixer_nop,
- 'i.MX53': mixer_nop,
- 'i.MX6': mixer_nop,
- 'ORIGEN': mixer_nop,
- 'Snowball': mixer_nop
+}
+def audio_tests(board):
- MixerSetup[board]()
- # minimal speaker test producing a sine wave tone.
- speaker_test_audio_jack(board)
- # testing alsa with a stereo sound using aplay over jack
- aplay_over_jack(board);
- # Record a WAV stream using arecord and play it back over jack.
- arecord_and_aplay_over_audio_jack(board)
- # speaker-test over HDMI
- speaker_test_over_hdmi(board) # Need to test, dont have HDMI hw !
- # arecord and aplay over HDMI
- arecord_and_aplay_over_hdmi(board) # Need to test, dont have HDMI hw
!
+def check_sound_info():
- print "Running alsa-info.sh ..\n"
- call("alsa-info.sh --stdout", shell=True)
- print "************************************************\n"
+def main():
- cpuinfo = ["Beagle", "Panda", "i.MX6", "i.MX53", "ORIGEN",
"Snowball", "GenuineIntel"]
- long_options = ["check-info"]
- runtest = ""
- try:
- opts, args = getopt.getopt(sys.argv[1:], "", long_options)
- except getopt.GetoptError, err:
- # print help information and exit
- # will print something like "option -a not recognized"
- sys.stderr.writelines(str(err)+"\n")
- usage()
- call("aplay -l > aplay-l.log", shell=True)
- call("arecord -l > arecord-l.log", shell=True)
- for opt, arg in opts:
- if opt == '--check-info':
- print "Checking Sound/Audio related info ..."
- check_sound_info()
- sys.exit(0)
- else:
- print "unhandled option:", opt
- usage()
- cpufile = open("/proc/cpuinfo")
- cputext = cpufile.readlines()
- for line in cputext:
- for board in cpuinfo:
- if board in line:
- print "Hardware Detected: %s" % board
- print "Running audiotests for %s .." % board
- audio_tests(board)
- sys.exit(0)
- print "Err, looks like your hardware is not supported."
- print "Please report to harsh.bora@linaro.org"
- sys.exit(1)
+if __name__ == "__main__":
- main()
diff --git a/login.wav b/login.wav new file mode 100644 index 0000000..ec06433 Binary files /dev/null and b/login.wav differ
linaro-dev mailing list linaro-dev@lists.linaro.org http://lists.linaro.org/mailman/listinfo/linaro-dev
linaro-dev mailing list linaro-dev@lists.linaro.org http://lists.linaro.org/mailman/listinfo/linaro-dev
On Tue, May 15, 2012 at 4:24 PM, Tom Gall tom.gall@linaro.org wrote:
HI Paul,
On Tue, May 15, 2012 at 4:14 PM, Paul Larson paul.larson@linaro.org wrote:
Cool, does this replace the existing e2daudiotest I guess?
Please consider it as complementary.
Ah, I see after looking at it a bit more. This one isn't completely
automated and requires someone to listen to the sound :)
On 16 May 2012 09:38, Paul Larson paul.larson@linaro.org wrote:
On Tue, May 15, 2012 at 4:24 PM, Tom Gall tom.gall@linaro.org wrote:
HI Paul,
On Tue, May 15, 2012 at 4:14 PM, Paul Larson paul.larson@linaro.org wrote:
Cool, does this replace the existing e2daudiotest I guess?
Please consider it as complementary.
Ah, I see after looking at it a bit more. This one isn't completely
automated and requires someone to listen to the sound :)
Yes, Its the initial phase and therefore will evolve with time as required. We may want to plug-in e2eaudiotest and others if already available. As of now, it frees the user from finding out the card, device info for each audio playback/recording device on supported hardware and can help in identify issues where audio is almost ok, but not truly perfect (like choppy audio). Un-attended tests may treat imperfect audio as bad as no audio. I hope I am able to convey what I intend to do so.
thanks, Harsh
On Wed, May 16, 2012 at 1:43 AM, Harsh Prateek Bora harsh.bora@linaro.orgwrote:
On 16 May 2012 09:38, Paul Larson paul.larson@linaro.org wrote:
On Tue, May 15, 2012 at 4:24 PM, Tom Gall tom.gall@linaro.org wrote:
HI Paul,
On Tue, May 15, 2012 at 4:14 PM, Paul Larson paul.larson@linaro.org wrote:
Cool, does this replace the existing e2daudiotest I guess?
Please consider it as complementary.
Ah, I see after looking at it a bit more. This one isn't completely
automated and requires someone to listen to the sound :)
Yes, Its the initial phase and therefore will evolve with time as required. We may want to plug-in e2eaudiotest and others if already available. As of now, it frees the user from finding out the card, device info for each audio playback/recording device on supported hardware and can help in identify issues where audio is almost ok, but not truly perfect (like choppy audio). Un-attended tests may treat imperfect audio as bad as no audio. I hope I am able to convey what I intend to do so.
Ah, so if e2eaudiotest is plugged into it, it could act as a sort of
front-end for running it and making sure that the right audio device is set up for that particular board? So in this way, it could allow for automated tests, not just interactive ones?
Thanks, Paul Larson
On 17 May 2012 01:35, Paul Larson paul.larson@linaro.org wrote:
On Wed, May 16, 2012 at 1:43 AM, Harsh Prateek Bora <harsh.bora@linaro.org
wrote:
On 16 May 2012 09:38, Paul Larson paul.larson@linaro.org wrote:
On Tue, May 15, 2012 at 4:24 PM, Tom Gall tom.gall@linaro.org wrote:
HI Paul,
On Tue, May 15, 2012 at 4:14 PM, Paul Larson paul.larson@linaro.org wrote:
Cool, does this replace the existing e2daudiotest I guess?
Please consider it as complementary.
Ah, I see after looking at it a bit more. This one isn't completely
automated and requires someone to listen to the sound :)
Yes, Its the initial phase and therefore will evolve with time as required. We may want to plug-in e2eaudiotest and others if already available. As of now, it frees the user from finding out the card, device info for each audio playback/recording device on supported hardware and can help in identify issues where audio is almost ok, but not truly perfect (like choppy audio). Un-attended tests may treat imperfect audio as bad as no audio. I hope I am able to convey what I intend to do so.
Ah, so if e2eaudiotest is plugged into it, it could act as a sort of
front-end for running it and making sure that the right audio device is set up for that particular board? So in this way, it could allow for automated tests, not just interactive ones?
Yes, we can add more as well !
regards, Harsh
Thanks, Paul Larson
On 17 May 2012 00:12, Harsh Prateek Bora harsh.bora@linaro.org wrote:
On 17 May 2012 01:35, Paul Larson paul.larson@linaro.org wrote:
On Wed, May 16, 2012 at 1:43 AM, Harsh Prateek Bora < harsh.bora@linaro.org> wrote:
On 16 May 2012 09:38, Paul Larson paul.larson@linaro.org wrote:
On Tue, May 15, 2012 at 4:24 PM, Tom Gall tom.gall@linaro.org wrote:
HI Paul,
On Tue, May 15, 2012 at 4:14 PM, Paul Larson paul.larson@linaro.org wrote:
Cool, does this replace the existing e2daudiotest I guess?
Please consider it as complementary.
Ah, I see after looking at it a bit more. This one isn't completely
automated and requires someone to listen to the sound :)
Yes, Its the initial phase and therefore will evolve with time as required. We may want to plug-in e2eaudiotest and others if already available. As of now, it frees the user from finding out the card, device info for each audio playback/recording device on supported hardware and can help in identify issues where audio is almost ok, but not truly perfect (like choppy audio). Un-attended tests may treat imperfect audio as bad as no audio. I hope I am able to convey what I intend to do so.
Ah, so if e2eaudiotest is plugged into it, it could act as a sort of
front-end for running it and making sure that the right audio device is set up for that particular board? So in this way, it could allow for automated tests, not just interactive ones?
The tests in question are really for different audiences. The e2eaudiotest tool was designed to be in a fully automated environment as a build sniff test that does not require a human to see if the entire audio stack on a particular board/build works "good enough" using a default path.
The test script is to provide an interactive umbrella tool for the developer to exhaustively test the stack before upstreaming. This can include the former tool, but doesn't need to.
Yes, we can add more as well !
regards, Harsh
Thanks, Paul Larson
On 16 May 2012 02:44, Paul Larson paul.larson@linaro.org wrote:
Cool, does this replace the existing e2daudiotest I guess?
This script can serve as a unified interface to various audio tests that we are developing. Kurt (adding in CC) has suggested to plug-in e2eaudiotest into this as well.
Also, has it already been shown to work on all of the listed board?
It has been tested on Panda, imx6, Origen as of now, and the script works as expected. However, the tests obviously fail where audio recording is not supported by underlying kernel.
On Tue, May 15, 2012 at 9:00 AM, Harsh Prateek Bora <harsh.bora@linaro.org
wrote:
AudiVal (Audio Validation Suite for Linux)
This is an attempt to automate and integrate various audio related tests which can help validate audio on various boards supported by Linaro. Motivation for this project comes from various audio tests listed at: https://wiki.linaro.org/TomGall/LinaroAudioFeatureIndex
The git repo for this project can be cloned from: git://git.linaro.org/people/harshbora/audival.git
Various files required by this script are available in the git repo.
Requesting all to test this script on various boards that you may have access to and share feedback to make it better.
TODO: Add tests for Audio over USB, Bluetooth.
Signed-off-by: Harsh Prateek Bora harsh.bora@linaro.org
diff --git a/AudiVal.py b/AudiVal.py new file mode 100755 index 0000000..7d56c4e --- /dev/null +++ b/AudiVal.py @@ -0,0 +1,247 @@ +#!/usr/bin/env python +# +# Audival : Audio Validation Suite for Linux. +# +# Author: Harsh Prateek Bora +# harsh.bora@linaro.org +# harsh@linux.vnet.ibm.com
+import os +import sys +import getopt +from subprocess import * # for calling external programs +import commands # deprecated since python 2.6, Python 3.0 uses subprocess
+def usage():
- print "========================================="
- print "AudiVal: Audio Validation Suite for Linux"
- print "========================================="
- print "Usage:"
- print sys.argv[0], "[--check-info]"
- print "Supported HW: PandaBoard (ES), BeagleBoard (XM), i.MX53,
i.MX6, Origen, Snowball"
- sys.exit(1)
+SpeakerJack = {
- 'GenuineIntel': 'Analog',
- 'Panda': 'Headset',
- 'Beagle': 'TWL4030',
- 'i.MX53': 'HiFi',
- 'i.MX6': 'HiFi',
- 'ORIGEN': 'Pri_Dai',
- 'Snowball': 'Headset'
+}
+MicJack = {
- 'GenuineIntel': 'Analog',
- 'Panda': 'Headset', # not sure though, arecord doesnt
work for me!
- 'Beagle': 'TWL4030',
- 'i.MX53': 'HiFi',
- 'i.MX6': 'HiFi',
- 'ORIGEN': 'Pri_Dai',
- 'Snowball': 'Headset'
+}
+# As and when HDMI out/in device string differs, we'll need 2 dictionaries. +HDMI_Audio = {
- 'GenuineIntel': 'HDMI',
- 'Panda': 'HDMI',
- 'Beagle': 'HDMI',
- 'i.MX53': 'HDMI',
- 'i.MX6': 'HDMI', # audio out only supported, audio in not
supported.
- 'ORIGEN': 'HDMI',
- 'Snowball': 'hdmi' # odd one, lowercase
+}
+Audio_Devices = {
- 'playback': 'aplay-l.log',
- 'capture': 'arecord-l.log'
+}
+def get_device_list(logfile):
- fobj = open(logfile)
- return fobj
+def get_card_device_info_by_name(devicestr, fobj):
- """Helper routine to get card, device number by interface name"""
- optxt = fobj.readlines()
- card = ""
- device = ""
- for line in optxt:
if devicestr in line:
cardtext, colon, text = line.partition(':')
pre, sep, card = cardtext.partition(' ')
devtext, colon, text = text.partition(':')
pre, sep, device = devtext.partition('device ')
break
- hwstr = 'plughw:' + card + ',' + device
- if card is "" and device is "":
return None
- return hwstr
+def speaker_test_audio_jack(board):
- fobj = get_device_list(Audio_Devices['playback'])
- print "speaker-test over audio jack .."
- headset_jack_id = get_card_device_info_by_name(SpeakerJack[board],
fobj)
- fobj.close()
- if headset_jack_id is None:
print "No Audio Jack found !"
return
- call("date > speaker-test-jack.log", shell=True)
- cmdstr = "speaker-test -D " + headset_jack_id + " -t s -c 2 -l 1 >
speaker-test-jack.log 2>&1"
- call(cmdstr, shell=True)
- print "If you heard beeps from left and right speaker, test passed."
+def aplay_over_jack(board):
- fobj = get_device_list(Audio_Devices['playback'])
- headset_jack_id = get_card_device_info_by_name(SpeakerJack[board],
fobj)
- print "Testing aplay over audio jack .."
- fobj.close()
- if headset_jack_id is None:
print "No Audio Jack found !"
return
- cmdstr = "aplay login.wav -D " + headset_jack_id
- call(cmdstr, shell=True)
- print "If you heard a stereo sound, test passed."
- # Check dmesg to see if there is an error or I2C error
- call("dmesg | tail | grep error", shell=True)
- print "Note: Error, if any, shall be displayed above."
+def arecord_and_aplay_over_audio_jack(board):
- # Record the WAV stream and play it back.
- fobj = get_device_list(Audio_Devices['capture'])
- mic_jack_id = get_card_device_info_by_name(MicJack[board], fobj)
- if mic_jack_id is None:
print "No Mic Jack found !"
return
- cmdstr = "arecord -c 2 -f S16_LE -d 10 -r 44100 aud44k16S.wav -D " +
mic_jack_id
- print "Testing arecord over audio jack .."
- print "Started recording audio over jack for 10 seconds (replay
follows) .."
- call(cmdstr, shell=True)
- print "Replaying the recorded audio now .."
- call("aplay aud44k16S.wav", shell=True)
- # Check dmesg to see if there is an error or I2C error
- call("dmesg | tail | grep error", shell=True)
- print "If you heard the recorded audio, test passed."
- print "Note: Error, if any, shall be displayed above."
- fobj.close()
+def speaker_test_over_hdmi(board):
- """ speaker-test over HDMI audio interface. """
- fobj = get_device_list(Audio_Devices['playback'])
- print "Running speaker-test over HDMI .."
- # Automatic detection of card,device number for HDMI interface
- hdmi_hw_id = get_card_device_info_by_name(HDMI_Audio[board], fobj)
- if hdmi_hw_id is None:
print "No HDMI device found !"
return
- cmdstr = "speaker-test -D " + hdmi_hw_id + " -t s -c 2 -l 1 >
speaker-test-hdmi.log 2>&1"
- print "speaker-test over HDMI .."
- call(cmdstr, shell=True)
- print "If you heard beeps from left and right speaker, test passed."
- fobj.close()
+def arecord_and_aplay_over_hdmi(board):
- """ arecord and aplay over HDMI audio interface. """
- fobj = get_device_list(Audio_Devices['capture'])
- print "Testing arecord over HDMI .."
- # Automatic detection of card,device number for HDMI interface
- hdmi_hw_info = get_card_device_info_by_name(HDMI_Audio[board], fobj)
- if hdmi_hw_info is None:
print "No HDMI device found !"
sys.exit(1)
return
- arecord_cmd = "arecord -D " + hdmi_hw_info + " -c 2 -f S16_LE -d 10
-r 44100 aud44k16S.wav"
- aplay_cmd = "aplay -D " + hdmi_hw_info + " aud44k16S.wav"
- print "Started recording audio over HDMI for 10 seconds (replay
follows).."
- call(arecord_cmd, shell=True)
- print "Replaying the recorded audio now .."
- call(aplay_cmd, shell=True)
- # Check dmesg to see if there is an error or I2C error
- call("dmesg | tail | grep error", shell=True)
- print "If you heard the recorded audio, test passed."
- print "Note: Error, if any, shall be displayed above."
- fobj.close()
+def mixer_panda():
- # silently setup mixer using -q
- call("amixer sset Headset 10 -q", shell=True)
- call("amixer sset 'Headset Left Playback' 'HS DAC' -q", shell=True)
- call("amixer sset 'Headset Right Playback' 'HS DAC' -q", shell=True)
+def mixer_nop():
- pass # for unknown mixer settings
+MixerSetup = {
- 'GenuineIntel': mixer_nop,
- 'Panda': mixer_panda,
- 'Beagle': mixer_nop,
- 'i.MX53': mixer_nop,
- 'i.MX6': mixer_nop,
- 'ORIGEN': mixer_nop,
- 'Snowball': mixer_nop
+}
+def audio_tests(board):
- MixerSetup[board]()
- # minimal speaker test producing a sine wave tone.
- speaker_test_audio_jack(board)
- # testing alsa with a stereo sound using aplay over jack
- aplay_over_jack(board);
- # Record a WAV stream using arecord and play it back over jack.
- arecord_and_aplay_over_audio_jack(board)
- # speaker-test over HDMI
- speaker_test_over_hdmi(board) # Need to test, dont have HDMI hw !
- # arecord and aplay over HDMI
- arecord_and_aplay_over_hdmi(board) # Need to test, dont have HDMI hw
!
+def check_sound_info():
- print "Running alsa-info.sh ..\n"
- call("alsa-info.sh --stdout", shell=True)
- print "************************************************\n"
+def main():
- cpuinfo = ["Beagle", "Panda", "i.MX6", "i.MX53", "ORIGEN",
"Snowball", "GenuineIntel"]
- long_options = ["check-info"]
- runtest = ""
- try:
opts, args = getopt.getopt(sys.argv[1:], "", long_options)
- except getopt.GetoptError, err:
# print help information and exit
# will print something like "option -a not recognized"
sys.stderr.writelines(str(err)+"\n")
usage()
- call("aplay -l > aplay-l.log", shell=True)
- call("arecord -l > arecord-l.log", shell=True)
- for opt, arg in opts:
if opt == '--check-info':
print "Checking Sound/Audio related info ..."
check_sound_info()
sys.exit(0)
else:
print "unhandled option:", opt
usage()
- cpufile = open("/proc/cpuinfo")
- cputext = cpufile.readlines()
- for line in cputext:
for board in cpuinfo:
if board in line:
print "Hardware Detected: %s" % board
print "Running audiotests for %s .." % board
audio_tests(board)
sys.exit(0)
- print "Err, looks like your hardware is not supported."
- print "Please report to harsh.bora@linaro.org"
- sys.exit(1)
+if __name__ == "__main__":
- main()
diff --git a/login.wav b/login.wav new file mode 100644 index 0000000..ec06433 Binary files /dev/null and b/login.wav differ
linaro-dev mailing list linaro-dev@lists.linaro.org http://lists.linaro.org/mailman/listinfo/linaro-dev