Hi all,
I wonder how to get access to data compressed into ‘flac’ file format, did anyone already worked around this format ? Anything else than first convert flac to wav format, to be opened afterwards with wavread()
?
Thanks,
David
Hi all,
I wonder how to get access to data compressed into ‘flac’ file format, did anyone already worked around this format ? Anything else than first convert flac to wav format, to be opened afterwards with wavread()
?
Thanks,
David
Hello David,
There is an old toolbox supporting flac: https://atoms.scilab.org/toolboxes/sndfile_toolbox/0.2.1
However, I have no idea of the necessary work to rebuild it, as it was designed to work with Scilab 5 family.
S.
A good news is that the thirdparty library (libsndfile · GitHub) is still maintained.
S.
Hi Stephane,
thank you for pointing to this module sndfile, I’m trying to rebuild it on WIN64 and I’m stuck on compilation phase, see below. It looks like stack-c.h
that is pointed in the gateway is no longer available : actually I saw that it’s the old C API, deprecated since Scilab 6 : is there somewhere resource to help moving from the old API to the new one ?
David
--> exec('C:\Users\dc227480\Downloads\sndfile_toolbox-0.2.1-2-src\sndfile_toolbox_0.2.1\builder.sce', -1)
Création des macros...
-- Création de [sndfile_toolboxlib] (Macros) --
Création de la passerelle...
"------------- Compile file sci_sfgetbroadcastinfo.c --------------"
" IF NOT EXIST Release mkdir Release"
" cl -D__MSC__ -DFORDLL -D_WIN64 -c -DSTRICT -D_CRT_SECURE_NO_DEPRECATE -D__MAKEFILEVC__ -nologo -I"C:/Users/dc227480/AppData/Local/SCILAB~4.0/libs/MALLOC/includes" -I"C:/Users/dc227480/AppData/Local/SCILAB~4.0/libs/f2c" -I"C:/Users/dc227480/AppData/Local/SCILAB~4.0/libs/intl" -I"C:/Users/dc227480/AppData/Local/SCILAB~4.0/modules/core/includes" -I"C:/Users/dc227480/AppData/Local/SCILAB~4.0/modules/api_scilab/includes" -I"C:/Users/dc227480/AppData/Local/SCILAB~4.0/modules/call_scilab/includes" -I"C:/Users/dc227480/AppData/Local/SCILAB~4.0/modules/output_stream/includes" -I"C:/Users/dc227480/AppData/Local/SCILAB~4.0/modules/jvm/includes" -I"C:/Users/dc227480/AppData/Local/SCILAB~4.0/modules/localization/includes" -I"C:/Users/dc227480/AppData/Local/SCILAB~4.0/modules/dynamic_link/includes" -I"C:/Users/dc227480/AppData/Local/SCILAB~4.0/modules/mexlib/includes" -I"C:/Users/dc227480/AppData/Local/SCILAB~4.0/modules/time/includes" -I"C:/Users/dc227480/AppData/Local/SCILAB~4.0/modules/windows_tools/includes" -I"C:/Users/dc227480/AppData/Local/SCILAB~4.0/modules/threads/includes" -I"C:/Users/dc227480/AppData/Local/SCILAB~4.0/modules/ast/includes/ast" -I"C:/Users/dc227480/AppData/Local/SCILAB~4.0/modules/ast/includes/exps" -I"C:/Users/dc227480/AppData/Local/SCILAB~4.0/modules/ast/includes/operations" -I"C:/Users/dc227480/AppData/Local/SCILAB~4.0/modules/ast/includes/parse" -I"C:/Users/dc227480/AppData/Local/SCILAB~4.0/modules/ast/includes/symbol" -I"C:/Users/dc227480/AppData/Local/SCILAB~4.0/modules/ast/includes/system_env" -I"C:/Users/dc227480/AppData/Local/SCILAB~4.0/modules/ast/includes/types" -I"C:/Users/dc227480/AppData/Local/SCILAB~4.0/modules/string/includes" -I"C:/Users/dc227480/AppData/Local/SCILAB~4.0/modules/console/includes" -W3 -Gd -Z7 -O2 -MD -DNDEBUG /Fo"Release/" /Fd"Release/" -D__SCILAB_TOOLBOX__ -DFORDLL -I"C:\Users\dc227480\Downloads\sndfile_toolbox-0.2.1-2-src\sndfile_toolbox_0.2.1\sci_gateway\c\../../thirdparty/include" -D__USE_DEPRECATED_STACK_FUNCTIONS__ -DNDEBUG -DSNDFILE_C_GW_EXPORTS sci_sfgetbroadcastinfo.c"
"sci_sfgetbroadcastinfo.c"
"sci_sfgetbroadcastinfo.c(6): fatal error C1083: Impossible d'ouvrir le fichier include : 'stack-c.h' : No such file or directory"
"NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\bin\HostX64\x64\cl.EXE"'á: code retour '0x2'"
"Stop."
à la ligne 34 de la fonction dlwCompile ( C:\Users\dc227480\AppData\Local\scilab-2025.0.0\modules\dynamic_link\macros\windows\dlwCompile.sci ligne 47 )
à la ligne 70 de la fonction ilib_compile ( C:\Users\dc227480\AppData\Local\scilab-2025.0.0\modules\dynamic_link\macros\ilib_compile.sci ligne 86 )
à la ligne 125 de la fonction ilib_build ( C:\Users\dc227480\AppData\Local\scilab-2025.0.0\modules\dynamic_link\macros\ilib_build.sci ligne 138 )
à la ligne 134 de la fonction tbx_build_gateway ( C:\Users\dc227480\AppData\Local\scilab-2025.0.0\modules\modules_manager\macros\tbx_build_gateway.sci ligne 148 )
à la ligne 59 du fichier exécuté C:\Users\dc227480\Downloads\sndfile_toolbox-0.2.1-2-src\sndfile_toolbox_0.2.1\sci_gateway\c\builder_gateway_c.sce
à la ligne 13 de la fonction tbx_builder ( C:\Users\dc227480\AppData\Local\scilab-2025.0.0\modules\modules_manager\macros\tbx_builder.sci ligne 26 )
à la ligne 54 de la fonction tbx_builder_gateway_lang ( C:\Users\dc227480\AppData\Local\scilab-2025.0.0\modules\modules_manager\macros\tbx_builder_gateway_lang.sci ligne 79 )
à la ligne 6 du fichier exécuté C:\Users\dc227480\Downloads\sndfile_toolbox-0.2.1-2-src\sndfile_toolbox_0.2.1\sci_gateway\builder_gateway.sce
à la ligne 13 de la fonction tbx_builder ( C:\Users\dc227480\AppData\Local\scilab-2025.0.0\modules\modules_manager\macros\tbx_builder.sci ligne 26 )
à la ligne 35 de la fonction tbx_builder_gateway ( C:\Users\dc227480\AppData\Local\scilab-2025.0.0\modules\modules_manager\macros\tbx_builder_gateway.sci ligne 51 )
à la ligne 25 du fichier exécuté C:\Users\dc227480\Downloads\sndfile_toolbox-0.2.1-2-src\sndfile_toolbox_0.2.1\builder.sce
ilib_compile : Erreur à l'exécution de Makelib.mak.
I just commented #include stack-c.h
since #include api_scilab.h
was already there, however still issue with old API functions calls, like pvApiCtx…
It looks like significant work to move the gateway to the new one, I guess beyond what I can afford.
David
"------------- Compile file sci_sfgetbroadcastinfo.c --------------"
" IF NOT EXIST Release mkdir Release"
" cl -D__MSC__ -DFORDLL -D_WIN64 -c -DSTRICT -D_CRT_SECURE_NO_DEPRECATE -D__MAKEFILEVC__ -nologo -I"C:/Users/dc227480/AppData/Local/SCILAB~4.0/libs/MALLOC/includes" -I"C:/Users/dc227480/AppData/Local/SCILAB~4.0/libs/f2c" -I"C:/Users/dc227480/AppData/Local/SCILAB~4.0/libs/intl" -I"C:/Users/dc227480/AppData/Local/SCILAB~4.0/modules/core/includes" -I"C:/Users/dc227480/AppData/Local/SCILAB~4.0/modules/api_scilab/includes" -I"C:/Users/dc227480/AppData/Local/SCILAB~4.0/modules/call_scilab/includes" -I"C:/Users/dc227480/AppData/Local/SCILAB~4.0/modules/output_stream/includes" -I"C:/Users/dc227480/AppData/Local/SCILAB~4.0/modules/jvm/includes" -I"C:/Users/dc227480/AppData/Local/SCILAB~4.0/modules/localization/includes" -I"C:/Users/dc227480/AppData/Local/SCILAB~4.0/modules/dynamic_link/includes" -I"C:/Users/dc227480/AppData/Local/SCILAB~4.0/modules/mexlib/includes" -I"C:/Users/dc227480/AppData/Local/SCILAB~4.0/modules/time/includes" -I"C:/Users/dc227480/AppData/Local/SCILAB~4.0/modules/windows_tools/includes" -I"C:/Users/dc227480/AppData/Local/SCILAB~4.0/modules/threads/includes" -I"C:/Users/dc227480/AppData/Local/SCILAB~4.0/modules/ast/includes/ast" -I"C:/Users/dc227480/AppData/Local/SCILAB~4.0/modules/ast/includes/exps" -I"C:/Users/dc227480/AppData/Local/SCILAB~4.0/modules/ast/includes/operations" -I"C:/Users/dc227480/AppData/Local/SCILAB~4.0/modules/ast/includes/parse" -I"C:/Users/dc227480/AppData/Local/SCILAB~4.0/modules/ast/includes/symbol" -I"C:/Users/dc227480/AppData/Local/SCILAB~4.0/modules/ast/includes/system_env" -I"C:/Users/dc227480/AppData/Local/SCILAB~4.0/modules/ast/includes/types" -I"C:/Users/dc227480/AppData/Local/SCILAB~4.0/modules/string/includes" -I"C:/Users/dc227480/AppData/Local/SCILAB~4.0/modules/console/includes" -W3 -Gd -Z7 -O2 -MD -DNDEBUG /Fo"Release/" /Fd"Release/" -D__SCILAB_TOOLBOX__ -DFORDLL -I"C:\Users\dc227480\Downloads\sndfile_toolbox-0.2.1-2-src\sndfile_toolbox_0.2.1\sci_gateway\c\../../thirdparty/include" -D__USE_DEPRECATED_STACK_FUNCTIONS__ -DNDEBUG -DSNDFILE_C_GW_EXPORTS sci_sfgetbroadcastinfo.c"
"sci_sfgetbroadcastinfo.c"
"sci_sfgetbroadcastinfo.c(15): error C2065: 'pvApiCtx' : identificateur non déclaré"
"sci_sfgetbroadcastinfo.c(15): warning C4022: 'assignOutputVariable' : incompatibilité de pointeur pour le paramètre réel 1"
"sci_sfgetbroadcastinfo.c(16): error C2065: 'pvApiCtx' : identificateur non déclaré"
"sci_sfgetbroadcastinfo.c(16): warning C4022: 'returnArguments' : incompatibilité de pointeur pour le paramètre réel 1"
"NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\bin\HostX64\x64\cl.EXE"'á: code retour '0x2'"
"Stop."
Hi.
You can have a look to the following MR: thirdparty build and clean gateway sources (!1) · Merge requests · scilab / forge / sndfile-toolbox · GitLab
I am currently working on the Windows build, but you will find above some fixes that have to be done in the sources.
S.
I have a workaround, but you need to have the reference (official) codec (flac.exe) somewhere in your computer. It would be possible to create a function from scratch that implements the codec since the flac format is thoroughly documented. I tried this approach but it is too much work. Using the reference codec is much easier and it ensures compatibility with any future update provided you have the last version.
Find here
https://www.fceia.unr.edu.ar/acustica/psychoacoustics/
the functions flacread() and flacwrite() which allow both reading and writing flac files. At the beginning of the functions you have some information about syntax and usage, including the link to download the codec.
I believe the functions work only in Windows since they need access to flac as a command-line tool
Regards,
Federico Miyara
PD: The reference codec is also quite efficient, much more than could be achieved with a Scilab function
Thank you Stephane,
I read the changes that you made in gitlab for sndfile module, it confirms what I found in this resource GatewaysFromScilab5ToScilab6
that explains the fixes to implement from scilab 5 to scilab 6 (and above) gateways. I suppose I can try to download and build the gitlab module to confirm it works properly ?
David
Hello,
I have just finished updating and building the module, you just have to type
atomsSystemUpdate
atomsInstall sndfile_toolbox
S.
Hello Stephane,
it works like a charm !
Actually it’s not audio data inside the flac file that I’m processing but voltage sine waves record from the electricity distribution grid, compressed format to manage large amount of data. This may possibly help other people working in this field hopefully.
Thank you again
David