ArrayArrayArrayArrayArray BrainModular BrainModular Users Forum 2015-04-17T01:44:09+02:00 https://www.brainmodular.com/forums/app.php/feed/topic/4851 2015-04-17T01:44:09+02:00 2015-04-17T01:44:09+02:00 https://www.brainmodular.com/forums/viewtopic.php?t=4851&p=32281#p32281 <![CDATA[ptAudio Manipulation]]> Statistics: Posted by martignasse — 17 Apr 2015, 01:44


]]>
2015-04-16T19:51:33+02:00 2015-04-16T19:51:33+02:00 https://www.brainmodular.com/forums/viewtopic.php?t=4851&p=32276#p32276 <![CDATA[ptAudio Manipulation]]>
however i noticed the audioout was heavy distorded compared to standard array out, ive plugged an array display or set to check and it seems mecopy only copy the first 32 values of my 128 blocsize array, while i specified 128, and audioOut size was set to 128, as the tempbuffer i filled and feed for the bloc copy.

float4bytes, 4x 32 = 128 , might it be related maybe mmm? i keep on investigate

any ideas?

edit : yesss if i multy blocsizeby4 for meme copy that seems to work . ok start to undersatnd :)

Statistics: Posted by 23fx23 — 16 Apr 2015, 19:51


]]>
2015-04-15T22:03:27+02:00 2015-04-15T22:03:27+02:00 https://www.brainmodular.com/forums/viewtopic.php?t=4851&p=32271#p32271 <![CDATA[ptAudio Manipulation]]>
for the size yup was not very clear in my comments but every thing occurs in call back onec and only normally.
I try to be carefull to exlude everything that can be out of process thanks for the reminder.

Cool, can't wait to test that :) ! thx a lot! will theck that memcopy thing i missed!

yeay did it quicly for tetst, i have to figure for the non complete buffer stuff.

Statistics: Posted by 23fx23 — 15 Apr 2015, 22:03


]]>
2015-04-15T21:19:16+02:00 2015-04-15T21:19:16+02:00 https://www.brainmodular.com/forums/viewtopic.php?t=4851&p=32270#p32270 <![CDATA[ptAudio Manipulation]]>
i'll try to clarify

first of all, if you do this code in the onProcess, you are massively leaking memory because of this

CODE:

BLOC_SMP_BUFFER = new float&#91;BlocSize&#93;;
it mean you allocate a new array every audio tick ! !
plus the fact that you should avoid completly allocating memory in the onProcess callback

but it's not the cause of your problem, you misunderstood the meaning of sdkSetEvtPointer()
it give you the pointer to the event itself, not a pointer to the data of the event.
you should use sdkGetEvtDataAddr() instead.

what you want to achieve can be made more simply, assuming SMP_BUFFER is your 1 second audio buffer array

CODE:

// declare a TPrecision* ptrBufferBloc member in the include fileif &#40;PLAY&#41;&#123;// should be in onBlockSizeChanged callbacksdkSetEvtSize&#40;Audio_Out, BlocSize&#41;;sdkSetEvtSize&#40;AudioOut, BlocSize&#41;;CurrentBloc = CurrentBloc + 1;// floor&#40;&#40; SMP_DURATION / BlocSize &#41;&#41; can be preconputed outside of onProcess// in onBlockSizeChanged callback precisely // but should also take care of when SMP_DURATION changeif &#40;CurrentBloc > floor&#40;&#40; SMP_DURATION / BlocSize &#41;&#41;&#41;&#123;CurrentBloc = 0;&#125;ptrBufferBloc = sdkGetEvtDataAddr &#40;AudioOut&#41;;memcpy &#40;&#40;void*&#41;ptrBufferBloc, &#40;void*&#41;&#40;SMP_BUFFER + &#40;CurrentBloc * BlocSize&#41;&#41;;    &#125;&#125;
doc to memcpy here

the code isn't test but should put you on the right track

also note that you loose the end of your SMP_BUFFER in case it's not multiple of BlockSize

Statistics: Posted by martignasse — 15 Apr 2015, 21:19


]]>
2015-04-15T17:22:47+02:00 2015-04-15T17:22:47+02:00 https://www.brainmodular.com/forums/viewtopic.php?t=4851&p=32269#p32269 <![CDATA[ptAudio Manipulation]]>
I got a float buffer array ranging -1 .. 1 contening wav sample info let's say of 1 second lenght 44100.

