Showing posts with label Projects. Show all posts
Showing posts with label Projects. Show all posts

Monday, June 22, 2026

Making a NDI Hotspot with Dicaffeine

 RasPi box that sends AND recieves NDI streams. I didn't believe it at first, but works damn well with minimal latency. 

Big ups to @TheKillerBeeRelayTeam for finding this, check out his website at www.hivemindsynthesis.com.

Also, check us out at the Hive Discord. Lot's of like minded synth-heads all helping each other out, myself included!


NOTE: All of this info is available and sourced from and on Dicaffeine's site for Raspian setup, just parsing it here for my Hive friends to understand some beginner things/not fully familar with RasPi setup! All rights reserved, I do not claim anything here as my own work, it's just what I had to do to get it working for me, and then hopefully them. If you are part of the Hive and you get stuck, DM me with where you are stuck and I will try to help you through.

I tested this with a RasPi 3 B+ with Bookworm 64-bit, and got some good results with it. I wouldn't recommend any lower. But you do you, boo. 

Get a 16+GB MicroSD card, plug it into your computer. Get the RasPi OS Imager and set that up, as you would.


Image your OS




Opening the Imager software, select your device. Like I said before, 3 B+ or higher for this.


The suggested OS, based on the Dicaffeine site, is Bookworm 64-bit, so you will need to find it in the legacy section of the setup. Scroll down till you get "Raspberry Pi OS (Legacy, 64-bit)".
All you need is the OS and Desktop enviroment. This would be a good time to get those settings it asks you for straightend out. Remember what you name it on hostname, it might help you later on finding it on the network. In this walkthrough, we are going to have "doughndi" as the RasPi's name, cause that's what I fucking named it. Tell it where you reside in time. Give it a username and password. Remember the username and password your setup here as well. In this walkthrough, we are going to have "djdoughy" as the username. Why? Cause that's what I fucking named it. And setting up the WiFi for it now would be benificial, and turn on SSH while you are at it.  Write that to the SDcard. Yes, this will take quite a few minutes, grab a beer/coffee/tea, and relax man. Chill out... Come back here when it's done.

Boot your Pie
Slap that MicroSD card into the pi, and power it on. It should be connected to a screen and keyboard/mouse by now, I hope. Let it boot to the desktop, and get connected to the internet. You set that WiFi up earlier, yeah? First boot's will take a bit, let it cook. Open the web browser, ONLY CLICK IT ONCE. Seriously, it will open, give it a break. You might get prompted with a keychain password? I don't know, I did. I just put a really simple password in, you don't need the browser but only for downloading 2 files. Get the Yuri2 and Dicaffeine downloads at the guys page directly, as it seemed to be the easiest to get to: 
https://dicaffeine.com/raspbian
A lot of things will not load on the chromium browser on RasPi's from my experience. I got the site to load after putting in the keychain password. If it doesn't work, perhaps updating the chromium would work? I'll note it later at bottom
Once those are in your Downloads folder, close that window out. Good time to run updates on the GUI, if you want. When you are done, reboot that bad boy.

Now if you are comfy doing the next part on the RasPi, open a terminal from the desktop and continue on after this next bit (Setting up Dicaffeine). Or, you can SSH into it and carefully copy and paste commands. Use PuTTY, or if you are on Windows, open PowerShell/Terminal. I used Terminal. At the prompt type ssh <the username you chose>@<the hostname you gave it> and push enter. Like so:
If it can't find the hostname, use the IP from the RasPi


Read the screen, type yes to accept the finger print, and then type the password you made eariler to log in.

The rest of this walkthrough will be done in the terminal, either through SSH or the terminal app on the pi.


Setting up Dicaffeine

Good time to maybe do some updates, I am not an expert at the RasPi by any means, but its always safe to update. The following command should be ran to update all the installed packages.

sudo apt update

Once that is done, give the pi a reboot
sudo reboot now

Once rebooted, open terminal,
At the prompt type this:
cd ~/Downloads
This puts us in the downloads folder where the packages from earlier should reside.

