Using my own samples with Mozzi

Have finally cracked getting my own samples into Mozzi. The sound clips need to be VERY short (around 0.5 seconds) or they are too big for the Nano. I also tried mono to see if that saved space, but then there was no sound at all. I really raised the volume of this sample and the clipping isn’t too noticeable compared to the previously-encoded version , as it clips because of the processing anyway.

Here’s the code:

/*  Example of playing a sampled sound,
    using Mozzi sonification library.
    Demonstrates one-shot samples scheduled
    with EventDelay.
    Circuit: Audio output on digital pin 9 on a Uno or similar, or
    DAC/A14 on Teensy 3.1, or 
    check the README or
    Mozzi help/discussion/announcements:!forum/mozzi-users
    Tim Barrass 2012, CC by-nc-sa.

#include <MozziGuts.h>
#include <Sample.h> // Sample template
#include <samples/alienwave.h>
#include <EventDelay.h>

#define CONTROL_RATE 64

// use: Sample <table_size, update_rate> SampleName (wavetable)
Sample <alienwave_NUM_CELLS, AUDIO_RATE> aSample(alienwave_DATA);

// for scheduling sample start
EventDelay kTriggerDelay;

void setup(){
  aSample.setFreq((float) alienwave_SAMPLERATE / (float) alienwave_NUM_CELLS); // play at the speed it was recorded
  kTriggerDelay.set(1500); // 1500 msec countdown, within resolution of CONTROL_RATE

void updateControl(){

int updateAudio(){
  return (int);

void loop(){

With thanks to Tim Barass and his very helpful forum for help getting this working.

Arduino – Mozzi Piezo input tests

“A piezo creates a varying voltage when you squeeze it. [We’ll] use it as a sensor by measuring the voltage the piezo produces across a 1 megaOhm resistor…Notice it has a very fast response, especially a sharp attack and decay when it’s knocked.”

This first test was changing the frequency as the piezo was scraped and touched.

And the audio version:


Piezo sample trigger (& speed)


Piezo sample scrub

And finally an example of an external speaker circuit. Will need to work on the output level for this.

Arduino audio – further Mozzi tests

A video showing an Arduino Nano running the Mozzi library, which allows sounds generated from sensors. This uses the LDR + resistor as input to Analog Pins A1 +  A2, and using the code from Arduino➞File➞Examples➞Mozzi➞03.Sensors➞Knob_LightLevel_x2_FMsynth

And here’s the attendant audio.

This week’s research – 06/04/2018

Thinking this week about echo location, in the context of the space objects ‘talking’ to each other and sensing the distances between themselves.

Found some inspiring projects in A Touch of Code.  Most notably (so far):

  • Markus Kison’s Touched Echo, using sound conducted through bones. Visitors put themselves into the place of the people who shut their ears away from the noise of the explosions. While leaning on the balustrade the sound of airplanes and explosions is transmitted from the swinging balustrade through their arm directly into into the inner ear (bone conduction).
  • WhiteVoid’s ‘unstuck’ augmented game.
  • “Experiencing Abstract Information” by Jochen Winker and Stefan Kraiss
  • And Leonel Moura’s Robotarium. The first zoo in the world for artificial life.
  • Drawing Machine  by Fernando Orellana. Explores the notion of generative art or art that makes art on its own. The piece consists of a three tiered mobile sculpture that is driven by the vibration of a motor.

  • LITERALLY SPEAKING Torsten Posselt, Martin Kim Luge – transforms tweets from twitter-users into the sound of singing birds.
  • Kathrin Strumreich’s fabric machine. Two fabric loops, driven by a motor, create a division in space. Light sensors measure the opacity of the textile.

Love the design and the sounds of these Bivalvia mini synths.

And some musical inspiration for the Space Rock objects from Hatis Noit; especially the way the first track here plays with voice – using various layers, some treated and distorted, some not.