FreeDATA/test
dj2ls ea133f054d moved simple test from pyaudio to sounddevice
thisis just a test as I'm not happy with the overall way we are dong tests. This has been great during first steps with the tnc ( virtual audio devices ) but now we should to a more reliable way with named pipes for example
2022-04-30 12:27:14 +02:00
..
001_highsnr_stdio_audio changed folder structure 2021-12-20 11:10:41 +01:00
002_highsnr_ping_pong changed folder structure 2021-12-20 11:10:41 +01:00
hamlib-test.py accessed static 2021-12-28 21:25:19 +01:00
in8.raw connection mode, documentation, ... 2022-03-04 16:50:32 +01:00
out8.raw connection mode, documentation, ... 2022-03-04 16:50:32 +01:00
out48.raw connection mode, documentation, ... 2022-03-04 16:50:32 +01:00
ping.py changed folder structure 2021-12-20 11:10:41 +01:00
pong.py changed folder structure 2021-12-20 11:10:41 +01:00
README.md updated readme 2022-01-12 07:32:09 +01:00
t48_8_short.py updated to new folder structure 2021-12-20 11:15:32 +01:00
test_arq_short.py fixed arq test 2022-01-12 07:42:37 +01:00
test_audiobuffer.py audio buffer thread sfaety test 2021-12-21 08:20:02 +10:30
test_callback_multimode_rx.py added stream.is_active excepotion 2021-12-21 10:39:07 +01:00
test_callback_multimode_rx_outside.py logging in own thread 2021-12-21 09:25:06 +01:00
test_callback_multimode_tx.py multimode callback TX 2021-12-22 11:19:43 +01:00
test_callback_rx.py reduced bytes_out buffer size factor *2 2021-12-20 15:57:32 +01:00
test_callback_rx_outside.py changed folder structure 2021-12-20 11:10:41 +01:00
test_callback_tx.py code cleanup 2021-12-22 11:19:27 +01:00
test_multimode_rx.py time meassurement for tests 2022-01-10 10:51:26 +01:00
test_multimode_tx.py Correcting some typos. 2022-04-10 13:20:58 -04:00
test_pa.py changed folder structure 2021-12-20 11:10:41 +01:00
test_rx.py moved simple test from pyaudio to sounddevice 2022-04-30 12:27:14 +02:00
test_tx.py moved simple test from pyaudio to sounddevice 2022-04-30 12:27:14 +02:00
test_virtual1.sh changed folder structure 2021-12-20 11:10:41 +01:00
test_virtual1a.sh changed folder structure 2021-12-20 11:10:41 +01:00
test_virtual1b.sh changed folder structure 2021-12-20 11:10:41 +01:00
test_virtual1c.sh changed folder structure 2021-12-20 11:10:41 +01:00
test_virtual2.sh changed folder structure 2021-12-20 11:10:41 +01:00
test_virtual3a.sh changed folder structure 2021-12-20 11:10:41 +01:00
test_virtual3b.sh changed folder structure 2021-12-20 11:10:41 +01:00
test_virtual4a.sh multimode callback tests 2021-12-20 12:15:35 +01:00
test_virtual4b.sh multimode callback tests 2021-12-20 12:15:35 +01:00
test_virtual_mm.sh changed folder structure 2021-12-20 11:10:41 +01:00

Instructions

  1. Install:
    cd FreeDATA
    mkdir build
    cd build
    cmake -DCODEC2_BUILD_DIR=$HOME/codec2/build_linux ..
    
  2. List available tests:
    ctest -N
    Test project /home/david/FreeDATA/build
    Test #1: 000_audio_tests
    Test #2: 001_highsnr_stdio_audio
    
    Total Tests: 2
    
  3. Run tests:
    ctest --output-on-failure
    
  4. Run tests verbosely:
    ctest -V
    

001_HIGHSNR_STDIO_AUDIO TEST SUITE

  1. Install
    sudo apt update
    sudo apt upgrade
    sudo apt install git cmake build-essential python3-pip portaudio19-dev python3-pyaudio
    pip3 install crcengine
    pip3 install threading
    
  2. Install codec2, and set up the libcodec2.so shared library path, for example
    export LD_LIBRARY_PATH=${HOME}/codec2/build_linux/src
    

STDIO tests

Pipes are used to move audio samples from the Tx to Rx:

python3 test_tx.py --mode datac1 --delay 500 --frames 2 --bursts 1 | python3 test_rx.py --mode datac1 --frames 2 --bursts 1

AUDIO test via virtual audio devices

Important:

The virtual audio devices are great for testing, but they are also a little bit tricky to handle. So there's a high chance, the tests will fail, if you are running them via virtual audio devices. You should run the tests several times, while keeping this in mind. Most time the ctest is working even if it is failing.

  1. Create virtual audio devices. Note: This command needs to be run again after every reboot

    sudo modprobe snd-aloop index=1,2 enable=1,1 pcm_substreams=1,1 id=CHAT1,CHAT2 
    
  2. Check if devices have been created

     aplay -l
    
     Karte 0: Intel [HDA Intel], Gerät 0: Generic Analog [Generic Analog]
       Sub-Geräte: 1/1
       Sub-Gerät #0: subdevice #0
     Karte 1: CHAT1 [Loopback], Gerät 0: Loopback PCM [Loopback PCM]
       Sub-Geräte: 1/1
       Sub-Gerät #0: subdevice #0
     Karte 1: CHAT1 [Loopback], Gerät 1: Loopback PCM [Loopback PCM]
       Sub-Geräte: 1/1
       Sub-Gerät #0: subdevice #0
     Karte 2: CHAT2 [Loopback], Gerät 0: Loopback PCM [Loopback PCM]
       Sub-Geräte: 1/1
       Sub-Gerät #0: subdevice #0
     Karte 2: CHAT2 [Loopback], Gerät 1: Loopback PCM [Loopback PCM]
       Sub-Geräte: 1/1
       Sub-Gerät #0: subdevice #0
    
  3. Determine the audio device number you would like to use:

    python3 test_rx.py --list
    <snip>
    audiodev:  0 HDA Intel PCH: ALC269VC Analog (hw:0,0)
    audiodev:  1 HDA Intel PCH: HDMI 0 (hw:0,3)
    audiodev:  2 HDA Intel PCH: HDMI 1 (hw:0,7)
    audiodev:  3 HDA Intel PCH: HDMI 2 (hw:0,8)
    audiodev:  4 Loopback: PCM (hw:1,0)
    audiodev:  5 Loopback: PCM (hw:1,1)
    audiodev:  6 Loopback: PCM (hw:2,0)
    audiodev:  7 Loopback: PCM (hw:2,1)
    

    In this case we choose audiodev 4 for the RX and 5 for the Tx.

  4. Start the Rx first, then Tx in separate consoles:

    python3 test_rx.py --mode datac0 --frames 2 --bursts 1 --audiodev 4 --debug
    python3 test_tx.py --mode datac0 --frames 2 --bursts 1 --audiodev 5