Daniel's Weblog
Posts Tags Colophon
About

Tags / Bash



SCR-20260512-kpdi.png

Tool - Explain Shell. When I come across a terminal command or a set of arguments I don’t recognize my first stop is always ExplainShell.com. It isn’t perfect because it pulls data from manpages which don’t follow a perfectly uniform structure but much more often than not it helps me quickly make sense of what I’m looking at. After several years in maintance mode it recently got an updated set of data which I’m very excited to see!.



Converting records with a USB turntable and Raspberry Pi Peviously I left a laptop sitting by my record player running Audacity but that was inconvenient so I stuck a Raspberry Pi over there and run these commands via SSH.

I am not an expert, I’m just using the equipment I have so please don’t interpret this as “the best way to convert records”

You can hear some records converted by this process at by browsing posts tagged “vinyl”

Components:

  • Record player with USB output (AT-LP120XUSB)
  • Raspberry Pi (Using a 3B but probably anything will work)
  • NAS

Prior Art:

  • Hi-Fi analog to digital with IceCast
    Utilizes IceCast to stream audio around your network. Involves running several services and is primarily focused on streaming.

  • PiDeck
    A system for DJing with your turntable, not for converting

  • Z-LiveRec
    This is an interesting piece of software but is built as a desktop application. I’d rather run everything from the command line. If it had a web interface I would consider purchasing it.

  • Ripping Vinyl Records on a Raspberry Pi
    This is very close to what I am doing! Ed describes some issues writing to his local storage and file server but I haven’t noticed anything similar. Perhaps he was using an older Raspberry Pi? (I’m using a Raspberry Pi 3)

Update, March 2026:

  • Vinyl-Airplay Sending audio from a turntable to AirPlay and recording it with a Raspberry Pi! This is very cool!

My Setup:

  1. Connect Raspberry Pi to record player via USB

  2. Ensure mount directory exists and mount the NAS via SMB

    mkdir -p /tmp/nas;
    sudo mount.cifs //nas.local/home /tmp/nas -o user=daniel,nounix,uid=$(id -u),gid=$(id -g)
    
  3. Change to the relevant directory

    cd /tmp/nas/my_new_record
    
  4. Identify the correct audio device

    arecord -l
    

    I’m going to be using card 2, device 0 which is indicated on the second line:

    **** List of CAPTURE Hardware Devices ****
    card 2: CODEC [USB AUDIO  CODEC], device 0: USB Audio [USB Audio]
        Subdevices: 0/1
        Subdevice #0: subdevice #0
    
  5. Begin recording

    # Start a tmux session so the recording continues even
    # if the SSH connection gets disconnected
    tmux;
    
    sudo arecord --device "hw:2,0" -vv --vumeter=stereo -c 2 -f "S16_LE" -r 44100 raw_audio.wav;
    

    Explanation:

    • --device "hw:2,0" This means “card 2, device 0” that we found in step 4
    • -vv Double verbosity. Activates the VU meter
    • --vumeter=stereo Shows two channels in the VU meter
    • -c 2 Record two channels
    • -f "S16_LE" Record in Signed 16-bit little endian. I picked this simply becuase it matched the Audacity default that I was previously using
    • -r 44100 record in 44.1 kHz. Again, picked because it matched the Audacity default
  6. Finish recording by pressing ctrl-c on the arecord command

Future work:

  • Automatically mount SMB on startup
  • Detect the end of the record / the record getting stuck and send a Pushover notification
  • I thought about automatically recording when the Pi detects a record playing but I decided that it would be too confusing to have to deal with unlabeled files


Uploading an entire directory to the Internet Archive: I had a collection of files around ~50 GB in size that I wanted to upload to a single item in the Internet Archive directly from my NAS. There is a cli that could work but didn’t have a trivial way to upload all the files in a directory. I tried the S3-compatible endpoint with Cyberduck but that also didn’t work as expected.

I ended up running the Python library in a detached tmux session.

# In Bash:
python3 -m venv venv;
source venv/bin/activate;
pip install internetarchive;

# In Python:
from internetarchive import upload
upload(
    'DESTINATION_ITEM_ON_INTERNET_ARCHIVE',
    'LOCAL_FOLDER/',
    # After creating an account you can ge the required keys here:
    # https://archive.org/account/s3.php
    access_key='YOUR_ACCESS_KEY',
    secret_key='YOUR_SECRET_KEY'
)

Note: Remember, uploading things to the Internet Archive makes the email address associated with your account publicly visible