Well, not exactly. After you obtain the absolute value of the signal, which is called a rectified signal, you need to low pass filter it out in order to make it a signal that evolves following the envelope of the original signal. Then you can use the signal as a control signal as you pointed out.
https://en.wikipedia.org/wiki/Envelope_detector <- this is the equivalent in the analog domain, diode rectifies and capacitor lowpassfilters.
Glad to hear that it helped you! Which breathe sensor are you using? I've always wanted to create a trumpet-like instrument but never known of suitable sensors... You think yours can serve that purpose?
WMXZ, dunno buddy, I call that envelope an it works for me to generate the envelope of another signal... I just linked to wikipedia for a quick-dirty illustration of the concept!
Hey! I'm using the envelope to control the bandpass frequency of the state variable filter. So it's like an auto wah. I use the effect on the synth sounds generated using the library.
I'm thinking you may want to add the '#include "effect_abs.h"' statement explicitly to your application code rather than putting it in Audio.h. If PRJC updates the library and creates a new Audio.h, then your modification will be lost.
#include "AudioStream.h"
Nice! And which is the sensor you are using to detect the breathe?
Nevermind, I just thought that as long as you wanted to monitor human breath patterns you were using some sort of sensor to do so.
Well, not exactly. After you obtain the absolute value of the signal, which is called a rectified signal, you need to low pass filter it out in order to make it a signal that evolves following the envelope of the original signal. Then you can use the signal as a control signal as you pointed out.
https://en.wikipedia.org/wiki/Envelope_detector <- this is the equivalent in the analog domain, diode rectifies and capacitor lowpassfilters.
View attachment 10313
Here's the arduino sketch that you can use as a test. It uses de signal you will input in the analog input of the teensy, gets its envelope and uses it to modulate the amplitude of a sine wave. What you should listen is the volume of the sine wave to increase as the signal volume of the breathe detector increases.
Hope it helps, and get back to me for any doubts or help you need.
Salut!
Hi Kirazvora!
I think that what you want to do is definitely possible. Your guess is right: you need to get the envelope with the abs and then the filter and then output this from the audio system to the sketch so you can put these values into a variable that is sent with usbMDI CC1. To do so input and output data from the sketch to the audio system and back again to the sketch I'm pretty sure you need to use AudioPlayQueue and AudioRecordQueue respectively. I haven't done so yet and it looks you have to deal with buffers and other stuff that might be tricky but I think that's the way to go. If needed I can try to implement and sketch with these so I learn myself how to use them!
Salut!
#include "effect_abs.h"
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>
// GUItool: begin automatically generated code
AudioInputI2S i2s1; //xy=89.88888931274414,110.66666793823242
AudioEffectAbs abs1; //xy=210,35.555556297302246
AudioFilterStateVariable filter1; //xy=350.00002670288086,38.88889026641846
AudioFilterStateVariable filter2; //xy=354.44444274902344,110.00000381469727
AudioOutputI2S i2s2; //xy=528.2222518920898,57.33333969116211
AudioConnection patchCord1(i2s1, 0, abs1, 0);
AudioConnection patchCord2(i2s1, 0, filter2, 0);
AudioConnection patchCord3(abs1, 0, filter1, 0);
AudioConnection patchCord4(filter1, 0, filter2, 1);
AudioConnection patchCord5(filter2, 1, i2s2, 0);
AudioControlSGTL5000 sgtl5000_1; //xy=716.5555725097656,208.22222709655762
// GUItool: end automatically generated code
void setup() {
AudioMemory(60);
filter1.frequency(1.0);
filter2.frequency(600);
filter2.resonance(5);
filter2.octaveControl(7);
}
void loop() {
}