Not sure to fully understand the logic, but looking at the C++ generated file, 
I see the global table being filled in fillmydspSIG0 method, so once at init 
time.

Try to simplify the code as much as possible, and looking at the SVG diagram 
can possibly help ?

Stéphane 

> Le 4 janv. 2024 à 15:56, Autumn Cheney <autumn.che...@protonmail.ch> a écrit :
> 
> of course!
> 
> this was as simple as i could get it, but hopefully everything is 
> self-explanatory:
> 
> import("stdfaust.lib");
> 
> table_size = 2 << 16;
> min_freq = 16.3515978313;
> p_num = 64;
> 
> current_oct(x) = ceil(ma.log2(x-0.3515978313))-5;
> 
> sine_partial(len,harm,amp,phase,x) = 
> (sin((((x+phase)*2*ma.PI)/(len))*harm)*amp)/(harm);
> 
> // 1st 64 are harmonic amplitudes, 2nd 64 are harmonic phases
> blank = 0, 0, 0, 0, 0, 0, 0, 0,
>       0, 0, 0, 0, 0, 0, 0, 0, 
>       0, 0, 0, 0, 0, 0, 0, 0,
>       0, 0, 0, 0, 0, 0, 0, 0,
>       0, 0, 0, 0, 0, 0, 0, 0,
>       0, 0, 0, 0, 0, 0, 0, 0,
>       0, 0, 0, 0, 0, 0, 0, 0,
>       0, 0, 0, 0, 0, 0, 0, 0,
> 
>       0, 0, 0, 0, 0, 0, 0, 0,
>       0, 0, 0, 0, 0, 0, 0, 0, 
>       0, 0, 0, 0, 0, 0, 0, 0,
>       0, 0, 0, 0, 0, 0, 0, 0,
>       0, 0, 0, 0, 0, 0, 0, 0,
>       0, 0, 0, 0, 0, 0, 0, 0,
>       0, 0, 0, 0, 0, 0, 0, 0,
>       0, 0, 0, 0, 0, 0, 0, 0;
> 
> // saw wave example
> saw_wave_add = par(i,64,1),par(i,64,0); 
> 
> table_init(table_size,partials,freq) = 
> (partials),par(i,p_num,(float(ba.time)/float(table_size))) : 
> route(p_num*3,p_num*3,par(i,p_num*3,((i+1),(3*(ma.modulo(i,p_num)))+(ceil((i+1)/p_num)))))
>  : par(i,p_num,(_*(freq*(i+1)<=(ma.SR/2)),_,_)) : 
> par(i,p_num,(sine_partial(1,i+1))) :> _;
> table_gen(table_size,partials,oct,min_freq,read) = 
> table_size,table_init(table_size,partials,min_freq*(2^(oct))),read:rdtable;
> table_osc(table_size,partials,freq,min_freq,reset,phase) = 
> int(os.hsp_phasor(freq,reset,phase))<:par(i,10,table_gen(table_size,partials,i,min_freq)):>ba.selectn(10,current_oct(freq));
> 
> process = table_osc(table_size,saw_wave_add,440,min_freq,0,0); 
> 
> /*
> 
> table_init(table_size,partials) = 
> (partials),par(i,p_num,(float(ba.time)/float(table_size))) : 
> route(p_num*3,p_num*3,par(i,p_num*3,((i+1),(3*(ma.modulo(i,p_num)))+(ceil((i+1)/p_num)))))
>  : par(i,p_num,(sine_partial(1,i+1))) :> _;
> table_gen(table_size,partials,read) = 
> table_size,table_init(table_size,partials),read:rdtable;
> table_osc(table_size,partials,freq,reset,phase) = 
> int(os.hsp_phasor(freq,reset,phase))<:par(i,10,table_gen(table_size,partials)):>ba.selectn(10,current_oct(freq));
> 
> process = table_osc(table_size,saw_wave_add,440,0,0);
> 
> */
> 
> if you run this no sound is produced, like the rdtable is empty. the big 
> commented out part without the freq parameter in table_init doesn't work 
> either
> 
> thanks in advance!
> 
> On Thursday, January 4th, 2024 at 2:26 AM, Stéphane Letz <l...@grame.fr> 
> wrote:
> 
> 
>> Do you have some simple code to share ?
>> 
>> Stéphane
>> 
>>> Le 3 janv. 2024 à 22:02, Autumn Cheney via Faudiostream-users 
>>> faudiostream-users@lists.sourceforge.net a écrit :
>>> 
>>> i'm designing a wavetable synth where the waveform is generated using a 
>>> array of signals specifying the harmonic amplitudes and phases of the 
>>> waveform. i'm trying to do mip mapping (i.e., creating sub-wavetables for 
>>> each octave to avoid aliasing) and i've found that using the par iterator 
>>> with the rdtable either gives me a "checkinit failed for type rses" error 
>>> or compiles successfully but gives an empty rdtable
>>> 
>>> is there a way i can do this purely using the rdtable? if i have to use 
>>> rwtable, is there a way to write the mip mapped waveforms only once at 
>>> initialization?
>>> 
>>> thanks!
>>> _______________________________________________
>>> Faudiostream-users mailing list
>>> Faudiostream-users@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/faudiostream-users



_______________________________________________
Faudiostream-users mailing list
Faudiostream-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/faudiostream-users

Reply via email to