Raw-data Note Extractor/Creator

Discussion about the Bidule SDK, post your questions, feature request and plugins here.

Moderators: davidv, seb@plogue

seb@plogue
Site Admin
Posts: 9593
Joined: Tue Mar 02, 2004 7:23 pm
Location: Montreal
Contact:

Re: Raw-data Note Extractor/Creator

Postby seb@plogue » Thu Nov 18, 2010 10:12 am

Does this mean that you might make changes to core code or something?


Always possible but I was mostly talking about having bidules/the core code not using/preserving the 4th MIDI byte in case someone using the SDK is using it.

boonier
Posts: 986
Joined: Wed Sep 14, 2005 6:34 am
Location: Brighton, UK

Re: Raw-data Note Extractor/Creator

Postby boonier » Thu Nov 18, 2010 10:24 am

This is starting to sound like a hacky solution...Are there any other methods you can think of?

I've pretty much exhausted all conventional techniques I can think of :? (internal value lists in the poly voice driving the parameters doesn't seem to work - the parameter value lists exported to the group ui don't propagate to all the voices)

Incidentally,would values be limited to 0-127?

thanks

seb@plogue
Site Admin
Posts: 9593
Joined: Tue Mar 02, 2004 7:23 pm
Location: Montreal
Contact:

Re: Raw-data Note Extractor/Creator

Postby seb@plogue » Thu Nov 18, 2010 1:55 pm

This is starting to sound like a hacky solution...Are there any other methods you can think of?


That would depend on what you want to do, send one parameter on a note on to its allocated voice or more parameters than that to all voices or a specific one.

Incidentally,would values be limited to 0-127?


0-255

boonier
Posts: 986
Joined: Wed Sep 14, 2005 6:34 am
Location: Brighton, UK

Re: Raw-data Note Extractor/Creator

Postby boonier » Thu Nov 18, 2010 4:13 pm

previous content scrubbed...I just reread what you meant...

send one parameter on a note on to its allocated voice or more parameters than that to all voices or a specific one


yes this is what i want to do, send more than one parameter to its allocated voice.

Hansje
Posts: 823
Joined: Wed Jun 23, 2004 6:22 pm
Location: Utsira, Norway

Re: Raw-data Note Extractor/Creator

Postby Hansje » Fri Dec 24, 2010 7:15 am

As requested by boonier, here is the source for this plugin.

nec03.zip
(3.59 KiB) Downloaded 305 times

If you use the code, please change the namespace "hansje" to something else, change the bidule names (in the main.cpp) and rename the files.
Thanks.

boonier
Posts: 986
Joined: Wed Sep 14, 2005 6:34 am
Location: Brighton, UK

Re: Raw-data Note Extractor/Creator

Postby boonier » Wed Dec 29, 2010 5:07 pm

Many thanks Hansje!

boonier
Posts: 986
Joined: Wed Sep 14, 2005 6:34 am
Location: Brighton, UK

Re: Raw-data Note Extractor/Creator

Postby boonier » Thu Feb 17, 2011 5:53 am

Hi

I haven't really had the time to work on this recently, but I increasingly find my self wishing for this facility. Maybe its just my way of working....but...

send one parameter on a note on to its allocated voice or more parameters than that to all voices or a specific one


I'm trying to work this out in SDK land. I guess I need a bit more assistance on conceptualizing this, as I'm not fully sure about the workings of the poly adapter. Presuming that I'd use the 4th byte (because there is no other method I can think of currently) :

-> Use that be as an identifier to index a shared array (static array?) in memory. So values at extra inputs on the Note Creator would be captured and populate the array, and then the array would be iterated at the Note Extractor end to extract those stored values.

Now my confusion arises - what happens with individual voice groups - will all instances receive the same values from the shared array? Or will the values be specific to the instantiated voice, in the same way that frequency and velocity are? As far as I can tell, the 4th midi byte won't take an array - its too advanced - only 8 bit values.

thanks and help pls!

seb@plogue
Site Admin
Posts: 9593
Joined: Tue Mar 02, 2004 7:23 pm
Location: Montreal
Contact:

Re: Raw-data Note Extractor/Creator

Postby seb@plogue » Thu Feb 17, 2011 9:47 am

Now my confusion arises - what happens with individual voice groups - will all instances receive the same values from the shared array?


Your dll/bundle will be loaded only once in memory but you will have several object instances of your class(es), you can use that fact to have some static data available by all instances, a note event is only sent to the voice it activates (and shut off), the other voices won't see the note events.

boonier
Posts: 986
Joined: Wed Sep 14, 2005 6:34 am
Location: Brighton, UK

Re: Raw-data Note Extractor/Creator

