]]>2017-06-30T23:38:55+02:002017-06-30T23:38:55+02:00https://www.brainmodular.org/forums/viewtopic.php?t=5770&p=37229#p37229I did the tricks on your first post. put 8 array outputs so I can scan the memory slots differently for each of my 8 loudspeakers.
Statistics: Posted by oli_lab — 30 Jun 2017, 23:38
]]>2017-06-30T23:19:41+02:002017-06-30T23:19:41+02:00https://www.brainmodular.org/forums/viewtopic.php?t=5770&p=37226#p37226 float mybuffer[128][1024]; // both are int representing X Y sizes for a float contening array. where here for ex 128 is your nb of 'slots' and 1024 nb of floats want in each slot.
]]>2017-06-30T22:15:20+02:002017-06-30T22:15:20+02:00https://www.brainmodular.org/forums/viewtopic.php?t=5770&p=37218#p37218how would you declare mybuffer[128][1024]; //128 slots, 1024 floats
as 128 is for int and 1024 is for floats. ?
Statistics: Posted by oli_lab — 30 Jun 2017, 22:15
]]>2017-06-30T21:39:47+02:002017-06-30T21:39:47+02:00https://www.brainmodular.org/forums/viewtopic.php?t=5770&p=37216#p37216Statistics: Posted by 23fx23 — 30 Jun 2017, 21:39
]]>
2017-06-30T16:08:10+02:002017-06-30T16:08:10+02:00https://www.brainmodular.org/forums/viewtopic.php?t=5770&p=37199#p37199for conveniance i pers would do a bi-dimentional vector or array of nb_slots, nb_floats_per_slot, then let you set/get a slot. for ex
mybuffer[128][1024]; //128 slots, 1024 floats
TPrecision* Out_Ptr; //pointer to float adress
Out_Ptr = sdkGetEvtDataAddr(pArrayOut); // get mem adress of output pin array
memcpy(Out_Ptr, &(mybuffer[5][0]), slot_bytes_size); //copy to output array the content starting at start mem adress of slot 5, of slot size.
]]>2017-06-30T16:03:21+02:002017-06-30T16:03:21+02:00https://www.brainmodular.org/forums/viewtopic.php?t=5770&p=37198#p37198 The next idea is to build wavetables from fft : From an audio signal snap a fft every 10ms then resynthetise from the fft data on one period. Put the waves each after the other in one big wavetable that can be scanned. This way I can store a large amount of spectral data with fewer ram.
Statistics: Posted by oli_lab — 30 Jun 2017, 16:03
or you can use new in cpp but be careful to delete the array prior a new one at some point if multiple calls or ram use will increase delete[] mybuffer; mybuffer = nullptr;
if want dynamic size i think it's better to use vector. vector has a reserve size where you would put max size, and a resize function to dynamically alter its size without needing to recreate a new one. vector.reserve(size); ie at init and vector.resize(newsize) in the code, ie getting length of your input buffer first #include <vector>
you can resize even without a reserve size set first, then it will find some freespace in ram and allocate, but internally the resizing will be more efficient if you had reserved first, tho of course i assume the max_size is locked space in ram then.
no problem looping and setting to 0 each id, but if setting to 0 the whole array man can use memset: memset(mybuffer, 0 , sizeof(float)*MAX_SIZE); or more simply memset(mybuffer, 0 , sizeof(mybuffer));
or assuming you know the MAX_SIZE, the bytes size is MAX_SIZE * 4 (4 bytes per float) so for a 1024 array its 4094 bytes memset(mybuffer,0,4096);
]]>2017-06-29T17:07:26+02:002017-06-29T17:07:26+02:00https://www.brainmodular.org/forums/viewtopic.php?t=5770&p=37179#p37179so I build a store array module !
I did a
TPrecision* m_buffer; and int bufferSize = MAX_ARRAY_SIZE * SLOTNUMBER; in .h
that init like this in .cpp:
storeArray::storeArray() { //Ensure that initial memo values at buffer are 0.0f m_buffer = new float[bufferSize]; for (int i = 0; i<bufferSize; i++) { m_buffer = 0.0f; }
so I have a buffer in which all the memory slots will be saved for example, if I set 128 slots of 1024 bits there will be a fixed amount of memory that will be taken for this module.
- is it a problem ?
- is there another way to have the size been chosen from the size of the incoming array at input ?
thanx
Statistics: Posted by oli_lab — 29 Jun 2017, 17:07
]]>2017-06-30T23:38:55+02:002017-06-30T23:38:55+02:00https://www.brainmodular.org/forums/viewtopic.php?t=5770&p=37229#p37229I did the tricks on your first post. put 8 array outputs so I can scan the memory slots differently for each of my 8 loudspeakers.
Statistics: Posted by oli_lab — 30 Jun 2017, 23:38
]]>2017-06-30T23:19:41+02:002017-06-30T23:19:41+02:00https://www.brainmodular.org/forums/viewtopic.php?t=5770&p=37226#p37226 float mybuffer[128][1024]; // both are int representing X Y sizes for a float contening array. where here for ex 128 is your nb of 'slots' and 1024 nb of floats want in each slot.
]]>2017-06-30T22:15:20+02:002017-06-30T22:15:20+02:00https://www.brainmodular.org/forums/viewtopic.php?t=5770&p=37218#p37218how would you declare mybuffer[128][1024]; //128 slots, 1024 floats
as 128 is for int and 1024 is for floats. ?
Statistics: Posted by oli_lab — 30 Jun 2017, 22:15
]]>2017-06-30T21:39:47+02:002017-06-30T21:39:47+02:00https://www.brainmodular.org/forums/viewtopic.php?t=5770&p=37216#p37216Statistics: Posted by 23fx23 — 30 Jun 2017, 21:39
]]>2017-06-30T16:08:10+02:002017-06-30T16:08:10+02:00https://www.brainmodular.org/forums/viewtopic.php?t=5770&p=37199#p37199for conveniance i pers would do a bi-dimentional vector or array of nb_slots, nb_floats_per_slot, then let you set/get a slot. for ex
mybuffer[128][1024]; //128 slots, 1024 floats
TPrecision* Out_Ptr; //pointer to float adress
Out_Ptr = sdkGetEvtDataAddr(pArrayOut); // get mem adress of output pin array
memcpy(Out_Ptr, &(mybuffer[5][0]), slot_bytes_size); //copy to output array the content starting at start mem adress of slot 5, of slot size.
]]>2017-06-30T16:03:21+02:002017-06-30T16:03:21+02:00https://www.brainmodular.org/forums/viewtopic.php?t=5770&p=37198#p37198 The next idea is to build wavetables from fft : From an audio signal snap a fft every 10ms then resynthetise from the fft data on one period. Put the waves each after the other in one big wavetable that can be scanned. This way I can store a large amount of spectral data with fewer ram.
Statistics: Posted by oli_lab — 30 Jun 2017, 16:03
or you can use new in cpp but be careful to delete the array prior a new one at some point if multiple calls or ram use will increase delete[] mybuffer; mybuffer = nullptr;
if want dynamic size i think it's better to use vector. vector has a reserve size where you would put max size, and a resize function to dynamically alter its size without needing to recreate a new one. vector.reserve(size); ie at init and vector.resize(newsize) in the code, ie getting length of your input buffer first #include <vector>
you can resize even without a reserve size set first, then it will find some freespace in ram and allocate, but internally the resizing will be more efficient if you had reserved first, tho of course i assume the max_size is locked space in ram then.
no problem looping and setting to 0 each id, but if setting to 0 the whole array man can use memset: memset(mybuffer, 0 , sizeof(float)*MAX_SIZE); or more simply memset(mybuffer, 0 , sizeof(mybuffer));
or assuming you know the MAX_SIZE, the bytes size is MAX_SIZE * 4 (4 bytes per float) so for a 1024 array its 4094 bytes memset(mybuffer,0,4096);
]]>2017-06-29T17:07:26+02:002017-06-29T17:07:26+02:00https://www.brainmodular.org/forums/viewtopic.php?t=5770&p=37179#p37179so I build a store array module !
I did a
TPrecision* m_buffer; and int bufferSize = MAX_ARRAY_SIZE * SLOTNUMBER; in .h
that init like this in .cpp:
storeArray::storeArray() { //Ensure that initial memo values at buffer are 0.0f m_buffer = new float[bufferSize]; for (int i = 0; i<bufferSize; i++) { m_buffer = 0.0f; }
so I have a buffer in which all the memory slots will be saved for example, if I set 128 slots of 1024 bits there will be a fixed amount of memory that will be taken for this module.
- is it a problem ?
- is there another way to have the size been chosen from the size of the incoming array at input ?
thanx
Statistics: Posted by oli_lab — 29 Jun 2017, 17:07