sox-devel@lists.sourceforge.net unofficial mirror
 help / color / mirror / code / Atom feed
* Bug in noiseprof and solution
@ 2013-07-22 20:10 Eric Seigne
  2013-07-22 20:48 ` Eric Wong
  2013-07-22 22:29 ` Ulrich Klauer
  0 siblings, 2 replies; 3+ messages in thread
From: Eric Seigne @ 2013-07-22 20:10 UTC (permalink / raw)
  To: sox-devel

Hello SoX,
thanks a lot for this great software,

Here is a bug on "noiseprof" i've found with a qt/c++ program linked 
with libsox: i'm french and my LC_ALL is fr_FR,UTF-8,

So, with

     e = sox_create_effect(sox_find_effect("noiseprof"));
     /** @todo : hardcoded /tmp */
     args[0] = 
QString("/tmp/speech,noise-profile"),toLocal8Bit(),data(), 
assert(sox_effect_options(e, 1, args) == SOX_SUCCESS);
     /* Add the effect to the end of the effects processing chain: */
     assert(sox_add_effect(chain, e, &in->signal, &in->signal) == 
SOX_SUCCESS);
     free(e);

here is the "/tmp/speech,noise-profile" file:

Channel 0: 3,047390, 1,534390, 4,114414, 3,004703, 1,243448, 2,580552, 
1,129953, 0,404866, -0,121925, 0,044354, -0,710480, -0,979841, 
-0,711537, -0,996287, -1,384458, -1,586990, -1,336374, -1,201493, 
-1,697891, -2,279214, -2,590128, -2,145515, -2,348577, -2,689942, 
-2,481813, -3,085717, -2,521961, -2,713550, -2,320019, -2,840446, 
-3,526634, -3,148457, -3,034222, -2,870867, -3,457385, -3,601101, 
-2,863945, -3,179872, -3,024866, -3,170430, -3,621130, -3,475812, 
-3,904187, -4,044270, -3,248022, -3,389662, -4,115351, -3,659480, 
-3,953193, -3,662701, -3,889562, -4,013755, -4,003562, -4,006090, 
-4,090188, -3,878983, -3,614705, -3,836484, -3,610538, -3,533174, 
-3,676175, -3,809078, -3,791255, -3,979275, -3,643000, -3,255655, 
-3,879137, -4,114060, -3,921518, -3,501679, -3,722234, -4,315992, 
-4,238842, -4,613838, -4,013523, -4,689832, -4,576934, -4,135202, 
-4,764537, -4,382237, -4,044756, -4,095278, -4,158801, -4,316542, 
-3,779092, -4,021744, -4,380245, -4,300476, -4,070212, -4,071876, 
-4,233169, -4,730268, -4,330000, -4,847591, -4,565621, -4,806035, 
-4,866297, -4,719074, -4,804684, -4,429832, -5,059474, -5,055383, 
-5,476941, -4,885943, -4,877392, -4,672623, -4,970227, -4,906325, 
-4,360123, -4,440337, -4,751331, -5,089587, -4,687487, -4,648368, 
-4,447606, -4,812624, -4,549119, -4,607228, -4,884578, -5,238595, 
-4,849269, -4,815041, -5,529047, -5,267439, -5,067604, -5,534753, 
-5,492247, -5,096827, -5,252319, -5,346457, -4,976724, -6,047471, 
-5,304580, -5,481613, -5,077429, -5,545468, -5,813852, -5,566026, 
-6,226928, -5,775159, -5,794435, -6,136821, -5,620793, -5,637400, 
-5,443169, -5,874087, -5,833232, -5,472189, -5,264391, -5,506101, 
-5,484663, -6,318092,

please have a look at "," wich is used twice, one for decimal separator 
and one for fields separator ... so noiseprof does not work !

if i add

     setlocale(LC_ALL, "C");

juste before "    e = sox_create_effect(sox_find_effect("noiseprof"));" 
here is the result:

