This is how I set up my own Jetson Nano. This is not a tutorial. I know nothing. Use at your own risk. It works for me, but that might be a freak accident. I make music. But maybe this helps someone make more cool music stuff.
Jetson Nano Rebuild Kernel to allow for use of ALSA-Midi
Get current SD car Image and etch it (e.g. with Balena etcher):
https://developer.nvidia.com/jetson-nano-sd-card-image
My starting version was 4.6.1. As I have tried making other combinations work (see below for Jetpack 4.5) I would not recommend doing that. I found it a disagreeable experience.
Start your Jetson Nano with it. Open Terminal
sudo apt-get update
sudo apt-get dist-upgrade -y
### This got me L4T 32.7.3 with kernel 4.9.299
sudo apt autoremove
reboot
### Speedup. Can be skipped.
git clone https://github.com/JetsonHacksNano/installSwapfile
cd installSwapfile
./installSwapfile.sh
sudo jetson_clocks
### Getting sources and changing kernel
cd && mkdir kernel && cd kernel
wget https://developer.nvidia.com/downloads/remack-sdksjetpack-463r32releasev73sourcest210publicsourcestbz2
tar -xvjf remack-sdksjetpack-463r32releasev73sourcest210publicsourcestbz2
cd Linux_for_Tegra/source/public/
tar -xvjf kernel_src.tbz2
cd kernel/kernel-4.9
### getting current config file to edit it.
zcat /proc/config.gz > .config
vim .config
In vim editor you will need the following commands:
i = insert mode. So you can write.
Esc = leave current mode
Number > Ctrl+g = o to line number
/ = Search (case-sensitive)
Use the search to activate the Midi-relevant lines. e.g:
CONFIG_SOUND_OSS_CORE=y
CONFIG_SND_SEQUENCER=m
CONFIG_SND_MIXER_OSS=m
CONFIG_SND_PCM_OSS=y
CONFIG_SND_PCM_TIMER=y
CONFIG_SND_HRTIMER=y
# also check that these are set
CONFIG_HIGH_RES_TIMERS=y
CONFIG_NO_HZ_IDLE=y
:wq = save & exit
Now we write the new config file. Using this command we only have to confirm the changes we just made.
make oldconfig
It should now only ask you about the changes you just made to the .config file. Things like:
Sound card support (SOUND) [Y/n/m/?] y
Preclaim OSS device numbers (SOUND_OSS_CORE_PRECLAIM) Y/n/? y
Answer y. If it states first makeconfig failed and restarts the config stop and repeat from unpacking the kernel packages. Otherwise you will have to go through 8000 button prompts you cannot mess up. (If you get an error you can cill the process with ctrl+c.)
Now for the actual building of the kernel. The third step will take a LONG time.
make prepare
make modules_prepare
make -j4 Image && make -j4 modules
sudo make modules_install
sudo cp arch/arm64/boot/Image /boot/Image
reboot
You might want to consider actually going for a real-time Kernel. I did not so far find it necessary. Look it up here:
https://wiki.linuxaudio.org/wiki/system_configuration
jetsonUtilities
To find out more about the system you just installed you might like the jetsonUtilities script.
git clone https://github.com/jetsonhacks/jetsonUtilities
cd jetsonUtilities
python jetsoninfo.py
# or:
./jetsonInfo.py
Setup PureData with Externals for Wiimote, RAVE and nn~
sudo apt install puredata
# open once before installing externals.
sudo apt-get install pd-wiimote
# if it does not get detected => Preferences > Startup > add > wiimote
sudo apt autoremove
Getting Rave to run on Nano
Following https://github.com/acids-ircam/RAVE/blob/master/docs/training_setup.md
But: Do not follow their instructions to setup miniconda! This will not work on a jetson nano for this purpose. At least it did not work for me. Instead we use miniforge:
Whenever there appears sth. like /benno/ in the links you obviously need to chane it to whatever applies to you.
https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge-pypy3-Linux-aarch64.sh
cd /home/benno/Downloads
sudo bash Miniforge-pypy3-Linux-aarch64.sh
# give the virtual Environment writing permissions:
sudo chown -R benno:benno /home/benno/.conda/
sudo chown -R benno:benno /home/benno/miniforge-pypy3/
# set upenv for RAVE
conda create -n rave python=3.9
conda activate rave
git clone https://github.com/acids-ircam/RAVE
cd RAVE
pip3 install -r requirements.txt
# on any other platform you could now start training. The problem is,thaton a jetson nano, the torch-installation needs to be CUDA-activated (not the CPU). But the requirements do not realize that and training fails with an error that points to a false numpy version instead. Do not fall for that. So let's uninstall the CPU-version of PyTorch.
pip3 uninstall torch
pip3 install torch==1.11.0 torchvision==0.12.0 -f https://download.pytorch.org/whl/cu102/torch_stable.html
conda install numpy=1.20.3
# after this is done you should check:
python
>>> import torch
>>> torch.cuda.is_available()
# And you want to see:
True
# maybe you'll need these:
pip3 show numpy
To activate it later to start training:
# if conda is running
conda activate rave
# if conda is not running
source ~/miniforge-pypy3/bin/activate rave
cd RAVE
python cli_helper.py
This will create commandlines for you kike:
python train_rave.py -c small --name industrial --wav /home/benno/Music/drums/out_44100 --preprocessed /home/benno/RAVE/temp/industrial/rave --sr 44100 --data-size 16 --n-signal 8000 --no-latency true
setup of puredata external nn_tilde
sudo apt update
sudo apt install -y cmake build-essential git puredata puredata-dev python3 python3-pip
LIBTORCH=$(pwd)/.local/lib/pypy3.9/site-packages/torch
# this will be another path for you!
git clone https://github.com/acids-ircam/nn_tilde.git
cd nn_tilde
mkdir build
cd build
cmake ../src/ -DCMAKE_PREFIX_PATH=$LIBTORCH -DCMAKE_BUILD_TYPE=Release
make > /dev/null
sudo mkdir -p /usr/local/lib/pd-externals/
sudo cp frontend/puredata/nn_tilde/nn~.pd_linux /usr/local/lib/pd-externals/
cd ../../
rm -fr nn_tilde
And because everyone involved here seems just to be nice, there are some pre-trained models available for everyone to check out.
https://acids-ircam.github.io/rave_models_download
To Change standard Python version (eg within conda group):
These are examples of likely python version you will have at this point. You add them to a group with the update-alternatives command and then config which one will be preferred.
sudo update-alternatives --install /usr/bin/python python /usr/bin/python2.7 1
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.6 2
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.9 3
sudo update-alternatives --config python
# Then just press number of wanted python version
If you don’t know where a python version is installed, start it (e.g. python3.9) and then go:
>>> import sys
>>> sys.executable
Groups and Priorities
You should add yourself to a group called audio to sort out priorities.
groups
sudo usermod -a -G audio benno
pip install --upgrade rtcqs
For me starting this tool with the terminal command rtcqs did not work However, navigating to the folder (for me /home/benno/.local/lib/python3.6/site-packages/rtcqs) and just starting it with python worked just fine.
python rtcqs.py
There you will find a lot of recommendations: I followed them for the most part.
Download Priority Manager rtirq:
sudo apt-get install rtirq-init
Really important:
To get puredata and other audio fun to run at top proirity: Set up limits.conf
sudo vim /etc/security/limits.conf
adding uncommented lines:
@audio - rtprio 90
@audio - memlock unlimited
Midimanager and other autostart setup tipps:
To find out what midi-devices are connected and what they are connected to:
aconnect -l
To place a script or file in Autostart on this jetson nano open the gnome-session-properties (press alt + F2 and type it). There you add e.g.
pd /home/benno/Documents/Pd/midiwii.pd
This will open Pure Data and specifies a file to do so.
To run a script just add it as well e.g.
/home/benno/Documents/Pd/midiconnect.sh
Or just navigate to any file or script you want to open at startup.
This example is my shell script for Midi-configuration. It connects my instruments together at startup. The content of this file is something like:
#!/bin/bash
aconnect -d ‚Axoloti Core‘:0 ‚HYDRASYNTH DR‘:0
aconnect ‚Pure Data‘:1 ‚HYDRASYNTH DR‘:0
The option -d disconnects. It also works with addresses:
aconnect 28:0 32:0
Then make it executable:
sudo chmod +x /home/benno/Documents/Pd/midiconnect.sh
On a raspberry to do the same you can also:
edit as sudo:
sudo nano /etc/xdg/lxsession/LXDE-pi/autostart
# add → Filename in new line. Use Filename without spaces! e.g.
pd /home/benno/Documents/Pd/midiwii.pd
@sh /home/benno/Documents/Pd/midiconnect.sh
JETPACK 4.5
Following mostly Karaage0703 https://qiita.com/karaage0703/items/9bef6aeec9ad24f647c6
First: Get Jetpack 4.5
Etch it with Balena etcher
https://developer.nvidia.com/jetson-nano-sd-card-image-45
Start your Jetson Nano with it.
git clone https://github.com/JetsonHacksNano/installSwapfile
cd installSwapfile
./installSwapfile.sh
sudo jetson_clocks
cd && mkdir kernel && cd kernel
wget https://developer.nvidia.com/embedded/L4T/r32_Release_v5.0/sources/T210/public_sources.tbz2
tar -xvjf public_sources.tbz2
cd Linux_for_Tegra/source/public/
tar -xvjf kernel_src.tbz2
cd kernel/kernel-4.9
zcat /proc/config.gz > .config
vim .config
###
CONFIG_SOUND_OSS_CORE=y
CONFIG_SND_SEQUENCER=y
CONFIG_SND_MIXER_OSS=y
CONFIG_SND_PCM_OSS=y
CONFIG_SND_RAWMIDI_SEQ=y
CONFIG_SND_HRTIMER=y
CONFIG_NO_HZ_IDLE=y
CONFIG_HIGH_RES_TIMERS=y
###
make oldconfig
make prepare
make modules_prepare
make -j4 Image && make -j4 modules
sudo make modules_install
sudo cp arch/arm64/boot/Image /boot/Image
####
reboot
sudo apt-get update
sudo apt-get dist-upgrade -y
reboot