[Scilab-users] 3 byte integers

Jan Åge Langeland j-lan at online.no
Wed Dec 18 13:29:39 CET 2019


As a quick fix, would it work to use a temporary file for the data you 
want to append?  Something like this

wavwrite(wavdata_24,'temp')

f1=mopen('temp.wav'.,'rb')

wavdata_bytes=mget(n_bytes,'c',f1)

f2=mopen('main.wav','ab')

mput(wavdata_bytes(45:n_bytes),'c',f2)

Brgds

Jan

On 2019-12-18 5:37 AM, Federico Miyara wrote:

>
> Stéphane,
>
> Sorry for having explained myself so poorly. The problem with the 
> macros already available is that in order to save a wavfile in a 
> single operation, I need to have the whole signal loaded in a 
> variable. I'm not sure whether it is possible to handle a variable 
> with about 2 gigasamples (the maximum 16 bit mono file that Windows 
> allows --a total file size of 4 GB--). This would demand 16 GB just 
> for a single variable.
>
> I'm pretty sure that problems would arise even with an audio variable 
> much smaller than that.
>
> This is the reason why I need to be able to append new audio data to 
> an existing wave file, so that much less information is handled at a 
> time. Of course this requires to edit the header to update the file 
> size after the append, but this is quite easy.
>
> The tough part is to save three byte numbers, since the existing mput 
> command supports 1, 2, 4 and 8 byte formats, but not the 3 byte used 
> for 24 bit audio. If there were a native macro or primitive capable of 
> formatting numbers as 3 byte, it would be helpful.
>
> Thanks,
>
> Federico Miyara
>
>
>
> On 17/12/2019 18:37, Federico Miyara wrote:
>>
>> Stéphane,
>>
>> wavewrite also supports 3 bytes, but as I commented, I cannot save, 
>> not evem generate huge files, so i must create them by successive 
>> appending, so i needto be able to save 3 byte numbers directly.
>>
>> Thanks anyway.
>>
>> Regards,
>>
>> Federico Miyara
>>
>> On 17/12/2019 17:15, Stéphane Mottelet wrote:
>>> Hello
>>>
>>> I think it is supported in savewave and loadwave. There was a pb 
>>> with savewave but fixed by
>>>
>>> https://codereview.scilab.org/#/c/19947/
>>>
>>> in 6.0.2
>>>
>>> S.
>>>
>>>> Le 17 déc. 2019 à 20:09, Federico Miyara <fmiyara at fceia.unr.edu.ar> 
>>>> a écrit :
>>>>
>>>> 
>>>> Dear All,
>>>>
>>>> While it is possible to create directly a wav file of reasonable 
>>>> size from Scilab, if the size is very large, say, 1 Gb,we willmost 
>>>> likely have memory problems. That's why I'm trying to program a 
>>>> script allowing to append new audio data to an existing wav file.
>>>>
>>>> It is simple to save 8 bit, 16 bit and 32 bit samples to a file. 
>>>> However, 24 bit is also a popular format and Scilab doesn't seem to 
>>>> support 3 byte integer format, either for variables and read/write 
>>>> file operations.
>>>>
>>>> Is there some way to save 3 byte integers other than creating a 
>>>> specialized routine from scratch?
>>>>
>>>> Regards,
>>>>
>>>> Federico Miyara
>>>> _______________________________________________
>>>> users mailing list
>>>> users at lists.scilab.org
>>>> https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/users
>>>
>>> _______________________________________________
>>> users mailing list
>>> users at lists.scilab.org
>>> http://lists.scilab.org/mailman/listinfo/users
>>
>>
>> _______________________________________________
>> users mailing list
>> users at lists.scilab.org
>> http://lists.scilab.org/mailman/listinfo/users
>
>
> _______________________________________________
> users mailing list
> users at lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20191218/67ffb79d/attachment.htm>


More information about the users mailing list