Problem with the ADSR

325 views
Skip to first unread message

Levi

unread,
Jun 15, 2014, 3:07:32 PM6/15/14
to mozzi...@googlegroups.com
Dear Tim
I am attempting to create a little synth with 13 capacitive sensors instead of a midi keyboard, with different wavetables, a Lfo and a cutoff but my ADSR sounds just awful and even though I have a boolean it triggers all the time. The second problem is that the Arduino always stuck when the lowpassfilter has the cutoff frequency 0 and I don`t know why. You may have a look on the sketch?

thanks in advance 
levi
Capacitive_Synth.ino

Levi

unread,
Jun 16, 2014, 11:08:14 AM6/16/14
to mozzi...@googlegroups.com
Ok I managed to fix the lpf, just had to reduce the output. And I replaced the lfo with a tremolo effect because this works better, but I still have the problem with the adsr, do I have to integrate 13 different envelopes?
Capacitive_Synth.ino

Tim Barrass

unread,
Jun 17, 2014, 8:05:03 AM6/17/14
to mozzi...@googlegroups.com
Hi Levi,

One ADSR should be OK for monophonic.

>  ADSR... triggers all the time
do you mean every updateControl()?
Do you need to re-set the ADSR params every updateControl()?  It should be OK the way it is, but worth testing perhaps just doing it once in setup()..

Does the frequency code all work OK without the ADSR?

There's a chance that the capacitive sensor code is blocking the processor which could cause glitches, with lots of them being tested each updateControl().
I've attached a class called RCpoll which used to be in Mozzi (though I can't remember if I ever released it), and a demo sketch for it, to do non-blocking capacitive sensing.  The object can be polled in updateControl(), or in updateAudio() if updateControl() is too slow (or increase CONTROL_RATE).

>the Arduino always stuck
not sure what you mean..


 >when the lowpassfilter has the cutoff frequency 0
the docs for LowPassFilter say "Be careful of distortion at the lower end, especially with high resonance"
http://sensorium.github.io/Mozzi/doc/html/class_low_pass_filter.html#ad7958bf53ac1c24b5653861ed521ed14
- maybe that's what's happening?

I might be able to (try to) help a bit more with some more info - I can't test with hardware at the moment as I'm traveling for the next few weeks.

Tim




--
You received this message because you are subscribed to the Google Groups "Mozzi-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mozzi-users...@googlegroups.com.
To post to this group, send email to mozzi...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/mozzi-users/9de396d6-53d7-4544-8176-36a32f7e7952%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

RCpoll.h
RCpoll.ino

Levi

unread,
Jun 17, 2014, 12:54:08 PM6/17/14
to mozzi...@googlegroups.com
I fixed the problem with the lpf. But it`s really strange with the adsr, I believe it has something to do with the Control_Rate, but when I put the control rate from 64 to 128 nothing happens anymore and a noise comes out of the speakers. I also tried it with only one sensor (attached sketch) there it works perfect but only on a control rate of 128. Any idea why? Maybe because of the tremolo?
Have a nice trip^^
Levi


Adsr2try.ino
Capacitive_Synth.ino

Tim Barrass

unread,
Jun 19, 2014, 6:23:44 AM6/19/14
to mozzi...@googlegroups.com
Hi Levi,
I've attached a version of the ADSR triggering sketch which works using the RCPoll object, which is included in the sketch.  The CapacitiveSensor library disables interrupts while it senses, which won't work with Mozzi.  RCPoll counts how long the pin change sensing takes, either in updateControl() or updateAudio(), each time it is called without blocking the processing.  If you need better resolution, call RCPoll::next() in updateAudio().  As it is, this version works with a 180k resistor between the sensor pin and ground, and a loose wire used as a sensor.  You could try different resistors to see what happens, and print out the values to check.  The more complex RC circuit would probably be even better.
This version checks to avoid constnatly  retriggering the ADSR while the sensor is "on".
I fixed some of the variable sizes which were too small for the numbers you were using, and made it a tiny bit more efficient by using local variables where appropriate.
I also changed the ADSR to interpolate at AUDIO_RATE for smoother audio.
Good luck with adapting this for multiple sensors, it will certainly be possible to work correctly (famous last words).
What you are doing seems quite similar to the keyboard on Ototo https://www.kickstarter.com/projects/905018498/ototo-make-music-from-anything?ref=category - those people are making a small fortune on the back of Mozzi!  Are you part of that project?

Tim



--
You received this message because you are subscribed to the Google Groups "Mozzi-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mozzi-users...@googlegroups.com.
To post to this group, send email to mozzi...@googlegroups.com.
Capacitive_Trigger_ADSR.zip

Levi

unread,
Jun 24, 2014, 12:31:08 PM6/24/14
to mozzi...@googlegroups.com
Thank you very much for the help, I will try this out. And no I`m not from ototo, I`m doing this as a school project, experimenting with capacitive sensor, trying to create something usable.

Levi


Am Sonntag, 15. Juni 2014 21:07:32 UTC+2 schrieb Levi:
Reply all
Reply to author
Forward
0 new messages