that is probably because the date on your board is behind. It should updated in a few minutes after the board is connected to the internet, so chances are if you were to try again now it would work. If it keeps failing, load up the Bela IDE and that should also set the date on the board, at which point you should be able to re-run the line successfully.
Monome Grid & Bela
- Edited
Ok! You were right it worked now. However, yet another issue... When I run the bash command for the monome setup, I get an error about waf and then when I try to start serialoscd, it doesn't work:
root@bela:/# bash -ex ./bela-setup-monome.sh
+ sudo apt install libudev-dev liblo-dev libavahi-compat-libdnssd-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
libavahi-compat-libdnssd-dev is already the newest version (0.6.32-2).
liblo-dev is already the newest version (0.28-5+b2).
libudev-dev is already the newest version (232-25+deb9u12).
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
+ git clone https://github.com/monome/libmonome.git
Cloning into 'libmonome'...
remote: Enumerating objects: 3160, done.
remote: Total 3160 (delta 0), reused 0 (delta 0), pack-reused 3160
Receiving objects: 100% (3160/3160), 1.31 MiB | 1009.00 KiB/s, done.
Resolving deltas: 100% (1671/1671), done.
+ ./waf configure
./bela-setup-monome.sh: line 10: ./waf: No such file or directory
root@bela:/# systemctl start serialoscd
Failed to start serialoscd.service: Unit serialoscd.service not found.
Sorry for all the issues!!
- Edited
it seems like that file is missing one line. I now cloned the project and amended the file.
So, you'll have to download the new one overwriting the old one. Updated instructions:
# get on the board (may prompt for verification, type `yes` and enter)
ssh root@bela.local
# download the setup script to the board (overwriting the existing one if any)
wget https://raw.githubusercontent.com/giuliomoro/bela-utils/patch-1/bela-setup-monome.sh -O bela-setup-monome.sh
# execute it
bash -ex ./bela-setup-monome.sh
Yes I caught that before your next response. Unfortunately I can no longer run the sh script because I already have libmonome now and it exits at that part cuz it says it already exists.
So I just am going through each line of the script and doing it manually now, however, I always get an error when I execute ./waf inside the serialosc directory:
root@bela:/serialosc# ./waf
Waf: Entering directory `/serialosc/build'
[ 8/59] Compiling third-party/libuv/src/inet.c
[10/59] Compiling third-party/libuv/src/unix/core.c
[12/59] Compiling third-party/libuv/src/unix/fs.c
../third-party/libuv/src/unix/fs.c: In function 'uv__fs_copyfile':
../third-party/libuv/src/unix/fs.c:1154:20: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
if (s.f_type != / CIFS / 0xFF534D42u)
~
cc1: all warnings being treated as errors
Waf: Leaving directory `/serialosc/build'
Build failed
-> task in 'LIBUV' failed with exit status 1 (run with -v to display more information)
Hopefully, I can just get this running so I can stop bothering you!
- Edited
that is an issue with the dependency libuv
, and the easiest way is to fix it manually:
edit the file ~/serialosc/third-party/libuv/src/unix/fs.c
, go to line 1154 and edit it from
if (s.f_type != /* CIFS */ 0xFF534D42u)
to
if ((unsigned int)s.f_type != /* CIFS */ 0xFF534D42u)
i.e.: add (unsigned int)
in front of s.f_type
.
You can either do this manually, or by running the following line:
sed -i "s/s.f_type/(unsigned int)s.f_type/" ~/serialosc/third-party/libuv/src/unix/fs.c
Then you can resume from ./waf
from within the ~/serialosc
folder.
I made a further amendment to the file, as systemd
requires a full path to the executable: https://github.com/giuliomoro/bela-utils/commit/33d8e9af84fe603f9e1a344fde8e3f4b4e7b95ee
and another amendment because serialoscd
does not daemonise https://github.com/giuliomoro/bela-utils/commit/98b6a93faca1cdd6cd95d072dc6d265d5233d2ea
Ultimately, these two changes affect the content of the file /lib/systemd/system/serialoscd.service
. Ensure it looks like this:
[Unit]
Description=serialosc daemon
[Service]
Type=simple
ExecStart=/usr/local/bin/serialoscd
PIDFile=/var/run/serialoscd.pid
RemainAfterExit=no
Restart=on-failure
RestartSec=5s
[Install]
WantedBy=multi-user.target
- Edited
Ok so success in this whole monome setup script, I can execute systemctl start serialoscd
with no errors! Thank you so much!! Now I just need to figure out how to actually use this in C++ with the Bela, I have no idea honestly and I don't think the plain OSC examples really help me here? I am following this thread but it is a bit hard for me to understand and even at the end the OP doesn't seem to quite get it correctly: https://forum.bela.io/d/863-monome-grid-osc-bela/3
Sorry I am not really an engineer but more an artist hence all the simple questions, so I have a bit of difficulty with this and honestly was surprised that using monome wasn't so common or well documented with bela! I guess not enough people trying this yet? I will keep trying out things but I'm a bit lost for where to go from here...
well my understanding is still the same as it was here:
giuliomoro I know nothing about it, but I would guess that serialoscd is a bridge between OSC and the monome: my guess is that it receives OSC messages from the user application and passes them over to the monome over serial, and also receives serial from the monome and passes it on as OSC to the user application. So, I guess it has to stay open throughout for the program to work!
I guess you now need to send OSC to serialoscd
and receive OSC from it, using the OscSender
and OscReceiver
classes . This can be done using the Communication/OSC example as a starting point. That example relies on bi-directional communication with a node
server, but ultimately you only need to send and receive (without the more complex handshake logic implemented in there).
As to WHAT messages to send/receive, I have no idea, that would be in the monome documentation, I imagine? As to WHERE to send the messages (what port), that's hopefully in the serialosc
documentation. Note that there will be nothing here that is Bela-specific, so you can probably find better support in specialised Monome forums.
One thing that emerges from the README of serialosc
is that you need to plugin the monome for the process to daemonise and do something useful. This may mean that in /lib/systemd/system/serialoscd.service
it should be Type=forking
as it was originally, instead of Type=simple
as I changed it. I cannot test this because I don't have a monome, but you can. Make sure you look at the output of journalctl -f -n 50 -u serialoscd
to see if anything useful is printed when the Monome is connected.
ndivuyo @guiliomoror Greetings! I'm getting along fairly well (for my needs at least!) with Bela Salt C++ programming. I'm thinking about buying a Monome Grid to use it to control the Bela Salt. What are the chances of this connectivity working reasonably smoothly?
The above setup should work reliably, but I don't have a Monome so I couldn't try it out. @padenot may also be able to say something about how it worked for him. Because of how the BBG + Bela cape are mounted in Salt, you will need to solder some wires to the back of your BeagleBone to break out the UART signals.
I confirm that plugging a monome device (arc or grid, I tested both) on a Bela just works, nothing special to report, just like any Linux computer. I've been using quite a few packages from different languages to test things out a few years back before writing mine in Rust, also nothing to report, everything just worked, even when stress testing it.
I've only be using the regular Bela, not the mini, I don't know if we should expect anything different? Maybe it has less available power output to drive the monome or something?
- Edited
padenot I've only be using the regular Bela, not the mini, I don't know if we should expect anything different? Maybe it has less available power output to drive the monome or something?
no should be the same. Which reminds me that the serial connection is actually virtual via USB, so
you will need to solder some wires to the back of your BeagleBone to break out the UART signals.
doesn't apply: if you have Salt+ along Salt, you have the USB host port right at the front, otherwise you can still plug it in onto the BBG's USB host port inside the rack.
Thanks @giuliomoro and @padenot - much appreciated. I'l report back when I have taken some more action! :-)
Hi giuliomoro Greetings! So, I finally got a Monome Grid delivered and installed enough on my Bela Salt so that #include <serialosc_helpers/SerialOsc.h>
"works".
However, I'm now trying to get something of https://github.com/daniel-bytes/serialosc_example/blob/master/serialosc_example/serialosc_example.cpp
to work in my code - but I'm not sure what files I should put where on the Bela (and anything else I should do) in order to get the sample code working.
Any tips would be gratefully received!
Is serialosc built as a (shared or static) library? If yes, you'll need to set LDFLAGS
and CPPFLAGS
accordingly for the Bela project so that libserialosc
is linked in and the appropriate -L
and -I
paths are set. You mention you can already include the header file appropriately, is that achieved by placing the source files for libserialosc in the project folder?
Good questions! I will check and report back! :-)
- Edited
Hi
First a bit of eye candy :-)
OK, so I thought I would sort of start from scratch on my non Salt Bela and try and install serialosc again. I've probably made previous attempts on this device so its not a virgin try. (I might flash a fresh image soon)
In the mean time, here's what I did.
On the Bela terminal, I ran the contents of: https://monome.org/docs/serialosc/raspbian/
And this went smoothly! At the end of the process I could enter serialoscd and it returned without error.
Now, my next step was to try and test the grid with the Bela somehow.
For this I thought I would and try and include SerialOsc.h from https://github.com/daniel-bytes/serialosc_example.git into my project.
I wasn't really sure how I should to this but a ssh'd to the Bela again and git cloned serialosc_example.git into my Bela/projects/SimonSaysSeeq folder. Then I tried to build my project from the Bela IDE. I got some errors e.g.
In file serialosc_example/serialosc_example/osckpack/ip/posix/NetworkingUtils.cpp: 'ip/NetworkingUtils.h' file not found column: 10, line: 37 -
but I think I worked around those by adding some sym links.
Then my project built with the line:
#include <serialosc_example/serialosc_example/SerialOsc.h>
- but then the Bela was unresponsive (both with and without the monome grids attached.
Do you have any pointers for me on how to test serialosc is working? I'm kind of C++ newbi so I may be barking up several wrong trees!
Happy to flash a fresh image etc.
cheers, Simon
p.s. Might it make sense to build in serialosc support if it enables devices such as grid etc?
- Edited
simonredfern In file serialosc_example/serialosc_example/osckpack/ip/posix/NetworkingUtils.cpp: 'ip/NetworkingUtils.h' file not found column: 10, line: 37 -
that has two reasons: the file says:
#include "ip/NetworkingUtils.h"
which would normally semantically mean that there is an ip/
folder included in the current folder which contains a file NetworkingUtils.h
(i.e.: in serialosc_example/osckpack/ip/posix/ip/NetworkingUtils.h
). However, the file is in serialosc_example/osckpack/ip/NetworkingUtils.h
, so it is not found. You could modify the path so that it goes back up one folder, i.e.: #include "../NetworkingUtils.h"
), or - better (because it addresses the same issue with other files (if any)) - adding proper include paths to the Make parameters
entry in the project settings : CPPFLAGS=-I serialosc_example/serialosc_example/osckpack
.
HOWEVER, you won't be able to build this project through the IDE as it is because it will try to build all .cpp files in the project but the files in the win32
folder include some Windows-specific header files, so you will at least need to delete that folder.
I can build serialosc_example
by placing in serialosc_example/serialosc_example
the following file called Makefile
CPPFLAGS = -Iosckpack -pthread -Wno-psabi
CC=$(CXX) # for the linker
LDLIBS=-lpthread
OBJS:= \
./SerialOsc.o \
./osckpack/ip/IpEndpointName.o \
./osckpack/ip/posix/UdpSocket.o \
./osckpack/ip/posix/NetworkingUtils.o \
./osckpack/osc/OscPrintReceivedElements.o \
./osckpack/osc/OscOutboundPacketStream.o \
./osckpack/osc/OscReceivedElements.o \
./osckpack/osc/OscTypes.o \
./serialosc_example.o
serialosc_example: $(OBJS)
then you can cd
into that directory (NOT via the Bela IDE) and type make
to build it and ./serialosc_example
to run it. Play around with it a bit.
Now that you have the program building, what do you want to do it? How do you want to integrate it with a Bela program? To create a Bela program that will build through the IDE without need for extra Make parameters
, you should organise the files as follows:
projects/oscserial_bela/SerialOsc.h
projects/oscserial_bela/UdpSocket.cpp
projects/oscserial_bela/NetworkingUtils.cpp
projects/oscserial_bela/SerialOsc.cpp
projects/oscserial_bela/MessageMappingOscPacketListener.h
projects/oscserial_bela/MonomeDevice.h
projects/oscserial_bela/ip/IpEndpointName.h
projects/oscserial_bela/ip/TimerListener.h
projects/oscserial_bela/ip/NetworkingUtils.h
projects/oscserial_bela/ip/UdpSocket.h
projects/oscserial_bela/ip/IpEndpointName.cpp
projects/oscserial_bela/ip/PacketListener.h
projects/oscserial_bela/osc/OscPrintReceivedElements.cpp
projects/oscserial_bela/osc/OscException.h
projects/oscserial_bela/osc/OscOutboundPacketStream.cpp
projects/oscserial_bela/osc/OscHostEndianness.h
projects/oscserial_bela/osc/OscReceivedElements.cpp
projects/oscserial_bela/osc/OscTypes.h
projects/oscserial_bela/osc/OscReceivedElements.h
projects/oscserial_bela/osc/OscPrintReceivedElements.h
projects/oscserial_bela/osc/OscOutboundPacketStream.h
projects/oscserial_bela/osc/OscTypes.cpp
projects/oscserial_bela/osc/OscPacketListener.h
projects/oscserial_bela/serialosc_example.cpp
note that running this project from the IDE you won't be able to interact with it via the keyboard because the console at the bottom is not interactive.
Anyhow, once this builds in the IDE, you can add a render.cpp
(or add its contents to serialosc_example.cpp
) and (IMPORTANT) rename the main()
function which is in that file at the moment to something else.
giuliomoro Fantastic, thanks so much. I will try the above and report back. :-)