zynthbox / zynthbox-module-norns

A small tool which creates something that vaguely resembles a control box for a Norns synthesizer.
0 stars 0 forks source link

Sketchpad idea: Add "NornsPad", a sketchpad that runs norns apps in the middle with some simulated controls around to mimic HW #7

Open star-buck opened 3 years ago

star-buck commented 3 years ago

Matron: The GUI interface running on the rpi4 Maiden: Their web-backend to send stuff to Matron

Overview Norns, Fates, Orca, Supercollider: https://github.com/p3r7/awesome-monome-norns/blob/main/README.md

Terms: https://github.com/p3r7/awesome-monome-norns/blob/main/README.md#lingo

Sound Examples: https://llllllll.co/t/approaching-norns/13236/241

ideas for a sketchpad interface grid from technobear: https://www.youtube.com/watch?v=o95V0E1x7a0


TODOS:

star-buck commented 3 years ago

to run fates on normal rpi4b with 7inch elecrow screen:

replace /boot/config.txt with this: (just realizing how kloeppeled together this is from the zynthian webconf)

# For more options and information see
# http://www.raspberrypi.org/documentation/configuration/config-txt.md
# Some settings may impact device functionality. See link above for details

# Tell bootloader to use initram image
#initramfs initrd.img-4.1.13-v7+

# Load RT Kernel for RBPI2
#kernel=kernel7-rt.img

# uncomment if you get no picture on HDMI for a default "safe" mode
#hdmi_safe=1

# uncomment this if your display has a black border of unused pixels visible
# and your display can output without overscan
#disable_overscan=1

# uncomment the following to adjust overscan. Use positive numbers if console
# goes off screen, and negative if there is too much border
#overscan_left=16
#overscan_right=16
#overscan_top=16
#overscan_bottom=16

# uncomment to force a console size. By default it will be display's size minus
# overscan.
#framebuffer_width=1280
#framebuffer_height=720

# uncomment if hdmi display is not detected and composite is being output
[pi4]
hdmi_force_hotplug=1
[all]

# uncomment to force a specific HDMI mode (this will force VGA)
#hdmi_group=1
#hdmi_mode=1

# uncomment to force a HDMI mode rather than DVI. This can make audio work in
# DMT (computer monitor) modes
#hdmi_drive=2

# uncomment to increase signal to HDMI, if you have interference, blanking, or
# no display
#config_hdmi_boost=4

# uncomment for composite PAL
#sdtv_mode=2

# Disable Splash Screen
disable_splash=1

# Disables dynamic frequency clocking
force_turbo=1

# Uncomment to overclock the arm. 700 MHz is the default.
[pi2]
arm_freq=900
core_freq=250
sdram_freq=450
over_voltage=2
[all]

# Uncomment some or all of these to enable the optional hardware interfaces
dtparam=i2c_arm=on
dtparam=i2s=on
dtparam=spi=on

# Uncomment this to enable the lirc-rpi module
#dtoverlay=lirc-rpi

# Additional overlays and parameters are documented /boot/overlays/README

# Enable MMAP support (Jackd, etc.)
dtoverlay=i2s-mmap

# Enable UART for MIDI
enable_uart=1

[pi3]
# Swap back the ttyAMA0 to GPIO
dtoverlay=miniuart-bt
[all]

[pi4]
# Enable OTG
dtoverlay=dwc2
# Swap back the ttyAMA0 to GPIO
dtoverlay=miniuart-bt
[all]

# Enable RBPi Onboard Audio (Headphones)
dtparam=audio=on
audio_pwm_mode=2

# Soundcard Config
dtparam=audio=on
audio_pwm_mode=2

# Display Config
hdmi_force_hotplug=1
hdmi_drive=1
hdmi_group=2
hdmi_mode=1
hdmi_mode=87
hdmi_cvt 1024 600 60 6 0 0 0

# Activity LED Config

# Adjust UART clock for MIDI Baudrate (31250)

#New kernels
dtoverlay=midi-uart0

# Old kernels
#[pi3]
#init_uart_clock=39062500
#init_uart_baud=38400
#dtparam=uart0_clkrate=48000000
#[pi2]
#init_uart_clock=2441000
#init_uart_baud=38400
#dtparam=uart0_clkrate=3000000
#[all]
star-buck commented 3 years ago

FATES IMG


norns seems to not support alsa, just jack: https://github.com/monome/norns-image/issues/53


get img, use balena etcher: https://archive.org/download/fates-pi4b-5.4-20210120/fates-pi4b-5.4-20210120.img

Open a terminal, SSH to the Pi ssh we@norns.local (or the IP address of the device) password is **sleep**

Expand filesystem this is super important sudo raspi-config

2.2.3 Set audio device • Run nano norns-image/config/norns-jack.service • Change hw:1 to your audio device

7inch elecrow: https://llllllll.co/t/norns-on-raspberry-pi/14148/664

/boot/config.txt

hdmi_force_hotplug=1 max_usb_current=1 hdmi_group=2 hdmi_mode=1 hdmi_mode=87 hdmi_cvt 1024 600 60 6 0 0 0 hdmi_drive=1


Configuring Ideas for Norns on RPI: https://github.com/FigrHed/Norns-on-Raspberry-pi

Fates on Zynthian: https://discourse.zynthian.org/t/norns-on-zynthian-hardware/3076/8


aplay -l

systemctl status norns-jack.service systemctl status norns-init.service systemctl status norns-crone.service

idea to merge real audio card output with dummy input: https://jackaudio.org/faq/multiple_devices.html

Todos when using fates img:


sudo apt-get install alsa-utils alsa-tools sudo rm /etc/modprobe.d/raspi-blacklist.conf

