Xiph.Org issueshttps://gitlab.xiph.org/groups/xiph/-/issues2017-11-03T10:00:01Zhttps://gitlab.xiph.org/xiph/libao/-/issues/2282Sample rate: return effective value, option to disable auto-conversion2017-11-03T10:00:01ZDaniel Richard G.Sample rate: return effective value, option to disable auto-conversionI am writing a program based on LibAO that synthesizes sound. For this to work correctly, I need to know the exact sample rate that is in effect.
Unfortunately, this is at present not so straightforward in LibAO. Some drivers may not gi...I am writing a program based on LibAO that synthesizes sound. For this to work correctly, I need to know the exact sample rate that is in effect.
Unfortunately, this is at present not so straightforward in LibAO. Some drivers may not give you the exact rate you request, but something close. (Problem: You have no way of knowing what the real rate is.) Some drivers, like "alsa", will actually give you any arbitrary sample rate you choose (let's do 512 kHz!) but actually resample in software to whatever the hardware wants. (Problem: This eats up CPU, and messes up my synthesis.)
The attached patch (against git master) addresses these issues:
1. As far as I can tell, only the "alsa", "macosx" and "oss" drivers can give you a sample rate different than what you requested. In these, I added code to update the ao_sample_format struct that was passed in to reflect the actual rate. This way, the calling program can subsequently examine the struct to see what it got.
(The same thing could potentially be done with other parameters in there, like the channels. I think this would be a good pattern to follow generally, as the struct is otherwise useless after the ao_open_*() call.)
2. Pass in SND_PCM_NO_AUTO_RESAMPLE to the snd_pcm_open() call in ao_alsa.c, to disable the "dmix" resampling layer. If you request a rate of 512000, you should see a "sample rate not supported" warning and get an actual rate like 48000; you should not get a software simulation of a 512 kHz ultra-hi-def sound card.
(FYI: the snd_pcm_hw_params_set_rate_resample() function may be another way of going about this. I used the aforementioned open-mode flag only because I saw its use in a patch to VLC's ALSA driver.)Monty MontgomeryMonty Montgomeryhttps://gitlab.xiph.org/xiph/libao/-/issues/2280libao 1.2.0 uses deprecated OS X audio APIs2020-06-14T10:09:37ZMax Hornlibao 1.2.0 uses deprecated OS X audio APIsRunning ogg123, linked against libao 1.2, produced this warning on Mac OS X 10.11 (El Capitan):
```
WARNING: 140: This application, or a library it uses, is using the
deprecated Carbon Component Manager for hosting Audio Units. Support...Running ogg123, linked against libao 1.2, produced this warning on Mac OS X 10.11 (El Capitan):
```
WARNING: 140: This application, or a library it uses, is using the
deprecated Carbon Component Manager for hosting Audio Units. Support for
this will be removed in a future release. Also, this makes the host
incompatible with version 3 audio units. Please transition to the API's
in AudioComponent.h.
```
Looking at libao's git, it seems this was already fixedin January 2016: https://git.xiph.org/?p=libao.git;a=commit;h=0dc9485462179744d7f1acf319c417a2b3c2a54c
So I a guess I am requesting that a new release is made -- the last one is from 2014.Monty MontgomeryMonty Montgomeryhttps://gitlab.xiph.org/xiph/libao/-/issues/2217libao fails to signal output device change2017-11-03T10:00:01Zjrleemanlibao fails to signal output device changelibao does not signal a change of audio output device in such a way that applications may respond. Related to/discovered in pianobar issue: https://github.com/PromyLOPh/pianobar/issues/536#issuecomment-135080348 libao does not signal a change of audio output device in such a way that applications may respond. Related to/discovered in pianobar issue: https://github.com/PromyLOPh/pianobar/issues/536#issuecomment-135080348 Monty MontgomeryMonty Montgomeryhttps://gitlab.xiph.org/xiph/libao/-/issues/2210Warning: Carbon Component Manager is being depricated2020-06-14T10:09:15ZSethWarning: Carbon Component Manager is being depricatedApplications running in OS X 10.11 (El Capitan) have errors stating that Carbon Component Manager is deprecated:
This application, or a library it uses, is using the deprecated Carbon Component Manager for hosting Audio Units. Support...Applications running in OS X 10.11 (El Capitan) have errors stating that Carbon Component Manager is deprecated:
This application, or a library it uses, is using the deprecated Carbon Component Manager for hosting Audio Units. Support for this will be removed in a future release. Also, this makes the host incompatible with version 3 audio units. Please transition to the API's in AudioComponent.h.Monty MontgomeryMonty Montgomeryhttps://gitlab.xiph.org/xiph/libao/-/issues/2204libao-1.2.0 faulty configure check for wmm driver2017-11-03T10:00:02ZBen G.libao-1.2.0 faulty configure check for wmm driverHello
The AC_LANG_SOURCE() function in configure.ac for the wmm detection code is misplaced and disable the test altogether.
I've joined a small patch that fix the problem.
```
--- libao-1.2.0-bug/configure.ac 2014-01-27 18:02:05.000...Hello
The AC_LANG_SOURCE() function in configure.ac for the wmm detection code is misplaced and disable the test altogether.
I've joined a small patch that fix the problem.
```
--- libao-1.2.0-bug/configure.ac 2014-01-27 18:02:05.000000000 +0100
+++ libao-1.2.0-fix/configure.ac 2015-06-15 02:49:42.994291600 +0200
@@ -224,13 +224,13 @@ AC_ARG_ENABLE([wmm],
[include WMM output plugin @<:@default=check@:>@])],
[],[enable_wmm="check"]
)
-AS_IF([AC_LANG_SOURCE([test "x$enable_wmm" != "xno"],
+AS_IF([test "x$enable_wmm" != "xno"],
[AC_CHECK_HEADERS([mmsystem.h],
[
AC_MSG_CHECKING([waveOut family functions])
waveout_old_LIBS="$LIBS"; LIBS="$LIBS -lwinmm"
dnl Can't use AC_SEARCH_LIBS because symbols are decorated
- AC_LINK_IFELSE([
+ AC_LINK_IFELSE([AC_LANG_SOURCE([
#include <windows.h>
#include <mmsystem.h>
int main(int na, char ** a) {
```
--
G.BMonty MontgomeryMonty Montgomeryhttps://gitlab.xiph.org/xiph/libao/-/issues/2196ao_open_file: Race condition in checking for file2017-11-03T10:00:01ZRaúl Salinas-Monteagudoao_open_file: Race condition in checking for fileWhen "not overwrite" is specified, [ao_open_file()](https://trac.xiph.org/browser/trunk/ao/src/audio_out.c#L1352) will try to first open it for reading and this does not fail, open it for writing.
```
if (!overwrite) {
/* Test for fil...When "not overwrite" is specified, [ao_open_file()](https://trac.xiph.org/browser/trunk/ao/src/audio_out.c#L1352) will try to first open it for reading and this does not fail, open it for writing.
```
if (!overwrite) {
/* Test for file existence */
file = fopen(filename, "r");
if (file != NULL) {
fclose(file);
errno = AO_EFILEEXISTS;
return NULL;
}
}
file = fopen(filename, "w");
```
There is a [TOCTTOU](http://en.wikipedia.org/wiki/Time_of_check_to_time_of_use) condition, the file could have been created by someone else after the check.
A non-racy way to create it would be to use
```
file=fopen(filename, "wx");
```
and checking for the errno E_EXIST.
If this is not portable enough, open( ... , O_CREAT|O_EXCL) could be used.Monty MontgomeryMonty Montgomeryhttps://gitlab.xiph.org/xiph/libao/-/issues/2129libao.conf man page doesn't list default_driver=pulse option2017-11-03T10:00:02Zcomputersforpeacelibao.conf man page doesn't list default_driver=pulse optionThis option is especially important for users of Pulse, as they often are unaware they need to switch from 'alsa' to 'pulse' to allow concurrent use of the sound device. See:
https://bugs.launchpad.net/ubuntu/+source/libao/+bug/1075479
...This option is especially important for users of Pulse, as they often are unaware they need to switch from 'alsa' to 'pulse' to allow concurrent use of the sound device. See:
https://bugs.launchpad.net/ubuntu/+source/libao/+bug/1075479
https://wiki.archlinux.org/index.php/PulseAudio#libao
https://github.com/PromyLOPh/pianobar/issues/494
Will attach patch shortlyPhilipp SchafftPhilipp Schaffthttps://gitlab.xiph.org/xiph/libao/-/issues/2083[patch] support for jack in libao2017-11-03T10:00:01Zlparcq[patch] support for jack in libaoThe patch for the configure.ac and src/plugins/Makefile.am is 0001-jack-plugin.patch
The code for the plugin itself is libao-jack-plugin.tgz
By default it connects to all available physical ports. It can be configured
with the paramet...The patch for the configure.ac and src/plugins/Makefile.am is 0001-jack-plugin.patch
The code for the plugin itself is libao-jack-plugin.tgz
By default it connects to all available physical ports. It can be configured
with the parameter "ports"
ports=system:playback_1,system:playback_2
The plugin uses libsamplerate to resample the audio to the jack server rate.
There are different algorithms in libsamplerate. There are selected according to
the value of parameter "quality" (value from 0 to 9). The default is 5. It
impacts the CPU consumption.
Monty MontgomeryMonty Montgomeryhttps://gitlab.xiph.org/xiph/libao/-/issues/2051non-blocking ao_play() and associated ao_wait()2017-11-03T10:00:01ZPeter Billamnon-blocking ao_play() and associated ao_wait()Greetings. I've been exploring libao, but for what I want to do I need a non-blocking ao_play(), so I can then do processing in real-time, then an ao_wait to get to the end of the previous buffer, then play my new buffer and loop.
It lo...Greetings. I've been exploring libao, but for what I want to do I need a non-blocking ao_play(), so I can then do processing in real-time, then an ao_wait to get to the end of the previous buffer, then play my new buffer and loop.
It looks like this has not been implemented, perhaps because it's not portable enough :-(
Suggestions gratefully received...
Regards, PeterMonty MontgomeryMonty Montgomeryhttps://gitlab.xiph.org/xiph/libao/-/issues/2035libao 1.2.0 differing behaviour for 8bit audio2017-11-03T10:00:01Zjohn_spencerlibao 1.2.0 differing behaviour for 8bit audiolibao 1.1.0 behaves as expected: the amplitude is unsigned (0..255)
libao 1.2.0 behaves differently: the amplitude is signed (-128..127)
noticed when trying to mute a stream by using 0 for the samples
for 1.2.0 you have to pass 127 to m...libao 1.1.0 behaves as expected: the amplitude is unsigned (0..255)
libao 1.2.0 behaves differently: the amplitude is signed (-128..127)
noticed when trying to mute a stream by using 0 for the samples
for 1.2.0 you have to pass 127 to mute.
```
#include <unistd.h>
#include <ao/ao.h>
#include <stdlib.h>
#include <string.h>
struct AoWriter {
ao_device *device;
ao_sample_format format;
int aodriver;
};
int AoWriter_init(struct AoWriter *self) {
ao_initialize();
memset(self, 0, sizeof(*self));
self->format.bits = 8;
self->format.channels = 1;
self->format.rate = 11025;
self->format.byte_format = AO_FMT_LITTLE;
self->aodriver = ao_default_driver_id();
self->device = ao_open_live(self->aodriver, &self->format, NULL);
return self->device != NULL;
}
int AoWriter_write(struct AoWriter *self, void* buffer, size_t bufsize) {
return ao_play(self->device, buffer, bufsize);
}
int AoWriter_close(struct AoWriter *self) {
return ao_close(self->device);
}
static unsigned char blip[] = {0x52, 0x51, 0x51, 0x51, 0xC4, 0x4C, 0xF4, 0xF4, 0xF3,0xEF};
static int blip_frame(int idx) {
idx = idx % (2*sizeof(blip));
if(idx>=sizeof(blip)) idx=(2*sizeof(blip))-idx;
return blip[idx];
}
static void generate_blip(unsigned char* data, size_t bufsize, double volume) {
int i;
for(i=0;i<bufsize;i++)
/* libao 1.1.0 behaves as expected: the amplitude is unsigned (0..255)
libao 1.2.0 behaves differently: the amplitude is signed (-128..127) */
#if 1
data[i] = (blip_frame(i)-128)*volume+127;
#else
data[i] = blip_frame(i)*volume;
#endif
}
#define DEFAULT_VOLUME 0.02
int main() {
struct AoWriter ao;
AoWriter_init(&ao);
unsigned char buf[100];
generate_blip(buf, sizeof(buf), DEFAULT_VOLUME);
unsigned passed = 0;
while(1) {
usleep(1000);
passed++;
if(passed >= 200) {
passed=0;
AoWriter_write(&ao, buf, sizeof buf);
}
}
AoWriter_close(&ao);
return 0;
}
```
Monty MontgomeryMonty Montgomeryhttps://gitlab.xiph.org/xiph/libao/-/issues/2034release 1.2.0 was not announced and is not linked on the downloads page2017-11-03T10:00:01Zjohn_spencerrelease 1.2.0 was not announced and is not linked on the downloads pagedespite it being available on the ftp since several weeksdespite it being available on the ftp since several weeksMonty MontgomeryMonty Montgomeryhttps://gitlab.xiph.org/xiph/libao/-/issues/2023ao_file_extension() invisible due to symbol versioning2017-11-03T10:00:02ZChristian Weisgerberao_file_extension() invisible due to symbol versioninglibao 1.2.0 added ao_file_extension(), but since src/ao.vers was not updated,
ao_file_extension is effectively hidden by symbol versioning.
libao 1.2.0 added ao_file_extension(), but since src/ao.vers was not updated,
ao_file_extension is effectively hidden by symbol versioning.
Monty MontgomeryMonty Montgomeryhttps://gitlab.xiph.org/xiph/libao/-/issues/2022Missing include path for PulseAudio plugin2017-11-03T10:00:02ZChristian WeisgerberMissing include path for PulseAudio pluginsrc/plugins/pulse/Makefile.am does not add the include path where the PulseAudio headers may be found (e.g., /usr/local/include/pulse). PULSE_CFLAGS needs to be added, see the attached patch.
src/plugins/pulse/Makefile.am does not add the include path where the PulseAudio headers may be found (e.g., /usr/local/include/pulse). PULSE_CFLAGS needs to be added, see the attached patch.
Monty MontgomeryMonty Montgomeryhttps://gitlab.xiph.org/xiph/libao/-/issues/2006libao: 24-bit ALSA playback is broken2017-11-03T10:00:01ZAndrew Ekstedtlibao: 24-bit ALSA playback is brokenALSA requires 24-bit samples to be padded to 32 bits.
> The 24-bit linear samples use 32-bit physical space, but the sample is stored in the lower three bytes.
> http://www.alsa-project.org/alsa-doc/alsa-lib/pcm.html#pcm_formats
Libao ...ALSA requires 24-bit samples to be padded to 32 bits.
> The 24-bit linear samples use 32-bit physical space, but the sample is stored in the lower three bytes.
> http://www.alsa-project.org/alsa-doc/alsa-lib/pcm.html#pcm_formats
Libao used to do this correctly, but changeset r18883 (which made it in to libao 1.2) rewrote the padding code to also handle upconverting arbitrary sample sizes, by filling the low bytes with zeros. Unfortunately, ALSA's 24-bit padding works the other way around - the _high_ byte is supposed to be zero-filled. Needless to say, padding the wrong end doesn't work very well.
https://gitlab.xiph.org/xiph/libao/-/issues/1999[patch] libao generates mangled error messages when verbosity=02017-11-03T10:00:02Z0xdaf[patch] libao generates mangled error messages when verbosity=0I've been noticing a cryptic error message emanating from programs
I've been writing:
%" in channel matrix "%"
I tracked this down to libao. When verbosity is nonzero, a (somewhat)
more meaningful error message appears:
ao_pul...I've been noticing a cryptic error message emanating from programs
I've been writing:
%" in channel matrix "%"
I tracked this down to libao. When verbosity is nonzero, a (somewhat)
more meaningful error message appears:
ao_pulse ERROR: Unrecognized channel name "%" in channel matrix "%"
The code that generates this message does so partly using aerror()
(which checks the verbosity level before printing) and partly using
fprintf() (which doesn't).
Attached is a patch to only use aerror().
Monty MontgomeryMonty Montgomeryhttps://gitlab.xiph.org/xiph/libao/-/issues/1992AIFF input for libao2017-11-03T10:00:02ZDavid GriffithAIFF input for libaoI was just wondering if you guys could add AIFF (and maybe AIFF-C) input to libao.I was just wondering if you guys could add AIFF (and maybe AIFF-C) input to libao.Monty MontgomeryMonty Montgomeryhttps://gitlab.xiph.org/xiph/libao/-/issues/1976libao / OSS on illumos2017-11-03T10:00:01ZGabriele Bulfonlibao / OSS on illumosHi, we're working on a new distro based on illumos (Solaris fork).
While trying to work out xmms2, we had to build and package libao,
required for xmms2 / OSS on Solaris brands.
It works for many simple audio files, but not for many hig...Hi, we're working on a new distro based on illumos (Solaris fork).
While trying to work out xmms2, we had to build and package libao,
required for xmms2 / OSS on Solaris brands.
It works for many simple audio files, but not for many high quality
mp3 or so, because libao seems not to support 32 bit samples in
this configuration:
ao_oss ERROR: Unsupported number of bits: 32.ao_oss
Is there anything we can do to make it work?
Gabriele.Monty MontgomeryMonty Montgomeryhttps://gitlab.xiph.org/xiph/libao/-/issues/1972libao alsa output driver fails to open device2017-11-03T10:00:01ZCody P Schaferlibao alsa output driver fails to open deviceAn example using ogg123 (a libao user) vs mplayer (which does not use libao)
```
~ $ cat /etc/libao.conf
default_driver=alsa
dev=default
debug
~ $ ogg123 ~/Radiohead_-_Pyramid_Song_\(sample\).ogg
debug: Loaded driver null (built-in)
de...An example using ogg123 (a libao user) vs mplayer (which does not use libao)
```
~ $ cat /etc/libao.conf
default_driver=alsa
dev=default
debug
~ $ ogg123 ~/Radiohead_-_Pyramid_Song_\(sample\).ogg
debug: Loaded driver null (built-in)
debug: Loaded driver wav (built-in)
debug: Loaded driver raw (built-in)
debug: Loaded driver au (built-in)
debug: Loading driver plugins from /usr/lib64/ao/plugins-4...
debug: Loaded driver pulse
debug: Loaded driver alsa
debug: Loaded driver oss
debug: Testing drivers to find playback default...
Audio Device: Advanced Linux Sound Architecture (ALSA) output
Playing: /home/cody/Radiohead_-_Pyramid_Song_(sample).ogg
Ogg Vorbis stream: 2 channel, 44100 Hz
ao_alsa debug: Trying to open ALSA device 'default'
ao_alsa debug: snd_pcm_hw_params_set_access() failed.
ao_alsa debug: Unable to open ALSA device 'default'
ao_alsa ERROR: Unable to open ALSA device 'default' for playback => Invalid argument
ERROR: Cannot open device alsa.
~ $ mplayer -ao alsa ~/Radiohead_-_Pyramid_Song_\(sample\).ogg
MPlayer 1.1-4.7.3 (C) 2000-2012 MPlayer Team
MMX2 supported but disabled
Playing /home/cody/Radiohead_-_Pyramid_Song_(sample).ogg.
libavformat version 54.63.104 (external)
libavformat file format detected.
[vorbis @ 0x7fc9a96a07a0]Warning: not compiled with thread support, using thread emulation
[lavf] stream 0: audio (vorbis), -aid 0
Load subtitles in /home/cody/
==========================================================================
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
libavcodec version 54.92.100 (external)
[vorbis @ 0x7fc9a96a07a0]Warning: not compiled with thread support, using thread emulation
AUDIO: 44100 Hz, 2 ch, floatle, 64.0 kbit/2.27% (ratio: 8000->352800)
Selected audio codec: [ffvorbis] afm: ffmpeg (FFmpeg Vorbis)
==========================================================================
AO: [alsa] 44100Hz 2ch floatle (4 bytes per sample)
Video: no video
Starting playback...
A: 2.1 (02.0) of 28.6 (28.6) 0.8%
Exiting... (Quit)
```
The specific version of libao used is gentoo's `libao-1.1.0-r1`.Monty MontgomeryMonty Montgomeryhttps://gitlab.xiph.org/xiph/libao/-/issues/1971Comments in /etc/libao.conf cause pulse output driver to fail2017-11-03T10:00:02ZCody P SchaferComments in /etc/libao.conf cause pulse output driver to failExample using pulseaudio output:
```
~ $ cat /etc/libao.conf
#HI
default_driver=pulse
~ $ ogg123 6.ogg
Audio Device: PulseAudio Output
Playing: 6.ogg
Ogg Vorbis stream: 6 channel, 44100 Hz
ERROR: Cannot open device pulse.
```
vs.
...Example using pulseaudio output:
```
~ $ cat /etc/libao.conf
#HI
default_driver=pulse
~ $ ogg123 6.ogg
Audio Device: PulseAudio Output
Playing: 6.ogg
Ogg Vorbis stream: 6 channel, 44100 Hz
ERROR: Cannot open device pulse.
```
vs.
```
~ $ cat /etc/libao.conf
default_driver=pulse
~ $ ogg123 6.ogg
Audio Device: PulseAudio Output
Playing: 6.ogg
Ogg Vorbis stream: 6 channel, 44100 Hz
Done.
^C~ $
```
The specific libao version used is gentoo's `libao-1.1.0-r1`Monty MontgomeryMonty Montgomeryhttps://gitlab.xiph.org/xiph/libao/-/issues/1933QNX 6.x support in libao2024-02-02T11:48:20ZMike GorchakQNX 6.x support in libaoI did a libao port to QNX 6.x, patch is attached.
QNX 6.x uses QSA audio architecture which is very close to ALSA 0.5.x
API, but still has many differencies. Current qsa driver supports 8,
16, 24, 32 sample bits playback.
Thanks in adv...I did a libao port to QNX 6.x, patch is attached.
QNX 6.x uses QSA audio architecture which is very close to ALSA 0.5.x
API, but still has many differencies. Current qsa driver supports 8,
16, 24, 32 sample bits playback.
Thanks in advance!Monty MontgomeryMonty Montgomery