Okay, I spent a little time this evening sorting out my dream file-copying-automation terminal script. I’m sharing it here for others who don’t have much terminal-fu and want to have an easy way to get tape recordings off Norns and onto their computer.
Disclaimer
The script presumes everything about your Norns is default - that you haven’t renamed your Norns, or given it a different password, or anything else. It runs on Terminal on a Mac. It might not work on Windows, but maybe someone else can suggest a similar script that’ll run there. If you’re using Linux you almost certainly don’t need my help. In general: use this script at your own risk.
How do to it
First install ffmpeg on your Norns. SSH into Norns from your terminal with ssh we@norns.local and then type in the Norns’ password (default is sleep). Once connected type: sudo apt install ffmpeg. Then type exit to go back to your machine.
Next, make a folder on your computer to hold the files. In it, create a file called pull.sh. Paste the following inside the file, and make sure you change the last line to reference the folder on your computer where you want to send the MP3s:
#!/bin/bash
echo "Connecting to Norns and converting WAV to MP3..."
# Run commands on the remote machine
ssh we@norns.local <<'ENDSSH'
cd dust/audio/tape
mkdir -p mp3
for file in *.wav; do
mp3_file="mp3/${file%.wav}.mp3"
if [ ! -f "$mp3_file" ]; then
ffmpeg -i "$file" -q:a 0 "$mp3_file"
fi
done
ENDSSH
echo "Syncing converted MP3s to local directory"
rsync -v -a we@norns.local:dust/audio/tape/mp3/ "/Users/username/the-local-folder-you-want-to-sync-to"
This logs into Norns from your local machine, scans through all the wav files in the tape folder, and converts them to MP3 and stores them in an /mp3 subfolder. If the file already exists in that folder, it skips it. Then it uses rsync to sync the contents of that folder to your machine.
Finally, make your pull.sh file executable, by going to the folder in terminal and typing chmod +x pull.sh.
You can now run the script by navigating to the folder where it lives in Terminal and typing ./pull.sh. It should log into Norns and do its thing.
The only pain is that you have to type in Norns’ SSH password twice in this process. To avoid having to do that on your machine, you can set up SSH key authentication. This is easier than it sounds.
SSH Key Authentication setup
Step one: On your local machine, open terminal and type: ssh-keygen -t rsa -b 2048 to generate a SSH key pair. When prompted, you can choose to save the key to the default location. It’ll ask for a passphrase. Just hit enter instead.
Step two: Copy your public key to the remote machine. Use the following command: ssh-copy-id we@norns.local. It’ll ask for your SSH password for Norns one last time.
Step three: Try connecting by typing ssh we@norns.local. It should just connect without asking for a passphrase. If it doesn’t, try running through the above again. Once you’re connected, exit will get you back to your machine again.
That should do it. Run ./pull.sh again and it should do its thing without needing a password.
Hope that’s of help to some folks! Next step: making a script or mod for Norns that automates this process and has a nice UI?