sudo nano /etc/systemd/system/norns-init.service

ExecStart=/usr/bin/amixer set Headphones 0 on

sudo nano /etc/systemd/system/norns-jack.service

ExecStart=/usr/bin/jackd -R -P 95 -d alsa -C hw:2 -P hw:1 -r 48000 -n 3 -p 1024 -S -s

sudo nano /etc/modules

# i2c-dev snd-bcm2835 snd-dummy


in matron: pink.scd { Out.ar(Crone.ctx.out_b.index, PinkNoise.ar.dup); }.play

speaker-test


below here is not important

lsmod | grep snd_bcm2835

If it you don’t see any output then this means that the modules are not yet loaded, so you will have to load them manually.

sudo modprobe snd_bcm2835


sudo nano /etc/modprobe.d/alsa-base.conf

options snd_bcm2835 index=0
options snd slots=snd-bcm2835
leinir commented 3 years ago

The way i've managed to get norns (or more specifically fates) to work is to essentially grab the fates update package (fates-210706.tgz in this release: https://github.com/fates-project/norns/releases/tag/v2.5.4 ), stuff the decompressed stuff into /root, and then apply the patch underneath to make crone handle the lack of an input on the raspberry pi's sound chip. To make it paint anything larger than a tiny 128x64px in one corner, the output needs scaling up, which can be done by applying this patch: matron-screen-size.diff.txt

diff --git a/crone/src/main.cpp b/crone/src/main.cpp
index d4686662..395acc0a 100644
--- a/crone/src/main.cpp
+++ b/crone/src/main.cpp
@@ -38,7 +38,7 @@ int main() {

     cout << "connecting ports... " << endl;
-    m->connectAdcPorts();
+//     m->connectAdcPorts();
     m->connectDacPorts();
     m->connect<2, 2>(sc.get(), MixerClient::SinkCut, SoftcutClient::SourceAdc);
     sc->connect<6, 6>(m.get(), 0, MixerClient::SourceCut); 

Once you have applied the patch above (or just manually comment out that line, possibly easier), you will need to install some development packages, then add a new repository (to avoid building things that already exist and work fine), and install a few things from that repository. The fuller instructions for this part can also be found in the fates-norns repository over here:

sudo apt-get install libevdev-dev liblo-dev libudev-dev libcairo2-dev liblua5.3-dev libavahi-compat-libdnssd-dev libasound2-dev libncurses5-dev libncursesw5-dev libsndfile1-dev
curl https://keybase.io/artfwo/pgp_keys.asc | sudo apt-key add -
echo "deb https://package.monome.org/ stretch main" | sudo tee /etc/apt/sources.list.d/norns.list
sudo apt update
sudo apt install libmonome-dev libnanomsg-dev supercollider-language supercollider-server supercollider-dev

Then you need to build the various bits, and also install the crone supercollider parts, which you do by doing as follows in the norns directory:

./waf configure
./waf
pushd sc
./install.sh
popd

(the two first lines configure and build all the c parts, and the three latter install the supercollider scripts)

Then add the various files in this package etc.tar.gz to the appropriate locations in your /etc dir (specifically, this swaps the sound driver for the basic raspberry pi one, adds some extra bits to your alsa setup).

You will also need the dust files in your root directory, from the fates disk image, or grab them here: dust.tar.gz - it turns out that the dust you might get by cloning the monome dust repository aren't actually what's needed here, so... this one it is.

Once that has been done, to actually run this stuff, it turns out we need x11 up and running for some reason (something to do with how jack works apparently), and the first step for that is, cleverly, to shut down the zynthian service. Plug in keyboard, switch to a tty, and then log in as root and run systemctl stop zynthian (or do this through ssh), and once that has been done you can run startx xterm, which will bring up x and give you that terminal. Now you can do the following, to first launch crone, and then matron. Make sure to wait for crone to actually get done loading before you try and launch matron! It takes a short while:

cd /root/norns
./crone.sh
./matron.sh

It will then take a little while again, and Matron should show up, and hopefully let you navigate to the scripts, where you can pick for example the we/scales demo (which is what i used to identify this working).

As you can see, it's a fair bit of messing about to get to work, but... i also expect this should basically all be automatable, so i will try and throw together a script tomorrow, so it's just a question of running one thing and it's installed, and then work out another script to switch back and forth between zynthian and norns :)

leinir commented 3 years ago

https://leinir.dk/bluesystems/fates-leinir.tar.gz is a big tarball with a bunch of fates-norns stuff in it, and includes a script called install-fates.sh which is supposed to do all the setup work for you. This is as yet untested, but i thought i'd toss it up here while i do that, basically to kind of... well, have it somewhere, i guess :) The procedure /should/ be as simple as starting with a freshly written zynthian sd card, downloading that tarball and decompressing it somewhere, and then running the install script (it'll be doing a bunch of system stuff, so it needs to be run either as root, or with sudo). As mentioned, it's untested, so don't run it just yet on something that you want to keep (it's entirely possible one of those commands will fall back to rm -rf / - mostly because it's untested, i don't expect that it will, but... you know, treat this as dangerous for now :) )

update: as expected, the first iteration was kind of wonky, and a new one's going up now - will report back when that's done and i've got a new sd ready to test it on :)

update2: it's now ready! Download the tarball, decompress, and run the install script. Then follow the instructions at the end once it completes, and pay attention to any warnings (it will take a while to complete)

update3: And there we go, we now have a tarball with an install script and a readme to help people a bit: https://leinir.dk/bluesystems/fates-zynthian.tar.gz (download and decompress in /root on the zynthian image, and then follow the instructions in the readme.md file).