Welcome to %s forums

BrainModular Users Forum

Login Register

reaching some limits question

Create your own modules in C++
Post Reply
23fx23
Member
Posts: 2545
Contact:

Unread post by 23fx23 » 10 Apr 2018, 19:38

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?

User avatar
oli_lab
Member
Posts: 1261
Location: Brittany, France
Contact:

Unread post by oli_lab » 10 Apr 2018, 21:30

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

Win11 Ryzen9/32GB RAM - RME MADIFACE - SSL alpha link 4-16 - OSC capable interfaces

follow OLI_LAB adventures on Mastodon
@olivar_premier@mastodon.social

User avatar
oli_lab
Member
Posts: 1261
Location: Brittany, France
Contact:

Unread post by oli_lab » 10 Apr 2018, 21:34

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 = 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

Win11 Ryzen9/32GB RAM - RME MADIFACE - SSL alpha link 4-16 - OSC capable interfaces

follow OLI_LAB adventures on Mastodon
@olivar_premier@mastodon.social

23fx23
Member
Posts: 2545
Contact:

Unread post by 23fx23 » 10 Apr 2018, 22:24

ah cool thanks gonna investigate this method :)

User avatar
oli_lab
Member
Posts: 1261
Location: Brittany, France
Contact:

Unread post by oli_lab » 10 Apr 2018, 23:54

is it waveterrain oscillator you're making ?

I did wavetable oscillator, I can send you the code if you want.
http://oli-lab.org

Win11 Ryzen9/32GB RAM - RME MADIFACE - SSL alpha link 4-16 - OSC capable interfaces

follow OLI_LAB adventures on Mastodon
@olivar_premier@mastodon.social

23fx23
Member
Posts: 2545
Contact:

Unread post by 23fx23 » 11 Apr 2018, 01:19

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.

User avatar
oli_lab
Member
Posts: 1261
Location: Brittany, France
Contact:

Unread post by oli_lab » 11 Apr 2018, 13:23

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

Win11 Ryzen9/32GB RAM - RME MADIFACE - SSL alpha link 4-16 - OSC capable interfaces

follow OLI_LAB adventures on Mastodon
@olivar_premier@mastodon.social

sm_jamieson
Member
Posts: 551
Contact:

Unread post by sm_jamieson » 11 Apr 2018, 14:17

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.

23fx23
Member
Posts: 2545
Contact:

Unread post by 23fx23 » 12 Apr 2018, 14:04

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

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests