Re: [Alsa-user] e-mu 0204 onset/offset distortions

2014-02-16 Thread Robert M. Riches Jr.
> Date: Sun, 16 Feb 2014 14:56:08 -0800 (PST)
> From: Bill Unruh 
> To: Samuele Carcagno 
> Cc: alsa-user@lists.sourceforge.net
>
> On Sun, 16 Feb 2014, Samuele Carcagno wrote:
>
> > On Sunday 16 Feb 2014 20:47:44 you wrote:
> >> I have never seen that in any of the files I have played. That hints that 
> >> that
> >> is your input stream, rather than some problem with the soundcard itself,
> >> although I have also never used your sound card.
> >>
> >> So to be clear, you recorded onto a .wav file that sound. That .wav file 
> >> did
> >> not have those transients. You then played that file with aplay, and 
> >> recorded
> >> the output, starting the input before the file started playing and ending
> >> after it stopped.
> >
> > yes, that's correct. Because aplay does play the wav file well after it is 
> > "primed"
> > by playing some sounds with PyAudio, I wonder what PyAudio is doing and 
> > whether
> > I could instruct aplay to do the same through some command-line option.
> >
> > Just for completeness I should add that I observed this behaviour with the 
> > soundcard
> > plugged on different computers, as well as with the Debian testing branch 
> > and the current
> > Ubuntu development branch. I removed pulseaudio before running any of these 
> > tests as it has other
> > problems for me:
> >
> > http://lists.freedesktop.org/archives/pulseaudio-discuss/2012-October/014756.html
> >
> > Probably I can circumvent the onset/offset transient issue with a function 
> > that automatically
> > plays some sounds with pulseaudio each time my pyqt4 program starts. I will 
> > also have to check
> > that the soundcard plays sounds with 24-bit depth.
>
> It definitely sounds like a problem with your soundcard. 
> What happens if you put in say 1 sec of silence before the sound starts
> playing. 
> Mind you that trailing DC really looks suspicious, as if your file has a DC
> component, rather than the soundcard, but is belied by the fact that if you
> play it later, it is fine. The DC looks like it is dying away at the
> beginning, but then it sure should not be there at the end.

I agree there's something very odd about the DC segments before
and after the tone burst.  I think I can just barely see the
10ms fade-in/out.  It's a little more apparent when zoomed in.
The DC segments look like maybe switching transients while the
card is being initialized.  Perhaps playing a short piece of
silence via PyAudio before playing your real content via AlsaAudio
would be the most practical solution for that situation.

One other thing I remembered about PyAudio with my program is I
see a lot of whining about 'Unable to find definition ...',
'No such file or directory', 'Unknown PCM rear', 'Failed to create
secure directory: Permission denied', and so forth with PyAudio
during program initialization.  With AlsaAudio, there is no such
complaining.

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


Re: [Alsa-user] e-mu 0204 onset/offset distortions

2014-02-16 Thread Bill Unruh
On Sun, 16 Feb 2014, Samuele Carcagno wrote:

> On Sunday 16 Feb 2014 20:47:44 you wrote:
>> I have never seen that in any of the files I have played. That hints that 
>> that
>> is your input stream, rather than some problem with the soundcard itself,
>> although I have also never used your sound card.
>>
>> So to be clear, you recorded onto a .wav file that sound. That .wav file did
>> not have those transients. You then played that file with aplay, and recorded
>> the output, starting the input before the file started playing and ending
>> after it stopped.
>
> yes, that's correct. Because aplay does play the wav file well after it is 
> "primed"
> by playing some sounds with PyAudio, I wonder what PyAudio is doing and 
> whether
> I could instruct aplay to do the same through some command-line option.
>
> Just for completeness I should add that I observed this behaviour with the 
> soundcard
> plugged on different computers, as well as with the Debian testing branch and 
> the current
> Ubuntu development branch. I removed pulseaudio before running any of these 
> tests as it has other
> problems for me:
>
> http://lists.freedesktop.org/archives/pulseaudio-discuss/2012-October/014756.html
>
> Probably I can circumvent the onset/offset transient issue with a function 
> that automatically
> plays some sounds with pulseaudio each time my pyqt4 program starts. I will 
> also have to check
> that the soundcard plays sounds with 24-bit depth.

It definitely sounds like a problem with your soundcard. 
What happens if you put in say 1 sec of silence before the sound starts
playing. 
Mind you that trailing DC really looks suspicious, as if your file has a DC
component, rather than the soundcard, but is belied by the fact that if you
play it later, it is fine. The DC looks like it is dying away at the
beginning, but then it sure should not be there at the end.

>
> Cheers,
>
> Sam
>
> --
> 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
>

-- 
William G. Unruh   |  Canadian Institute for| Tel: +1(604)822-3273
Physics&Astronomy  | Advanced Research  | Fax: +1(604)822-5324
UBC, Vancouver,BC  |   Program in Cosmology | un...@physics.ubc.ca
Canada V6T 1Z1 |  and Gravity   |  www.theory.physics.ubc.ca/

--
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


Re: [Alsa-user] e-mu 0204 onset/offset distortions

