Reply
Posts: 10
Registered: ‎03-05-2015

AN0055 speexenc source code

Hello, there is a modified version of source code speexenc.c (with output to "C" header file) used in AN0055? I use Linux and can not use speexenc.exe. Well thank you.

Posts: 2,202
Registered: ‎10-14-2014

Re: AN0055 speexenc source code

i am not sure i understand your question correctly or not.
i think the speexenc is a software that developed by Speex and you could try to get them from Internet.
WeiguoLu
Posts: 490
Registered: ‎09-18-2015

Re: AN0055 speexenc source code

Hi @dloop6,

 

You need to download the Speex source and build the package yourself. Google is your friend Smiley Happy

 

https://speex.org/downloads/

 

John

Posts: 10
Registered: ‎03-05-2015

Re: AN0055 speexenc source code

Yes, spexx from speex.org I have modified for AN0055 and SimplicityStudio (GCC) for Linux, this works. My question is just one file from the entire package - "speexenc.c", that was modified by SiliconLabs, and this is not a source code.

AN0055.pdf - ..."In order to save Speex encoded data to internal flash for voice playback, a PC application is required to convert a WAV file into a header file for the compiler to work with. The speexenc.exe in “pc_software” folder is used for this purpose. The Speex encoding utility is modified from speexenc.c that can be downloaded from http:// www.speex.org/downloads/. This PC application will convert the input WAV file into Speex encoded format binary file and C header file in one step."

Unmodified speexenc.c only generates a binary compressed file.

I need to get this:

/*
Header file generated by Speex Encoding Utility

Copyright (C) 2012 Silicon Labs
http://www.silabs.com


Encoding 8000 Hz audio using narrowband mode
Bitrate is: 8000 bps
Denoise is enabled
AGC level is: 8000.000000
Encoded file size is: 2860
*/

const unsigned char voice8k[] =
{
0x1b, 0x82, 0x4e, 0x00, 0x00, 0x39, 0xce, 0x70, 0x00, 0x1c, 0xe7, 0x38, 0x00,
0x0e, 0x73, 0x88,...

Posts: 246
Registered: ‎11-17-2013

Re: AN0055 speexenc source code

Linux ships with tools that can process binary input to a C compatible format:

 

> hexdump -ve '1/1 "0x%0.1x\,"' <input.bin >output.cinc

Usage is an include in a C source file:

uint8_t binary_array[]={
#include "output.cinc"
};
Posts: 10
Registered: ‎03-05-2015

Re: AN0055 speexenc source code

This is complicated because the output from the original speexenc utility is not RAW bin but it is wrapped in the OGG container.
It would be a good idea if I got the modified source code "speexenc.c" from Silabs so I could compile it for Linux. "Speexenc.exe" works though, but for this I have to start Virtualbox and Windows to run the spexenc.exe utility :-)

Posts: 490
Registered: ‎09-18-2015

Re: AN0055 speexenc source code

Hi @dloop6,

 

I think your best option at this point is to get familiar with Gstreamer and use it to demux the ogg container and dump the raw data into a .bin file. You can then use hexdump as @Turbo_J to get your a file with a C const array.

 

John

Highlighted
Posts: 10
Registered: ‎03-05-2015

Re: AN0055 speexenc source code

Hi JohnB,

thanks for the tip.

I like simple solutions, "speexenc.exe" does exactly what it takes. If it is a problem for Silabs to publish the modified source code "speexenc.c" (which is, by the way, part of the openource speex project), then I will have to modify it myself ...

Rasto