# [Rd] defining r audio connections

irederik m@iii@g oii oib@@et irederik m@iii@g oii oib@@et
Wed May 6 19:09:19 CEST 2020

Dear R Devel,

Since Linux moved away from using a file-system interface for audio, I think it is necessary to write special libraries to interface with audio hardware from various languages on Linux.

In R, it seems like the appropriate datatype for a snd_pcm_t handle pointing to an open ALSA source or sink would be a "connection". Connection types are already defined in R for "file", "url", "pipe", "fifo", "socketConnection", etc.

Is there a tutorial or an example package where a new type of connection is defined, so that I can see how to do this properly in a package?

I can see from the R source that, for example, do_gzfile is defined in connections.c and referenced in names.c. However, I thought I should ask here first in case there is a better place to start, than trying to copy this code.

I only want an object that I can use readBin and writeBin on, to read and write audio data using e.g. snd_pcm_writei which is part of the alsa-lib package.

Thank you very much,

Frederick