Trying to achieve midi in to pure data stream #1658
simmit123456789
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi I've been attempting midi in with pure data stream. I have no idea if I'm getting close as I don't have much coding experience. I'm getting stuck with this error-expression list treated as compound expression in initializer [-fpermissive]
code I'm trying below. would be amazing if someone who knows anything could have a look :)
#define SAMPLE_RATE 44100
#define HV_HASH_NOTEIN 0x67E37CA3
#include "AudioTools.h"
#include "AudioLibs/I2SCodecStream.h"
#include "Heavy_miditest.hpp"
#include "Heavy_miditest.h"
#include "AudioLibs/PureDataStream.h"
#include "Midi.h"
AudioInfo info(SAMPLE_RATE, 2, 16);
Heavy_miditest pd_miditest(SAMPLE_RATE);
PureDataStream pd(pd_miditest);
I2SCodecStream out(AudioKitEs8388V1);
StreamCopy copier(out, pd);
MidiCallbackAction action;
MidiStreamIn in(Serial, action);
void onNoteOn(uint8_t channel, uint8_t note, uint8_t velocity) {
bool hv_sendMessageToReceiverV(HV_HASH_NOTEIN, 0, "fff",
(float) note, // pitch
(float) velocity, // velocity
(float) channel);
}
void onNoteOff(uint8_t channel, uint8_t note, uint8_t velocity) {
bool hv_sendMessageToReceiverV(HV_HASH_NOTEIN, 0, "fff",
(float) note, // pitch
(float) 0, // velocity
(float) channel);
}
void setup() {
srand(time(NULL));
pd.begin();
auto cfg = out.defaultConfig();
//cfg.sd_active = false;
cfg.copyFrom(info);
out.begin(cfg);
Serial.begin(119200);
action.setCallbacks(onNoteOn, onNoteOff);
}
void loop() {
copier.copy();
if (!in.loop()){
delay(10);
}
}
Beta Was this translation helpful? Give feedback.
All reactions