for now ive created an "AudioOut" ptArray output of blocsize, . and i srub my big buffer array on process procedure.
that works if i connect ausio outs to the array i do hear the escpected audio. but feel it would be more clean, i would get more function if i used a ptAudio instead.

Howerver im currently stuck, don't really understand how to work with.

im tring to precompute/fill a BLOC_SMP_BUFFER of bloc size, then 'apply it to Audioout but that doesn't seem to work that way.

CODE:

if &#40;PLAY&#41;&#123;BLOC_SMP_BUFFER = new float&#91;BlocSize&#93;;sdkSetEvtSize&#40;Audio_Out, BlocSize&#41;;    //set size temporary here for debug, will be in callbacksdkSetEvtSize&#40;AudioOut, BlocSize&#41;;     // Audio_Out is a ptArray, AudioOut ptAudiioCurrentBloc = CurrentBloc + 1;if &#40;CurrentBloc > floor&#40;&#40; SMP_DURATION / BlocSize &#41;&#41;&#41;      // loops if reaching end of buffer&#123;CurrentBloc = 0;&#125;for &#40;int i = 0; i < BlocSize; i++&#41;&#123;BLOC_SMP_BUFFER&#91;i&#93; = SMP_BUFFER&#91;i + &#40;CurrentBloc * BlocSize&#41;&#93;;            //preparing a blocsize filled buffer//sdkSetEvtArrayData&#40;Audio_Out, i, SMP_BUFFER&#91;i + &#40;CurrentBloc * BlocSize&#41;&#93;&#41;;         // old code that was working if ptArrayOut//sdkSetEvtPointer&#40;AudioOut, BLOC_SMP_BUFFER&#41;;&#125;sdkSetEvtPointer&#40;AudioOut, BLOC_SMP_BUFFER&#41;;                  // trying to set the ptaudio out,   doesn't seem to work, what's the correct way of doing?&#125;
any enlightments?

Statistics: Posted by 23fx23 — 15 Apr 2015, 17:22


]]>
BrainModular BrainModular Users Forum 2015-04-17T01:44:09+02:00 https://www.brainmodular.com/forums/app.php/feed/topic/4851 2015-04-17T01:44:09+02:00 2015-04-17T01:44:09+02:00 https://www.brainmodular.com/forums/viewtopic.php?t=4851&p=32281#p32281 <![CDATA[ptAudio Manipulation]]> Statistics: Posted by martignasse — 17 Apr 2015, 01:44


]]>
2015-04-16T19:51:33+02:00 2015-04-16T19:51:33+02:00 https://www.brainmodular.com/forums/viewtopic.php?t=4851&p=32276#p32276 <![CDATA[ptAudio Manipulation]]>
however i noticed the audioout was heavy distorded compared to standard array out, ive plugged an array display or set to check and it seems mecopy only copy the first 32 values of my 128 blocsize array, while i specified 128, and audioOut size was set to 128, as the tempbuffer i filled and feed for the bloc copy.

float4bytes, 4x 32 = 128 , might it be related maybe mmm? i keep on investigate

any ideas?

edit : yesss if i multy blocsizeby4 for meme copy that seems to work . ok start to undersatnd :)

Statistics: Posted by 23fx23 — 16 Apr 2015, 19:51


]]>
2015-04-15T22:03:27+02:00 2015-04-15T22:03:27+02:00 https://www.brainmodular.com/forums/viewtopic.php?t=4851&p=32271#p32271 <![CDATA[ptAudio Manipulation]]>
for the size yup was not very clear in my comments but every thing occurs in call back onec and only normally.
I try to be carefull to exlude everything that can be out of process thanks for the reminder.

Cool, can't wait to test that :) ! thx a lot! will theck that memcopy thing i missed!

yeay did it quicly for tetst, i have to figure for the non complete buffer stuff.

Statistics: Posted by 23fx23 — 15 Apr 2015, 22:03


]]>
2015-04-15T21:19:16+02:00 2015-04-15T21:19:16+02:00 https://www.brainmodular.com/forums/viewtopic.php?t=4851&p=32270#p32270 <![CDATA[ptAudio Manipulation]]>
i'll try to clarify

