Re: Strange i/o problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



FYI, I finally got it working, by replacing the snd_pcm_wait construct with (pseudo code):

while (true) {
    poll_result = do_poll();
    if (poll_result == capture) {
       capture.getBuffer(in_buffer);
    }
    if (poll_result == playback)  {
       do_calbacks(in_buffer, out_buffer);
       playback.putBuffer(out_buffer);
    }
}

Regards
/R

> -----Original Message-----
> From: Robert Bielik
> Sent: den 15 januari 2018 17:59
> To: alsa-user@xxxxxxxxxxxxxxxxxxxxx
> Subject: RE: Strange i/o problem
> 
> Yet more info, the output of snd_pcm_hw_params_dump and
> snd_pcm_sw_params_dump (they look the same for both capture and
> playback):
> 
> ACCESS:  RW_INTERLEAVED
> FORMAT:  FLOAT_LE
> SUBFORMAT:  STD
> SAMPLE_BITS: 32
> FRAME_BITS: 64
> CHANNELS: 2
> RATE: 48000
> PERIOD_TIME: (666 667)
> PERIOD_SIZE: 32
> PERIOD_BYTES: 256
> PERIODS: 2
> BUFFER_TIME: (1333 1334)
> BUFFER_SIZE: 64
> BUFFER_BYTES: 512
> TICK_TIME: 0
> tstamp_mode: NONE
> tstamp_type: MONOTONIC
> period_step: 1
> avail_min: 32
> start_threshold: 32
> stop_threshold: 1073741824
> silence_threshold: 0
> silence_size: 1073741824
> boundary: 1073741824
> 
> > -----Original Message-----
> > From: Robert Bielik
> > Sent: den 15 januari 2018 17:47
> > To: Robert Bielik <Robert.Bielik@xxxxxxxxx>; alsa-
> user@xxxxxxxxxxxxxxxxxxxxx
> > Subject: RE: Strange i/o problem
> >
> > Ah, forgot to mention a couple of things, this is on a Raspberry Pi 3 with
> > Raspbian Stretch, the rendering thread is set to SCHED_RR with max
> priority,
> > the timing of the callback is typically (in microseconds):
> >
> > min, mean, max, stddev: 655, 666, 680, 1.45639
> > min, mean, max, stddev: 656, 666, 680, 1.25471
> > min, mean, max, stddev: 640, 666, 694, 1.83335
> > min, mean, max, stddev: 619, 666, 713, 2.10409
> > min, mean, max, stddev: 656, 666, 681, 1.32999
> > min, mean, max, stddev: 652, 666, 682, 1.65541
> > min, mean, max, stddev: 651, 666, 685, 1.49302
> > min, mean, max, stddev: 656, 666, 680, 1.33093
> > min, mean, max, stddev: 649, 666, 690, 1.6246
> > min, mean, max, stddev: 656, 666, 679, 1.3234
> > min, mean, max, stddev: 656, 666, 680, 1.36177
> > min, mean, max, stddev: 611, 666, 704, 1.9551
> > min, mean, max, stddev: 651, 666, 687, 1.37784
> > min, mean, max, stddev: 650, 666, 689, 1.4738
> > min, mean, max, stddev: 609, 666, 722, 2.2253
> > min, mean, max, stddev: 656, 666, 680, 1.57805
> > min, mean, max, stddev: 643, 666, 683, 1.54424
> >
> > (which to me looks more than OK)
> >
> > > -----Original Message-----
> > > From: Robert Bielik [mailto:Robert.Bielik@xxxxxxxxx]
> > > Sent: den 15 januari 2018 17:41
> > > To: alsa-user@xxxxxxxxxxxxxxxxxxxxx
> > > Subject:  Strange i/o problem
> > >
> > > I have a strange problem: I'm trying to pipe audio input -> output using a
> > I2S
> > > device @48000 Hz and 32 frames buffer size and 2 periods, to get as low a
> > > latency as possible.
> > >
> > > It works nicely if I either:
> > > 1. Use capture + playback and record capture to a wav file (sounds fine).
> > > 2. Use playback only and generate sine waves.
> > > 3. Pipe capture -> playback with a larger buffer size, such as 64.
> > >
> > > But if I have capture + playback, I get a very strange output noise akin
> > > towards heavy intermodulation distortion.
> > >
> > > The rendering thread is (pseudo code):
> > >
> > > while (true) {
> > >     if(capture_active) {
> > >        snd_pcm_wait(capture_handle, timeout);
> > >        read_pcm_data_into_buffer(capture_handle, input_buffer);
> > >     }
> > >     do_callback(input_buffer, output_buffer);
> > >     if (playback_active) {
> > >         snd_pcm_wait(playback_handle, timeout);
> > >         write_pcm_data_from_buffer(playback_handle, output_buffer);
> > >     }
> > > }
> > >
> > > Any ideas what can go wrong ?
> > > /R
> > >
> > >
> > > ------------------------------------------------------------------------------
> > > Check out the vibrant tech community on one of the world's most
> > > engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> > > _______________________________________________
> > > Alsa-user mailing list
> > > Alsa-user@xxxxxxxxxxxxxxxxxxxxx
> > > https://lists.sourceforge.net/lists/listinfo/alsa-user

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Alsa-user mailing list
Alsa-user@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/alsa-user



[Index of Archives]     [ALSA Devel]     [Linux Audio Users]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]

  Powered by Linux