If you want to work on the lab setup at any time outside of our general meetings on Wednesdays, here’s a quick tutorial on how!
Powering Up the Pi
Our hardware is underneath the lab bench in a (currently) unlabeled plastic tote container – a good way to see which one is ours is to check that there is a green and orange Pi in the box with a lot of audio equipment (the Amazon speakers and tons of audio-related cables and mics).
Then, take out the Pi, the Amazon speakers, and the already connected mic, along with the power supply plug, place them all flat on the bench, and then power up the Pi by plugging in the power supply plug. Wait a few seconds for the LED near the SD card to turn solid, then proceed to login.
Login to the Pi
To SSH into the Pi from the WaggleNet bench Mac:
ssh pi@169.254.51.165
then, the password is set to the default
raspberry
Note: when you are typing in the password, the Pi is “listening” to it, but will not output asterisks onto the console as you might expect. So, just try your best to type it in right the first time.
Upon logging in, you should see your terminal display a successful login prompt, and the user should also change from the default to
pi@169.254.51.165~
and you can type in any Linux command to the Pi as if you were actually using the GUI of the Linux OS installed on the Pi.
Linux Basics
Some basic Linux commands you should know for navigating directories in Linux are:
cd path/to/dir # changes working directory to
# directory indicated by path
cd .. # changes working directory to 1 level up
cd ../.. # changes working directory to 2 levels up
# hopefully, you see the pattern here
ls # lists all the directories and files inside
# the working directory
In the first command, don’t actually type “path/to/dir,” since it’s likely that’s not an actual directory in your Linux system. Instead, type in the actual directory. In the case of our Pi for WaggleNet, you’d type in
cd Documents/wagglenet
to reach the wagglenet directory, where the auto-recording script and recordings directory are stored.
Practice: how would you get to the recordings directory once you have reached the wagglenet directory?
In the wagglenet directory on the Pi, you’ll see a shell script named “auto_record.sh,” which is currently setup in a manner that splits audio recordings from the mic into 20-second intervals, but I have written the script so that we can later adjust this interval as needed.
Collecting Audio Samples
To execute the auto-recording script and begin gathering recordings, make sure you’re in the wagglenet directory and see the auto_record.sh script with a simple ls, then type into the terminal
pi@169.254.51.165~ ./auto_record.sh
Then the Pi will begin recording in 20-second intervals. The Pi will output onto the terminal lines indicating the name of the file that are being generated by the recordings, with the names being associated with the (currently incorrect) dates and times of the recordings down to the second. To stop collecting recordings, simply press the keyboard combination Ctrl+Z.
Playback of Samples
To playback any one of the recording(s) you’ve generated with the script, simply copy the names of one of the wav files generated from the console, and type into the console
pi@169.254.51.165~ aplay <paste name here>
(As it currently stands, we do not hear output from the speakers, even on max volume and speaking directly into the mic.) But, we have proven it to have worked before and heard sound outputted on the speakers.
Logging Out of the Pi
To logout of the Pi, simply type into the console twice
pi@169.254.51.165~ exit
(If you’re curious about the reason why we need to type it in twice, it’s because the Pi thinks the script is still running in the background even though we stopped it earlier with the Ctrl+Z combo).
Finally, unplug the Pi from power and put the Pi + audio stuff back into the tote, and put that tote back under the bench.
And that’s it! Now you know how to operate the setup and generate & playback audio recordings.