Copied from a PM discussion with mh.
Hi!
I read (
http://wiki.tcl.tk/20832) about your Tcl GSoC 2008 Project. Personally I'm involved in a project, which tries to create a MP3 Jukebox system/framework (jukebox in a classical sense) based on AOLserver/Tcl (
http://audiomat.sourceforge.net/), but thats still in planning stage. For our purpose I played a lot with the Snack Sound Toolkit, but there are some limitations which I wanted to remedy in the C code. E.g. we would need a possibility not to ouput the sound only to OSS/ALSA, but also to an Icecast/Shoutcast system. After some research I found out, that it can only be a hack, because the audio output architecture of Snack is quite inflexible (driver can only be chosen at compilation).
So I really appreciate your plans to create a new audio library for Tcl. Until now I found only that little information in the Tcl'ers Wiki, so I wanted to ask you:
- Do you plan "only" an audio output library (marriage of libao and libao2)?
- What are your plans for audio input? Will there be some kind of plugin architecture?
- Do you have any plans for audio processing functions similiar to Snack (because you compared your project somehow with snack, which is if course much more than an audio input/output library), eg playing/encoding mp3 files or crossfading? If not, will there be any kind of plugin/extensible architecture to achieve additional functionality?
Thanks in advance and best regards,
Michael Hofer
Hi,
Thanks for your interest!
The new library would probably be very helpful, you could write a driver for it that gets loaded dynamically which adds support for icecast/shoutcast/whatever if it doesn't already exist. This system will be very flexible.
To answer your questions :
1 - no, the plan is to have both audio input AND output... but audio input is only "if time permits"
2 - for audio input, there is no design yet, so I'm not sure yet how it will be done, but it should be fairly simple.. in the same way you would do ao_play(dev, buffer, len), you could do, ao_record(dev, &buffer, &len);
3 - No plans for anything more advanced than 'open+play+close', if you want, you can still do it in your own code, and if you implement it in the C code, then patches are of course welcomed
For example, the current planning has a slot for having the Tcl extension have a PlayWave function that would play an actual .wav file, it would be done with something like this :
int PlayWav ( ) {
dev = ao_open(...);
PlayWav2 (dev);
}
int PlayWav2 (AoDevice *dev2) {
buffer_size = ao_get_buffer(dev);
buffer_len = read(wav_fd, buffer, buffer_size);
ao_play(dev, buffer, buffer_len);
delay = ao_get_delay(dev);
Tcl_eval ( "after $delay / 2 [list PlayWav $dev]" );
}
I think you get the idea... for doing something like cross fading, it would be as simple as doing the same thing, but when you know the file is at the end, you apply a filter on it...
The purpose of the library is to provide a way to output sound as raw PCM data, if you need to do effects on it, then use a 'filter' library in the middle before sending your data to libao. This helps keep it modular and focused on doing one thing.
I hope this answers your questions! If you have any other question, don't hesitate to ask.
And by the way, do you allow me to copy/paste this discussion on the public forums and continue it in public ?
Thanks for your answer! Yes, perhaps I will write liblame bindings for Tcl built upon your library. That would make sense. Or perhaps its possible to port the Snack library to your new Tcl-libao. Lets see
PS: Of course you can move that discussion to public. I would have posted my messages in the public forums, but I didn't know where it fits, because its a bit off-topic.
Thanks ... i'm looking forward for any
Tcl audio developments ...
Best regards,
Michael.