Channel 0: 3.047390, 1.534390, 4.114414, 3.004703, 1.243448, 2.580552, 
1.129953, 0.404866, -0.121925, 0.044354, -0.710480, -0.979841, 
-0.711537, -0.996287, -1.384458, -1.586990, -1.336374, -1.201493, 
-1.697891, -2.279214, -2.590128, -2.145515, -2.348577, -2.689942, 
-2.481813, -3.085717, -2.521961, -2.713550, -2.320019, -2.840446, 
-3.526634, -3.148457, -3.034222, -2.870867, -3.457385, -3.601101, 
-2.863945, -3.179872, -3.024866, -3.170430, -3.621130, -3.475812, 
-3.904187, -4.044270, -3.248022, -3.389662, -4.115351, -3.659480, 
-3.953193, -3.662701, -3.889562, -4.013755, -4.003562, -4.006090, 
-4.090188, -3.878983, -3.614705, -3.836484, -3.610538, -3.533174, 
-3.676175, -3.809078, -3.791255, -3.979275, -3.643000, -3.255655, 
-3.879137, -4.114060, -3.921518, -3.501679, -3.722234, -4.315992, 
-4.238842, -4.613838, -4.013523, -4.689832, -4.576934, -4.135202, 
-4.764537, -4.382237, -4.044756, -4.095278, -4.158801, -4.316542, 
-3.779092, -4.021744, -4.380245, -4.300476, -4.070212, -4.071876, 
-4.233169, -4.730268, -4.330000, -4.847591, -4.565621, -4.806035, 
-4.866297, -4.719074, -4.804684, -4.429832, -5.059474, .../...

and everything works well.

So is this bug resolved with last git version ?

Éric

------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Bug in noiseprof and solution
  2013-07-22 20:10 Bug in noiseprof and solution Eric Seigne
@ 2013-07-22 20:48 ` Eric Wong
  2013-07-22 22:29 ` Ulrich Klauer
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Wong @ 2013-07-22 20:48 UTC (permalink / raw)
  To: sox-devel

Eric Seigne <eric.seigne@ryxeo.com> wrote:
> Here is a bug on "noiseprof" i've found with a qt/c++ program linked 
> with libsox: i'm french and my LC_ALL is fr_FR,UTF-8,

> here is the "/tmp/speech,noise-profile" file:
> 
> Channel 0: 3,047390, 1,534390, 4,114414, 3,004703, 1,243448, 2,580552, 

<snip>

> please have a look at "," wich is used twice, one for decimal separator 
> and one for fields separator ... so noiseprof does not work !
> 
> if i add
> 
>      setlocale(LC_ALL, "C");

I think you can use LC_NUMERIC instead of LC_ALL to limit the scope of
the locale change.

> and everything works well.
> 
> So is this bug resolved with last git version ?

It does not look to be, it looks like it's caused by the use of
"%f" with fprintf in src/noiseprof.c

I'm think the SoX maintainers would be interested in a portable fix
if you can provide one.

------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Bug in noiseprof and solution
  2013-07-22 20:10 Bug in noiseprof and solution Eric Seigne
  2013-07-22 20:48 ` Eric Wong
@ 2013-07-22 22:29 ` Ulrich Klauer
  1 sibling, 0 replies; 3+ messages in thread
From: Ulrich Klauer @ 2013-07-22 22:29 UTC (permalink / raw)
  To: sox-devel

Eric Seigne wrote:

>      setlocale(LC_ALL, "C");
> juste before "    e = sox_create_effect(sox_find_effect("noiseprof"));"

> So is this bug resolved with last git version ?

Well, your local locale is only set because you call setlocale()  
somewhere else in your program. SoX/libSoX never do that. I'd  
therefore think it is also your responsability to unset the locale  
(set to "C") when necessary, thus not consider it a bug.

Ulrich


------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-07-22 22:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-22 20:10 Bug in noiseprof and solution Eric Seigne
2013-07-22 20:48 ` Eric Wong
2013-07-22 22:29 ` Ulrich Klauer

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/sox.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).