Rockchip · AI & Linux Hub

Affichage et audio

Rockchip RockAA Utilisations: tests audio en temps réel et hors ligne

Rockchip RockAA Utilisations: tests d'algorithme audio en temps réel et hors ligne — V1.0.0

Compléter le contenu chinois/anglais V1.0.0 sur RockAA Utilisation test et utilisation. La portée source indique toutes les séries/générales; pour ArmSoM, il s’agit d’une référence de plate-forme nécessitant une vérification de la carte SoC, SDK/BSP, des I/O audio, des périphériques ALSA et des versions/disponibilité de la bibliothèque d’algorithme. Les journaux de temps/de charge de la source ne sont pas des mesures ArmSoM. Aucune commande audio n’a été exécutée. Cette source n’a pas de chiffres techniques.

ArmSoM Docs · Rockchip Linux

1. Aperçu général {#1-overview}

1.1 RockAA Utilisations Fonction Introduction {#11-rockaa-utils-function-introduction}

RockAA (Rockchip Audio Algorithm) Les utilisations sont utilisées pour aider les clients à valider rapidement l’efficacité des algorithmes audio Rockchip sans se soucier du cadre médiatique. RockAA Utils s’inspire de la philosophie de conception de minusculecap et de minusculeplay, principalement composé des outils rockaa_capt et rockaa_play, qui permettent de vérifier dans différents scénarios d’utilisation à travers différents paramètres de commande. Ils dépendent tous de la bibliothèque commune librockaa.so. De plus, comme rockaa_capt est principalement utilisé pour les tests de conversation et rockaa_play est principalement utilisé pour les tests d’effets audio, les bibliothèques d’algorithmes audio dont elles dépendent diffèrent également, avec les relations de dépendance spécifiques comme suit:

rockaa_capt
├── librockaa.so            # Common library for RockAA tools
├── libaec_bf_process.so    # Acoustic Echo Cancellation algorithm library
└── librkaudio_common.so    # Common audio algorithm library

rockaa_play
├── librockaa.so            # Common library for RockAA tools
└── librkaudio_effect.so    # Audio effect algorithm library

2. Scénarios d’utilisation Introduction {#2-usage-scenarios-introduction}

Les principaux scénarios applicables incluent actuellement : Talk Playback Effect

2.1 Essai de discussion de fichiers hors ligne {#21-offline-file-talking-testing}

Avant de déboger l’algorithme audio, la plupart des développeurs recueilleront l’audio à l’avance sur un modèle produit en masse avec une certaine structure, utiliseront cet audio comme entrée de source sonore fixe, et ajusteront et optimiseront les paramètres de l’algorithme jusqu’à ce que la sortie réponde aux données audio attendues:

./rockaa_capt -I record.pcm -O out_talk.pcm -c 2 -C 1 -b 16 -r 16000 -Z 1 -F config_aivqe.json

Ce journal indique l’opération sous test de conversation via un processus de fichier hors ligne:

[tagI] Capture via offline file process, in_file: record.wav

Analysons l’utilisation de plusieurs paramètres clés

"-I" is the only parameter for switching between offline file mode and real-time
online mode. If this parameter is included, it indicates operation in offline
file mode, with the following "record.pcm" representing the pre-recorded audio
source from the device that is ready for processing.
"-O out_talk.pcm" indicates the name of the PCM output after the audio algorithm
has been applied, which is a single channel with a sample rate and bit width
consistent with the "-b 16 -r 16000" specified later. If not specified, a default
PCM file starting with "TALK" will be generated;
"-c 2" indicates the total number of channels, "-C 1" indicates the number of
channels for the remote reference signal, and the number of channels for the
local MIC is the difference between them, such as in this example: "2-1=1", which
is a single MIC pickup scenario;
"-b 16 -r 16000" indicates the two basic PCM formats in addition to the number of
channels, with a 16-bit depth and a 16kHz sampling rate;
"-Z 1" indicates summary debug mode, which will provide a one-time summary of the
frame count, as well as the minimum, maximum, and average time consumption and
load after the test is completed:
[tagI] == frames:63, period_time:16000us, cost_time min:657us max:1375us
avg:793us, load min:4.11% max:8.59% avg:4.96% ==
"-Z 0" indicates that debug mode statistics are not enabled. "-Z 2" indicates
that time consumption and load statistics are performed for each frame. For
example:
[tagI] frame[1] period_time: 16000 us, cost_time: 942 us, load: 5.89%
[tagI] frame[2] period_time: 16000 us, cost_time: 808 us, load: 5.05%
[tagI] frame[3] period_time: 16000 us, cost_time: 858 us, load: 5.36%
"-Z 3" indicates a combination of the effects of "-Z 1" and "-Z 2", that is, load
is printed for each frame, and summary debug information is printed at the end.
...
"-F config_aivqe.json" indicates the JSON parameter configuration file for the
audio algorithm. If not specified, the program will exit directly with the
corresponding log prompt:
./rockaa_capt -I record.wav -O out_talk.pcm -c 2 -C 1 -b 16 -r 16000 -Z 1
input file: record.wav
[tagE] Can't support in_file: record.wav without conf file

2.2 Essais de conversation en ligne en temps réel {#22-real-time-online-talking-testing}

Comme mentionné ci-dessus, si le paramètre “-I” n’est pas inclus, cela signifie que les paramètres du test de fichier hors ligne précédent ont obtenu de bons résultats, et le test entrera en mode en temps réel en ligne pour une expérience plus similaire à celle de l’utilisateur:

./rockaa_capt record.wav -O out_talk.pcm -D 0 -d 0 -c 2 -C 1 -b 16 -r 16000 -Z 1 -F config_aivqe.json

Ce journal indique l’opération dans le cadre de tests de conversation en ligne en temps réel:

[tagI] Capture via run-time process

La plupart des paramètres sont les mêmes que dans le test hors ligne de fichier susmentionné, et voici une description supplémentaire pour les différents paramètres:

"record.wav" is used here as the wav file format to save before audio algorithm
processing;
"-D 0 -d 0" comes from the concepts of TINYALSA and ALSA, indicating audio
capture from card0 and device0;
"-t 10" means recording for 10 seconds;
"-F config_aivqe.json" specifies the json parameter configuration file for the
audio algorithm. If not specified, it will work in bypass capture mode, similar
to tinycap, with corresponding log prompts. For example:
./rockaa_capt record.wav -D 0 -d 0 -c 2 -C 1 -b 16 -r 16000 -Z 1
[tagI] Not specify conf_path and capture raw pcm directly

2.3 Essai d’effet audio hors ligne de lecture {#23-offline-playback-audio-effect-testing}

Pour tester le scénario d’effet sonore de lecture, les développeurs peuvent également ajouter le paramètre “-I” en premier, en utilisant la source audio existante pour être testée pour les tests hors ligne et le réglage des paramètres:

./rockaa_play -I speech_2ch.wav -O out_effect.pcm -p 256 -Z 1 -F config_playeffect.bin

Ce journal indique l’opération sous le test d’effet de lecture hors ligne :

[tagI] Playback via offline file process, in_file: speech_2ch.wav

Analysons l’utilisation de plusieurs paramètres clés :

"-I" here still serves as the only parameter for switching between offline file
mode and real-time online mode. If this parameter is included, it indicates
operation in offline file mode, with the following "speech_2ch.wav" being the
pre-collected audio source ready for processing.
"-O out_effect.pcm" indicates the PCM name output after specifying the audio
algorithm, which is a single channel, with the sample rate and bit width
consistent with the later specified "-b 16 -r 16000". If not specified, it will
default to generate an output file starting with "EFFECTPLAY";
"-c -b -r" still indicates the three basic elements of PCM format, that is, the
number of channels, bit depth, and sample rate, which can be forcibly specified
as PCM format with the lowercase "-i raw". This example is a wav input,
automatically parsed and played according to the wav format;
"-p 256" means processing 256 sample points per frame, which at 16kHz is
256/16000=16ms per frame.
"-Z 0 -Z 1 -Z 2 -Z 3" have the same effect as the aforementioned rockaa_capt.
"-F config_playeffect.bin" indicates the specification of the sound effect
configuration file. If not specified, it will exit directly with the
corresponding log prompt:
./rockaa_play -I speech_2ch.wav -O out_effect.pcm -p 256 -Z 1
[tagE] Can't support in_file: speech_2ch.wav without conf file

2.4 Essais de lecture en ligne en temps réel {#24-real-time-online-audio-effect-playback-testing}

Si les paramètres du test de fichier hors ligne précédent ont obtenu de bons résultats, supprimez le paramètre “-I” pour entrer le test de lecture en temps réel de l’effet audio en ligne:

./rockaa_play speech_2ch.wav -D 0 -d 0 -p 256 -Z 1 -F config_playeffect.bin

Ce journal indique l’opération effectuée dans le cadre du test de lecture en temps réel des effets audio en ligne :

[tagI] Playback via run-time process

La plupart des paramètres fonctionnent de la même manière que ceux mentionnés ci-dessus. Il est important de noter que si le paramètre “-F” n’est pas spécifié à ce moment, il signifie lecture par contournement, qui a le même effet que le minuscule jeu et a les invites de log correspondantes. Par exemple:

./rockaa_play speech_2ch.wav -D 0 -d 0 -p 256 -Z 1
[tagI] Not specify conf_path and playback raw pcm directly

3. Utilisation plus détaillée dans l’aide {#3-more-detailed-usage-in-help-information}

La liste d’aide de rockaa_capt:

# ./rockaa_capt
Usage: ./rockaa_capt [OPTION]...

-h, help
-v  print current version
-b, bits of samples
-r, the sample rate for stream (default: 16000)
-c, the number of channels (default: 2)
-C, the number of far-end channels (default: 1)
-p, the size of per-period (default: 256)
-n, the number of periods (default: 4)
-t, capture time (default: UINT_MAX)
-a, enable DOA and return result (default: disabled)
-F, the path of json config file, without it capture raw pcm directly
-I, use offline input file mode, without capture via sound card
-Z, use debug mode, 0:disabled 1:summary 2:per-frame 3:summary+per-frame
(default: 0)
For example:
    ./rockaa_capt cap.wav -c 2 -C 1 -b 16 -r 16000 -t 10 -Z 1 -F config_aivqe.json

La liste d’aide pour rockaa_play :

# ./rockaa_play
usage: ./rockaa_play file.wav [options]
options:
-D | --card   <card number>    The card to receive the audio
-d | --device <device number>  The device to receive the audio
-p | --period-size <size>      The size of the PCM's period
-n | --period-count <count>    The number of PCM periods
-i | --file-type <file-type>   The type of file to read (raw or wav)
-c | --channels <count>        The amount of channels per frame
-r | --rate <rate>             The amount of frames per second
-b | --bits <bit-count>        The number of bits in one sample
-f | --float                   The frames are in floating-point PCM
-M | --mmap                    Use memory mapped IO to play audio
-F | --conf-name               The parameters of configuration File, (Mandatory)
-I | --in-file                 Use offline input file mode, without playback via
sound card
-O | --out-file                The output file name
-Z | --debug-mode              Use debug mode, 0:disabled 1:summary 2:per-frame
3:summary+per-frame (default: 0)
For example:
    ./rockaa_play -I speech_2ch.wav -O out_effect.pcm -p 256 -Z 1 -F config_playeffect.bin

Explorer ce sujet → · Parcours →