How to install audiowaveform on Ubuntu 18.04

sudo add-apt-repository -y ppa:chris-needham/ppa
sudo apt-get update
sudo apt-get install -y audiowaveform

sudo tee "/usr/local/bin/audiowaveform-scale-json.py" <<'EOF'
#!/usr/bin/env python

import json
import sys

if len(sys.argv) < 2:
    print("Usage: python scale-json.py file.json")
    exit()

filename = sys.argv[1]

with open(filename, "r") as f:
    file_content = f.read()

json_content = json.loads(file_content)
data = json_content["data"]

max_val = float(max(data))
new_data = []
for x in data:
    new_data.append(x/max_val)

json_content["data"] = new_data
file_content = json.dumps(json_content)

with open(filename, "w") as f:
    f.write(file_content)
EOF
sudo chown root:root "/usr/local/bin/audiowaveform-scale-json.py"
sudo chmod 0755 "/usr/local/bin/audiowaveform-scale-json.py"

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.