Sensomusic

#1 2018-04-10 17:38:51

23fx23
Community

think oli faced maybe similar case but i couldn't  find back the thread.

ive made kinda wavtable oscillator  class .h .cpp

if i declare a float array to contain the wavtable in the .h like:

float wavtable[4096];      //  no problem, that works

but if i ty to make it bigger

float wavtable[524288]; //256 tables of 2048 samples.

then i got errors on init and it get weird in paint and stuff

for debuging i don't call/use the array  anywere, just creating few oscillators.

any ideas?

Offline

 

#2 2018-04-10 19:30:53

oli_lab
Platinum Member

Hi !
As for the wavetable module, I used the sdk audiofile thingo :

in .h :
AudioFilePtr wavetable;

in .cpp :
void WTsynth::onInitModule(MasterInfo* pMasterInfo, ModuleInfo* pModuleInfo)
{
    wavetable =  sdkCreateAudioFile();
}

and in callback :
sdkLoadInMemoryAudioFile(wavetable, sdkGetEvtPChar(fileName));


http://oli-lab.org

Win10 I7/16GB RAM  - RME MADIFACE - SSL alpha link 4-16 - OSC capable interfaces

follow OLI_LAB adventures on Facebook
http://www.facebook.com/pages/OLI_LAB/3 … 506?v=wall

Offline

 

#3 2018-04-10 19:34:49

oli_lab
Platinum Member

for live sampler and affiliate :
in .h :
TPrecision* m_buffer;    // Samples buffer
in .cpp :
// constructor
hydrogen::hydrogen()
{
    //Initialize values
    m_size = (lineSize+2) * 48000; //longueur fixe pour l'instant
    //m_read[AUDIO_INS_OUTS_MAX] = 0;
   
    //Ensure that initial sample values at buffer are 0.0f
    m_buffer = new float[m_size];
    for (int i = 0; i<m_size; i++)
    {
        m_buffer[i] = 0.0f;
    }
    m_size = m_size - 2 * 48000;
    m_write = m_size - 1;
}

// destructor
hydrogen::~hydrogen()
{
    delete[] m_buffer;
}
then you fill this buffer as you wish !


http://oli-lab.org

Win10 I7/16GB RAM  - RME MADIFACE - SSL alpha link 4-16 - OSC capable interfaces

follow OLI_LAB adventures on Facebook
http://www.facebook.com/pages/OLI_LAB/3 … 506?v=wall

Offline

 

#4 2018-04-10 20:24:04

23fx23
Community

ah cool thanks gonna investigate this method :)

Offline

 

#5 2018-04-10 21:54:11

oli_lab
Platinum Member

is it waveterrain oscillator you're making ?

I did wavetable oscillator, I can send you the code if you want.


http://oli-lab.org

Win10 I7/16GB RAM  - RME MADIFACE - SSL alpha link 4-16 - OSC capable interfaces

follow OLI_LAB adventures on Facebook
http://www.facebook.com/pages/OLI_LAB/3 … 506?v=wall

Offline

 

#6 2018-04-10 23:19:52

23fx23
Community

mm don't know wavterrain, not sure,
basically it's a 'simple' wavtable reader that  read like 256 tables of 2048 samples, made a basic linear interpolation for now between current read table and next one samples, the oscillator itself is working ok , its just  a bit strange  that i can't create big arrays  in 'external' files wich bugs me, like if there was a meory leak or something bit like your 'cannot be computed in a block issue' or something i don't understand yet..

but i made a different system tonight as workaround where i declare the big arrays in my main module file and pass the pointer, and that work ok that way.. so i don't really know why lol.

Offline

 

#7 2018-04-11 11:23:08

oli_lab
Platinum Member

Interesting even tho I didn't get everything.
Curious about  the workaround.
I did have trouble with the audiofile ask thing but my post disappeared after the hack attack on sensomusic server..
This sdkloadfile in memory works fine for small files but make  the rack hanging if the loading  takes longer than a block to load.
Should develop some sort of a trickling algorithm to load the file on more than one block so it leave time to other tasks to execute smoothly.


http://oli-lab.org

Win10 I7/16GB RAM  - RME MADIFACE - SSL alpha link 4-16 - OSC capable interfaces

follow OLI_LAB adventures on Facebook
http://www.facebook.com/pages/OLI_LAB/3 … 506?v=wall

Offline

 

#8 2018-04-11 12:17:35

sm_jamieson
Platinum Member

oli_lab wrote:

Interesting even tho I didn't get everything.
Curious about  the workaround.
I did have trouble with the audiofile ask thing but my post disappeared after the hack attack on sensomusic server..
This sdkloadfile in memory works fine for small files but make  the rack hanging if the loading  takes longer than a block to load.
Should develop some sort of a trickling algorithm to load the file on more than one block so it leave time to other tasks to execute smoothly.


They way to do this would be to create a new thread (c++ std:thread class) that can do whatever it wants, then when loading it finishes, set a flag to say the file has loaded. You can find thread examples with Google.
Also, the Wiimote user module does stuff with threads (see code in SDK), but I think it uses Juce.

Note that you will need thread locking (windows critical section, mutex, etc) to protect access to data accessed by several threads. If not, you will get occasional strange errors.

Last edited by sm_jamieson (2018-04-11 13:24:09)

Offline

 

#9 2018-04-12 12:04:38

23fx23
Community

have to try to wrap my head on threads too..

for now its working not bad  :) , lttle test vid:

https://drive.google.com/open?id=1LY8Df … nDBihKylqJ

with warp:
https://drive.google.com/open?id=1jHjBC … fr-EM8UfD3

Last edited by 23fx23 (2018-04-12 17:45:19)

Offline