Showing posts with label raspberry pi. Show all posts
Showing posts with label raspberry pi. Show all posts

Friday, October 04, 2024

Building Supercollider for Raspberry Pi Zero 2

 


Monday, November 13, 2023

Mediapipe Hand Solution on Raspberry Pi to OSC to Modular CV / Gate


Setup: 

  1. Set up a Raspberry Pi 4 with a clean install of Raspberry Pi OS: https://www.raspberrypi.com/software/ 
  2. Install Mediapipe as per the instructions here: https://github.com/googlesamples/mediapipe/tree/main/examples/pose_landmarker/raspberry_pi
  3. Install Python OSC on the Raspberry Pi: https://pypi.org/project/python-osc/ 
  4. Add detect_osc_pi.py (https://github.com/little-scale/Tele-o-Module/blob/main/software/dectect_pi_osc.py) to mediapipe/examples/hand_landmarker/rasperry_pi
  5. If using my Tele-o module (https://little-scale.blogspot.com/2023/01/tele-o-wifi-bluetooth-to-cv-gate.html) replace ip in detect_osc_pi.py with the address of the ESP32 in the module. 
  6. If using a different OSC endpoint, replace ip in detect_osc_pi.py with the appropriate address. 
  7. It may be beneficial to change the port variable in detect_osc_pi.py - the default is 3000
  8. Pressing together or releasing the thumb and index finger sends a 1 or 0 on OSC path /gate/0
  9. The distance between the thumb and index finger sends a float 0 - 1 on OSC path /cv/0
  10. The X and Y co-ordinates of the index finger are sent as floats of 0 -1 on OSC paths /cv/1 and /cv/2
  11. These OSC paths can be changed with the variables near the top of detect_osc_pi.py

Friday, January 13, 2023

RNBO and Max with Raspberry Pi - 03 - Encoders, LCD Screen and TouchOSC



This video shows how to get started with RNBO and Max with Raspberry Pi. We take the delay patch built in the previous tutorials and use some encoders to change the params and an LCD screen to view the params of the RNBO patch.

Links and resources: Python script for encoders and OSC: https://raw.githubusercontent.com/little-scale/rnbo/main/rnbo_python_3.txt gpiozero rotary encoders and button: https://gpiozero.readthedocs.io/en/stable/api_spi.html pyliblo: https://das.nasophon.de/pyliblo/ T18 knob: https://www.thingiverse.com/thing:5757475 D-shaft knob: https://www.thingiverse.com/thing:5759656 Raspberry Pi header: https://www.raspberrypi-spy.co.uk/2012/06/simple-guide-to-the-rpi-gpio-header-and-pins/ Encoders: https://thecustomizewindows.com/wp-content/uploads/2017/07/Rotary-Encoder-For-Dummies.jpg Rpi-lcd library: https://pypi.org/project/rpi-lcd/ Using an I2C LCD Display with Raspberry Pi: https://www.electroniclinic.com/raspberry-pi-16x2-lcd-i2c-interfacing-and-python-programming/ TouchOSC: https://hexler.net/touchosc 00:00 - Intro 00:41 - Same patch as last time 00:49 - Hardware setup 02:46 - Putting together the hardware 03:04 - Encoders in general 05:06 - Encoder 1 06:03 - Encoder 2 06:51 - Encoder 3 07:37 - Encoder 4 09:19 - LCD Display 10:08 - LCD GND 10:22 - LCD 5V 10:48 - LCD SDA 11:03 - LCD SCL 11:30 - Turn on I2C port in rasp-config 12:02 - Reboot 12:14 - Check I2C address 12:56 - Install I2C tools 13:08 - Install rpi-lcd 14:10 - Python script 20:58 - Testing out python script with encoders 21:33 - Testing python script with web interface 22:18 - TouchOSC 22:31 - Create fader 23:31 - Find address string in JSON file from RPI 23:51 - Add address path as constant string to fader messager in TouchOSC 24:10 - Set up TouchOSC editor as patch server 24:33 - iOS TouchOSC as patch client 25:15 - Create additional faders with param names in TouchOSC editor 26:50 - TouchOSC on iOS connected to pi

RNBO and Max with Raspberry Pi - 02 - Adding Pots



This video shows how to get started with RNBO and Max with Raspberry Pi. We take the delay patch built in the previous tutorial and set up some potentiometers and a button to control it, wired directly to the Raspberry Pi and interacting with the RNBO patch.

Links and resources: High resolution photo of the breadboard: https://github.com/little-scale/rnbo/blob/main/rnbo_2_photo.jpg Lydexic’s excellent tutorial: https://www.lysdexic.com/adding-potentiometers-to-your-raspberry-pi-with-rnbo/ Gpiozero: https://gpiozero.readthedocs.io/en/stable/api_spi.html Pyliblo: https://das.nasophon.de/pyliblo/ Raspberry Pi header: https://www.raspberrypi-spy.co.uk/2012/06/simple-guide-to-the-rpi-gpio-header-and-pins/ MCP3008 Datasheet: https://ww1.microchip.com/downloads/aemDocuments/documents/MSLD/ProductDocuments/DataSheets/MCP3004-MCP3008-Data-Sheet-DS20001295.pdf Python script to copy and paste: https://raw.githubusercontent.com/little-scale/rnbo/main/rnbo_2_python.txt Terminal commands: ssh pi@[IP address of PI] sudo apt install liblo-dev pip install pyliblo3 nano rnbo.py python rnbo.py 00:00 - Introduction 00:55 - Items required 02:39 - Python libs 03:49 - Why MCP3008? 04:28 - Setting up breadboard - adding MCP3008 05:05 - MCP3008 pinout 05:10 - Connections between MCP3008 and Pi 06:54 - Setting up pots 07:18 - Cap, gnd and 3v3 for MCP3008 08:52 - Setting up pots 10:46 - Button on breadboard 11:27 - Signals from pots to ADC 12:24 - Adding caps to pots 13:22 - Put knobs on pots 13:59 - Placing pots on breadboard 14:39 - Turning off Pi 14:45 - Pi ground 15:14 - Pi 3v3 16:00 - Pi MOSI 18:24 - Pi MOSI 19:14 - Pi clock 19:47 - Pi chip select 21:13 - Pi button 21:46 - Explaining the button toggle action 22:18 - Booting Pi 22:51 - Opening Terminal 23:06 - SSH into Pi 23:26 - Install pyliblo 24:51 - Make new nano document rnbo.py 25:11 - Paste python code 25:15 - Save as new document on Pi 25:19 - How does the code work? 28:47 - Python script running 29:10 - Parameters web interface 30:00 - Summary

RNBO and Max with Raspberry Pi - 01 - Setup and Parameters

This video shows how to get started with RNBO and Max with Raspberry Pi. We build a delay patch, set the parameters and then load the patch onto the Raspberry Pi. We then change the parameters from the web interface and from an OSC message.

Links and Resources: RNBO and Raspberry Pi: https://rnbo.cycling74.com/learn/raspberry-pi-target-overview Pi image: https://rnbo.cycling74.com/resources Pi Imager Utility: https://www.raspberrypi.com/news/raspberry-pi-imager-imaging-utility/ Simple Delay RNBO Patch: https://github.com/little-scale/rnbo/blob/main/rnbo_1_simple_delay.maxpat OSC Message Max Patch: https://github.com/little-scale/rnbo/blob/main/rnbo_1_simple_delay_send_osc.maxpat 00:00 - Introduction to RNBO 01:37 - Items Needed 02:17 - Compliant Sound Card 02:46 - RNBO Quickstart with RPI 02:56 - RPI Image and Imager 04:09 - Image Setup and Write 05:57 - Power Up Pi 06:30 - Starting Max Patch 07:45 - RNBOW Target Window 08:33 - Building RNBO Patch 09:07 - in~ 09:47 - delay~ 12:44 - param~ 13:07 - min and max attributes 14:22 - feedback~ 15:18 - lowres~ 16:09 - mix~ 18:13 - param for feedback 18:37 - param for filter freq 19:21 - linear vs non-linear scaling for param 20:07 - fromnormalized attribute 20:57 - example with mtof 22:31 - Mapping frequency to parameter based on pitch 22:38 - Graph display 22:52 - param for resonance 24:36 - param for wet / dry 24:43 - normalised output from param 25:15 - Pi update 26:04 - Pi target inspector 26:35 - Web interface for parameters 26:56 - Export to Pi 27:20 - Parameters in Web Interface 27:55 - displayorder attribute 28:51 - Re export with changes 29:04 - Reload interface 29:30 - Changing frequency range of filter 30:00 - Constraining parameter range using min and max attributes and fromnormalised function 30:45 - Equal octave scaling demonstration 32:26 - Audio config for Pi 33:48 - SSH into Pi 35:10 - QR Code from Phone for Web Interface 35:56 - OSC Message from Max 36:14 - JSON file 38:01 - OSC message 38:39 - udpsend IP and Port 38:58 - Randomised value for parameter from Max 40:30 - Using slider from Max to change parameter value 41:13 - Plugging in synth and changing parameters 42:12 - Summary