* Rate or Plug plugin problem when converting rate down
@ 2004-07-08 23:58 Francisco Moraes
2004-07-09 23:47 ` Francisco Moraes
0 siblings, 1 reply; 2+ messages in thread
From: Francisco Moraes @ 2004-07-08 23:58 UTC (permalink / raw)
To: alsa-devel
Whenever I use plug, plughw or rate plugins to convert a stream into a
lower frequency, I get cracks in the sound output.
I am attaching a dump of aplay -v with the rate plugin being used.
Any ideas of what can be wrong? I've tried even 24000 which is half of
the default frequency of the emu10k1x card, but it still causes the problem.
Francisco
Plug PCM: Rate conversion PCM (48000, sformat=S16_LE)
Its setup is:
stream : CAPTURE
access : RW_INTERLEAVED
format : S16_LE
subformat : STD
channels : 2
rate : 44100
exact rate : 44100 (44100/1)
msbits : 16
buffer_size : 3763
period_size : 1881
period_time : 42666
tick_time : 10000
tstamp_mode : NONE
period_step : 1
sleep_min : 0
avail_min : 1881
xfer_align : 1881
start_threshold : 1
stop_threshold : 3763
silence_threshold: 0
silence_size : 0
boundary : 986447872
Slave: Hardware PCM card 0 'Dell Sound Blaster Live!' device 0 subdevice 0
Its setup is:
stream : CAPTURE
access : MMAP_INTERLEAVED
format : S16_LE
subformat : STD
channels : 2
rate : 48000
exact rate : 48000 (48000/1)
msbits : 16
buffer_size : 4096
period_size : 2048
period_time : 42666
tick_time : 10000
tstamp_mode : NONE
period_step : 1
sleep_min : 0
avail_min : 2048
xfer_align : 2048
start_threshold : 1
stop_threshold : 4096
silence_threshold: 0
silence_size : 0
boundary : 1073741824
-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 -
digital self defense, top technical experts, no vendor pitches,
unmatched networking opportunities. Visit www.blackhat.com
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Rate or Plug plugin problem when converting rate down
2004-07-08 23:58 Rate or Plug plugin problem when converting rate down Francisco Moraes
@ 2004-07-09 23:47 ` Francisco Moraes
0 siblings, 0 replies; 2+ messages in thread
From: Francisco Moraes @ 2004-07-09 23:47 UTC (permalink / raw)
To: alsa-devel
Francisco Moraes wrote:
> Whenever I use plug, plughw or rate plugins to convert a stream into a
> lower frequency, I get cracks in the sound output.
>
> I am attaching a dump of aplay -v with the rate plugin being used.
>
> Any ideas of what can be wrong? I've tried even 24000 which is half of
> the default frequency of the emu10k1x card, but it still causes the
> problem.
I've looked at the source code for the pcm_rate plugin and it seems like
*snd_pcm_rate_shrink* will not fill the destination buffer last byte, at
least from in the cases I've tried. From looking at the code, the loop
is controlled by the source frames, which is bigger than the
destination. Depending on the get_increment fractional part, the last
"put" into the destination buffer will not happen and sound noise will
be generated. It gets worse on lower frequencies and I've been able to
reproduce this on both the emu10k1x and cs46xx sound cards.
I've also used the file plugin to write the output to a file and to play
it back and the sound noise was present in the written file.
It seems to me that the code calling the function assumes that all bytes
in the destination buffer will be filled and that's not happening. For
istance:
from 48000 to 24000, which would be a simple 0x8000 step in the code,
the actual calculated value for the get_increment is 0x7FFF from this code:
rate->pitch = (((u_int64_t)dst_rate * LINEAR_DIV) + src_rate - 1) / src_rate;
Anybody with better knowledge to comment on the above?
Francisco
-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 -
digital self defense, top technical experts, no vendor pitches,
unmatched networking opportunities. Visit www.blackhat.com
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-07-09 23:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-07-08 23:58 Rate or Plug plugin problem when converting rate down Francisco Moraes
2004-07-09 23:47 ` Francisco Moraes
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.