Were going to install the packages. The commands listed here are going to be 'generic' as the version numbers can change. Quick way to type these out is when you get to the file name, type the first few letters and push tab, it should auto fill the rest of the file name, then add the '-y' to auto accept the install. Run these seperatly, agree to any licenses after reading them. 
sudo apt install ./yuri2-2.8.0-xxx.deb -y
sudo apt install ./dicaffeine-xxx.deb -y

You might get some notices about issues (usually lil messages with a N: in front of them), but as long as it isn't throwing actual errors (E's or W's), they should install fine. The 2 things we installed was Yuri, a video processing framework, and Dicaffeine, which is the web interface and NDI host.
Speaking of NDI, now Dicaffine needs the libraries installed, run these 2 commands seperately. The dudes site said the second one was optional? I didn't get anything to work without it though, YMMV.
dicaffeine_get_ndi5 install aarch64-rpi4-linux-gnueabi
dicaffeine_get_ndi_hx install aarch64-rpi4-linux-gnueabi

Now we need to change the config of the RasPi itself so it can see audio. Open the RasPi config
sudo raspi-config
Navigate to "Advanced Options" then "Audio Config"
Change configuration to "PulseAudio". Navigate to finish and close the configuration. 

Next, we need to change something with the GUI interface. The following command will hide the 'taskbar' so the HDMI out will be full screen.
echo -e "autohide=true\nautohide_duration=500" >> ~/.config/wf-panel-pi.ini

Once that is done, plug a webcam in to test it here in a bit, then give the pi a reboot
sudo reboot now





And THAT should be it. Go to a computer on your network, type the "<hostname>/" in your browser and you should hopefully get the main page. "admin" is the default password. Poke around, have fun, if you break it, just start over!

Monday, October 2, 2023

DIY "StreamDeck"

 OK, so it's far from being an ACTUAL StreamDeck, but here's what I did to make a old external 10-key Numpad with PS/2 plug into a keypad that can do macro's over USB HID.



It started when I found a very unique 10key in a recycle pile. It had mechanical keys, and they were VERY clicky. Only issue was, it was PS/2. Ya know, the 5 pin barrel thing from back in the day? Yeah there's adapters for it, but really I didn't need a external numpad. In all honesty, I was just gonna make it a fidget thing cause I liked the clicky nature of it.

That is, until I started learning how some Arduino boards can be setup to be recognized as a HID device. Basically, when you plug it into a computer, it will recognize it as an interface device, and not an arduino board.



So that got me thinking. Yeah, I could make it USB instead of PS/2. But would it be possible for a computer to recognize it as a seperate input? So I can maybe setup hotkeys in OBS?

Well, no...not exactly

But what about translating the keypresses to something else?... Maybe?

I dug into the device to see what I could find. A bunch of pcb and a chip that has no datasheet filed anywhere online.

Welp, there went that idea of maybe tapping some pins to use the standard matrix style key project that can be found in many arduino starter packs. 

I went on to a couple Discord servers to chat/prod for help on this crazy lil idea I had, and someone suggested "Why not just have it use some extended keys?"

Yeah... Why not?

I already knew that keyboard standards accepted things like media hot keys and what have you, as well as function keys beyond the F12 of the standard keyboard. Why not have this do F13-F24? That's plenty of keys for using as macro hotkeys. I broke out my Arduino Leoardo, which I found can do HID nativly, and started looking up coding examples.

With the help of 'chaosfool' from Syd Heresy's crew on discord, I was able to put together a Arduino sketch that was able to take the scan code of the key press, then add a set number of however many keys above that was to make it equal to the scancode of the higher function keys. Wired up the PS/2 wires VC to 5V, GND to GND, Clock to SCL, and DATA to an open data pin on a Arduino Leonardo breakout board, then pushed the sketch over.

Viola! I have data! And the scan codes are pushing the right key presses! 0-9 with period and enter are showing up as F13-F24

Of course, there are still some issues.

