Skip to content

Instantly share code, notes, and snippets.

@giuliomoro
giuliomoro / _main.pd
Created Mar 29, 2021
Bela: libpd + HC-SR04 ultrasonic distance sensor, implemented in C++
View _main.pd
#N canvas 0 22 450 300 12;
#X obj 37 37 r distance;
#X obj 76 90 print;
#X connect 0 0 1 0;
@giuliomoro
giuliomoro / _main.pd
Created Mar 14, 2021
HC-SR04 for Pd on Bela, sample-accurate
View _main.pd
#N canvas 87 19 1280 778 12;
#X obj 160 234 samphold~;
#X floatatom 160 311 7 0 0 0 - - -;
#X obj 160 279 snapshot~;
#X obj 49 138 loadbang;
#X obj 51 181 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 1
1;
#X obj 806 40 loadbang;
#X obj 808 83 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 1
1;
View xenomai-images 9463737652d07a1198eb456f564a529328cd36f0
giulio@builder:~/xenomai-images$ kas-container build kas.yml:board-beagle-bone-black.yml:opt-linux-latest-5.4.yml
2021-02-09 11:04:37 - INFO - kas 2.3.3 started
2021-02-09 11:04:37 - INFO - /repo$ git rev-parse --show-toplevel
2021-02-09 11:04:37 - INFO - /repo$ git rev-parse --show-toplevel
2021-02-09 11:04:37 - INFO - /repo$ git rev-parse --show-toplevel
2021-02-09 11:04:37 - INFO - /repo$ git rev-parse --show-toplevel
2021-02-09 11:04:37 - INFO - Using /repo as root for repository xenomai
2021-02-09 11:04:37 - INFO - /work/isar$ git remote set-url origin https://github.com/ilbers/isar.git
2021-02-09 11:04:37 - INFO - /work/isar$ git cat-file -t 1cfe166c5e53ae96bc07b895a92bf6cd7ace7bc9
2021-02-09 11:04:37 - INFO - Repository isar already contains 1cfe166c5e53ae96bc07b895a92bf6cd7ace7bc9 as commit
@giuliomoro
giuliomoro / render.cpp
Created Jan 29, 2021
Bela: Compute CPU time for render()
View render.cpp
bool setup(BelaContext* context, void* userArg)
{
clock_t start, end;
start = clock();
unsigned int times = 10000;
for(unsigned int n = 0; n < times; ++n)
render(context, userArg);
end = clock(); //record time end
result = (double)(end - start)/(double)times;
cout << "result : " << ((result) / CLOCKS_PER_SEC) << " seconds" << endl;
View portion-of-render.cpp
void loop(void*)
{
unsigned int logIdx = 0;
std::vector<float> logs(10000);
unsigned int writeFileSize = logs.size() + 5000;
freq_mod_tone_bela.setBufferSize(writeFileSize);
while(!Bela_stopRequested())
{
// Read locations from Trill sensor
View tentative Pd + mpr121 for Bela
#include <Bela.h>
#include <DigitalChannelManager.h>
#include <cmath>
#include <stdio.h>
#define PD_THREADED_IO
#include <libpd/z_libpd.h>
extern "C" {
#include <libpd/s_stuff.h>
};
#include <libraries/UdpServer/UdpServer.h>
View heavy-render-with-trill.cpp
/*
____ _____ _ _
| __ )| ____| | / \
| _ \| _| | | / _ \
| |_) | |___| |___ / ___ \
|____/|_____|_____/_/ \_\
The platform for ultra-low latency audio and sensor processing
http://bela.io
@giuliomoro
giuliomoro / flash_mainline.sh
Created Sep 23, 2019
update uboot (locally or remotely) on a single-partition SD card with BeagleBoard image.
View flash_mainline.sh
#!/bin/bash -ex
MLO=MLO
IMG=u-boot.img
if [ ! "x${SSH_DEST}" = "x" ]; then
SSH_CMD="ssh -tt $SSH_DEST"
scp $MLO ${SSH_DEST}:MLO
scp $IMG ${SSH_DEST}:uboot.img
MLO=MLO
IMG=uboot.img
else
View render.cpp
```
/*
* Default render file for Bela projects running Pd patches
* using libpd.
*/
#include <Bela.h>
#include <DigitalChannelManager.h>
#include <cmath>
#include <stdio.h>
View render.cpp
/*
* Default render file for Bela projects running Pd patches
* using libpd.
*/
#include <Bela.h>
#include <DigitalChannelManager.h>
#include <cmath>
#include <stdio.h>
#define PD_THREADED_IO