> I've been knocking my head against a wall for more than a year trying to
> figure out how to correctly mix two streams of audio while using
> libsndfile for input and libao for output. My main requirement is that
> I cannot assume anything about the output drivers -- that is, I cannot
> depend on the output driver (ALSA, OSS, Sun, etc) being able to do the
> mixing for me. Many of my target platforms lack any sort of mixing
> services. I need to do this myself. I tried starting a mixer/player
> thread that would work in a producer/consumer relationship with one or
> two audio file decoder threads. I can play one sound at a time just
> fine. When I try to do both, I get distortion followed by a segfault.
Hi,
not sure if I understood correctly: do you just want to mix N files?
Like you I'm learning libsndfile and libao so this is my attempt to mix
some audio files:
http://pastebin.com/dm7z8b3Z
HTH,
Andrea
P.S.
Can someone explain line 88 (I already read the sndfile FAQ)?
On Mon, May 16, 2016 at 11:30 PM, <
linux-audio-dev-owner(a)lists.linuxaudio.org> wrote:
> You are not allowed to post to this mailing list, and your message has
> been automatically rejected. If you think that your messages are
> being rejected in error, contact the mailing list owner at
> linux-audio-dev-owner(a)lists.linuxaudio.org.
>
>
>
> ---------- Forwarded message ----------
> From: Andrea Del Signore <sejerpz(a)gmail.com>
> To: linux-audio-dev(a)lists.linuxaudio.org
> Cc:
> Date: Mon, 16 May 2016 21:26:40 +0000 (UTC)
> Subject: Re: [LAD] mixing while using libao and libsndfile
> On Sun, 15 May 2016 16:34:34 +0000, David Griffith wrote:
>
> > I've been knocking my head against a wall for more than a year trying to
> > figure out how to correctly mix two streams of audio while using
> > libsndfile for input and libao for output. My main requirement is that
> > I cannot assume anything about the output drivers -- that is, I cannot
> > depend on the output driver (ALSA, OSS, Sun, etc) being able to do the
> > mixing for me. Many of my target platforms lack any sort of mixing
> > services. I need to do this myself. I tried starting a mixer/player
> > thread that would work in a producer/consumer relationship with one or
> > two audio file decoder threads. I can play one sound at a time just
> > fine. When I try to do both, I get distortion followed by a segfault.
> >
> > So, I'm back to a demo program. What must I do to this program to cause
> > it to start playing one audio file, then play another N seconds later?
> >
> > David Griffith dave(a)661.org
> >
>
> Hi,
>
> not sure if I understood correctly: do you just want to mix N files?
>
> I'm a noob with both libsndfile and libao :)
>
> Here my code: http://pastebin.com/dm7z8b3Z
>
> HTH,
> Andrea
>
> P.S.
> Can someone explain line 88 (I already read the sndfile FAQ)?
>
>
>
I've been knocking my head against a wall for more than a year trying to
figure out how to correctly mix two streams of audio while using
libsndfile for input and libao for output. My main requirement is that I
cannot assume anything about the output drivers -- that is, I cannot
depend on the output driver (ALSA, OSS, Sun, etc) being able to do the
mixing for me. Many of my target platforms lack any sort of mixing
services. I need to do this myself. I tried starting a mixer/player
thread that would work in a producer/consumer relationship with one or two
audio file decoder threads. I can play one sound at a time just fine.
When I try to do both, I get distortion followed by a segfault.
So, I'm back to a demo program. What must I do to this program to cause
it to start playing one audio file, then play another N seconds later?
David Griffith
dave(a)661.org
===begin code===
/*
* gcc -o mixer mixer.c -lao -lsndfile
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <ao/ao.h>
#include <sndfile.h>
#define BUFFSIZE 512
int playfile(FILE *);
int main(int argc, char *argv[])
{
FILE *fp1, *fp2;
if (argc < 2) {
printf("usage: %s <filename>.ogg <filename>.aiff\n", argv[0]);
exit(1);
}
fp1 = fopen(argv[1], "rb");
if (fp1 == NULL) {
printf("Cannot open %s.\n", argv[1]);
exit(2);
}
fp2 = fopen(argv[1], "rb");
if (fp2 == NULL) {
printf("Cannot open %s.\n", argv[1]);
exit(3);
}
ao_initialize();
playfile(fp1);
playfile(fp2);
ao_shutdown();
return 0;
}
int playfile(FILE *fp)
{
int default_driver;
ao_device *device;
ao_sample_format format;
SNDFILE *sndfile;
SF_INFO sf_info;
short *shortbuffer;
int64_t toread;
int64_t frames_read;
int64_t count;
sndfile = sf_open_fd(fileno(fp), SFM_READ, &sf_info, 1);
memset(&format, 0, sizeof(ao_sample_format));
shortbuffer = malloc(BUFFSIZE * sf_info.channels * sizeof(short));
frames_read = 0;
toread = sf_info.frames * sf_info.channels;
count = 0;
default_driver = ao_default_driver_id();
memset(&format, 0, sizeof(ao_sample_format));
format.byte_format = AO_FMT_NATIVE;
format.bits = 16;
format.channels = sf_info.channels;
format.rate = sf_info.samplerate;
device = ao_open_live(default_driver, &format, NULL);
if (device == NULL) {
printf("Error opening sound device.\n");
exit(4);
}
while (count < toread) {
frames_read = sf_read_short(sndfile, shortbuffer, BUFFSIZE);
count += frames_read;
ao_play(device, (char *)shortbuffer, frames_read * sizeof(short));
}
ao_close(device);
sf_close(sndfile);
}
===end code===
--
David Griffith
dave(a)661.org
I'm not sure if this has been covered before...
While I understand that generally you can't be certain of writing or reading
all bytes in a block of data in one call, what about the specific case where
you *always* read and write the same number of bytes and the buffer is an exact
multiple of this size.
e.g data block is 5 bytes & buffer size is 75 bytes.
No I'm not intending to use such an example, I just want to cover worst case :)
If that doesn't work, what about the case when you are always working in
powers of 2?
e.g data block is 16 bytes & buffer size is 1024 bytes.
--
Will J Godfrey
http://www.musically.me.uk
Say you have a poem and I have a tune.
Exchange them and we can both have a poem, a tune, and a song.
The Guitarix developers proudly present
Guitarix release 0.35.0
Guitarix is a tube amplifier simulation for
jack (Linux), with an additional mono and a stereo effect rack.
Guitarix includes a large list of plugins[*] and support LADSPA / LV2
plugs as well.
The guitarix engine is designed for LIVE usage, and feature ultra fast,
glitch and click free, preset switching, full Midi and/or remote
controllable (Web UI not included in the distributed tar ball).
This release introduce the new GUI design by Markus Schmidt aka. boomshop
Beside that, it comes with a couple of fixes and some new plugins.
Also included be the MOD UI's for the LV2 plugins used by the MOD[*]
For all changes, please check out the changelog.
Please refer to our project page for more information:
http://guitarix.sourceforge.net/
Download Site:
http://sourceforge.net/projects/guitarix/
Forum:
http://guitarix.sourceforge.net/forum/
Please consider visiting our forum or leaving a message on
guitarix-developer(a)lists.sourceforge.net
<mailto:guitarix-developer@lists.sourceforge.net>
regards
hermann
[*] http://moddevices.com/
On Fri, Apr 29, 2016 at 09:08:40AM +0200, Jano Svitok wrote:
> I tried to compile ffado trunk now (ubuntu 14.04 trusty) and the
> compilation failed with undefined errno.
> The attached patch fixed that.
Thanks. Patch applied as r2607.
> I didn't look why the others work and these two files not.
The others either don't reference errno directly or include other headers
which apparently pull it in.
Regards
jonathan
Folks!
it has been our pleasure having some of you at c-base the past weekend!
It trully was an awesome event. Thank you!
Some notes about the event:
* all videos here: https://media.ccc.de/c/minilac16
* github association here: https://github.com/linuxaudio
* update your information and files for content freeze prior to wiki
move before 20160430! http://minilac.linuxaudio.org/
Please watch https://media.ccc.de/v/minilac16-lacisdeadlongliveminilac
to get an update on a possible location for next year.
The video also serves as explanatory for our proposal of a collective
redesign, managed through github.
For this to happen, please let me know about your github name, so I can
add you!
All the best from c-base,
David
--
David Runge
Schreinerstraße 11
10247 Berlin
http://sleepmap.de
Hi everybody,
On the wrap of the late miniLAC2016(a)c-base.org Berlin (April 8-10)
[7][8], where this Yet Same Old Qstuff* (continued) workshop [9]
babbling of yours truly (slides, videos[10]) was taken place.
There's really one (big) thing to keep in mind, as always: Qtractor [1]
is not, never was, meant to be a 'do-it-all' monolith DAW. Quite frankly
it isn't a 'pure' modular model either. Maybe we can agree on calling it
a 'hybrid' perhaps? And still, all this time, it has been just truthful
to its original mission statement--modulo some Qt [2] major version
numbers--nb. it started on Qt3 (2005-2007), then Qt4 (2008-2014), it is
now Qt5 full throttle.
It must have been like start saying uh. this is probably the best dot or
rather beta release of them all!
Now,
Qtractor 0.7.7 (haziest photon) is out!
Everybody is here compelled to update.
Leave no excuses behind.
As for the 'mission statement' coined above, you know it's the same as
ever was (and it now goes to eleven years in the making [11]):
Qtractor [1] is an audio/MIDI multi-track sequencer application
written in C++ with the Qt framework [2]. Target platform is Linux,
where the Jack Audio Connection Kit (JACK [3]) for audio and the
Advanced Linux Sound Architecture (ALSA [4]) for MIDI are the main
infrastructures to evolve as a fairly-featured Linux desktop audio
workstation GUI, specially dedicated to the personal home-studio.
Website:
http://qtractor.sourceforge.net
Project page:
http://sourceforge.net/projects/qtractor
Downloads:
http://sourceforge.net/projects/qtractor/files
- source tarball:
http://download.sf.net/qtractor/qtractor-0.7.7.tar.gz
- source package:
http://download.sf.net/qtractor/qtractor-0.7.7-25.rncbc.suse.src.rpm
- binary packages:
http://download.sf.net/qtractor/qtractor-0.7.7-25.rncbc.suse.i586.rpmhttp://download.sf.net/qtractor/qtractor-0.7.7-25.rncbc.suse.x86_84.rpm
Git repos:
http://git.code.sf.net/p/qtractor/codehttps://github.com/rncbc/qtractor.githttps://gitlab.com/rncbc/qtractor.githttps://bitbucket.org/rncbc/qtractor.git
Change-log:
- LV2 UI Touch feature/interface support added.
- MIDI aware plug-ins are now void from multiple or parallel instantiation.
- MIDI tracks and buses plug-in chains now honor the number of effective
audio channels from the assigned audio output bus; dedicated audio
output ports will keep default to the stereo two channels.
- Plug-in rescan option has been added to plug-ins selection dialog (yet
another suggestion by Frank Neumann, thanks).
- Dropped the --enable-qt5 from configure as found redundant given
that's the build default anyway (suggestion by Guido Scholz, thanks).
- Immediate visual sync has been added to main and MIDI clip editor
thumb-views (a request by Frank Neumann, thanks).
- Fixed an old MIDI clip editor contents disappearing bug, which
manifested when drawing free-hand (ie. Edit/Select Mode/Edit Draw is on)
over and behind its start/beginning position (while in the lower view pane).
License:
Qtractor [1] is free, open-source Linux Audio [5] software,
distributed under the terms of the GNU General Public License (GPL [6])
version 2 or later.
References:
[1] Qtractor - An audio/MIDI multi-track sequencer
http://qtractor.sourceforge.net
[2] Qt framework, C++ class library and tools for
cross-platform application and UI development
http://qt.io/
[3] JACK Audio Connection Kit
http://jackaudio.org
[4] ALSA, Advanced Linux Sound Architecture
http://www.alsa-project.org/
[5] Linux Audio consortium of libre software for audio-related work
http://linuxaudio.org
[6] GPL - GNU General Public License
http://www.gnu.org/copyleft/gpl.html
[7] miniLAC, a more compact, community-driven version of the yearly
Linux Audio Conference
http://minilac.linuxaudio.org
[8] c-base.org, Berlin
http://c-base.org
[9] Yet Same Old Qstuff* (continued) workshop
http://minilac.linuxaudio.org/index.php/Workshop#Yet_Same_Old_Qstuff.2A_.28…
[10] slides:
http://minilac.linuxaudio.org/index.php/File:Lac2016_qstuff_slides.pdf
videos: http://media.ccc.de/v/minilac16-yetsameoldqstuff
[11] Siskel & Ebert - "This Is Spinal Tap"
http://www.youtube.com/watch?v=4xgx4k83zzc
See also:
http://www.rncbc.org/drupal/node/1033
Enjoy && Have fun.
--
rncbc aka Rui Nuno Capela
Hi all,
After creating an account for the wiki, it appears
that apps are in a separate database from the wiki
page itself.
I'd like to add an entry for Nama, to the list of
DAW software.
Can someone put me in touch with the database maintainer?
Joel
--
Joel Roth
Hi,
I'm Perry, also I'm tatch on linuxmusicians if you've ever been there. I
posted this message on LM a while ago but was encouraged by falktx to post
this to LAD. so that is what I am doing now (here
<https://linuxmusicians.com/viewtopic.php?t=14913> is the original topic).
not sure if you’ve read about ableton live 9.5 but one of their planned
updates is this thing called ableton link
<http://createdigitalmusic.com/2015/11/link-could-change-how-you-play-music-…>
that seems to be a convincing inter-device tempo sync.
paul davis was present during the unveiling of ableton sync and has an
interesting perspective:
…The JACK community developed technology back in 2005 or earlier that could
> do what Link does (and a whole lot more besides). But the developers failed
> to package it, failed to make it usable for anyone other than a small group
> of tech-oriented tinkerers, failed to give it an inviting face. In
> addition, the developers failed to understand how significant platform is
> when trying to create products for people. Designing the most awesome thing
> in the world is no help if it doesn’t run on the platforms that people want
> to use (for whatever reason). Ableton not only chose OS platforms with huge
> numbers of users, but has proceeded to develop its own product-centric
> platform that provides compelling reasons for users to want to remain
> within its walls. The open source community shouldn’t be trying to follow
> or copy what a company like Ableton does, but there is a strong lesson
> here: our technology is not as important as we like to think.
In any case, one thing that we’ve talked about to various degrees in the
past is tempo ramping in JACK, and with the announcement of ableton link
I’d like to revisit the topic.
http://linuxmusicians.com/viewtopic.php?f=44&t=11681&p=46912http://linuxmusicians.com/viewtopic.php?f=19&t=2290&p=51449http://linuxmusicians.com/viewtopic.php?f=1&t=9835&p=30447
JACK does indeed largely do what Link does (and more) but I’ve been having
difficulty successfully tempo ramping. Incidentally, danboid recently posted
<https://linuxmusicians.com/viewtopic.php?f=1&t=14912> about how he can
successfully ramp in MuSE; but I don’t use MuSE nor do I plan to in the
near future, and unfortunately my attempts to change tempo dynamically
within the greater JACK/modular LAU paradigm have been rather unsuccessful.
To clarify my own use-case, I’d like to map an encoder/knob to a tempo
control and be able to speed up/slow down the tempo live, e.g. during a
performance.
*changing tempo as timebase master*
For the most part it seems that changing tempo dynamically is possible but
it is not well-defined.
- seq24 forces itself to be transport master (I know there’s supposed to
be a patch but it has still never worked for me ever) and disallows tempo
changes while playing
- hydrogen sort of allows tempo changes but it will sometimes politely
refuse to change (which is bad)
- klick can be configured to send out predefined tempo ramps but I
haven’t been able to set it as timebase master and actually interact with
it (I was trying klick -Ti and klick -To 8080 but it seems -i and -o
somehow disregard the -T option)
*changing tempo as a slave*
- hydrogen is happy to oblige tempo changes but is equally happy to cut
off the beginning/end of a bar
- qmidiarp follows tempo changes but doesn’t stay in time and forgets to
send note-offs
I’d appreciate if someone more familiar with the transport spec could chime
in on this, I’d like to understand what is missing from a technical
perspective (I’m actually not entirely clear on the timebase master/slave
relationship either).
Going a step further, it seems that ableton link may become the go-to
replacement for midi clock in software-based production; it could be
beneficial to discuss possible timebase master clock clients that can also
communicate using the ableton link protocol. Of course this is contingent
on the SDK being compatible with linux, which may be unlikely but they *are*
encouraging interested developers to get in touch
<https://www.ableton.com/en/link/>.
By the same token it would be great to have this for midi clock as well — I
know of jack_midi_clock <https://github.com/x42/jack_midi_clock> already
but I don’t believe the reverse case exists, though falktx and I briefly
discussed something related
<https://linuxmusicians.com/viewtopic.php?f=48&t=12755> a while ago.
To reiterate,
1. lau apps have to implement tempo ramping in JACK properly
2. a JACK timebase master clock client must be made that can
- change tempo dynamically
- communicate with ableton link to send/receive tempo information
(pending a working SDK for linux (this could also be optional in the app
for those who don’t want anything proprietary))
- set tempo given a midi clock input
Thoughts? I think tempo syncing is one way we can get JACK to interact more
proactively with other software/equipment, and that seems like it could be
a great way to reconnect with the rest of the audio community.
​