1

Im just in the process of updating some python programs to work on Python3. One of these uses Alsa Audio and according to their github entry, version 0.9.0 includes:

Pyalsaaudio 0.9.0

Added keyword arguments for channels, format, rate and periodsize Deprecated setchannel, setformat, setrate and setperiodsize

I have some code along the lines of that below which uses the deprecated stuff but Im not sure how to re-write it! Any ideas would be most welcome

    output = aa.PCM(aa.PCM_PLAYBACK, aa.PCM_NORMAL)
    output.setchannels(no_channels)
    output.setrate(sample_rate)
    output.setformat(aa.PCM_FORMAT_S16_LE)
    output.setperiodsize(chunk)

1 Answers1

3

I had the same problem. As of alsaaudio Version 0.9.0 keyword arguments were added for channels, format, rate and periodsize. The code above can be written as follows.

output = aa.PCM(aa.PCM_PLAYBACK, aa.PCM_NORMAL,
                channels = no_channels,
                rate = sample_rate,
                format = aa.PCM_FORMAT_S16_LE,
                periodsize = chunk)
bdw
  • 31
  • 3