Re: [fpc-pascal] Adding a array of float in ressource and use it ?

2017-03-08 Thread fredvs
> This has nothing to do with C compilers or with 16 vs 32 bit numbers. Ha, ok. Then I do not understand why C developers are afraid to store float data. ;-) Fre;D - Many thanks ;-) -- View this message in context:

Re: [fpc-pascal] Adding a array of float in ressource and use it ?

2017-03-08 Thread Jonas Maebe
On 08/03/17 19:57, fredvs wrote: For a file created with a TFileStream of gcc but that will be used by a program compiled with VS, you should convert the data from little endian to native ordering (or reverse) with something like: for i := 0 to nSamples-1 do b egin

Re: [fpc-pascal] Adding a array of float in ressource and use it ?

2017-03-08 Thread fredvs
> can't you have spreading incorrect information on C Hello. Some more infos about the problem of our C friends It seams that for C compilers (Clang, gcc, c++, VS,...) the way to order the data with a TFileStream differs (not same x-endians) for encoding float. So you must do it by code and

Re: [fpc-pascal] Adding a array of float in ressource and use it ?

2017-03-08 Thread fredvs
> The first says that 8-bit is unsigned, the second says signed. > The first does not mention floats, the second says 32-bits but only -1.0 > to 1.0. Hello. Yes wav is nebulous and this site: http://stackoverflow.com/questions/2062620/how-to-write-wav-file-with-32-bit-float-data says it must

Re: [fpc-pascal] Adding a array of float in ressource and use it ?

2017-03-08 Thread José Mejuto
El 08/03/2017 a las 0:03, Vojtěch Čihák escribió: there are different informations about *.wav, so maybe there are different impementations too. http://soundfile.sapp.org/doc/WaveFormat/

Re: [fpc-pascal] Adding a array of float in ressource and use it ?

2017-03-08 Thread Lukasz Sokol
On 07/03/17 23:03, Vojtěch Čihák wrote: > Hi, > > intersting, > > there are different informations about *.wav, so maybe there are different > impementations too. > > See: > > http://soundfile.sapp.org/doc/WaveFormat/ > This also has endiannes information, which is quite cool.. > and >

Re: [fpc-pascal] Adding a array of float in ressource and use it ?

2017-03-07 Thread Vojtěch Čihák
Hi,   there are different informations about *.wav, so maybe there are different impementations too. See: http://soundfile.sapp.org/doc/WaveFormat/ and https://blogs.msdn.microsoft.com/dawate/2009/06/23/intro-to-audio-programming-part-2-demystifying-the-wav-format/   The first says that 8-bit is

Re: [fpc-pascal] Adding a array of float in ressource and use it ?

