How to save a block of code as a runnable file
A script is just a plain text file. There is nothing special about it - the code you copy from this guide goes into a file, you give it a name ending in .py, and Python can then run it.
Open a terminal and type:
nano wav_to_header.py This opens a blank file in the terminal editor. Paste the script code in, then:
Open your text editor, create a new file, paste the code in, and save it as wav_to_header.py. Make sure it saves as plain text - not a Word document or rich text file.
Save it somewhere easy to find - your home folder (/home/yourname/) or a project folder works well.
Open a terminal, navigate to where you saved the file, and run it with Python:
python3 wav_to_header.py /tmp/myclip_8bit.wav myclip.h myclip If the terminal says No such file or directory, you are not in the right folder. Use cd to navigate there first - for example cd ~/Documents if that is where you saved it.