2014-02-16 Thread Samuele Carcagno
On Sunday 16 Feb 2014 20:47:44 you wrote:
> I have never seen that in any of the files I have played. That hints that that
> is your input stream, rather than some problem with the soundcard itself,
> although I have also never used your sound card.
> 
> So to be clear, you recorded onto a .wav file that sound. That .wav file did
> not have those transients. You then played that file with aplay, and recorded
> the output, starting the input before the file started playing and ending
> after it stopped.

yes, that's correct. Because aplay does play the wav file well after it is 
"primed"
by playing some sounds with PyAudio, I wonder what PyAudio is doing and whether
I could instruct aplay to do the same through some command-line option.

Just for completeness I should add that I observed this behaviour with the 
soundcard
plugged on different computers, as well as with the Debian testing branch and 
the current
Ubuntu development branch. I removed pulseaudio before running any of these 
tests as it has other
problems for me:

http://lists.freedesktop.org/archives/pulseaudio-discuss/2012-October/014756.html

Probably I can circumvent the onset/offset transient issue with a function that 
automatically
plays some sounds with pulseaudio each time my pyqt4 program starts. I will 
also have to check
that the soundcard plays sounds with 24-bit depth.

Cheers,

Sam

--
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


Re: [Alsa-user] e-mu 0204 onset/offset distortions

2014-02-16 Thread Bill Unruh
I have never seen that in any of the files I have played. That hints that that
is your input stream, rather than some problem with the soundcard itself,
although I have also never used your sound card.

So to be clear, you recorded onto a .wav file that sound. That .wav file did
not have those transients. You then played that file with aplay, and recorded
the output, starting the input before the file started playing and ending
after it stopped.

If so, that is one strange soundcard.




On Sun, 16 Feb 2014, Samuele Carcagno wrote:

>
>>
>> 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.)
>
> Yes, I've noticed this problem with PyAudio with other soundcards as well.
>>
>> 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.
>
> Thank you and Bill for the suggestion, I did that and it looks like
> there is a DC offset before and after the sound starts playing, you
> can see it on this graph:
>
> https://dl.dropboxusercontent.com/u/1162239/before_pyaudio.pdf
>
> this was obtained by playing a 500-ms 1 kHz pure tone with 10-ms
> fade in and 10-ms fade out (not obvious from the figure but the fade
> in and fade out is there) with aplay
>
> after I "prime" the soundcard by playing some sounds with pyaudio,
> the graph obtained by playing the same sound with aplay looks like this 
> instead:
>
> https://dl.dropboxusercontent.com/u/1162239/after_pyaudio.pdf
>
> Sam
>
> --
> 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
>

-- 
William G. Unruh   |  Canadian Institute for| Tel: +1(604)822-3273
Physics&Astronomy  | Advanced Research  | Fax: +1(604)822-5324
UBC, Vancouver,BC  |   Program in Cosmology | un...@physics.ubc.ca
Canada V6T 1Z1 |  and Gravity   |  www.theory.physics.ubc.ca/

--
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


Re: [Alsa-user] e-mu 0204 onset/offset distortions

2014-02-16 Thread Samuele Carcagno

> 
> 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.)

Yes, I've noticed this problem with PyAudio with other soundcards as well.
> 
> 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.

Thank you and Bill for the suggestion, I did that and it looks like
there is a DC offset before and after the sound starts playing, you
can see it on this graph:

https://dl.dropboxusercontent.com/u/1162239/before_pyaudio.pdf

this was obtained by playing a 500-ms 1 kHz pure tone with 10-ms
fade in and 10-ms fade out (not obvious from the figure but the fade
in and fade out is there) with aplay

after I "prime" the soundcard by playing some sounds with pyaudio,
the graph obtained by playing the same sound with aplay looks like this instead:

https://dl.dropboxusercontent.com/u/1162239/after_pyaudio.pdf

Sam

--
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


Re: [Alsa-user] e-mu 0204 onset/offset distortions

2014-02-16 Thread Robert M. Riches Jr.
> From: Samuele Carcagno 
> To: alsa-user@lists.sourceforge.net
> Date: Sun, 16 Feb 2014 13:36:02 +
>
> 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


Re: [Alsa-user] e-mu 0204 onset/offset distortions

2014-02-16 Thread Bill Unruh
On Sun, 16 Feb 2014, Samuele Carcagno wrote:

> 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

You could route the output into the line in input, and record what is coming
out of the system and compare it with what you sent. Now you do not expect bit
accuracy but you might be able to see something going on. Eg, a DC level
mismatch.


> 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.
>
> Thank you for your help,
>
> Sam
>
> --
> 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
>

-- 
William G. Unruh   |  Canadian Institute for| Tel: +1(604)822-3273
Physics&Astronomy  | Advanced Research  | Fax: +1(604)822-5324
UBC, Vancouver,BC  |   Program in Cosmology | un...@physics.ubc.ca
Canada V6T 1Z1 |  and Gravity   |  www.theory.physics.ubc.ca/

--
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


[Alsa-user] e-mu 0204 onset/offset distortions

2014-02-16 Thread Samuele Carcagno
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.

Thank you for your help,

Sam

--
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