Postby boonier » Thu Feb 17, 2011 10:10 am

seb@plogue wrote:
Now my confusion arises - what happens with individual voice groups - will all instances receive the same values from the shared array?


Your dll/bundle will be loaded only once in memory but you will have several object instances of your class(es), you can use that fact to have some static data available by all instances, a note event is only sent to the voice it activates (and shut off), the other voices won't see the note events.


Right, I'm not sure that I'm being clear enough...I don't want the data to be available to all instances of that class (the class being Note Extractor). I only want the data to be available to the note event and the corresponding voice it activates.

I don't mean be a bore on this, as I am the only one it seems to be bothered :) but i believe that this will truly enhance the poly adapter techniques and re-usability of groups as abstractions

seb@plogue
Site Admin
Posts: 9593
Joined: Tue Mar 02, 2004 7:23 pm
Location: Montreal
Contact:

Re: Raw-data Note Extractor/Creator

Postby seb@plogue » Thu Feb 17, 2011 10:33 am

Let's say you have a shared array/container available in your bundle, any code from that bundle can access it. As far as I understand what you wish to do you would have a Note Creator accepting extra inputs and a Note Extractor being able to output these.

Note Creator on receiving a note, create the struct/class containing all the extra info, store it into the shared array/container at specific index/key, stuff that index/key into the 4th MIDI Byte (or combined that with the channel or something else as long as it stays a valid note on message), the Note Extractor receives that event, decode the index/key and get the extra info from the shared array/container and can output it.

boonier
Posts: 986
Joined: Wed Sep 14, 2005 6:34 am
Location: Brighton, UK

Re: Raw-data Note Extractor/Creator

Postby boonier » Sat Feb 19, 2011 12:23 pm

Ok I understand the concept well, but my c++ knowledge is failing me....I'm not doing this correctly... :) Basic errors. For a start I'm getting confused about the scope of the data container and writing to the global array

I've created a header file called globaldata.h, and in that i have:

Code: Select all

#ifndef GLOBALDATA_H
#define GLOBALDATA_H

using namespace boonier;
using namespace plogue::biduleSDK;

namespace globaldata {
   extern double params[];
}

#endif


I've then included this header in my nc_extended.cpp file, and I'm unsuccessfully trying to reference the array in the process loop:

Code: Select all

#include "nc_extended.h"
#include "globaldata.h"

using namespace plogue::biduleSDK;
using namespace boonier;
using namespace globaldata;

nc_extended::nc_extended(BiduleHost* host):
BidulePlugin(host){
    _caps = 0;
   _numAudioIns = 8;
   _numAudioOuts = 0;
   _numMIDIIns = 0;
   _numMIDIOuts = 1;
   _numFreqIns = 0;
   _numFreqOuts = 0;
   _numMagIns = 0;
   _numMagOuts = 0;
   _numParams = 1;
}

nc_extended::~nc_extended(){
}

bool
nc_extended::init()
{   _realNoteOffs = true;
    return true;
}

void
nc_extended::idle()
{   
}

void
nc_extended::getAudioInNames(std::vector<std::string>& vec){
   vec.push_back("Note # [0..127]");
   vec.push_back("Note Velocity [0..127]");
   vec.push_back("Note On Trigger");
   vec.push_back("Note Off Trigger");
   vec.push_back("Parameter 1");
   vec.push_back("Parameter 2");
   vec.push_back("Parameter 3");
   vec.push_back("Parameter 4");
}

void
nc_extended::getAudioOutNames(std::vector<std::string>& vec){
}

void
nc_extended::getMIDIInNames(std::vector<std::string>& vec){
}

void
nc_extended::getMIDIOutNames(std::vector<std::string>& vec){
   vec.push_back("MIDI output port");
}

void
nc_extended::getFreqInNames(std::vector<std::string>& vec){
}

void
nc_extended::getFreqOutNames(std::vector<std::string>& vec){
}

void
nc_extended::getMagInNames(std::vector<std::string>& vec){
}

void
nc_extended::getMagOutNames(std::vector<std::string>& vec){
}

void
nc_extended::getParametersInfos(ParameterInfo* pinfos)
{   pinfos[0].id = 0;
   strcpy(pinfos[0].name, "Send True Note-Off Messages");
   pinfos[0].type = BOOLPARAM;
   pinfos[0].ctrlType = GUICTRL_CHECKBOX;
   pinfos[0].linkable = 1;
   pinfos[0].saveable = 1;
   pinfos[0].paramInfo.pb.defaultValue = true;
   pinfos[0].paramInfo.pb.isTrigger = false;

}

void
nc_extended::getParameterChoices(long id, std::vector<std::string>& vec) {
}

