-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Initial support for piping audio through external vocoder programs. #719
base: master
Are you sure you want to change the base?
Conversation
radae_demo_rx.sh
Outdated
# * Convert the audio into IQ data via zero-padding. | ||
# * Pass the IQ data into the RADAE decoder | ||
# * Send the resulting 16 kHz audio back to freedv-gui. | ||
$RADAE_VENV/bin/python3 $RADAE_PATH/int16tof32.py --zeropad | $RADAE_VENV/bin/python3 $RADAE_PATH/radae_rx.py $RADAE_PATH/model19_check3/checkpoints/checkpoint_epoch_100.pth -v 2 --auxdata | $RADAE_PATH/build/src/lpcnet_demo -fargan-synthesis - - |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about:
cd $RADAE_PATH
python3 int16tof32.py --zeropad | python3 radae_rx.py model19_check3/checkpoints/checkpoint_epoch_100.pth -v 2 --auxdata | ./build/src/lpcnet_demo -fargan-synthesis - -
Maybe try Ubuntu 22 and see if the VENV issues go away? It's pretty hard to follow the code with all the explicit paths. Apart from that it looks OK. You could maybe test the script stand alone to see if it streams OK. I'm not sure about streaming to and from scripts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I went ahead and cleaned up the scripts so they should be a bit neater now. Thanks for taking a look!
radae_demo_tx.sh
Outdated
# * Pass the IQ data into the RADAE encoder | ||
# * Send the resulting 8 kHz audio back to freedv-gui. | ||
export PATH=$RADAE_VENV/bin:$PATH | ||
$RADAE_PATH/build/src/lpcnet_demo -features - - | $RADAE_VENV/bin/python3 $RADAE_PATH/radae_tx.py $RADAE_PATH/model19_check3/checkpoints/checkpoint_epoch_100.pth --auxdata | python3 $RADAE_PATH/f32toint16.py --real --scale 16383 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks 👍 But as above - see if the streaming works when you run the script form the cmd line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, they work on the command line. It looks like there's significant latency before they even start encoding or decoding, mainly while PyTorch is setting itself up (hence why I was having the TX problem). This might be able to be worked around by e.g. not constantly killing and restarting the TX process.
Introduction
Add infrastructure so that external vocoders can be used. This is to support demoing of RADAE.
WARNING: This is experimental. You probably don't want to use this right now unless you're helping to test RADAE.
Setup
Linux/macOS
RADAE setup:
freedv-gui:
Once compiled, go to Tools->Options->Modem and configure External Vocoder (shown below):
Each of these should be the full paths to
radae_demo_rx.sh
andradae_demo_tx.sh
respectively. These scripts expect two arguments: the path to your RADAE folder and the path to the Python venv you set up. For example,/home/mooneer/freedv-gui/radae_demo_rx.sh /home/mooneer/radae /home/mooneer/radae/radae-venv
.Windows
C:\Users\User\Desktop
, creating a folder on the desktop namedFreeDV-1.9.10-devel-2024-08-23-37bc8434-windows-x86_64
.)C:\Users\User\miniconda3\envs\radae
(whereUser
is your username on your PC):(Note: pip is not being used for Windows due to the version of NumPy having performance issues on that platform. The version of NumPy installed by
conda
uses a different "BLAS" library that is better optimized and is able to run RADAE in real time. Additionally, there is a bug in PyTorch 2.4.0 that affects performance in Windows, which is why we're using nightly builds instead.)freedv.exe
in theFreeDV-1.9.10-devel-2024-08-23-37bc8434-windows-x86_64\bin
folder and go to Tools->Options->Modem. Much like with Linux and macOS, you'll need to configure the RX and TX paths to point toradae_rx.bat
andradae_tx.bat
respectively (along with paths to theconda
environment and RADAE). For example:RX command:
C:\Users\User\Desktop\FreeDV-1.9.10-devel-2024-08-23-37bc8434-windows-x86_64\bin\radae_rx.bat C:\Users\User\Desktop\FreeDV-1.9.10-devel-2024-08-23-37bc8434-windows-x86_64\radae C:\Users\User\miniconda3\envs\radae
TX command:
C:\Users\User\Desktop\FreeDV-1.9.10-devel-2024-08-23-37bc8434-windows-x86_64\bin\radae_tx.bat C:\Users\User\Desktop\FreeDV-1.9.10-devel-2024-08-23-37bc8434-windows-x86_64\radae C:\Users\User\miniconda3\envs\radae
Usage
Once set up, you can then choose "External" from the list of modes in the main window and click Start. You should then be able to decode RADAE if you happen to receive a signal. TX should also work, either via the voice keyer or by simply pushing the PTT button.
Limitations:
Additional Notes
Example of another way (on Linux) to test the scripts without transmitting OTA: