Skip to contentSkip to conversation

Application using ALSA-driver es-1968 for Maestro-2e: Bug or my fault?

DISCUSSION User for realtime audio 4 participants 6 messages Jun 17, 2002 – Jun 21, 2002

lore
Share & tools
lore
#0 lore raw

Hi,

I have a question to all those who have experience with a Maestro-2e soundcard and ALSA-applications:

I have written a realtime-capture plus playback application for realtime signal processing algorithms. It is simply
a modification of the PCM-example.

The software did work with my old notebook including an es-1668 soundcard but with the new es-1968 device none of the possible transfer modes function propperly.

The problem is that only parts of the buffers seem to be read correctly for capture, for example I have the IO-read access to a 16 bit capture device, periodsize is 64, buffersize 128 and two channels input.

The card only support non interleaved input (although only interleaved output for playback!).

Furthermore I have one buffer for sampleinput:

    signed short inputBuffer[128];

(2 channels, 64 samples for call of snd_pcm_readn(..))

In order to use non interleaved read-function I have created the void**-field:

    void** bufsInput[2];

for each channel and assigned the sample-buffer to each channel:

    bufsInput[0] = inputBuffer;
    bufsInput[1] = &inputBuffer[64];

In my callback-loop for audio read process I check that there are more than 64 samples available
If so I call the read function:

    err=snd_pcm_readn(pcmDevice_capture, bufsInput, 64);

After this call err is equal 64 so everything is fine. When dumping the received data some strange values are stored:

- sampleBuffer[0] .. sampleBuffer[15] seem to be the result from channel1 which is still correct.
- sampleBuffer[16]..sampleBuffer[31] seem to be the result from the other channel which is not correct anymore
(I can distinguish the channels as I am using different signals on the two channels)
- sampleBuffer[32].. sampleBuffer[63] have not been copied. The values in sampleBuffer BEFORE the snd_pcm_readn-call still remain unchanged!
- From sampleBuffer[64] .. sampleBuffer[127] the values from sampleBuffer[0] .. sampleBuffer[63] are repeated.

I would expect that values from 0 to 63 contain channel1 input and values from 64 to 127 contain other channel input..

Did I misunderstand the ALSA-API, what am I doing wrong or is there a bug in the ALSA-driver/library for this specific application?

aplay and the pcm example do function as expected but arecord seems to generate some clicking noise either....

System: I am using a Dell Lattitude CPH-500 notebook, SUSE linux, kernel 2.4.16 with the lowlatency patches + rtc-patch found in the alsa-beta0.12 package. The current alsa-version however is the current release candidate (rc1). I have also tried to use the unpatched 2.4.18 kernel which did not lead to different results.

I d appreceate any kind of hint or other experiences with this device, thanks in advance

Hauke

_______________________________________________________________

Sponsored by:
ThinkGeek at http://www.ThinkGeek.com/

#1 lore raw
Quoted 2 lines

I have a question to all those who have experience with a Maestro-2e soundcard and ALSA-applications:

probably not that many people in the intersection of these two sets.

you need to send more of your example code. in particular, we need to know what configuration parameters you used. it would also help to send the contents of the files under /proc/asound/cardN/pcmN while your application has the card open.

--p

_______________________________________________________________

Sponsored by:
ThinkGeek at http://www.ThinkGeek.com/

#2 lore raw
In reply to User for realtime audio

I am havine a similar problem on my m-audio dio 2448 (CMI8738 model 37). In my own code, or using arecord, some of the samsples are correct, but some are very wrong, and make a loud clicking noise.

Quoted 79 lines · User for realtime audio

Hi,

I have a question to all those who have experience with a Maestro-2e soundcard and ALSA-applications:

I have written a realtime-capture plus playback application for realtime signal processing algorithms. It is simply
a modification of the PCM-example.

The software did work with my old notebook including an es-1668 soundcard but with the new es-1968 device none of the possible transfer modes function propperly.

The problem is that only parts of the buffers seem to be read correctly for capture, for example I have the IO-read access to a 16 bit capture device, periodsize is 64, buffersize 128 and two channels input.

The card only support non interleaved input (although only interleaved output for playback!).

Furthermore I have one buffer for sampleinput:

    signed short inputBuffer[128];

(2 channels, 64 samples for call of snd_pcm_readn(..))

In order to use non interleaved read-function I have created the void**-field:

    void** bufsInput[2];

for each channel and assigned the sample-buffer to each channel:

    bufsInput[0] = inputBuffer;
    bufsInput[1] = &inputBuffer[64];