The code worked TOO well. As you can see in the video, when I press a key and release it, it sends 2 signals. This is how PS/2 is supposed to work! But, when the Leo translated it to USB via my sketch, it would send the signal twice. Which would cause the keypress to happen twice. And even then, it was sending the signal so fast, applications out of focus of the main window would not see the keypresses. After beating my head over it, I decided to shove it asside and see if I could make this even work independently without it in pieces.





In comes the DFRobot Beetle!

This lil thing is a bit bigger than a quarter and is basically a stripped down Leonardo. Perfect for what I am needing it for! 



The numpad thankfully used a header to connect to the PS/2 cable, so I was able to unplug the cable, snip the end with the header connection, and then strip some wires back to solder to the Beetle. PS/2 Vcc and GND went to 5V out and GND pads respectivly. Clock wire went to the SCL pad (ie, IRQ pin 3) and DATA wire went to Digital Data pin/pad 11.





Electrical taped it sealed, folded the wires over that and it fits perectly in the space above the PCB of the numpad! Had a super long MicroUSB so that fit in the wire hole and under the board of the keypad to the Beetle
Then I pushed the code again, and now I am back at where I was before. Double pressing of keys when I push it once, unable to use it with out of focus applications. At least it looked nice?
Was able to make key lables using a DYMO LabelManager 280 with the durable white on black lables. Being that the printer can connect via USB, I could make nice lil emote style covers.

The project sat for months while I hem and hawed over what to do about the code. I am a complete n00b when it came to C++, but then I decided I need to finish it. Otherwise, it was just getting in the way.

Long story short, fought with it a few days, then came across some information from some help on Reddit. The library I was using had some variables I didn't think of. Once those were in place, it worked like a charm! The sketch is below:

//NUMPAD to extended function keys (f13-f24)
//Converts PS/2 numpad to function as extended function keys over USB HID
#include <PS2KeyAdvanced.h> //required for higher function keys
#include <Keyboard.h>

PS2KeyAdvanced ps2kb;

#define DATAPIN 11 
#define IRQPIN 3 //SCL pin on Beetle

uint16_t c;

void setup( ) { 
   ps2kb.begin( DATAPIN, IRQPIN );
   ps2kb.setNoBreak(1);
   ps2kb.setNoRepeat(1);
   if ( ps2kb.available ( ) ) {
     c = ps2kb.read();
    }
  }

void loop( ) {
  if ( ps2kb.available( ) ) {
    c = ps2kb.read( );
    if ( c > 0 ) {
      uint16_t fkey = c + (PS2_KEY_F13 - PS2_KEY_KP0); // translate number key to function key
      char hidkey = KEY_F13 + (fkey - PS2_KEY_F13); // convert to hid key code
      if((c>>8)!=80);{ // send to computer
        Keyboard.press(hidkey);
        delay(50);
        Keyboard.release(hidkey); 
        } 
      }
    }
  }
