Updated Arduino Audio Tools/AudioKit/Maximilian questions #1105
-
Is an AudioKitStream an input or an output? Or both? Thank anyone for taking the time to explain. I’ve spent countless hours mulling over the documentation, loading dozens of examples to the AudioKit, scouring YouTube and all the forums trying to apply related information from similar questions but nothing’s turning the light bulb on. I’m gonna ask a few related questions. I can split them into separate posts if necessary, but given that they’re all related, each question sort of becomes a prerequisite for the other questions. First question(s): There’s only one parameter for a stream when you define it, which is “kit”, or “out” or “in” in most of the examples I’ve tried: SineWaveGenerator<int16_t> sineWave1(32000); And all of that makes sense to me. A sound is generated, put on a stream, and the stream is sent to an output. …but in the case of sending the microphone to the output per the example: AudioKitStream kit; // Access I2S as stream How does it know that “kit” is an input or an output? If the data is already “in” kit, why does it need to be put where it already is? // Audio …now what? It’s kinda both here. In the end, “kit”’s an output from copier, but also an input when setting up the effects stream before copier ever even sees it. Where in the stream does the stream change its’ purpose from a source to a sink? Does the mic stay on the stream dry and the effect is added, or is the signal diverted to the effects and then “brought back in” processed? Most importantly to me is regarding the microphone. There doesn’t seem to be a clear way of saying “this is a microphone signal” the same way as you say “this is a generated sine wave signal” or “this is specifically the output of a filter”. Do you somehow take the “output” of the microphone and assign it to a GeneratedSoundStream? And where exactly is the mic coming from in the first place? cfg.input_device = AUDIO_HAL_ADC_INPUT_LINE2; There’s this, but how do I access it? Second question(s): Is the entire Arduino Audio Tools fully integrated and internally compatible across the board? Can I use a filter output from a Maximilian filter to input directly to a Faust pitch shifter? Can I use a microphone from the AudioKit to input to a Maximilian compressor? Can I use a streams-generator-audiokit sine wave to input to a STKchorus? Are all those things inherently “streams” of their own, or do I need to set up a stream for each? Again, thanks for any time taken to hopefully give me the “aha” moment I so desperately crave. |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments
-
It can be anything:
That's bascially a feature of I2S which can be douplex! AudioKitStream kit; // Access I2S as stream Just defines that we copy the selected input (device) from the AduioKit (e.g. microphone) to the selected output of the AudioKit (e.g. speaker) |
Beta Was this translation helpful? Give feedback.
-
Astonishing! This work you've done is absolutely jaw dropping!
Despite it's simplicity...
...in order to be fully prepared once I'm back at the workbench... I still
don't know what to put as an input replacement in
VCFout=VCF.lores(*(VCO1out+VCO2out)**0.5, ADSRout*10000, 10);//now we stick
the VCO's into the VCF,
I'm assuming the following changes to the Maximillian sketch:
#include "AudioTools.h"
#include "AudioLibs/MaximilianDSP.h"
// Define Arduino output
AudioKitStream out; // <------ change this from I2SStreamout to
AudioKitStream out
Maximilian maximilian(out);
// setup audio output
auto cfg = out.defaultConfig(RXTX_MODE); // <---- change this
to RXTX from TX_MODE
out.begin(cfg);
maximilian.begin(cfg);
//These are the synthesiser bits
maxiOsc VCO1,VCO2,LFO1,LFO2;
maxiFilter VCF;
maxiEnv V_ADSR;
...
and here's this bit I still don't understand...
VCFout=VCF.lores(*(VCO1out+VCO2out)**0.5, ADSRout*10000, 10);//now we
stick the VCO's into the VCF,
should it be:
VCFout=VCF.lores(*(input)**0.5, ADSRout*10000, 10); ???
or:
VCFout=VCF.lores(*(out)**0.5, ADSRout*10000, 10); ???
or
GeneratedSoundStream<int16_t> sound(out);
...
VCFout=VCF.lores(*(sound)**0.5, ADSRout*10000, 10); ???
Or am I still missing the point completely?
…On Thu, Dec 28, 2023 at 12:05 AM Phil Schatzmann ***@***.***> wrote:
It can be anything:
- input (=RX_MODE)
- output (=TX_MODE)
- input and output (RXTX_MODE)
—
Reply to this email directly, view it on GitHub
<#1105 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AIUOOHJ5TUQFWNYXVX74JNTYLUR27AVCNFSM6AAAAABA5Z7VPSVHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM3TSNRSG4ZTI>
.
You are receiving this because you modified the open/close state.Message
ID:
<pschatzmann/arduino-audio-tools/repo-discussions/1105/comments/7962734@
github.com>
|
Beta Was this translation helpful? Give feedback.
-
I am sorry, but I have no clue where your lines of code come from! If you are interrested in Maximilian, I suggest that you go thru the different examples that have been adapted from the original project |
Beta Was this translation helpful? Give feedback.
-
I am sorry, but I have no clue where your lines of code come from!
...I suggest that you go thru the examples
I'm so sorry I didn't specify. That code was from the examples.
The following short bit is fully functional, no problems. It generates a
square wave and modulates the filter cutoff. Sounds great! The only comment
I have is line 16, where it describes the goal of replacing the oscillator
with a microphone. How do I get the microphone "into" maximillian with
Audio Tools?
#include "AudioTools.h"
#include "AudioLibs/MaximilianDSP.h"
#include "AudioLibs/AudioKit.h"
double filtOut;
AudioKitStream out;
Maximilian maximilian(out);
maxiOsc osc, lfo;
maxiFilter filter;
void setup() {
auto cfg = out.defaultConfig(RXTX_MODE);
out.begin(cfg);
maximilian.begin(cfg);
}
void play(float *output) {
filtOut = filter.lores(osc.square(100), 2000 + (lfo.sinebuf(1.2) * 1000), 5
);
// in the line above, I want the microphone to replace (osc.square(100))
output[0] = filtOut * 0.2;
output[1] = output[0];
}
void loop() {
maximilian.copy();
}
… Message ID:
<pschatzmann/arduino-audio-tools/repo-discussions/1105/comments/7973568@
github.com>
|
Beta Was this translation helpful? Give feedback.
-
As far as I can see Maximilian does not have any input functionality, but you can just read the data from the AudioKistStream and convert it to float AudioKitStream kit;
// provides the next sample from the audiokit input
float readFloat() {
int16_t stereo[2];
int len = sizeof(stereo);
float result = 0;
// convert stereo int16_t to mono float
if (kit.readBytes((uint8_t*)stereo, len) == len) {
result = ((static_cast<float>(stereo[0]) / 32768.0) + (static_cast<float>(stereo[1]) / 32768.0)) / 2.0;
}
return result;
}
|
Beta Was this translation helpful? Give feedback.
It can be anything:
That's bascially a feature of I2S which can be douplex!
AudioKitStream kit; // Access I2S as stream
StreamCopy copier(kit, kit); // copy kit to kit
Just defines that we copy the selected input (device) from the AduioKit (e.g. microphone) to the selected output of the AudioKit (e.g. speaker)