In my callback-loop for audio read process I check that there are more than 64 samples available
If so I call the read function:

    err=snd_pcm_readn(pcmDevice_capture, bufsInput, 64);

After this call err is equal 64 so everything is fine. When dumping the received data some strange values are stored:

- sampleBuffer[0] .. sampleBuffer[15] seem to be the result from channel1 which is still correct.
- sampleBuffer[16]..sampleBuffer[31] seem to be the result from the other channel which is not correct anymore
(I can distinguish the channels as I am using different signals on the two channels)
- sampleBuffer[32].. sampleBuffer[63] have not been copied. The values in sampleBuffer BEFORE the snd_pcm_readn-call still remain unchanged!
- From sampleBuffer[64] .. sampleBuffer[127] the values from sampleBuffer[0] .. sampleBuffer[63] are repeated.

I would expect that values from 0 to 63 contain channel1 input and values from 64 to 127 contain other channel input..

Did I misunderstand the ALSA-API, what am I doing wrong or is there a bug in the ALSA-driver/library for this specific application?

aplay and the pcm example do function as expected but arecord seems to generate some clicking noise either....

System: I am using a Dell Lattitude CPH-500 notebook, SUSE linux, kernel 2.4.16 with the lowlatency patches + rtc-patch found in the alsa-beta0.12 package. The current alsa-version however is the current release candidate (rc1). I have also tried to use the unpatched 2.4.18 kernel which did not lead to different results.

I d appreceate any kind of hint or other experiences with this device, thanks in advance

Hauke

Quoted 10 lines

_______________________________________________________________

Sponsored by:
ThinkGeek at http://www.ThinkGeek.com/
_______________________________________________
Alsa-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/alsa-devel

----------------------------------------------------------------------------------------------------
Sponsor's Message
----------------------------------------------------------------------------------------------------
Bringing you mounds of caffeinated joy
>>> http://thinkgeek.com/sf <<<

#3 lore raw

At Mon, 17 Jun 2002 14:00:21 -0700,

Quoted 4 lines · Howard Abrams

I am havine a similar problem on my m-audio dio 2448 (CMI8738 model 37). In my own code, or using arecord, some of the samsples are correct, but some are very wrong, and make a loud clicking noise.

i believe your problem is not related with the one on es1968. and i guess it's a hardware problem...
the analog i/o on cm8738 is very bad, although its digital i/o is nice.

Takashi

-------------------------------------------------------
Sponsored by:
ThinkGeek at http://www.ThinkGeek.com/

#4 lore raw

Sorry, I didn't mean to mislead you, I am not using the analog on the chip. I am going directly in via the coax digital in. From what I understand the board should do "sample-perfect" transfers, but similar to the es1968, half my samples seem to be garbage. Playback is perfect, it is just recording that is broke (arecord or my own code).

Your right, it may not be related, but where do I begin to figure out what is wrong? Does anyone reading this have a board like mine?

h.

Quoted 8 lines · Takashi Iwai

At Mon, 17 Jun 2002 14:00:21 -0700,

Quoted 4 lines · Howard Abrams

I am havine a similar problem on my m-audio dio 2448 (CMI8738 model 37). In my own code, or using arecord, some of the samsples are correct, but some are very wrong, and make a loud clicking noise.

Quoted 9 lines

i believe your problem is not related with the one on es1968. and i guess it's a hardware problem...
the analog i/o on cm8738 is very bad, although its digital i/o is nice.

Takashi

-------------------------------------------------------
Sponsored by:
ThinkGeek at http://www.ThinkGeek.com/

#5 lore raw

Hi,

At Fri, 21 Jun 2002 10:32:34 -0700,

Quoted 6 lines · Howard Abrams

Sorry, I didn't mean to mislead you, I am not using the analog on the chip. I am going directly in via the coax digital in. From what I understand the board should do "sample-perfect" transfers, but similar to the es1968, half my samples seem to be garbage. Playback is perfect, it is just recording that is broke (arecord or my own code).

well, if the arecord is broken, it must be fixed ;) i just wanted to differentiate the problems.

Quoted 3 lines

Your right, it may not be related, but where do I begin to figure out what is wrong? Does anyone reading this have a board like mine?

or, can this be a mixer configuration problem?
how did you route the digital input?
for example, if you turn on "IEC958 Mix Analog", then the signals will be contaminated by others.

please try to turn on/off some switches regarding spdif. the descriptions are found in alsa-kernel/Documentation/CMIPCI.txt.

ciao,

Takashi

-------------------------------------------------------
Sponsored by:
ThinkGeek at http://www.ThinkGeek.com/