Generating midi notes through an Arduino DIY Motion Sensing Device
Hi,
I just watched this very interesting feature:
Controlling Ableton Live with a DIY Motion Sensing Device
(link : https://www.youtube.com/watch?v=0Qg0Jkq9BHQ )
I was wondering if there is a device in Max for live that could generate midi notes
through the trigger of that Arduino DIY Motion Sensing Device. This would give the freedom
to play/turn on and off a sample -that would have been loaded in Ableton's Sampler for example-
with a single gesture. It could get even more interesting if there were two or three
Arduino's hooked through a usb hub so i can get 2-3 triggered samples (or even more
, regarding to the corresponding midi notes) by hovering my hand over the Motion Sensing Device(s).
Any thoughts?
One arduino alone can work with multiple sensors.
Also other sensor types could be used instead of motion sensor.
By the way thing used on the link posted is Ultrasonic Sensor HC-SR04.
Motion Sensor (PIR) is something else.
I would prefer hall sensor and put magnetic ring on my finger
or something similar.
OH49 (SS49E etc) analog hall sensor would cost nothing, one can get 10 pack for 1 Euro or less.
Arduino Nano with 8 analog inputs + 8 Sensors all together 4 Euros.
And it needs no extra components.
There are many tutorials about hall sensors,
but it is all too simple to loose time reading all that.
Simply - analog hall sensor reacts to magnetic field and outputs analog voltage
depending on magnetic field strength.
![](https://cycling74-web-uploads.s3.amazonaws.com/58ed04e7285705c15ccfa694/2019-12-21T13:37:41Z/Nano-Hall-Sensors.png)
Thanks for the information regarding an alternative sensor. I think that the hall sensor would be preferable.
My problem now is not the type of sensor that much as the function that i would like it to influence on Ableton:
I would like to load a different sample on each note or a group of notes (zones) throughout the whole midi note range, that is a common function of ableton's sampler and then activate each zone or note through movement. I have many 1-3 secs long samples that i would like to be activated through sensors. It would work perfectly for a dark room audio installation where the guest moves hands touching the (fake) walls (where the sensors are located) and while searching in the dark he is activating various samples. In short, i am looking for the Max for Live device that would do that sample activation through an arduino sensor.
Any idea?
I am no fan of ableton at all, and don't use Live.
That's why I can't help You directly with that,
I have no infos or interest in Live devices...
But conversion: Sensor Value to midi should be easy thing to do in max patch.
That is a trivial task. You can emulate it using anything,
like keystrokes replacing sensor triggers...
To come back to the sensors, hall sensor would only
work if one places magnet close to it.
If You don't want to stick magnets to people,
You need some alternatives, like touch sensors
or piezos used as knock sensors, even IR sensors etc.
Hi,
thanks for the reply. All i want is what you described above regardless Ableton.
I am a rookie regarding max and i will need a lot of help in order to get ''Sensor Value to midi '' as you pretty well pointed it out above. This is why i am leaning more towards M4L . Could you please direct me to the most user friendly start up in max so i can get keystrokes that will contain wav samples through sensor triggers?
Hi, if You know what notes are assigned to the samples,
than it is easy.
You can use anything to trigger a midi note.
I am not sure what You mean by
"keystrokes that will contain wav samples through sensor triggers"
I just meant that before starting with arduino, sensors etc,
one could first organise the sampler, check what notes or note range to use,
and then use keystrokes on the computer keyboard to simulate infos
that would otherwise come in from arduino.
As You are limited to let's say 8 sensors, You could use
numeric keys 1 - 8 for example.
Than one could assign several notes to one key, so that each
press would trigger next note in the list.
Or even randomise a range of notes per key.
Just an idea...
Now I need some info from You to continue :
1- do You want the trigger to just start the sample and let it run,
like one shot sample, or should trigger start and stop samples
like real midi keyboard ?
2- in case something like I suggested - like having a list of notes
on a single trigger, should all samples sound till their end, or
should each new triggered note stop previous sample ?
You see one allways have to make some decisions.
It also has to do with sensors that would be finally used.
Would they be capable of sending different values,
like distance or magnetic strength, or just send a trigger,
or a simple on/off switch ?
That would also dictate if one can use velocity
and note off, or just sample start.
-----------
So to resume, post a plan of what exactly would be
the best choice, that would make it easier to make choices,
in terms of sensors and sample playback.
----------
Here is a maxpatch with few examples :
Hi, thanks for the patch. It is kind of related and your info above helped me realise my project in more precision, so I can describe it in more precision:
My arduino nano ch340 is hooked with an ultrasonic range finder HC-SR04. Imagine an audio player that contains a list of 100 audio samples no longer than 5 secs each duration wise. Every time that my hand comes within the range of 30 cm that is the range that HC-SR04 receives signal, I would like a sample to be played through a max audio player in random mode. Each triggered sample should play till the end -one shot sample-(each of those samples will be 5 secs the longest), with a pause of 3 secs in between the next sample (supposing that my hand is still within the range of HC-SR04).
If the above setup: ‘’Arduino Nano ch340-HC SR04 sensor -max random wave files player’’ will be successful, then the next step would be to connect more HC SR04 sensors on the arduino nano so I get more triggers for the max random wav player. Ideally I would like to involve 3 sensors that are installed in 3 different walls of a small dark room. The guest comes in a small dark room where he is touching the walls (while exploring the surfaces) causing sound emission through an undercover sound system.
I see, that's good infos.
To make sure :
When sensor gets activated ( let's call it switched on)
1st random selected sample will start to play.
If it comes to it's end and sensor is still on, after 3 seconds next
random sample will start to play.
Sensor Off does not stop the playing sample
That's all clear.
I will post You a pach tomorrow, now I am on the run...
Here is max patch doing what You wanted.
first select folder with samples.
That will load umenu with samples and set maximum random number size for urn.
The rest looks maybe a bit complicated, but it just does the following :
each player has current playback position output and playback done bang.
both things control gates which enable / disable input from sensor triggers
and 3000ms delayed Auto Play Next.
While playback is running and Sensor is HIGH , retrigger is disabled and
playback end bang -> delay of 3000 ms to Auto Play Next sample is active.
If Sensor is LOW, playback continues to the end, but auto next is disabled.
I think that was what You wanted.
------------
Next step would be to make 3 sensors with arduino, sending only
Sensor States HIGH or LOW, replace keystrokes with serial object
and make Max Standalone app, which also means
automating file path to Samples Folder, initialising DSP etc etc.
Do You have arduino code for 3 sensors that works ?