2017-03-07 Thread Sven Barth via fpc-pascal
On 07.03.2017 22:39, fredvs wrote: > OK, Sven you win (and http://stackoverflow.com should follow fpc forum). > But you will not convince me that c does better than fpc, maybe equal but > surely not better. Despite me definitely favoring Object Pascal as well, I can't you have spreading

Re: [fpc-pascal] Adding a array of float in ressource and use it ?

2017-03-07 Thread fredvs
OK, Sven you win (and http://stackoverflow.com should follow fpc forum). But you will not convince me that c does better than fpc, maybe equal but surely not better. Huh, saving a buffer of float into wav file format, with correct header, ---> loaded by audacity > horrible noise. loaded by

Re: [fpc-pascal] Adding a array of float in ressource and use it ?

2017-03-07 Thread Sven Barth via fpc-pascal
On 07.03.2017 16:30, fredvs wrote: >>> Many thanks Sven for your help. >>> Do you agree if I add your name into the list of the "great contributors" >>> of >>> uos (https://github.com/fredvs/uos) ? >> I don't think that's necessary. I'm merely doing my "job"... > > OK, I understand. (But I ask it

Re: [fpc-pascal] Adding a array of float in ressource and use it ?

2017-03-07 Thread fredvs
>> Many thanks Sven for your help. >> Do you agree if I add your name into the list of the "great contributors" >> of >> uos (https://github.com/fredvs/uos) ? > I don't think that's necessary. I'm merely doing my "job"... OK, I understand. (But I ask it always when I get great help, it is a

Re: [fpc-pascal] Adding a array of float in ressource and use it ?

2017-03-07 Thread Lukasz Sokol
Hi, On 07/03/17 13:23, Michael Van Canneyt wrote: > >> Huh? Of course you can do that rather similary in C as well. > > Indeed. You can do exactly the same. You can do this: > > {$mode objfpc} > uses classes; > > > Type > Float = Double; > TFloatArray = Array of Float; > > Procedure

Re: [fpc-pascal] Adding a array of float in ressource and use it ?

2017-03-07 Thread Michael Van Canneyt
On Tue, 7 Mar 2017, Sven Barth via fpc-pascal wrote: Am 07.03.2017 13:49 schrieb "fredvs" : To access a file stored as a resource you need to use TResourceStream. Ho my Dog, I did not know this one. More than perfect, many thanks Sven. PS: About array of float into

Re: [fpc-pascal] Adding a array of float in ressource and use it ?

2017-03-07 Thread Sven Barth via fpc-pascal
Am 07.03.2017 13:49 schrieb "fredvs" : > > > To access a file stored as a resource you need to use TResourceStream. > > Ho my Dog, I did not know this one. > More than perfect, many thanks Sven. > > PS: About array of float into TFileStream, after Googling a while, it s not >

Re: [fpc-pascal] Adding a array of float in ressource and use it ?

2017-03-07 Thread fredvs
> To access a file stored as a resource you need to use TResourceStream. Ho my Dog, I did not know this one. More than perfect, many thanks Sven. PS: About array of float into TFileStream, after Googling a while, it s not possible to do directly like fpc does for C compilers. You need a

Re: [fpc-pascal] Adding a array of float in ressource and use it ?

2017-03-07 Thread Sven Barth via fpc-pascal
Am 06.03.2017 23:57 schrieb "fredvs" : > > Re-hello. > > Ok, I do not find yet the guilty in my code, I will re-try a other day. > By the way, your code is working perfectly Sven. > > Now, last part of the question: how to convert that file stored into > ressource but without to

Re: [fpc-pascal] Adding a array of float in ressource and use it ?

2017-03-06 Thread fredvs
Re-hello. Ok, I do not find yet the guilty in my code, I will re-try a other day. By the way, your code is working perfectly Sven. Now, last part of the question: how to convert that file stored into ressource but without to write to the disk (only memory stream)? A TFileStream could be used

Re: [fpc-pascal] Adding a array of float in ressource and use it ?

2017-03-06 Thread Sven Barth via fpc-pascal
Am 06.03.2017 22:45 schrieb "fredvs" : > > > I don't know what you're doing wrong, but the following works: > > Huh, it is exactly what I (think to) do. > And re-reading hundred times my code does not see any difference. > > OK, I will re-read thousand times the code, maybe I

Re: [fpc-pascal] Adding a array of float in ressource and use it ?

2017-03-06 Thread fredvs
> I don't know what you're doing wrong, but the following works: Huh, it is exactly what I (think to) do. And re-reading hundred times my code does not see any difference. OK, I will re-read thousand times the code, maybe I will find what is wrong. Many thanks for your code Sven. Fre;D

Re: [fpc-pascal] Adding a array of float in ressource and use it ?

2017-03-06 Thread Sven Barth via fpc-pascal
On 06.03.2017 19:31, fredvs wrote: >> Or, quite comically maybe: use a text file > > Or maybe, like in my second post, convert float32 ---> integer32 > > for x := 0 to length(floatbuffer) -1 do > begin >floatbuffer[x] := round(floatbuffer[x] * 2147483647); >if floatbuffer[x] >

Re: [fpc-pascal] Adding a array of float in ressource and use it ?

2017-03-06 Thread fredvs
> Or, quite comically maybe: use a text file Or maybe, like in my second post, convert float32 ---> integer32 for x := 0 to length(floatbuffer) -1 do begin floatbuffer[x] := round(floatbuffer[x] * 2147483647); if floatbuffer[x] > 2147483647 then floatbuffer[x] := 2147483647; if

Re: [fpc-pascal] Adding a array of float in ressource and use it ?

2017-03-06 Thread Lukasz Sokol
Or, quite comically maybe: use a text file... write/writeln and read/readln, and use zip compression on the text file to compress data... -L. On 06/03/17 15:59, Lukasz Sokol wrote: > On 06/03/17 14:50, fredvs wrote: >>> I don't know. By all logic, it should not work either. >> >> OK, It comes

Re: [fpc-pascal] Adding a array of float in ressource and use it ?

2017-03-06 Thread Michael Van Canneyt
On Mon, 6 Mar 2017, Lukasz Sokol wrote: On 06/03/17 14:50, fredvs wrote: I don't know. By all logic, it should not work either. OK, It comes from a "lucky" bug (thanks to reveal it). There was a setlength(buffer, length(buffer) * channels) not needed. Ok, fixed. But the problem remain:

Re: [fpc-pascal] Adding a array of float in ressource and use it ?

2017-03-06 Thread Michael Van Canneyt
On Mon, 6 Mar 2017, fredvs wrote: I don't know. By all logic, it should not work either. OK, It comes from a "lucky" bug (thanks to reveal it). There was a setlength(buffer, length(buffer) * channels) not needed. Ok, fixed. But the problem remain: If data are int16 or int32: OK, the file

Re: [fpc-pascal] Adding a array of float in ressource and use it ?

2017-03-06 Thread Lukasz Sokol
On 06/03/17 14:50, fredvs wrote: >> I don't know. By all logic, it should not work either. > > OK, It comes from a "lucky" bug (thanks to reveal it). > There was a setlength(buffer, length(buffer) * channels) not needed. > > Ok, fixed. > > But the problem remain: > > If data are int16 or

Re: [fpc-pascal] Adding a array of float in ressource and use it ?

2017-03-06 Thread fredvs
> I don't know. By all logic, it should not work either. OK, It comes from a "lucky" bug (thanks to reveal it). There was a setlength(buffer, length(buffer) * channels) not needed. Ok, fixed. But the problem remain: If data are int16 or int32: OK, the file is created with +- 1 mega bytes and I

Re: [fpc-pascal] Adding a array of float in ressource and use it ?

2017-03-06 Thread Sven Barth via fpc-pascal
Am 06.03.2017 13:42 schrieb "fredvs" : > > > I don't know. By all logic, it should not work either. > > Yes, it is I think too. > > Some more explanation: > > I use a "global" buffer of float to store data. > Those data can be int16, int32 or float32. > > For example, > > If

Re: [fpc-pascal] Adding a array of float in ressource and use it ?

2017-03-06 Thread fredvs
> I don't know. By all logic, it should not work either. Yes, it is I think too. Some more explanation: I use a "global" buffer of float to store data. Those data can be int16, int32 or float32. For example, If data are integer (16 or 32 bit), I do: bufferfloat[x] := 127.0 ; (for int16)

Re: [fpc-pascal] Adding a array of float in ressource and use it ?

2017-03-06 Thread Michael Van Canneyt
On Mon, 6 Mar 2017, fredvs wrote: Hello Michael and thanks for answer. You must write FileBuffer.Data.WriteBuffer(buffer[0],Length(Buffer)*Sizeof(Float)); Ha, perfect, many thanks. But there is something that I do not catch, why is it working for integer ? Sizeof Integer is 2 bits so,

Re: [fpc-pascal] Adding a array of float in ressource and use it ?

2017-03-06 Thread fredvs
Define "much less success". How are you writing the array and how are you reading it? Hello and thanks for answer. Here how the array is written: var buffer : array of float; FileBuffer.Data := TFileStream.Create(filename,fmCreate); FileBuffer.Data.Seek(0, soFromBeginning);

Re: [fpc-pascal] Adding a array of float in ressource and use it ?

2017-03-05 Thread Sven Barth via fpc-pascal
Am 05.03.2017 18:33 schrieb "fredvs" : > > Hello. > > I have saved the buffer into file with a TFileStream. > > With lot of success for array of cint16 and cint32. > > But for array of cfloat --> much less success. Define "much less success". How are you writing the array and

Re: [fpc-pascal] Adding a array of float in ressource and use it ?

2017-03-04 Thread fredvs
> What are you trying to achieve? Hello and thanks for answer. Huh, I realize that what I ask is stupid. Of course that array of float must be saved into file to be insered as ressource. I want to save a buffer of audio samples (a array of float) and use that saved file as ressource for a

Re: [fpc-pascal] Adding a array of float in ressource and use it ?

2017-03-04 Thread Sven Barth via fpc-pascal
Am 04.03.2017 16:06 schrieb "fredvs" : > > Hello. > > Is it possible to add a array of float into ressource ? > > For example, there is myarray : array of cfloat. > > Is it possible to store that array myarray ressource and, when I want to use > it from ressource, I get also a