Giter Club home page Giter Club logo

ofxpdsp's Introduction

ofxPDSP

ofxPDSP is an openFrameworks addon for audio synthesis and generative music. It is based on those design principles:

  • Native c++, made to be tightly integrated into c++ projects.
  • Class design mimics modular synthesizers, where inputs and outputs are patched with the >> operator.
  • Sample accurate timing for the included sequencer.
  • Thread-safe, lock-free methods for metering and control.
  • Lazy evaluated DSPs. DSP units are recursively processed in chunks big as the audio buffer size, DSPs switch between routines running at audio rate (process every sample) and control rate (once every buffer) on the fly when the result is the same. DSPs are also coded using SIMD instructions when possible.
  • Cross-platform code: works on Linux (x86/ARM), OSX, Windows, iOS, Android (only on ARM processors with NEON instructions).

It includes a good selection of modules ready to be used, like antialiasied oscillators and VA filters, an FFT convolver, analog-sounding envelopes, a delay, a noise generator, a sampler and a graincloud module, biquad equalizers (normal and 2x oversampled), modules for dynamic processing, units for oversampling/downsampling and a framework for writing and sequencing generative music. On top of that some other classes that uses openFrameworks for adding midi and OSC in/out, serial output, sequencer monitoring, waveform plotting and scopes, other audio addon wrapping and ofParameter-compatible control.

Documentation

