Hi, Maybe a bit off topic for this list, bt anyway. I have received several feature requests for DarkIce to support downsampling of the audio input before passing it to lame or ogg vorbis. For example the audio read from the soundcard would be 44.1kHz, and lame would get it at 22.05kHz. I figure two ways of doing this: 1. For lame, one can specify the input and the desired mp3 sampling rate, and lame will downsample the data as needed. I didn't find such possibility for vorbis. For lame, this increases the processing need quite a lot (almost double as I measure). 2. Downsample in DarkIce, by simple means. For example, from 44.1kHz -> 22.05kHz, simply send one sample for every two imput samples, taking their average value. This shouldn't result in large computing overhead, and I could also do it for vorbis. As there are people on the list more clever than me, I'd like to know what downsides are there for point 2? Thanks, Akos --- >8 ---- List archives: http://www.xiph.org/archives/ icecast project homepage: http://www.icecast.org/ To unsubscribe from this list, send a message to 'icecast-request@xiph.org' containing only the word 'unsubscribe' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.
On Thu, Oct 18, 2001 at 09:48:11AM +0300, Akos Maroy wrote:> 2. Downsample in DarkIce, by simple means. For example, from 44.1kHz -> > 22.05kHz, simply send one sample for every two imput samples, taking > their average value. This shouldn't result in large computing overhead, > and I could also do it for vorbis. > > As there are people on the list more clever than me, I'd like to know > what downsides are there for point 2?you can have a look into the resampling code of MuSE, in particular audioproc.cpp which contains different procedures for resampling while mixing (for better efficiency, we don't want to process all the bytes twice, better do both operations in once). the core algorithm plays with resolution by doing bitshift of array indexes, resulting in a better interpolation than the procedure you describe here. i.e: int mixxx_stereo_22(int *dest, short *chan, int num, float volume) { int c, off,tnum = (num<<1); int delta = (num << 16) / tnum; for(c=0,off=0;c<tnum;c++, off += delta) dest[c] = (int) (dest[c] + (chan[off >> 16]*volume)); this resamples 22 to 44 while also adding it to the mixing buffer dest[]. alltough there are more exact ways to do it, this looks to me the better compromise in performance and accuracy. i found this algo into the speed resampling plugin of xmms, by jammet-at-lionking.org, which originally was formulated to resample at any frequency: #define DO_PITCH(type, length, newlength, buffer, newbuffer) \ { \ int delta = (length << 16) / newlength, i, off; \ type *ptr = (type *)buffer, *newptr = (type *)newbuffer; \ for(i = 0, off = 0; i < newlength; i++, off += delta) \ *newptr++ = ptr[off >> 16]; \ } by using this you just need to calculate lenght proportions into your resampling. greetings -- jaromil //dyne.org - GPG fingerprint and ___id____ 6EEE 4FB2 2555 7ACD 8496 AB99 E2A2 93B4 6C62 4800 --- >8 ---- List archives: http://www.xiph.org/archives/ icecast project homepage: http://www.icecast.org/ To unsubscribe from this list, send a message to 'icecast-request@xiph.org' containing only the word 'unsubscribe' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.
Jack Moffitt wrote:> This isn't good enough. Just rip out lame's downsampling code (or > sox's) and use that (as long as your also under a compatible license).DarkIce is GPL, should be OK.> Those are both pretty good. Averaging every two samples just doesn't > cut it :)I thought so :( But I wouldn't need to rip out the code, if vorbis supported downsampling as well. Thanks anyway, Akos --- >8 ---- List archives: http://www.xiph.org/archives/ icecast project homepage: http://www.icecast.org/ To unsubscribe from this list, send a message to 'icecast-request@xiph.org' containing only the word 'unsubscribe' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.
harvey smith wrote:> I just a poor boy and only have a p233. But I just open my sound > card at 22.05 to begin with and then don't need to resample. I > guess this wouldn't work if you need the 44.1 for something else too > (like when doing both a HQ stream and a Low-fi one)This is the exact nature of the feature request :)> Last I checked ogg vorbis only did 44.1kHz, this question implies it > can do 22.05kHz now... must be time to go get the latest ; - )The sound quality is quite bad at 22.05kHz, I suppose you stick to 44.1. Also they say this in the documentation... Akos --- >8 ---- List archives: http://www.xiph.org/archives/ icecast project homepage: http://www.icecast.org/ To unsubscribe from this list, send a message to 'icecast-request@xiph.org' containing only the word 'unsubscribe' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.
Akos Maroy wrote:> 1. For lame, one can specify the input and the desired mp3 sampling > rate, and lame will downsample the data as needed. I didn't find such > possibility for vorbis. For lame, this increases the processing need > quite a lot (almost double as I measure). >I use this technique for this: http://perlmonks.org/index.pl?node_id=55445 However, I found that Lame doesn't handle broadcasts to well for some MP3's. I have MPG123 pull and play them, and then have Lame reencode the piped sound data. -- eval join"",map{chomp;s/^.+>\s*//;$_}grep{/>/}<DATA>; __DATA__ .' .' Kelly "STrRedWolf" Price -- WolfSkunk Designs xX xX .' http://stalag99.keenspace.com "X "X X .' tygris at cablespeed dot com _____. X" X NO UNSOLICITED COMMERCIAL E-MAIL ACCEPTED XXXXXXXx. X".' > 0; '"XXXXXX| X > 0; "XXX| X" > 0; 'XX' > 0; --- >8 ---- List archives: http://www.xiph.org/archives/ icecast project homepage: http://www.icecast.org/ To unsubscribe from this list, send a message to 'icecast-request@xiph.org' containing only the word 'unsubscribe' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.
> 2. Downsample in DarkIce, by simple means. For example, from 44.1kHz -> > 22.05kHz, simply send one sample for every two imput samples, taking > their average value. This shouldn't result in large computing overhead, > and I could also do it for vorbis.This isn't good enough. Just rip out lame's downsampling code (or sox's) and use that (as long as your also under a compatible license). Those are both pretty good. Averaging every two samples just doesn't cut it :) jack. --- >8 ---- List archives: http://www.xiph.org/archives/ icecast project homepage: http://www.icecast.org/ To unsubscribe from this list, send a message to 'icecast-request@xiph.org' containing only the word 'unsubscribe' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.
On Thu, 18 Oct 2001, Akos Maroy wrote:> I have received several feature requests for DarkIce to support > downsampling of the audio input before passing it to lame or ogg vorbis. > For example the audio read from the soundcard would be 44.1kHz, and lame > would get it at 22.05kHz.I just a poor boy and only have a p233. But I just open my sound card at 22.05 to begin with and then don't need to resample. I guess this wouldn't work if you need the 44.1 for something else too (like when doing both a HQ stream and a Low-fi one) Last I checked ogg vorbis only did 44.1kHz, this question implies it can do 22.05kHz now... must be time to go get the latest ; - ) harvey --- >8 ---- List archives: http://www.xiph.org/archives/ icecast project homepage: http://www.icecast.org/ To unsubscribe from this list, send a message to 'icecast-request@xiph.org' containing only the word 'unsubscribe' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.
> I just a poor boy and only have a p233. But I just open my sound > card at 22.05 to begin with and then don't need to resample. I > guess this wouldn't work if you need the 44.1 for something else too > (like when doing both a HQ stream and a Low-fi one)well, a poor boy like me uses a dual pentium pro 200 running both icecast and liveice... currently i use a liveice.cfg as follows without coming close to overloading the system. darkice on the other hand has no way of accomplishing this, nor does it's quality match liveices. this is what Akos is attempting to get into darkice. i personally am looking forward to it due to the frequent problems i have with icecast/liveice combo. Another 'feature' suggestion for darkice: allow darkice to be built *without* ogg/vorbis. ENCODER_STREAM_SET 1 SAMPLE_RATE 44100 BITRATE 128000 STEREO MOUNTPOINT hi ENCODER_STREAM_SET 0 SAMPLE_RATE 22050 BITRATE 16000 MONO MOUNTPOINT lo -- ------------------------------------ Robin P. Blanchard IT Program Specialist Georgia Center for Continuing Ed. fon: 706.542.2404 fax: 706.542.6546 email: Robin_Blanchard@gactr.uga.edu ------------------------------------ --- >8 ---- List archives: http://www.xiph.org/archives/ icecast project homepage: http://www.icecast.org/ To unsubscribe from this list, send a message to 'icecast-request@xiph.org' containing only the word 'unsubscribe' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.