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 » Mon Feb 21, 2011 1:12 pm

i mean an array of struct X instead of an array of doubles

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

Re: Raw-data Note Extractor/Creator

Postby boonier » Tue Feb 22, 2011 10:42 am

thanks Seb...

Could you just clarify for me, why the 4th midi byte needs to carry an identifier? If the creator is filling parameters into a global container and the extractor is taking from the global container immediately afterward, is there a need for the identifier?

Unless, each struct is unique to each voice....then I create an array of structs like you say, and store params in structs at unique indexes and use the identifier to retrieve the structs

am I over-complicating things again!? :roll:

I guess I'm not comprehending why you would need an index/identifier, if you are only ever using one struct to contain the data.

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 » Tue Feb 22, 2011 10:49 am

If the creator is filling parameters into a global container and the extractor is taking from the global container immediately afterward, is there a need for the identifier?


If you intend to have more than one voice going on?

Unless, each struct is unique to each voice....then I create an array of structs like you say, and store params in structs at unique indexes and use the identifier to retrieve the structs


That would be how to do it.

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

Re: Raw-data Note Extractor/Creator

Postby boonier » Tue Feb 22, 2011 11:11 am

seb@plogue wrote:If you intend to have more than one voice going on?


Most definitely!

That would be how to do it.


So presumably, the size of the array is governed by what, number of voices right. How would I gain that information? Or would I create a large array of structs and use a round robin counter to index through the next available slots, or index using the note number indentifier?

I'm getting there....
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 » Tue Feb 22, 2011 11:23 am

So presumably, the size of the array is governed by what, number of voices right. How would I gain that information? Or would I create a large array of structs and use a round robin counter to index through the next available slots, or index using the note number indentifier?


You should either do a round robin counter or use the note number, however if you intent to have multiple extended creators running at the same time going to different poly'ed group the note number could become an issue so you might want to have two-level index. A class to create/read/write/release arrays so for example, note number could also be an issue if you wish to use the detune member.

new note creator A -> create a new shared array with a round robin ID
note creator A receive a note -> write to its shared array using the note numbe4r, writes its array ID into the 4th MIDI byte

note extractor receiving a note -> request the values for 4th MIDI byte + note number

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

Re: Raw-data Note Extractor/Creator

Postby boonier » Thu May 05, 2011 1:49 pm

Hi, how do I extract the incoming midi note number from this? (taken from note creator code)

Code: Select all

 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);


I want to use it as an identifier

thanks!

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

Re: Raw-data Note Extractor/Creator

Postby boonier » Thu May 05, 2011 4:40 pm

no worries, figured it out :)

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

Re: Raw-data Note Extractor/Creator

Postby boonier » Fri May 06, 2011 4:21 am

seb@plogue wrote: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.


Ok I'm almost getting this working to a point. I've so far managed to store values into a single global struct, and retrieve them on the extractor end :) Obviously now I want to create this array of structs so in my global header file i have:

Code: Select all

#ifndef GLOBALDATA_H
#define GLOBALDATA_H

#define N_NOTES 128

struct paramData {
   double param1;
   double param2;
   double param3;
   double param4;
};

extern paramData pData [N_NOTES];

#endif


Ok and in my Note creator file the globaldata header is included and right after, I declare the paramData pData object:

Code: Select all

#include "nc_extended.h"
#include "globaldata.h"
paramData pData;

using namespace plogue::biduleSDK;
using namespace boonier;


When I compile, why am I getting multiple declaration errors?
_SNIPPED_ /nc_extended.cpp:7: error: conflicting declaration 'paramData pData'
_SNIPPED_ /globaldata.h:13: error: 'pData' has a previous declaration as 'paramData pData [128]'

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

Re: Raw-data Note Extractor/Creator

Postby boonier » Fri May 06, 2011 4:54 am

ok my bad, needs to be declared fully in the .cpp file

Code: Select all

#include "nc_extended.h"
#include "globaldata.h"
paramData pData [N_NOTES];

using namespace plogue::biduleSDK;
using namespace boonier;


hope someone out there learns from my muppetry. Hang on, theres an idea for a useless blog ;)

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

Re: Raw-data Note Extractor/Creator

Postby boonier » Fri May 06, 2011 9:40 am

Hi Seb/Eveyone,

Made some progress...data is being written to structs at appropriate indexes, and I'm able to retrieve the data on the other side.

In testing the plugin, the proof of the pudding as it were, is to have this working in poly'd groups. For some reason that I can't fathom, is that notes don't appear to be getting dispatched with a unique ID (from their note number), therefore they aren't being dispatched polyphonically. I fear I might have broken something!

Would someone mind taking a look at what I've done please? that'd be much appreciated. Source and test layout attached.

cheers
NEC_Extended.zip
(548.35 KiB) Downloaded 276 times

Note creator extractor tests 2.bidule
(168.21 KiB) Downloaded 280 times

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

Re: Raw-data Note Extractor/Creator

Postby boonier » Wed May 11, 2011 8:13 am

ahh :) I see that this been downloaded. Does anyone have any feedback yet?

Thanks muchly

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

Re: Raw-data Note Extractor/Creator

Postby boonier » Sat May 14, 2011 8:19 am

I now don't think i broke anything...

I just tested the original version of this code and it exhibits the same issue

Seb would you mind explaining what the problem is?

thanks

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

Re: Raw-data Note Extractor/Creator

Postby boonier » Tue May 17, 2011 10:44 am

is think this could be the problem....

The fdetune member is used mostly by the Note Creators/Extractors, the polyphonic adapter, the transposer and pretty much any internal bidules requiring to keep information on a per-note basis (actual midi note+fdetune is used as the key) and is also sent to VSTs (although there's only an handful of plugins using it...).

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 » Wed May 18, 2011 9:59 am

No note off are sent? The Poly Adapter does not bother about the gate output if no note off was received.

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

Re: Raw-data Note Extractor/Creator

Postby boonier » Wed May 18, 2011 10:12 am

Ok, so the poly manager still needs specific Note on/off messages, regardless of the gate output (which is needed to release the dsp on the voice). Makes sense.

With regards to the midnote + fdetune used as the key, how does that look in the C++ code? ...and following from that, how big would the struct need to be to cover each possible key (how many indices)? 128 * 128 ?

cheers


Return to “Bidule SDK”

Who is online

Users browsing this forum: No registered users and 1 guest