Raspberry Pi 4 has been out for a tiny bit here. The potential was tantalizing. Faster CPU, 4gb ram, USB 3.0. It was so much for everyone, sellouts everywhere were common. We are now able to get them easily. So what are we going to do with it?
When I received a Raspberry Pi 4, the standout difference from previous models is definitely the dual HDMI outputs. Native two-screen output!
The first idea I wanted to try with a two-screen output Pi 4 was an effects project. One screen one, I want to have a graphic effect running, and on the other screen, I would place the controls to change the effects.
The software works as follows:
- Power it up.
- Run the code via Processing for Pi.
- The video effect screen shows a reaction to sound sensed by the microphone.
- Change the effects on demand.
First, let’s gather all the necessary components you’ll need to build this project.
1x USB Microphone (I used a Blue Yeti)
2x Micro to standard HDMI cables
The Raspberry Pi 4 gets hot. Heatsinks would go a long way.
STEP 1 setting up the hardware
- Get the Raspberry Pi 4 setup with Rasbian. Get the Noobs image and start there.
I love projects like this. No need for any complex circuits to troubleshoot all the time, just connecting a board to a screen.
Connect your Pi 4 to your two screens. The control screen is on “HDMI 0,” and the graphics screen is “HDMI 1.”
Here is the hard part.. the Pi 4 has no native microphone support! So, you’ll need to get a USB microphone or USB sound card adapter. For this project, I used a USB mic called a “Blue Yeti.” The go-to microphone for the podcaster. I don’t cast.
- Plug the Microphone in. You’ll have to go into the sound setup on the pi and make the microphone the default mic. After that, you might want to test the Pi and the mic.
From the command line, type:
arecord -D plughw:1,0 -d 3 test.wav && aplay test.wav
The 3 in this line is in reference to how many seconds it records. If you do not hear playback, then right-click the sound icon on the desktop and make sure one of your screens with speakers is selected. Then try the command again. You should hear a playback of the recording.
STEP 2 setting up the Raspberry Pi and code environment
- Firstly, you should have the OS installed just find. Microphone working. This is probably the hardest part of the whole build.
- Second, you will need “Processing for Pi.” Processing is a “software sketchbook and language” for learning to code. It’s was designed for use with the “visual arts.” Fitting, since this is a project built around some visual effects.
To get Processing, go to: https://pi.processing.org/
There you can go to the download link on the left to get the file.
Alternatively, you can use this command line:
curl https://processing.org/download/install-arm.sh | sudo sh
- Third, you’ll have to install some libraries within Processing.
Go to Sketch, then Libraries, and select Add Library. There you can search for library names.
Find and install these two:
STEP 3 loading the program
Unpack the zip file to a directory of your choice. Inside there will be a folder called “cabe_videosynth.”
Inside that folder are a five files. Most important is the file “cabe_videosynth_w_sound.pde”
Open that in Processing.
STEP 4 Run the code
Once Processing loads the file, press the play button above the code box.
At this point, the second screen will start showing the rotating polygon graphics.
On the other screen, the control box will show up.
The system will start sensing sound through the microphone. Use the controls to change how the graphics react.
If you are curious, in my video the graphics screen is a 1080p 46” television. The other screen is a 4k monitor. I would recommend using two 1080p screens instead. It might improve performance.
Two screens on the Raspberry Pi is pretty cool. It lends itself to being a good special effects platform. This is the simplest thing I could come up with to test that idea. Hope you like tinkering with it.
Have a story tip? Message me at: cabe(at)element14(dot)com