(big up to http://hilite.me/ for its awesome html maker for code blocks!)

It basically now sends the keypress for 50 ms and then releases it. Super fast and instant. Once I got this running, all I needed to do was set the hotkeys in OBS. Now I am able to switch scenes and even mute input/outputs without needing to switch focus of applications! I'm sure it could be used for anything elses outside of OBS, but for now, I am happy with the result! Hope someone out there will find this and be able to do the same.

Total cost of this was $11 for the Beetle and some time. Well worth it seeing how stream decks are around $100. 



Tuesday, August 30, 2022

RasPi Eyesy Clone Part 3 - The Case (Part 2) and MORE

 


After many MANY remeasures, the case is complete!


Everything lines up 99% of the way. Some interference with the microHDMI, and the headphone jack is off center but not interfering. Output RCA was a stretch, and works with some RCA plugs (half sleeved for the most part)


Was even able to get a small button to fit perfectly on top of the left output RCA with a dab of hot glue, and ran wires to a open GPIO (21) and ground, to allow for clean shutdown.

Will upload the case here in the next few days and link to the TinkerCAD file so you can edit it however you wish. Keep your eye on this blog.
And yes, this case will work for any application of the AudioInector, so have fun with the design when it comes!




Tuesday, August 23, 2022

RasPi Eyesy Clone - Part 2 : The Case

 


Almost pulled my hair out measuring everything out for the AudioInjector-on-the-Pi case... This is what I have now, will try to print it later this week, see if it works. I need to add some sort of venting on it because the Pi4 runs pretty hot. I think it will be an answer for all of those on the AudioInjector forums. Because measuring this out 3 or 4 times to make sure its correct was a pain. I really hope it all lines up....



Sunday, August 21, 2022

Raspberry Pi 4 Eyesy Clone Guide

Raspberry Pi 4 "Eyesy" Clone 

Using a Raspberry Pi 4, MIDI, and an AudioInjector


Opening Note
This is pretty much the same thing you can find over on this Blokas thread, however this is modified to work with a much cheaper AudioInjector hat for the Pi. It does not have "The Button" like the PiSound has, but I might make an addendum on how to setup a button through the GPIO of the Pi. The setup cost me around $100, which includes the Pi, 45W USB-C Dell Power supply (a little overkill but what I had on hand that could put out 5V at 3A), 32gig MicroSD card, and microHDMI adapter.



The Guide
This is a step-by-step guide that worked for me, I now have a EYESY running smoothly on my Pi and is controllable by MIDI and OSC and I hope this will help you make one for your own for relatively cheap!

EYESY from Critter and Guitari is a self-contained video synthesizer based on a Raspberry Pi. It generates animated graphics (made with Python)

Original Critter and Guitari Eyesy



More Info on the original > EYESY




Difficulty: Intermediate

Optimized for Headless Use: Yes (with future modification)

Recommended Raspberry Pi Models: I have a Raspberry PI 4b 4GB, I wouldn't recommend anything under RaspberryPi 3

Required Hardware:
Required Software:

An important note: in order to run EYESY on a RaspberryPi 4 8Gb with AudioInjector, I mixed several information and tutorials together (I took most of this tutorial/guide from Blokas user jqrsound, and information gathered from the email group on AudioInjector.net)

Some passages may be redundant and when I encountered a problem I found a solution on various boards or websites. A little Google'ing can go a long way in trying to understand why something is happening, or isn't happening.

For this guide I did copy/paste the mentioned tutorial plus I added some personal notes. Some mistakes where probably made, so please report them to me, but please consider that after a lot of trial and error at the end is all working 

Note: according to Okyeron EYESY expects a pi/pi user/group, therefore I installed Raspbian Buster instead of Patchbox or Bullseye. I used a Windows 10 PC to set this up.

This is edited expecting you to know a bit on how to setup and work your way around a Raspberry Pi and a Linux/Debian environment already. Sorry if it doesn't cover minor details!


The process is 2 or 3 hours long, so grab a drink and here we go!


Step 01: Prepare the SD card with the base system image.
    Download Raspberry Pi OS Lite and flash it onto your SD card with Balena Etcher.
Open up the image for Raspbian Lite, choose the SD card and click flash.


Step 02: Setup Config
    Power on the Pi connected to a display and keyboard. First boot will have you log into the standard Pi root user. Log in, then type:

sudo raspi-config

This step uses the standard RaspberryPi configuration program to configure the Pi, it uses the arrow keys and the tab key to navigate.

Change/update the following:
System Option
    S3 Change User Password – Set a new password (please do this!)
    S1 Wireless Lan - Enter your SSID and passphrase here
    S5 Boot/Autologin – Desktop
Localisation Options
    L2 Change Timezone – pick your timezone
    L4 Change Wi-fi Country – pick your country
Interfacing Options
    P2 SSH - Yes
    P3 VNC – Yes
Performance
    P2 GPU Memory – 16
Display
    D1 Resolution – 1920x1080
Then [tab] key to Finish, hit return, then select Yes to reboot.
After the reboot, log in to pi with your new password you typed into the S3 step


Step 03: Log in to your Raspbian Lite remotely
    When you are logged in, get your IP address.
Type:

ifconfig

 

Note the IP for your WiFi connection.

    At this point, you can go back to a computer that you are reading this from (so you can copy and paste commands) and open PuTTy (or whatever ssh software you want to do SSH from). If you followed the steps above, your Pi should now be connected to the same network as your computer. type your IP address in and select SSH and connect. Accept the key request and log in with the username "pi" and the password you made in the config.




Step 04: Update and Install Basics
    Run these 2 commands.  This will ensure you have the latest version of all the installed packages.
sudo apt-get update
sudo apt-get dist-upgrade

 

    Depending on how old the image you downloaded is, this could be quick or take some time.
Now install the minimal things needed to be able to run a graphical desktop.
Run these two commands.
sudo apt-get install --no-install-recommends \
screen vim \
git make \
xserver-xorg xinit \
realvnc-vnc-server

sudo apt-get install raspberrypi-ui-mods

 


Step 05: Important packages and dependencies
    Run this command to install git and perl which are important packages you will need later on.

sudo apt update && sudo apt install git perl



Step 06: Disable the on-board audio output
    I did this because EYESY is looking for your sound card to be the “default” device, so I guessed it’d be easier to disable the others 
To disable the on board Jack output on the Pi open up the boot config file

sudo nano /boot/config.txt 

Find the line that says dtparam=audio=on and comment it out so that it looks like this:

#dtparam=audio=on

Then add this line to the end for the AudioInjector:

dtoverlay=audioinjector-wm8731-audio

Reboot, then check to see the audio input after you log in by typing this

aplay -l

You should see something like this:
**** List of PLAYBACK Hardware Devices ****
card 0: audioinjectorpi [audioinjector-pi-soundcard], device 0: AudioInjector audio wm8731-hifi-0 [AudioInjector audio wm8731-hifi-0]

  Subdevices: 1/1
  Subdevice #0: subdevice #0

If the card is the only one shown, then it is working so far! 



Step 07: Tuning the system
    The following commands are based on the canonical instructions for tuning your Linux system for audio work.
 Warning: These will alter config files on your system, use at your own risk and only on a fresh Raspbian installation.

Mads Kjeldgaard gathered these in a handy gist, so you can execute them just by copy-pasting his long command:

git clone https://gist.github.com/madskjeldgaard/c5731e95bc5be9b3e2789b14b1149b6e && mv c5731e95bc5be9b3e2789b14b1149b6e raspiaudiotune && cd raspiaudiotune && chmod +x raspiaudiotune.sh && ./raspiaudiotune.sh && cd ~ && rm -rf raspiaudiotune

To make these changes take effect, the Pi must be rebooted once more.

sudo reboot

 


Step 08: Install and setup Jack
    Jack is used to patch audio throughout your audio system on Linux.
Let’s install and setup Jack:

sudo apt-get install jackd2

Jack has a configuration file in ~/.jackdrc that we will set up on installation, but you can edit this anytime to tune the system’s settings using a text editor by running "
nano ~/.jackdrc"


The config file consists of a jackdcommand which will be run when we boot the audio server in there.

Create config file in home folder called .jackdrc:

echo /usr/bin/jackd -P75 -dalsa -dhw:0 -r48000 -p512 -n2 > ~/.jackdrc

Explanations of the flags used here:
-P75 - the real-time priority of the audio
-dhw:0 is AudioInjector device number.
-r48000 is AudioInjector sample rate.
-p512 is the block size. This can be tuned to achieve lower latency. Must be power of two.
-n2 - Jack’s buffer periods.



Step 09: Watchdog (optional)
If you are using your Pi for a live gig or an installation, setting up a watchdog can be a good idea. If your Pi gets overexcited or crashes, the watchdog will reboot the system (which as a consequence will trigger whatever startup script you have installed, if any).

sudo apt install watchdog

Open up the config file for the watchdog: /etc/watchdog.conf
Uncomment the following:
max-load-1 = 24
min-memory = 1
watchdog-device = /dev/watchdog

Then add the following:


watchdog-timeout=15

The watchdog can be run and activated automatically using systemd. This is done using the following commands:

sudo systemctl enable watchdog 
sudo systemctl start watchdog

To test if the watchdog is doing it’s job, you can stress the system by creating a so-called fork bomb which will make the system crash by recursively calling a function until the Pi chokes up.
On the Pi (not your main computer!), execute the following fork bomb:

forkbomb(){ forkbomb | forkbomb & }; forkbomb

Wait a bit and then see your Pi crash. After choking up, it should automatically reboot itself. If it does this, your watchdog is doing it’s job.




Step 10: Backup

    It’s a good idea to back up your sd card at this point.
I followed this instructions: Backing up and Restoring your Raspberry Pi's SD Card




Step 11: Graphic Login
    You can work with your Pi entirely from the ssh connection. But having a graphical desktop on the Pi often makes setting up patches, and debugging them much much easier.

On your computer, install RealVNC Viewer:

Run it and connect to your Pi.

You’ll need to enter login information twice, once so RealVNC connect to the Pi and then once to the Pi screen that comes up.




Step 12: Install VideoSynth Eyesy (by Okyeron)
    Open a terminal on the VNC connection and type the following:

git clone https://github.com/okyeron/EYESY_OS_for_RasPi.git Eyesy 
cd Eyesy ./deploy.sh 


This will install Pure Data and over 700 MB of packages.




Step 13: Install amidiauto to control MIDI.
    This will really help troubleshoot programming your MIDI controllers to control the Eyesy

Run in the Terminal via VNC:

sudo apt-get update && sudo apt-get install amidiauto

Copy the following lines in /etc/amidiauto.conf (if you can’t find the file, create it):

[allow]
* <-> *

Now open Pure Data under the audio settings and under Media select Alsa MIDI. 


    Before you run EYESY and play with the MIDI the first time, an IMPORTANT NOTE on the MIDI CC setupCC34 doesn’t work correctly, instead of modifying the input gain of EYESY, it actually mute your audio input (Midi 0 to127 result in a gain stage of 0.00% to 0.29%). To restore the original setup you need to reinstall the entire Eyesy folder on the Pi!

Shutdown your Pi, connect a display to the HDMI out and boot up your Pi.
Power the device back on and run the following

sudo ./Eyesy/run.sh

    Audio and MIDI should work as expected, to test them follow the Control via Midi section from Okyeron Github page: GitHub - okyeron/EYESY_OS_for_RasPi
There you will find the CC numbers to control the parameters for the Eyesy software via MIDI.

    Side Note: The TouchOSC software mentioned on that page is another way to control your Eyesy via WiFi. It does cost some money, but the layout and intuitiveness is amazing.



Step 14: Setup your pi to auto start Eyesy, add a button to turn on and off, etc.
  -  To make Eyesy start upon boot, open a terminal or ssh in and type

sudo nano /etc/profile

    At the end of the file, type this

sudo ./Eyesy/run.sh
 
Save and close the file.

    (power switch coming soon)



Step 15: Clean and clone (optional)
To removes packages which are not longer needed from the system, run:

sudo apt autoremove && sudo apt clean

Download Piclone (SD Card Copier) 

sudo apt update sudo apt install piclone

The SD Card Copier application, which can be found on the Accessories menu of the Raspberry Pi Desktop, will copy Raspberry Pi OS from one card to another. To use it, you will need a USB SD card writer.

To back up your existing Raspberry Pi OS installation, put a blank SD card in your USB card writer and plug it into your Pi, and then launch SD Card Copier.




That’s it, at this point you have a running EYESY on your headless Pi, have fun! 


Afterword: I have set my "Eyesy" to work with an old M-Audio Triggerfinger by changing the knobs and sliders to the correct CC channels. MIDI transported over USB connection, and Triggerfinger powered by RasPi. Video below...






Here you can read the original tutorials:

Making a NDI Hotspot with Dicaffeine

 RasPi box that sends AND recieves NDI streams. I didn't believe it at first, but works damn well with minimal latency.  Big ups to @The...