> From: Samuele Carcagno <sam.carca...@gmail.com>
> To: alsa-user@lists.sourceforge.net
> Date: Sun, 16 Feb 2014 13:36:02 +0000
>
> Hi,
>
> I'm trying to set up the e-mu 0204 for psychoacoustics research purposes on 
> Debian Wheezy.
> When using aplay to play a short (200 ms, or 900 ms) wav file, at the onset 
> and at the offset of the sound
> there are audible pops and clicks. I'm actually using a GUI program I wrote 
> in pyqt4 that writes the sound
> to a wav file, and then calls aplay to play it. This program can also output 
> sound through PyAudio (portaudio) and
> pyalsaaudio. If I play a sound with PyAudio, then there are no pops and 
> clicks at the onset/offset of the
> sound, however, with PyAudio there are occasional distortions in the middle 
> of the sound.
> The strange thing is that if I first play some sounds with PyAudio and then 
> switch to aplay, aplay
> works well without pops and clicks at the onset/offset of the sound. I have 
> the impression that PyAudio
> is setting some soundcard parameters that make it work well with aplay. If I 
> close the pyqt4 GUI and
> open it again, the problem with aplay returns. Do you have any idea of what 
> the problem could be,
> and how it could be fixed?
>
> Some additional info. The problem with aplay is present also if I use it from 
> the command line rather
> than the pyqt4 app. pyalsaaudio has the same problem as aplay, again if I 
> play some sounds with PyAudio
> and then switch to aplay the problem is fixed, as long as I keep the pyqt4 
> app open. I have been using
> the same program with the e-mu 0202 and it has been working without any 
> issues, so I would discard the pyqt4
> app as the source of the program. I have tried plugging the 0204 on different 
> USB ports but the problem persists.

Coincidentally, I just finished doing some coding for PyAudio and
(py)alsaaudio on Debian 7/Wheezy, though I don't use PulseAudio.
I also found that PyAudio has pops and clicks characteristic of
Xruns (overruns and/or underruns), while AlsaAudio does not.
(FWIW, I decided to use AlsaAudio rather than PyAudio, though I
coded my program with a constant that makes it trivial to switch
between the two.)

In another reply, Bill Unruh suggested routing the output through
the line input of another card.  That is a very good idea and may
give you an idea of what's happening with the pops and clicks in
the middle of the file with PyAudio.

Another idea is to look at the original file to see if it has a
DC offset.  In my experience, you can get a click at the start or
end of a file if the first or last frame has a value very far from
zero.  If that is the cause of the beginning and ending transients,
you might want to consider editing your file to shave off a few
frames so it starts and ends very close to zero.  Another idea
would be to make a short (a few ms) fade-in or fade-out.

Another possible issue if if PyAudio vs. AlsaAudio set up the
card to different sample rates, one of them using software to
resample from the input WAV file to match what they set the card
to.

HTH

Robert

------------------------------------------------------------------------------
Android apps run on BlackBerry 10
Introducing the new BlackBerry 10.2.1 Runtime for Android apps.
Now with support for Jelly Bean, Bluetooth, Mapview and more.
Get your Android app in front of a whole new audience.  Start now.
http://pubads.g.doubleclick.net/gampad/clk?id=124407151&iu=/4140/ostg.clktrk
_______________________________________________
Alsa-user mailing list
Alsa-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/alsa-user

Reply via email to