Howdy peeps.
Not really much of a release, so not much fanfare, but in the
interests of sharing effort I give you...
Powernap!
http://dis-dot-dat.net/?item=code/powernap/
If, like me, you need to drive an app from a Python interface,
powernap can help. It's a small extension that switches to the
real-time scheduler and provides two handy sleep-like functions:
nap() naps for a given number of milliseconds, timed with the RTC
rnap() is a "rolling nap" that tries to make the time between calls
the given number of milliseconds. A padding nap, if you will.
It works for me and it might come in handy for someone else.
James
Hi everybody!
I am a newbie to alsa programming.
I am trying to follow the article which locates at
http://www.suse.de/~mana/alsa090_howto.html to develop a playback program.
My code here:
snd_pcm_t*pcm_handle;
unsigned int rate = 8000;
// Sample rate returned by
// snd_pcm_hw_params_set_rate_near
int exact_rate;
// exact_rate == rate ----> dir =0
//exact_rate < rate ----> dir =-1
//exact_rate > rate ----> dir =1
int dir = 0;
// Number of periods
int periods = 2;
snd_pcm_stream_t stream = SND_PCM_STREAM_PLAYBACK;
// This structure contains information about the hardware
//and can be used to specify the configuration to be used for the
PCM stream.
snd_pcm_hw_params_t *hwparams;
// Name of the PCM device, like plughw:0,0
//The first number is the number of the soundcard,
//the second number is the number of the device.
char *pcm_name;
// Init pcm_name. Of course, later you
//will make this configurable ;-)
pcm_name = strdup("plughw:0,0");
printf("Device name:%s\n",pcm_name);
//Allocate the snd_pcm_hw_params_t structure on the stack.
snd_pcm_hw_params_alloca(&hwparams);
// Open PCM. The last parameter of this function is the mode.
// If this is set to 0, the standard mode is used. Possible
// other values are SND_PCM_NONBLOCK and SND_PCM_ASYNC.
// If SND_PCM_NONBLOCK is used, read / write access to the
// PCM device will return immediately. If SND_PCM_ASYNC is
// specified, SIGIO will be emitted whenever a period has
//been completely processed by the soundcard.
if (snd_pcm_open(&pcm_handle, pcm_name, stream, 0) <
0){//SND_PCM_NONBLOCK
fprintf(stderr, "Error opening PCM device %s\n", pcm_name);
return;
}
// Init hwparams with full configuration space
if (snd_pcm_hw_params_any(pcm_handle, hwparams) < 0) {
fprintf(stderr, "Can not configure this PCM device.\n");
return;
}
// Set access type. This can be either
SND_PCM_ACCESS_RW_INTERLEAVED or
// SND_PCM_ACCESS_RW_NONINTERLEAVED.There are also access types for
// MMAPed access, but this is beyond the scope of this introduction.
if (snd_pcm_hw_params_set_access(pcm_handle, hwparams,
SND_PCM_ACCESS_RW_INTERLEAVED) < 0) {
fprintf(stderr, "Error setting access.\n");
return;
}
//Set sample format
if (snd_pcm_hw_params_set_format(pcm_handle, hwparams,
SND_PCM_FORMAT_S16_LE) < 0) {
fprintf(stderr, "Error setting format.\n");
return;
}
// Set sample rate. If the exact rate is not supported by the
hardware, use nearest possible rate.
exact_rate = snd_pcm_hw_params_set_rate_near(pcm_handle, hwparams,
&rate, &dir);
if (exact_rate < 0) {
fprintf(stderr, "Error setting rate.\n");
return;
}
if (rate != exact_rate) {
fprintf(stderr, "The rate %d Hz is not supported by your
hardware.\n=> Using %d Hz instead.\n", rate, exact_rate);
}
// Set number of channels
if (snd_pcm_hw_params_set_channels(pcm_handle, hwparams, 2) < 0) {
fprintf(stderr, "Error setting channels.\n");
return;
}
// Set number of periods. Periods used to be called fragments.
if (snd_pcm_hw_params_set_periods(pcm_handle, hwparams, periods, 0)
< 0)
{
fprintf(stderr, "Error setting periods.\n");
return;
}
// Set buffer size (in frames). The resulting latency is given by
// latency = periodsize * periods / (rate * bytes_per_frame)
snd_pcm_uframes_t buffersize = ( snd_pcm_uframes_t )(
number_of_frames * periods );
if (snd_pcm_hw_params_set_buffer_size_near(pcm_handle, hwparams,
&buffersize) < 0){
fprintf(stderr, "Error setting buffersize.\n");
return;
}
printf("Buffer size asked for %d, set %d \n",buffersize,exact_rate);
// Apply HW parameter settings to
// PCM device and prepare device
if (snd_pcm_hw_params(pcm_handle, hwparams) < 0) {
fprintf(stderr, "Error setting HW params.\n");
return;
}
snd_pcm_prepare(pcm_handle);
Unfortunately, exact_rate is zero.The following lines were printed out:
The rate 8000 Hz is not supported by your hardware.
=> Using 0 Hz instead.
If exact_rate > 0 is OK but it is zero.
I don't know how to solve the problem.
Please help me.
Thanks!
Phuoc Nguyen
Hi,
Is there a standard way of converting a 24bit sample to 16bit?
I ask because I think that in different scenarios, one would want a
different result.
1) scale a 24bit value to a 16bit by simple multiplication by a fraction.
2) bit shift the 24bit value, so that the "most useful 16bits" are
returned to the user. The problem here is what are the "most useful
16bits"? I have one application where just using the lower 16bits of the
24bit value is ideal, due to extremely low input signals.
Option (1) looses information due to compression of the signal.
Option (2) is more likely to loose information through clipping.
James
In gimp list, I mentioned that I don't want my software to be
used in Windows. That would encourage people to install Linux.
My plan was to use GPL + Windows exclusion. I was very clearly
informed that it would not work.
Then why similar works for Linuxsampler?
BTW, I'm still puzzled on what kind of license I should use.
Juhana
--
http://music.columbia.edu/mailman/listinfo/linux-graphics-dev
for developers of open source graphics software
So, I'm trying to build Smack, which needs Om, which needs libgnomecanvasmm,
which my os (Fedora Core 3) doesn't seem to have, so I found it here:
http://sunsite.mff.cuni.cz/MIRRORS/ftp.gnome.org/pub/GNOME/sources/libgnome…
And when I try to build it, I get this:
g++ -DHAVE_CONFIG_H -DG_LOG_DOMAIN=\"libgnomecanvasmm\" -I../../libgnomecanvas
-I../../libgnomecanvas -DXTHREADS -D_REENTRANT -DXUSE_MTSAFE_API -I/usr/local/include/libart-2.0
-I/usr/include/gtkmm-2.4 -I/usr/lib/gtkmm-2.4/include -I/usr/include/glibmm-2.4
-I/usr/lib/glibmm-2.4/include -I/usr/include/gdkmm-2.4 -I/usr/lib/gdkmm-2.4/include
-I/usr/include/pangomm-1.4 -I/usr/include/atkmm-1.6 -I/usr/include/gtk-2.0
-I/usr/include/sigc++-2.0 -I/usr/lib/sigc++-2.0/include -I/usr/include/glib-2.0
-I/usr/lib/glib-2.0/include -I/usr/lib/gtk-2.0/include -I/usr/X11R6/include
-I/usr/include/pango-1.0 -I/usr/include/freetype2 -I/usr/include/freetype2/config
-I/usr/include/atk-1.0 -I/usr/include/libgnomecanvas-2.0 -g -O2 -MT line.lo -MD -MP -MF
.deps/line.Tpo -c line.cc -fPIC -DPIC -o .libs/line.o
In file included from line.cc:3:
../../libgnomecanvas/libgnomecanvasmm/line.h:374: error: extra qualification ignored
../../libgnomecanvas/libgnomecanvasmm/line.h:375: error: explicit specialization of non-template
`Glib::<anonymous class>'
../../libgnomecanvas/libgnomecanvasmm/line.h:375: error: an anonymous union cannot have function
members
../../libgnomecanvas/libgnomecanvasmm/line.h:378: error: abstract declarator `Glib::<anonymous
class>' used as declaration
make[4]: *** [line.lo] Error 1
make[4]: Leaving directory
`/home/scameron/software/libgnomecanvasmm-2.6.0/libgnomecanvas/libgnomecanvasmm'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory
`/home/scameron/software/libgnomecanvasmm-2.6.0/libgnomecanvas/libgnomecanvasmm'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/scameron/software/libgnomecanvasmm-2.6.0/libgnomecanvas'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/home/scameron/software/libgnomecanvasmm-2.6.0/libgnomecanvas'
make: *** [all-recursive] Error 1
[scameron@zuul libgnomecanvasmm-2.6.0]$
Anybody know how to get around this...? (without installing another OS
preferably)
-- steve
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
Hi!
Trying to understand some magic with Ipmulse Response, FFT and so on, I'm playing with
scipy, matplotlib (and python as new language for me as a bonus). Concrete IR was got
with help of DRC (rec_imp, saying more strictly).
Currently I have got this frequency response graph:
http://gaydenko.com/mix/needSmooth.png
And the question is: what is common way to smooth the result? Some offtopic apps has
something like "1/24, ..., 1/3 octave smoothing". What does it mean?
Andrew
Hi peeps.
I've just been running an app through valgrind and I'm getting a few
of these:
==11955== Syscall param write(buf) points to uninitialised byte(s)
==11955== at 0x4D51BDB: (within /lib64/libpthread-2.4.so)
==11955== by 0x4B27CDD: (within /usr/lib64/libjack.so.0.0.23)
==11955== by 0x4B29434: jack_deactivate (in
/usr/lib64/libjack.so.0.0.23)
==11955== by 0x4B2945F: jack_client_close (in
/usr/lib64/libjack.so.0.0.23)
==11955== by 0x40402F: jackpart_close() (jackPart.cc:86)
==11955== by 0x40235F: mainLoop() (sampleplayer.cpp:438)
==11955== by 0x40237B: main (sampleplayer.cpp:444)
==11955== Address 0x7FEFFE934 is on thread 1's stack
I can't see anything wrong on my part, so I thought I'd check with
people who know more than I before I tear my program apart.
I also get them coming from jack_port_register, jack_activate and
jack_connect.
Any ideas?
James
Linuxaudio.org is getting ready to announce new memberships in the coming
weeks. For this reason, I would like to invite all Linux Audio projects and
its members, as well as other allied projects, institutions, companies, and
hardware vendors to consider joining our organization.
HOW TO JOIN
Simply send an e-mail to ico at linuxaudio dot org stating your interest to
join. There are no dues or hidden costs and the membership can be terminated
at any time via member's written request.
BENEFITS
As the consortium grows, we strive to provide a focal, converging point
through which we will represent our community, offer new opportunities for
collaboration and interaction, represent and preserve interests of the
community, as well as serve as a point of contact for commercial industry
and hardware vendors.
For more info please visit linuxaudio.org or do not hesitate to contact me
directly.
Best wishes,
Ivica Ico Bukvic, D.M.A. Composition
Virginia Tech
Dept. of Music - 0240
Blacksburg, VA 24061
(540) 231-7047
(540) 231-5034 (fax)
ico(a)vt.edu
http://www.music.vt.edu/people/faculty/bukvic/
> You are... Linux sampler doesn't support built-in effects because of what
> working with audio is like under linux. JACK (jack audio connection kit)
> is an application that allows one to manage connection between various
> audio software. This includes linux sampler, but also plugins based on the
> LADSPA sdk. You are right to say that there are no built-in effect in
> Linuxsampler. It's not a lack of functionnality. It's meant to be like
> this because you can connect linuxsampler's output to a effect management
> rack like jack-rack (which also benefits of being jack compatible) have
> any effect you like applied (and there's loads ! see
> http://www.ladspa.org/).
I can appreciate this modularity as much as the next fellow, but having effects
support in the sampler itself is near-critical. Creating sophisticated sounds
using a sampler requires it.
I need to have multiple layers of samples, each filtered and modulated
differently. You can't do this in post-processing. It just isn't possible.
Even supposing Linux Sampler could route sounds out to effects and back in to
the sampler, that would be far to complicated to be even remotely usable without
giving up huge amounts of sampling felixibility.
This is not about applying reverb to a drum kit. It's about having 6 samples
triggered when I press a key on the keyboard, and each sample being filtered,
pitch bended, saturated differently, and modulating all of those parameters
using LFO's, envelopes, and midi parameters. You can't do that using "outboard"
effects.
-Forest
Hello all,
I finally took the big step and handed in my resignation at
my employer, Alcatel Alenia Space.
After 3 years of CAD, 3 years of real-time kernels, and 11
years in space telecoms, I want to return to my first love
which is audio, acoustics, and music. My activities in LAD
have certainly contributed to this desire.
It will be at least end of september before I really say
goodbye at AAS, and I have at this moment no idea at all
which way I will go. Which means I'm open to suggestions.
I will consider 'a real job' if it's related to acoustics,
audio engineering, ambisonics, electro-acoustic music etc.
For this type of thing I'm also prepared to move to France,
Germany, and any of the European countries bordering the
Mare Nostrum. I speak Portuguese (needs refreshing), I am
currently learning Greek, and if necessary I'll add Spanish
or Italian. I'm not really looking for a job as a programmer.
The alternative is of course free-lance consultancy work.
And if all else fails, I will be raising sheep on Crete.
Anyone interested or having interesting pointers please
contact me off-list.
(and no, I'm not quitting LAD :)
--
FA
Follie! Follie! Delirio vano e' questo!