void
nc_extended::parameterUpdate(long id)
{   if(id == 0)
   getParameterValue(0, _realNoteOffs);
}


void
nc_extended::process(Sample** sampleIn, Sample** sampleOut, MIDIEvents* midiIn, MIDIEvents* midiOut, Frequency*** freqIn, Frequency*** freqOut,
                  Magnitude*** magIn, Magnitude*** magOut, SyncInfo* syncIn, SyncInfo* syncOut){
   
      
   
   int i;
   midiOut[0].numEvents = 0;
   
   for (i=0;i<_dspInfo.bufferSize;i++)
   {
     if (sampleIn[2][i] == 1) {
        midiOut[0].events[midiOut[0].numEvents].bufTick = i;
        midiOut[0].events[midiOut[0].numEvents].midiData[0] = (0x90 | ( ((MIDI_t) sampleIn[4][i]) & 0x0F));
        midiOut[0].events[midiOut[0].numEvents].midiData[1] = ( ((MIDI_t) sampleIn[0][i]) & 0x7F);
        midiOut[0].events[midiOut[0].numEvents].midiData[2] = ( ((MIDI_t) sampleIn[1][i]) & 0x7F);
      
        params[0] = sampleIn[4][i];
        params[1] = sampleIn[5][i];
        params[2] = sampleIn[6][i];
        params[3] = sampleIn[7][i];
       
        //midiOut[0].events[midiOut[0].numEvents].midiData[3] = theData ;
        ++midiOut[0].numEvents;
     }
     if (sampleIn[3][i] == 1){
        midiOut[0].events[midiOut[0].numEvents].bufTick = i;
        if (_realNoteOffs){
           midiOut[0].events[midiOut[0].numEvents].midiData[0] = (0x80 | ( ((MIDI_t) sampleIn[4][i]) & 0x0F));
           midiOut[0].events[midiOut[0].numEvents].midiData[1] = ( ((MIDI_t) sampleIn[0][i]) & 0x7F);
           midiOut[0].events[midiOut[0].numEvents].midiData[2] = ( ((MIDI_t) sampleIn[1][i]) & 0x7F);             
        } else {
           midiOut[0].events[midiOut[0].numEvents].midiData[0] = (0x90 | ( ((MIDI_t) sampleIn[4][i]) & 0x0F));
           midiOut[0].events[midiOut[0].numEvents].midiData[1] = ( ((MIDI_t) sampleIn[0][i]) & 0x7F);
           midiOut[0].events[midiOut[0].numEvents].midiData[2] = 0;
       }             
       ++midiOut[0].numEvents;
     }   
   }
}


I'm getting compilation errors in xcode :
"globaldata::params", referenced from:
...
Symbols not found


Have I got the wrong idea about this? Should I be using a pointer to reference the array? Reading through C++ forums is just confusing me. I realize that this isn't a C++ forum, but any help would be very much appreciated, and it is contextual to Bidule sdk.

thanks

seb@plogue
Site Admin
Posts: 9593
Joined: Tue Mar 02, 2004 7:23 pm
Location: Montreal
Contact:

Re: Raw-data Note Extractor/Creator

Postby seb@plogue » Mon Feb 21, 2011 10:37 am

First of all when you use extern it means solve a link time, with what you have pasted here, it looks like params[] is only declared as an extern at one place and never defined at all.

boonier
Posts: 986
Joined: Wed Sep 14, 2005 6:34 am
Location: Brighton, UK

Re: Raw-data Note Extractor/Creator

Postby boonier » Mon Feb 21, 2011 11:05 am

I'm going to be consulting a c++ developer friend of mine i think, as all I'm succeeding in doing is over complicating and confusing myself. I think I'm partially there but the concept of classes and scoping is spinning my head a bit.

Incidently, the key/index stuffed into the 4th midi byte will be an integer. Does that imply that the all the data will be stored in a 2d array?

thanks

seb@plogue
Site Admin
Posts: 9593
Joined: Tue Mar 02, 2004 7:23 pm
Location: Montreal
Contact:

Re: Raw-data Note Extractor/Creator

Postby seb@plogue » Mon Feb 21, 2011 11:06 am

Incidently, the key/index stuffed into the 4th midi byte will be an integer. Does that imply that the all the data will be stored in a 2d array?


Yes but nothing prevents you from making a struct containing 4 double for your params and do an array of these.

boonier
Posts: 986
Joined: Wed Sep 14, 2005 6:34 am
Location: Brighton, UK

Re: Raw-data Note Extractor/Creator

Postby boonier » Mon Feb 21, 2011 11:41 am

You mean an array of structs, or an array of the params values from the struct?


Return to “Bidule SDK”

Who is online

Users browsing this forum: No registered users and 2 guests