Here is the reference page for a selection of the most high level classes and function (probably you won't ever need more than that).
To learn how to use ofxPDSP also be sure to check out all the included examples, starting from the basics.

Dependencies

ofxPDSP requires the latest stable or master release of openFrameworks, ofxMidi, ofxAudioFile and ofxOsc.

Examples

Check out the videos of some included examples:

ofxPDSP example-scoring4-wolfram-dub

ofxPDSP example-graincloud

ofxPDSP example-midi_polysynth

ofxPDSP example-scoring3-masterplan

ofxPDSP example-serial-arduino

ofxPDSP example-data-to-wave

License

Nicola Pisanti, MIT License 2016-2018.
For FFT the AudioFFT wrapper is used, Copyright (c) 2013 HiFi-LoFi.

ofxpdsp's People

Contributors

macfurax avatar macramole avatar npisanti avatar potrepka avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ofxpdsp's Issues

can't compile on MAC OSX for Iphone

Hello,

Example run without problem on Mac, but when I try different way to run your lib on my Ipad, he definitely have a Apple Mach-O Linker Error.

ld: warning: directory not found for option '-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks'

My specs : macOS 10.12 / Xcode 8 / OF101 / Target ios 10

My project run with ofxMidi, ofxOSc etc.. Every dependency working great, but when i add ofxPDSP via Projet generator, i can't run it.

Any idea ? Is there a software uncompatibility (Need Xcode 10, updated Framework...) ?

Thanks for your help and thanks for your fantastic work !

error in example_wavesynth_pc_keys

Hello,
there is an error in error in example_wavesynth_pc_keys, it only outs one channel.
I found the error, it's in synth.cpp

it's because of this line:
chorus.ch(1) >> gain.ch(0);

it must be:
chorus.ch(1) >> gain.ch(1);

I also noticed that the midin selection of port does not implement the port selection by name as in ofxmidi.
For selection of audio device, I also had some issues. It works perfect for my external soundcard but with my (old 2009 beginning) iMac it apparently doesn't for the internal audio device. I can't if it's specific for this model or to all macintosh's computers.

Best Regards,
Loïc

ToGateTrigger to float number

Hi, i'm trying to get a trigger from an audio signal and reading the trigger as 0/1 float number.

This is what i have:

pdsp::FullWavePeakDetector  peakDetector;
pdsp::EnvelopeFollower      follower;
pdsp::ToGateTrigger         toTrigger;
pdsp::ValueControl          thresh_ctrl;

// then in setup()

thresh_ctrl >> toTrigger.in_threshold();
thresh_ctrl.set(0.5f);
thresh_ctrl.enableSmoothing(10.0f);

audioIN >> peakDetector >> follower >> toTrigger;

// then in update

printf("Trigger: %f", toTrigger.meter_gate());

But is not working (always zero). Can you tell me what i'm doing wrong?
Maybe the patch is not correct?

Thank you in advance!

is_playing() returns false when sampler plays in reverse

is_playing() does not return true if a sample is being played in reverse.

Playback is reversed like this:

-1.f >> in_direction();
1.f >> in_start();

Sound plays correctly from the last sample to the first one but is_playing() always returns false.

UI problems on linux

Having a bit of an issue getting the any of the example ui to work. any idea what might be causing this?
screenshot from 2017-11-30 02-13-04

Having problems building ofxPDSP on windows 10

Ive believe I've got the correct dependencies, but I keep getting some linking error (windows 10) in visual studios. Im running the openframeworks v11.0 and the latest versions of ofxPDSP and ofxAudioFile.

Just wanted to see if this looked familiar or if there were any fixes for it.

Problem:
image

Here are my addons:
image

I can build my project if I remove ofxPDSP. It seems like other users are able to get this working on mac, but I am having no luck on my machine.

Any help is appreciated!!
Thanks!

Polyphonic sequences

Hello. Ive been using the lib for a few motnths and it sounds good.
BTW i dont figure out how to perform polyphonic melodies with sequencer objetct. The examples just cover "midi imput" and "keyboard" polyphonic output but not sequencer ones.
It is possible?
Thanck you!
Luigi

not an issue... looking for a good example to make a (params/mouse controlled) step sequencer...

hey I am trying to replace a timer based step sequencer like https://github.com/genekogan/ofxSequencer, because of the unstable and drifting clocking.

Screen Shot 2019-05-05 at 15 21 01

This addon have a clicking system to fill the square steps (bool/int/float ofParameters), but it's a little tricky and maybe I'll like to use ofxGuiExtended from scratch for that.

So I thought to use the PDSP engine just to replace the timer clock for the one from audio buffer engine:
( https://forum.openframeworks.cc/t/accurate-sequencing/3404/16 )
( https://forum.openframeworks.cc/t/music-sequencer-bpm-slightly-off/25067/2 )

So I would like to know what's a good point to do this from your examples.
I build all the scoring/sequencer examples. I have seen maybe this one as a good 'template': example_sequencing5_passing_data
There are also this ones from your np-patches (but they are not compiling now..):
Euclidean : euclidean rhythm generator
Tracker : file based tracker with probability for each step

Any suggestions are appreciated. Cheers

Use map instead of vector for MidiControls

@npisanti I've rewritten the

MidiControls
and
MidiCCBuffers
classes to use maps instead of vectors to store MessageBuffer and SequencerValueOutput in order to avoid the awkward range-based allocation of buffers. Good idea?

The change renders

getMaxCCNum
and
setMaxCCNum
irrelevant and deprecated. Let me know if you'd like me to make a pull request.

example-midi_polysynth crashes when releasing a key while more than 4 keys are hold

steps to reproduce:

  1. press and hold more than 5 keys at the same time
  2. release one key

the app crashes at the function: ofxMidiKeysBuffers::processPolyMidiNoteOn

it crashes at the line:
notes[i].note == noteNumber

when accessing notes[4], while there are only 4 notes

Also, sometimes there are stuck notes with very light volumes...

[help] - audio input to frequency

hello!

I'm having trouble trying to pass frequency from audio_in to a synth.

    engine.audio_in(0) >> synth.voices[0].in("trig");
    float pitch = 80.0f; // how can I get this value from audio_in?
    pitch >> synth.voices[0].in("pitch");

// something like this, but its not working :/
    //engine.audio_in(0)  >> freqToPitch >> synth.voices[0].in("pitch");

can someone help me or point a direction?

thanks

Move constructors

I've run into some cases where I need to implement a move constructor, namely, when there is a vector to be resized. Here are some examples:

pdsp::PatchNode::PatchNode(PatchNode && other) noexcept
: output(other.output) {
    other.output.buffer = nullptr;
    other.output.state = Unchanged;
    addInput("patch", input);
    addOutput("patch", output);
    updateOutputNodes();
    input.setDefaultValue(0.0f);
}
pdsp::ExternalInput::ExternalInput(ExternalInput && other) noexcept
: buffer(other.buffer), output(other.output), inputUpdated(other.inputUpdated) {
    other.buffer = nullptr;
    other.output.buffer = nullptr;
    other.output.state = Unchanged;
    other.inputUpdated = false;
    addOutput("signal", output);
    updateOutputNodes();

    if (dynamicConstruction) {
        prepareToPlay(globalBufferSize, globalSampleRate);
    }
}

@npisanti Can I get your opinion on if I'm doing this correctly, and if everything looks good, should I go ahead and submit a pull request, or multiple pull requests?

Long compilation on raspberry pi

Could the includes be structured differently to decrease complication time, for example I need to include ofxmidi even when I don't use MIDI, I also see all of the possible modules getting compiled when I know I am only using a single oscillator. I am guessing this is difficult. It is ok on my windows machine, but compiling on raspberry pi takes a really long time for something not so complex. I also feel it slow down code sense (or whatever it is called there) in Xcode.

Crashing when adding multiple effects

Hi, long time since my last message. I hope everything is ok.

I have an array of Patchable called effects where each one is actually an effect (BasiVerb, VAFilter, etc). So it represents a "daisy chain" of effects.

I'm adding and removing effects on the fly and when adding I experiment random crashes. My guess is some method I'm using is not thread safe.

The code is pretty simple:

void AudioEffects::addEffect(EffectUI *newEffect)
{
    effects.push_back(newEffect);

    if ( effects.size() == 1 ) {
        nodeIn0.disconnectOut();
        nodeIn1.disconnectOut();
        nodeOut0.disconnectIn();
        nodeOut1.disconnectIn();

        nodeIn0 >> effects[0]->channelOut(0) >> nodeOut0;
        nodeIn1 >> effects[0]->channelOut(1) >> nodeOut1;
    } else {
        int last = effects.size() - 1;
        effects[ last - 1 ]->disconnectOut();
        nodeOut0.disconnectIn();
        nodeOut1.disconnectIn();

        effects[ last - 1 ]->channelOut(0) >> effects[ last ]->channelIn(0);
        effects[ last - 1 ]->channelOut(1) >> effects[ last ]->channelIn(1);

        effects[ last ]->channelOut(0) >> nodeOut0;
        effects[ last ]->channelOut(1) >> nodeOut1;
    }
}

nodeIn0 and nodeIn1 are just PatchNodes.
AudioEffects is also a Patchable and is part of a larger pipeline that includes two Samplers and multiple Amps

I've tried:

  • unpatching everything and then patching again
  • stopping audio engine and restarting. This prevent crashes but has two issues: a short hiccup and JACK being disconnected and connected causing manually set "virtual cables" to not reconnect.

I hope you can point me in the right direction, thanks

pdsp::PatchNode error on creating var [WINDOWS]

Hi,
i'm having a weird crash trying to create some pdsp::PatchNode variable at startup; i'm using those variables as temporary links to audio streaming inputs/outputs, so i can connect/disconnect whatever.

So this is happening only on Windows, the exact same code is perfectly working on osx/linux!

I have somewhere in the setup:

pdsp::PatchNode tempPN;
this->pdspOut[i] = tempPN;

So just creating PatchNode vars and storing it in a vector, just that is causing the crash!

Even:

pdsp::PatchNode tempPN;
//this->pdspOut[i] = tempPN;

is crashing, so basically the culpable line is the pdsp::PatchNode tempPN; ????

Probably it must be related with something low level that i'm not aware of, so if you can shine a light for me, it would be really appreciated!!

Thanks in advance!

No Audio input ?

I'm trying the example_analysis on os X (10.12.6) and the build-in input. Everything seem to be ok on the console, but I do not see anything on the scope :

[notice ] ofSoundStreamListDevices: 
[Unkown API: 0] Apple Inc.: Built-in Input [in:2 out:0] (default in)
[Unkown API: 1] Apple Inc.: Built-in Output [in:0 out:2] (default out)

[notice ] [pdsp] engine: starting with parameters: buffer size = 512 | sample rate = 44100 | 1 inputs | 0 outputs

[notice ] [pdsp] engine: started | buffer size = 512 | sample rate = 44100 | 1 inputs | 0 outputs

Here is the content of the setup() :

    engine.listDevices();
    engine.setDeviceID(0);
    //engine.setInputDeviceID(0);
    engine.setChannels(2, 0);
    
    // patching the scope
    engine.audio_in(0) >> scope >> engine.blackhole();

How to access raw soundstream data from input?

Hi

I really like this library, I've been patching some devices to generate some sounds but I'm still struggling how to link my own audio analyzer to one of the ofxPDSP inputs. I think I'm missing something to continue. Can you help out?

I've created my own AudioAnalyzer class that analyzes the raw float data from an ofSoundStream. But since ofxPDSP registers both an input and output stream, I need to be able to get the raw float data from the inputStream in ofxPDSP (it's currently a private variable).

Normally I do this:

  // setup audio device input
  soundStream.setDeviceID(AUDIO_IN_DEVICE_ID);
  soundStream.setup(NUM_CHANNELS_OUT, NUM_CHANNELS_IN, SAMPLE_RATE, BUFFER_SIZE, NUM_BUFFERS);
  soundStream.setInput(this);

  // analyzer setup
  audioAnalyzer = new AudioAnalyzer();
  audioAnalyzer->setup(&soundStream);

and then I pass the float data to my analyzer like this:

void AudioManager::audioIn(float *input, int bufferSize, int nChannels) {
  audioAnalyzer->analyze(input, bufferSize, nChannels);
}

But now I'm using ofxPDSP for both in and output:

  // setup the audio output engine
  engine = new ofxPDSPEngine();
  engine->setDeviceID(AUDIO_DEVICE_ID);
  engine->setup(SAMPLE_RATE, BUFFER_SIZE, NUM_BUFFERS);

But how do I link the input of ofxPDSP to my audio analyzer? I can't seem to access the raw input data. Do I need to pass the audio_in through another device or something?

Thanks for your help!

Selecting hardware API for output

Hi, I really love this addon, I am having a lot of fun with it and have used it for a great project. I have a one request, on windows I need to be able to select the API to get my output working (I think this is because I have asio4All. It would be convenient to somehow expose the API setting that soundstream has from your engine.listDevices() and engine.setDeviceId() functions, I am guessing this is also useful on linux.

Implementing a kick synth

Hi, i'm trying to implement a basic kick synth, i'm following this:

Sin título

and this is what i'm using:

pdsp::Amp                     amp;
pdsp::FMOperator        osc;
pdsp::Saturator2           drive;
pdsp::VAFilter                filter;
pdsp::ADSR                   ampEnv;
pdsp::ADSR                   modEnv;

pdsp::ValueControl       osc_freq_ctrl;
pdsp::ValueControl       filter_freq_ctrl;
pdsp::ValueControl       filter_res_ctrl;

and

    osc_freq_ctrl >> osc.in_pitch();
    osc_freq_ctrl.set(pdsp::f2p(oscFreq));
    osc_freq_ctrl.enableSmoothing(50.0f);

    filter_freq_ctrl >> filter.in_pitch();
    filter_freq_ctrl.set(pdsp::f2p(filterFreq));
    filter_freq_ctrl.enableSmoothing(50.0f);

    filter_res_ctrl >> filter.in_reso();
    filter_res_ctrl.set(filterRes);
    filter_res_ctrl.enableSmoothing(50.0f);

    pdsp::VAFilter::LowPass12 >> filter.in_mode();

    osc >> amp;
    gate_ctrl.out_trig() >> ampEnv.set(0.0f,240.0f,0.0f,0.0f) >> amp.in_mod();
    gate_ctrl.out_trig() >> modEnv.set(0.0f,15.0f,0.0f,0.0f) * osc_freq_ctrl.get() >> osc.in_pitch();

    amp >> filter >> drive >> engineOutput;

Now, the basic concept is working, but the sound is still lacking power/richness, can you give me some clues for a more professional result?

I know it's not a code related issue, sorry for that, but any help will be really appreciated!

If you're interested, i've implemented all this modules from your addon for the Mosaic software:

Sin título2

and this is a simple patch with some of them ( i'm finishing a refactoring to imgui so they are not all already ported )

mosaicScreenshot_200904

Anyway, thanks in advance!

Sequencer step time glitch

Hi, i've stepped in some problem with the sequencer, while using it triggering sample files sometimes it seems like the timing was slightly off. so i tested the step time with this code:

// ofApp.h


pdsp::Function                                seq;

std::atomic<int>                              step_millis;

std::chrono::steady_clock::time_point         clock_begin;
std::chrono::steady_clock::duration           time_span;


// ofApp.cpp

//--------------------------------------------------------------
void ofApp::setup(){

  engine.sequencer.setTempo( 108 );

  seq.code = [&]() noexcept {

    time_span = std::chrono::steady_clock::now() - clock_begin;
    clock_begin = std::chrono::steady_clock::now();

    step_millis = static_cast<int>(floor(double(time_span.count()) * 1000 * std::chrono::steady_clock::period::num / std::chrono::steady_clock::period::den));

  }

  // ............

}

//--------------------------------------------------------------
void ofApp::draw(){

  // ............

  ofSetColor(255);
  // printing out the instructions
  string info = "master playhead (bars): ";
  info += to_string( engine.sequencer.meter_playhead() );
  info += "\nStep Time (ms) "+to_string( step_millis );
  info += " \n";
  info += "space : pause/play.\n";
  info += "s : stop.\n";

  ofDrawBitmapString(info, 50, 50 );


  // ............

}

As you can see in the animated gif ( slo-mo ), the step time is around 138/139 millis, perfect
for 108 BPM ( 60000 / 4 / 108 ), but you can see the "glitch" around master playhead at 3.38 ( step 7 of 16 ),
where the step time goes down to 116 ms, and then come back to the correct 138 ms

It occurs along the time with no regular pattern, at least for what i've observed.

Please tell me if i've done something wrong or i'm not considering some basic issues.
And if not, where can i look to find the reason for that, and maybe fix it?

Thanks a lot for your amazing code!

[question] What's the more recent/recommended AudioAnalyzerBand from your repositories?

hey @npisanti ,
Thanks for all this amazing work.

I am looking for a simple FFT band analyzer. I looked into your repositories and I see different versions and I want to know which one is these are the more recently updated or recommended:

https://github.com/npisanti/ofxPDSP/tree/master/example_analysis/src
https://github.com/npisanti/np-patches/tree/master/example_analyzer
https://github.com/npisanti/np-analyzer

For the moment I do not need other ofxPDSP features, so maybe I can try other alternatives if you think preferable.

undefined reference to SynthVoice::synthUI on example-midi_polysynth

Hi! I try to compile the midi_polysynth example on QTCreator with openFrameworks 0.9.3 (from GitHub) and I get:

/home/xxx/src/openFrameworks/addons/ofxPDSP/example-midi_polysynth/src/ofApp.cpp:73: error: undefined reference to `SynthVoice::synthUI'

Did I do something wrong, or is there a bug somewhere? Cheers!

getters from sequence at trigger time

Hello!
I am trying to get some value generated with a lambda function to setuo another lambda for another seq.""" At trigger time.""" Is this possible??

I am having a lot of fun with this
Thanck you.

MidiKeysBuffer keeping highest and lowest note

@npisanti

The following code on line 272 of ofx/helper/MidiKeysBuffer.cpp feels arbitrary and is actually problematic for me, since it clashes with how external plugins treat MIDI note stealing.

                for(int i=0; i(notes.size()); ++i){
                        if(notes[i].notehighest){
                                highest = notes[i].note;
                                indexHighest = i;
                        }
                }

Vote to remove? Would like to hear your thoughts. Having it commented out locally works for me, too.

Pattern abstraction?

Hi, first of all, thank you very much for this gem! What a piece of nice work, really... Well documented and with examples provided, it's quite easy to pick up.

That brings me to following question: apart from code I have stumbled upon in 'sequencing4 passing data' example, I could not find any other feasible way to load patterns to sequencer.

I guess your answer will be "roll your own" but I just wonder if there's other way how to go about this or if you have any other abstraction that you could point me towards (as I might missed something, somewhere, somehow...)

Cheers

Martin

error messages

hi i've succesfully compiled the examples but they don't seem to work. i got errors like these

RtApiCore::getDeviceInfo: system error (CoreAudio unknown error) getting sample rate info.

RtApiCore::getDeviceInfo: system error (CoreAudio unknown error) getting sample rate info.

[notice ] ofSoundStreamListDevices:
[0] Apple Inc.: Built-in Microphone [in:2 out:0] (default in)
[1] Apple Inc.: Built-in Output [in:0 out:2] (default out)
[2] globaldelight: BoomDevice [in:2 out:2]
[3] ma++ ingalls for Cycling '74: Soundflower (2ch) [in:2 out:2]
[4] ma++ ingalls for Cycling '74: Soundflower (64ch) [in:64 out:64]
[5] Apple Inc.: After Effects 11.0 [in:0 out:0]
[6] Apple Inc.: Premiere Pro 6.0 [in:0 out:0]

[ error ] RtApiCore::probeDeviceOpen: the device (0) does not support the requested channel count.
[pdsp] engine: started | buffer size = 512 | sample rate = 44100 | 0 inputs | 2 outputs

VAOscillator pitch frequency

It seems that the pitch for the VAOscillator is given as MIDI values (that is not indicated in the doc..). How to set it as frequencies in Hertz ?

Error when quitting application!

Hello.

Everything seems to work fine up until now, but found a bug when I quit the compiled application, either by the ESC key binding or by clicking the x in the window. The bug appears in BasicNodes.cpp, node->removeInputUnilateral( *this ); with the following warning: Thread 1: EXC_BAD_ACCESS (code=EXC_I386_GPFLT)

void pdsp::OutputNode::disconnectAll() {

    for( InputNode* &node : outputs ) {
        node->removeInputUnilateral( *this );
    }
    connections = 0;
    state = Changed;
    outputs.clear();
}

Any idea on how to solve this when I quit the application, without calling a specific audio kill function in the openframeworks core code? Thanks!

Trouble integrating with ofSoundplayer raspberry pi, song player example.

Hi, I have trouble integrating this addon with ofSoundplayer on Raspberry pi, I did not test all cases, but when I am using a grain cloud. I cannot load any samples with sound player once grain cloud is loaded. I looked at the song player example, as I can initialize a sound stream engine once for all ofxPDSP objects and I am guessing this is the issue, that on the pi each object wants to take control of the audio hardware. So far so good, when I look at the pattern you created in the song_player example it is reasonable simple. but for this task I need to know where I am playing at any current time with from an audio file player like in song_player_example. I exposed the sampler1.meter_position(); from the AudioPlayer class that you made for the example but I only get 0 back when I call that method. Is this the correct approach? Is there something wrong with this method that it returns 0 all the time? If this compatibility between ofSoundPlayer and ofxPDSP (on Raspberry pi) is not just a mistake I am making it would be great to be able to use ofxPDSP as a drop in replacement, so have a way to replicate all the methods would be amazing.

Anyway, it would be great to know at which points I am messing up or encountering an actual error. Cheers

PitchToFreq class

If I want to use only frequencies, not pitches, do I have to change the source code of the VAOscillator class? In this case, editing the functions of the PitchToFreq class?

If anyone can help me I appreciate it.

rafa

error C2039: 'to_string': is not a member of 'std'

Hi,
I'm trying to compile a new project using ofxPDSP that is an exact copy of 'example_sequencing1". I am using OF 0.11.0 on Windows 10 with Visual Studio 2017.

When I try to compile the program I get the errors:

`1>C:\Users\Edward\Documents\of_v0.11.0_vs2017_release\addons\ofxPDSP\src\sequencer\Function.cpp(74,32): error C2039: 'to_string': is not a member of 'std'

1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.23.28105\include\random(27): message : see declaration of 'std'

1>C:\Users\Edward\Documents\of_v0.11.0_vs2017_release\addons\ofxPDSP\src\sequencer\Function.cpp(74,41): error C3861: 'to_string': identifier not found

1>C:\Users\Edward\Documents\of_v0.11.0_vs2017_release\addons\ofxPDSP\src\sequencer\Function.cpp(126,32): error C2039: 'to_string': is not a member of 'std'

1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.23.28105\include\random(27): message : see declaration of 'std'

1>C:\Users\Edward\Documents\of_v0.11.0_vs2017_release\addons\ofxPDSP\src\sequencer\Function.cpp(126,41): error C3861: 'to_string': identifier not found`

Do you know what this error of "'to_string': is not a member of 'std'" is occuring?

`sndfile.hh` file not found error - OF for Android

Hi there,

Thanks for the great add-on!

I'm trying to create a new OF-Android project with ofxPDSP. My setup mirrors that of the OF-Android guide found here.

After generating the project using OF's Project Generator, and opening it in Android Studio and making the project, I'm getting the following errors:

screen shot 2017-11-27 at 7 54 49 pm

I'm using Android Studio 3.0.1.

Thanks!

Grain cloud behavior

In the grain cloud, I notice that when I disengage the granular, by lifting off the mouse, the last position is still active. This makes sense for moving through the position in a linear fashion, however (I am using the grain cloud example as a reference here), when I click on a position in the file and then release the mouse I would expect when I click the mouse again and engage the controlOn(x,y) method that the grains from the previous position do not play, but currently they do play until they are all cleared.

Is there a way to change this behavior, I guess a way to clear all the samples from the buffer from the last position and only play samples from the current position, the way it reacts when you engage the grains for the first time?

MidiKeys maxNotes is sometimes non-zero

In MidiKeys.cpp, line 75

for(int i=0; i<this->maxNotes; ++i){ gates[i].unLink(); values[i].unLink(); }

The problem is

this->maxNotes is never initialized to zero
so gates[i].unLink(); throws a EXC_BAD_ACCESS occasionally

input example control to right channel error

I notice an error in the audio input example, the code to control time delay is:

d1_time_ctrl >> delayL.in_time();
d2_time_ctrl >> delayL.in_time();

it assign both control to the left channel, it should be:
d1_time_ctrl >> delayL.in_time();
d2_time_ctrl >> delayR.in_time();

Cannot bind to value of unrelated type

Hi there,
I was just running through the tutorial on building modules and I ran into the following error 'Non-const Ivalue reference to type 'pdsp::InputNode' cannot bind to a value of unrelated type 'pdsp::Patchable'.

Thanks.

screen shot 2016-03-28 at 5 52 08 pm

destruct or discconect

I have a strange issue, I am using a file player, (a copy of your file player example - (https://github.com/npisanti/ofxPDSP/blob/master/example_song_player/src/AudioPlayer.h) and granular synthesis on raspberry pi.

When I load a straight file to play before loading my granular stuff everything is ok. If I load the granualr stuff afterward it says it loads ok, but fails, no audio comes from the granular stuff even though no errors are reported.

As I wanted to do this dynamically I wanted to know if there is a way to delete objects and connections properly. I tried adding a destructer to the grain cloud class and in the audiofile player class but it does not help.

Is there a proper way to connect and disconnect to the engine and delete objects?

Like

narrCloud.out_L() >> narrAmpControl[0] * dB(12.0f) >> engine.audio_out(0);
But the opposite?

Trouble Loading Audio File Using Relative Path

Hi Nicola! I'm having trouble when trying to load a sound file using a relative path. I tried within the song player example player.load("sound.wav") and also player.load("bin/data/sound.wav") but neither functioned right. It gives me the following error:
[ofxAudioFile] ERROR loading wav file
[pdsp] error loading sample
_UniCharInfo_LinearCount:888

Any help is appreciated!

All best,

Maximo.

Multichannel

Hello,
as already mentioned in this post i have problems working with multichannel outputs.

It seems like setting the number of inputs and outputs crashes the app.
Thanks for having a look.

Testing OSC

Hi, we are implementing ofxPDSP in our application AudioStellar (http://audiostellar.xyz/)

We are having difficulties understanding how to test if an OSC message is arriving to our application.

We are using pdsp::osc::Input Class

We need to make a custom behavior when an OSC message arrive, so we think we should be using parser (string oscAddress, int argument=0)

Documentation says: get a reference to the parser for the selected address and argument. You can assign a lambda function to this value to elaborate the signal

Can you provide an example on how to do this?, we are not into lambda functions and we tried googling but still can't understand the syntax.

Thanks in advance.

Few example not compiling on linux with Qtcreator.

I tried some example and they are working fine, I was really excited about the wolfram example but it is not compiling, i even tried the one present in nb-patches they too fail.
Here is one example of error trying to run example_midi_polysynth

/home/s***/Programs/openframeworks/openframeworks-nightly/of_v20190324_linux64gcc6_release/addons/ofxPDSP/example_midi_polysynth/src/ofApp.cpp:27: error: undefined reference to 'PolySynth::setup(int)'
/home/s***/Programs/openframeworks/openframeworks-nightly/of_v20190324_linux64gcc6_release/addons/ofxPDSP/example_midi_polysynth/src/ofApp.cpp:107: error: undefined reference to 'PolySynth::Voice::meter_pitch() const'
/home/s***/Programs/openframeworks/openframeworks-nightly/of_v20190324_linux64gcc6_release/addons/ofxPDSP/example_midi_polysynth/src/ofApp.cpp:114: error: undefined reference to 'PolySynth::Voice::meter_mod_env() const'
collect2: error: ld returned 1 exit status

Audio Sound Stream Thread crash on exit

I'm working on a software that integrates ofxPDSP engine and i've found a minor issue that appear sometimes on quit. In this software is possible to start and stop the DSP computing, plus is possible to re-configure it, changing the input and output device on the fly, so far no problems with that, but after a session whith device changings and reset/reload of the pdsp::Engine(), on quit appear this:

Thread 9 Crashed:: com.apple.audio.IOThread.client
0   org.example.Mosaic            	0x00000001099caad4 pdsp::ExternalInput::copyInterleavedInput(float*, int, int, int const&) + 180
1   org.example.Mosaic            	0x0000000109fcc73d pdsp::Engine::audioIn(ofSoundBuffer&) + 109
2   org.example.Mosaic            	0x000000010a376b1b ofRtAudioSoundStream::rtAudioCallback(void*, void*, unsigned int, double, unsigned int, void*) + 149
3   org.example.Mosaic            	0x000000010b6121e9 RtApiCore::callbackEvent(unsigned int, AudioBufferList const*, AudioBufferList const*) + 345
4   org.example.Mosaic            	0x000000010b611537 callbackHandler(unsigned int, AudioTimeStamp const*, AudioBufferList const*, AudioTimeStamp const*, AudioBufferList*, AudioTimeStamp const*, void*) + 23
5   com.apple.audio.CoreAudio     	0x00007fff8eea68ce HALC_ProxyIOContext::IOWorkLoop() + 5290
6   com.apple.audio.CoreAudio     	0x00007fff8eea5264 HALC_ProxyIOContext::IOThreadEntry(void*) + 128
7   com.apple.audio.CoreAudio     	0x00007fff8eea4fa3 HALB_IOThread::Entry(void*) + 75
8   libsystem_pthread.dylib       	0x00007fffa530d93b _pthread_body + 180
9   libsystem_pthread.dylib       	0x00007fffa530d887 _pthread_start + 286
10  libsystem_pthread.dylib       	0x00007fffa530d08d thread_start + 13

and this:

Thread 9 Crashed:: com.apple.audio.IOThread.client
0   org.example.Mosaic            	0x000000010127cb9f pdsp::ExternalInput::process(int) + 31
1   org.example.Mosaic            	0x0000000101277265 pdsp::InputNode::process() + 293
2   org.example.Mosaic            	0x000000010127d3f2 pdsp::PatchNode::process(int) + 18
3   org.example.Mosaic            	0x000000010127dfbd pdsp::Processor::processAndCopyInterleaved(float*, int const&, int const&) + 173
4   org.example.Mosaic            	0x000000010187e6bc pdsp::Engine::audioOut(ofSoundBuffer&) + 428
5   org.example.Mosaic            	0x0000000101c28bc3 ofRtAudioSoundStream::rtAudioCallback(void*, void*, unsigned int, double, unsigned int, void*) + 301
6   org.example.Mosaic            	0x0000000102ec41e9 RtApiCore::callbackEvent(unsigned int, AudioBufferList const*, AudioBufferList const*) + 345
7   org.example.Mosaic            	0x0000000102ec3537 callbackHandler(unsigned int, AudioTimeStamp const*, AudioBufferList const*, AudioTimeStamp const*, AudioBufferList*, AudioTimeStamp const*, void*) + 23
8   com.apple.audio.CoreAudio     	0x00007fff8eea68ce HALC_ProxyIOContext::IOWorkLoop() + 5290
9   com.apple.audio.CoreAudio     	0x00007fff8eea5264 HALC_ProxyIOContext::IOThreadEntry(void*) + 128
10  com.apple.audio.CoreAudio     	0x00007fff8eea4fa3 HALB_IOThread::Entry(void*) + 75
11  libsystem_pthread.dylib       	0x00007fffa530d93b _pthread_body + 180
12  libsystem_pthread.dylib       	0x00007fffa530d887 _pthread_start + 286
13  libsystem_pthread.dylib       	0x00007fffa530d08d thread_start + 13

Where the first one is related to the engine audioIn() method and the second one to the audioOut().

So i've tried first the engine.close() and engine.stop() methods on exit but they hangs and forced me to force quit the app.

Then i've dig a little in the code and i've found an easy solution:

  • the audioIn() method execute the copyInterleavedInput() call only if we have at least one input channel
  • the audioOut() method execute the processAndCopyInterleaved() call always

So i've modified the Engine.cpp adding a conditional that leave the processAndCopyInterleaved() call alone if there are no putput channels:

if(outputChannels > 0){
        processor.processAndCopyInterleaved(outBuffer.getBuffer().data(), outBuffer.getNumChannels(), outBuffer.getNumFrames());
    }

Then, i've just added a engine->setChannels(0,0); in the exit() call, so just before quitting, neither audioIn() nor audioOut() engine calls will cause the issue.

Don't now if is the optimal solution or if this is happening because i've done something wrong, but the fix logic do no harm.

Anyway, i hope this helps in some way the development of your amazing addon, thanks for sharing.

Reading RMS values

Is it possible to have a small example on how to get RMS values from a signal ?

Thanks.

problems with dynamic allocation

Hello. I was developing and having a lot of fun with the lib the last two months and i had composed a full six tracks album. Each track is launched once with a hardcoded number. But now i would like to get better the app by adding some user interface to be able to choose between tracks and i am having some problems (i thinck with Sequence objects).
Here the log. Thank you very much!

[pdsp] score section output already used as value out, assignation invalid
Assertion failed: (false), function pdsp_trace, file ../../../../../../addons/ofxPDSP/src/sequencer/../DSP/pdspFunctions.h, line 31.
Message from debugger: The LLDB RPC server has crashed. The crash log is located in ~/Library/Logs/DiagnosticReports and has a prefix 'lldb-rpc-server'. Please file a bug and attach the most recent crash log.

Engine::stop() freezes on Windows 10

Application freezes when calling engine->stop();

I'm compiling using Visual Studio Community 2017. Using ASIO4ALL as the ASIO driver. This doesn't happen on Linux or on Mac.

Since a much more complex example was freezing, I've tried a simple example: example_basics1_patching. I added a line of code for stopping on click and it freezes.

What is actually freezing is the stop() method of ofSoundStream. So I tried the oF example called audioOutputExample which also uses ofSoundStream directly. The stop() method is working fine in that example.

It seems to me that something must be stopped before calling the stop() method but since I don't fully understand ofxPDSP architecture I don't know what could it be, does it ring any bell for you ? maybe stop calling the process function?

I also tried commenting the lines where patching is done in example_basics1_patching so it just starts the audio server and then stop it, but it also freeze. I was thinking maybe I should unpatch everything before stopping.

Any ideas ?

Thanks for reading.

Error on input in Windows

Dear npisanti,

your addon is great stuff, thank you very much!
I sucessfully compiled the examples on Win7, OF 0.10. I have a problem with input, though. When running example-audio-input or example-analysis, I get the following error in command window (and do not hear/see any input at all):

RtApiWasapi::probeDeviceOpen: Render device selected as input device

engine.listDevices(); brings me sth. like:

[Unknown API: 0] Lautsprecher (Realtek High Definition Audio) [in:0 out:2] (default out)
[Unknown API: 1] Mikrofon (Realtek High Definition Audio) [in:2 out:0] (default in)
[Unknown API: 1] Mikrofon (HD Webcam C525) [in:1 out:0]

Error occurs no matter what I choose for setOutputDeviceID() and engine.setOutputDeviceID(). (It also occurs, when de-plugging web cam...)
Do I miss something?

Thanks for any hint...
oe

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.