first of all, if you do this code in the onProcess, you are massively leaking memory because of this

CODE:

BLOC_SMP_BUFFER = new float&#91;BlocSize&#93;;
it mean you allocate a new array every audio tick ! !
plus the fact that you should avoid completly allocating memory in the onProcess callback

but it's not the cause of your problem, you misunderstood the meaning of sdkSetEvtPointer()
it give you the pointer to the event itself, not a pointer to the data of the event.
you should use sdkGetEvtDataAddr() instead.

what you want to achieve can be made more simply, assuming SMP_BUFFER is your 1 second audio buffer array

CODE:

// declare a TPrecision* ptrBufferBloc member in the include fileif &#40;PLAY&#41;&#123;// should be in onBlockSizeChanged callbacksdkSetEvtSize&#40;Audio_Out, BlocSize&#41;;sdkSetEvtSize&#40;AudioOut, BlocSize&#41;;CurrentBloc = CurrentBloc + 1;// floor&#40;&#40; SMP_DURATION / BlocSize &#41;&#41; can be preconputed outside of onProcess// in onBlockSizeChanged callback precisely // but should also take care of when SMP_DURATION changeif &#40;CurrentBloc > floor&#40;&#40; SMP_DURATION / BlocSize &#41;&#41;&#41;&#123;CurrentBloc = 0;&#125;ptrBufferBloc = sdkGetEvtDataAddr &#40;AudioOut&#41;;memcpy &#40;&#40;void*&#41;ptrBufferBloc, &#40;void*&#41;&#40;SMP_BUFFER + &#40;CurrentBloc * BlocSize&#41;&#41;;    &#125;&#125;
doc to memcpy here

the code isn't test but should put you on the right track

also note that you loose the end of your SMP_BUFFER in case it's not multiple of BlockSize

Statistics: Posted by martignasse — 15 Apr 2015, 21:19


]]>
2015-04-15T17:22:47+02:00 2015-04-15T17:22:47+02:00 https://www.brainmodular.com/forums/viewtopic.php?t=4851&p=32269#p32269 <![CDATA[ptAudio Manipulation]]>
I got a float buffer array ranging -1 .. 1 contening wav sample info let's say of 1 second lenght 44100.

for now ive created an "AudioOut" ptArray output of blocsize, . and i srub my big buffer array on process procedure.
that works if i connect ausio outs to the array i do hear the escpected audio. but feel it would be more clean, i would get more function if i used a ptAudio instead.

Howerver im currently stuck, don't really understand how to work with.

im tring to precompute/fill a BLOC_SMP_BUFFER of bloc size, then 'apply it to Audioout but that doesn't seem to work that way.

CODE:

if &#40;PLAY&#41;&#123;BLOC_SMP_BUFFER = new float&#91;BlocSize&#93;;sdkSetEvtSize&#40;Audio_Out, BlocSize&#41;;    //set size temporary here for debug, will be in callbacksdkSetEvtSize&#40;AudioOut, BlocSize&#41;;     // Audio_Out is a ptArray, AudioOut ptAudiioCurrentBloc = CurrentBloc + 1;if &#40;CurrentBloc > floor&#40;&#40; SMP_DURATION / BlocSize &#41;&#41;&#41;      // loops if reaching end of buffer&#123;CurrentBloc = 0;&#125;for &#40;int i = 0; i < BlocSize; i++&#41;&#123;BLOC_SMP_BUFFER&#91;i&#93; = SMP_BUFFER&#91;i + &#40;CurrentBloc * BlocSize&#41;&#93;;            //preparing a blocsize filled buffer//sdkSetEvtArrayData&#40;Audio_Out, i, SMP_BUFFER&#91;i + &#40;CurrentBloc * BlocSize&#41;&#93;&#41;;         // old code that was working if ptArrayOut//sdkSetEvtPointer&#40;AudioOut, BLOC_SMP_BUFFER&#41;;&#125;sdkSetEvtPointer&#40;AudioOut, BLOC_SMP_BUFFER&#41;;                  // trying to set the ptaudio out,   doesn't seem to work, what's the correct way of doing?&#125;
any enlightments?

Statistics: Posted by 23fx23 — 15 Apr 2015, 17:22


]]>