Hello there!
So i’m new to openframeworks and have been playing around with Maximilian, building my own synth in the testproject that Mick has provided with the addon. Which worked fine and I’ve heard lots of interesting sounds!
However now i’ve come to building it as my own project i am no longer getting any sound (even with just the sine solitary oscillating sine wave), it compiles fine but no sound and I don’t know why
Can anyone help? I feel this is probably just a really dumb mistake or overlook by me but I’ve been staring at it for too long, and could use a clip round the back of the head…
Other part of the app will use ofxCV (which I have working in a separate file, but for now I would really like the audio working…
Any help would be greatly appreciated.
//header
#pragma once
#include “ofMain.h”
#include “maximilian.h”
class testApp : public ofBaseApp{
public:
void setup();
void play (double *output);
void update();
void draw();
void play(double *output);
void keyPressed(int key);
void keyReleased(int key);
void mouseMoved(int x, int y );
void mouseDragged(int x, int y, int button);
void mousePressed(int x, int y, int button);
void mouseReleased(int x, int y, int button);
void windowResized(int w, int h);
void dragEvent(ofDragInfo dragInfo);
void gotMessage(ofMessage msg);
//for synth
maxiOsc Osc1, Osc2, LFO1;
maxiFilter Fil;
maxiEnvelope ADSR;
//Envelope Values
double adsrEnv[4]={0,0.5,0.25,0};
//for left and right
double myStereoOutput[2];
//Mix for Stereo
maxiMix myOutputs;
//Controls for running synth
maxiOsc metro;
//when to trigger next beat
int currentCount,lastCount;
//synth out bits
double Osc1out, Osc2out, LFO1out, Filout, ADSRout,Freq, Rate;
////CPP BIT
#include "testApp.h"
//--------------------------------------------------------------
void testApp::setup(){
//This is where a setup would go, IF i had one.
}
//--------------------------------------------------------------
void testApp::play(double *output){
//Metronome
currentCount=(int)metro.phasor(2.3);
if (lastCount!=currentCount){
//so the metro starts from the begninning of the phasor
ADSR.trigger(0,adsrEnv[0]);
cout << "tick\n";//the clock ticks
//set the count to 0 again
lastCount=0;
}
//Synth Buildy bit
//Oscillator 1
Osc1out=Osc1.sinewave(440+LFO1out);
//Oscillator 2
Osc2out=Osc2.sinewave(220/2+LFO1out);
//LFO used to control the filter
LFO1out=LFO1.sinebuf(3);
//Filter
Filout=Fil.lopass((Osc1out+Osc2out)*0.1, 0.001);
//ADSR envelope
ADSRout=ADSR.line(4,adsrEnv);
//Using ADSR as amplitude modulator
myOutputs.stereo(Filout*ADSRout,myStereoOutput,0.5);
output[0]=myStereoOutput[0];
output[1]=myStereoOutput[1];
}
//--------------------------------------------------------------
void testApp::update(){
}
//--------------------------------------------------------------
void testApp::draw(){
}
//--------------------------------------------------------------
void testApp::keyPressed(int key){
}
//--------------------------------------------------------------
void testApp::keyReleased(int key){
}
//--------------------------------------------------------------
void testApp::mouseMoved(int x, int y ){
}
//--------------------------------------------------------------
void testApp::mouseDragged(int x, int y, int button){
}
//--------------------------------------------------------------
void testApp::mousePressed(int x, int y, int button){
}
//--------------------------------------------------------------
void testApp::mouseReleased(int x, int y, int button){
}
//--------------------------------------------------------------
void testApp::windowResized(int w, int h){
}
//--------------------------------------------------------------
void testApp::gotMessage(ofMessage msg){
}
//--------------------------------------------------------------
void testApp::dragEvent(ofDragInfo dragInfo){
}