Reply by Erik de Castro Lopo March 21, 20062006-03-21
Randy Yates wrote:
> > If Einstein were a software developer, I'm sure his philosophy would be > > "Write code as simple as possible, but no simpler."
And I'd agree with that as long as "simple as possible" includes proper testing of corner cases, error returns from functions, proper validation of untrusted input etc. I seen statistics somewhere that for any significnt piece of code, up to 50 percent of the code (by line count) was input validation and error handling Erik -- +-----------------------------------------------------------+ Erik de Castro Lopo +-----------------------------------------------------------+ "C++ : You won't live long enough to learn it all from experience." -- Peter Miller (author of Aegis)
Reply by Erik de Castro Lopo March 21, 20062006-03-21
robert bristow-johnson wrote:
> > one thing i would have to say, Erik, while i respect the technical merit of > your code (i've only looked at libsndfile), it is awfully opaque to read.
Funny thing is, I have had a number of people dive into the libsndfile code and add significant chunks of functionality, and then sending me a patch. The first I hear of it is a the patch arrives in my my inbox. Many of those people have also said that the libsndfile code base was rather easy to work on.
> a > few years ago, i tried extracting the salient functions out of it to include > in a simple C program i was writing to do some (undefined) music/sound > processing on some .wav files. whenever i did, it left so many undefined > symbols and such that i ended up writing a simple .wav file reader from > scratch.
Like any large piece of code, libsndfile has had a bunch of common functionality abstracted away into internal helper functions and then called from throughout the rest the code. This is commonly considered good software engineering practice. This and the concientious use of test driven development has made the libsndfile code base extremely robust and reliable. libsndfile is extremely widely used. It is installed on a large proportion of Linux systems and is used for file I/O on Mac Win32 and Linux) in CSound5, SuperCollider3, Chuck and a number of other widely used pieces of sound software. Even with this wide usage, bug reports are extremely rare and are fixed with a very short turn-around. Part of the reason for the relatively bug free nature of libsndfile is the use of internal helper functions. This also makes it difficult to pull a single file out of libsndfile and hope to compile it into something else. I don't apologize for that.
> i'm just an EE who is a code minimalist
As am I. If I wasn't a minimalist libsndfile would be written in C++ with deeply nested class heirarchies and templates and the standard template library throughout. As if it is, libsndfile uses little code outside the ISO C99 standard.
> your code looks > like something written by a hard-core professional
I'l take that as a compliment :-). I do make my living writing code in projects of 100k plus lines.
> working in a big company like Micro$oft.
But that is not. If it wasn't you rbj, I'd take that as an insult :-).
> that may be good, in some regards, but it is not transparent.
May its a culture thing. For experienced software engineers working in C on Linux, libsndfile does not look all that strange, especially if they have had some experience in writing device drivers on Linux. For someone coming from outside that culture, the libsndfile may look rather opaque. Erik -- +-----------------------------------------------------------+ Erik de Castro Lopo +-----------------------------------------------------------+ "There are two kinds of large software systems: those that evolved from small systems and those that don't work." -- Seen on slashdot.org, then quoted by amk
Reply by Randy Yates March 20, 20062006-03-20
robert bristow-johnson <rbj@audioimagination.com> writes:
> [...] > i'm just an EE who is a code minimalist,
If Einstein were a software developer, I'm sure his philosophy would be "Write code as simple as possible, but no simpler." --RY -- % Randy Yates % "Ticket to the moon, flight leaves here today %% Fuquay-Varina, NC % from Satellite 2" %%% 919-577-9882 % 'Ticket To The Moon' %%%% <yates@ieee.org> % *Time*, Electric Light Orchestra http://home.earthlink.net/~yatescr
Reply by robert bristow-johnson March 20, 20062006-03-20
in article 441E8025.D66D99D1@mega-nerd.com, Erik de Castro Lopo at
nospam@mega-nerd.com wrote on 03/20/2006 05:12:

> twain wrote: >> >> Oh man, it's not for MSVC++, what a headache! >> Why won't you simple include an executable for Win32 on your web site? >> >> It says: >> "Building libsndfile using the microsoft compiler does not currently >> work. Microsoft's compiler is a C++ compiler and does not compile a >> number of ISO C99 Standard constructs. If you insist on compiling >> libsndfile with the microsoft compiler you are on your own. "
one thing i would have to say, Erik, while i respect the technical merit of your code (i've only looked at libsndfile), it is awfully opaque to read. a few years ago, i tried extracting the salient functions out of it to include in a simple C program i was writing to do some (undefined) music/sound processing on some .wav files. whenever i did, it left so many undefined symbols and such that i ended up writing a simple .wav file reader from scratch. that was simpler than making libsndfile work for me. i haven't yet tried to crack Secret Rabbit yet, but i have my own ways of doing SRC, and probably functionally equivalent to your ways, but with many fewer files and keystrokes. i'm just an EE who is a code minimalist, and frankly Erik, your code looks like something written by a hard-core professional working in a big company like Micro$oft. that may be good, in some regards, but it is not transparent. -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."
Reply by Erik de Castro Lopo March 20, 20062006-03-20
twain wrote:
> > Oh man, it's not for MSVC++, what a headache! > Why won't you simple include an executable for Win32 on your web site? > > It says: > "Building libsndfile using the microsoft compiler does not currently > work. Microsoft's compiler is a C++ compiler and does not compile a > number of ISO C99 Standard constructs. If you insist on compiling > libsndfile with the microsoft compiler you are on your own. "
About 1 inch above the text you have just quotes, it says: Note : For pre-compiled binaries for windows, see the main web page. Did you look on the main web page? Maybe for the ZIP file that is labeled: Windows .zip file including precompiled binaries and all source code Erik -- +-----------------------------------------------------------+ Erik de Castro Lopo +-----------------------------------------------------------+ "If Java had true garbage collection, most programs would delete themselves upon execution." -- Robert Sewell
Reply by twain March 20, 20062006-03-20
Oh man, it's not for MSVC++, what a headache!
Why won't you simple include an executable for Win32 on your web site?
It says:
"Building libsndfile using the microsoft compiler does not currently 
work. Microsoft's compiler is a C++ compiler and does not compile a 
number of ISO C99 Standard constructs. If you insist on compiling 
libsndfile with the microsoft compiler you are on your own. "

Erik de Castro Lopo wrote:
> twain wrote: >> I have a large bunch of WAV files sampled at 44.1kHz and at 48kHz, which >> I would like to convert to 8kHz sampling rate, efficiently/quickly but >> professionally & accurately (i.e. no aliasing etc.) >> >> Could anyone recommend me a tool for doing that (free software or Matlab)? >> >> (For example I know GoldWave is bad for this purpose since its >> anti-aliasing filter is unprofessional.) > > Secret Rabbit Code will do the trick: > > http://www.mega-nerd.com/SRC/ > > > Erik
Reply by twain March 20, 20062006-03-20
File 'sndfile.h' is missing:
and not defined: sf_count_t

Erik de Castro Lopo wrote:
> twain wrote: >> I have a large bunch of WAV files sampled at 44.1kHz and at 48kHz, which >> I would like to convert to 8kHz sampling rate, efficiently/quickly but >> professionally & accurately (i.e. no aliasing etc.) >> >> Could anyone recommend me a tool for doing that (free software or Matlab)? >> >> (For example I know GoldWave is bad for this purpose since its >> anti-aliasing filter is unprofessional.) > > Secret Rabbit Code will do the trick: > > http://www.mega-nerd.com/SRC/ > > > Erik
Reply by twain March 20, 20062006-03-20
File 'sndfile.h' is missing:
sndfile-resample.c
.\examples\sndfile-resample.c(30) : fatal error C1083: Cannot open 
include file: 'sndfile.h': No such file or directory
NMAKE : fatal error U1077: 'cl.exe' : return code '0x2'
Stop.

Erik de Castro Lopo wrote:
> twain wrote: >> I have a large bunch of WAV files sampled at 44.1kHz and at 48kHz, which >> I would like to convert to 8kHz sampling rate, efficiently/quickly but >> professionally & accurately (i.e. no aliasing etc.) >> >> Could anyone recommend me a tool for doing that (free software or Matlab)? >> >> (For example I know GoldWave is bad for this purpose since its >> anti-aliasing filter is unprofessional.) > > Secret Rabbit Code will do the trick: > > http://www.mega-nerd.com/SRC/ > > > Erik
Reply by Erik de Castro Lopo March 18, 20062006-03-18
twain wrote:
> > I have a large bunch of WAV files sampled at 44.1kHz and at 48kHz, which > I would like to convert to 8kHz sampling rate, efficiently/quickly but > professionally & accurately (i.e. no aliasing etc.) > > Could anyone recommend me a tool for doing that (free software or Matlab)? > > (For example I know GoldWave is bad for this purpose since its > anti-aliasing filter is unprofessional.)
Secret Rabbit Code will do the trick: http://www.mega-nerd.com/SRC/ Erik -- +-----------------------------------------------------------+ Erik de Castro Lopo +-----------------------------------------------------------+ "The trouble with Muslims is not that they try to make us think as they do, but that they try to make us do as they think!" -- paraphrased from H.L. Mencken on Puritans
Reply by Martin Blume March 18, 20062006-03-18
"twain" schrieb
> I have a large bunch of WAV files sampled at 44.1kHz > and at 48kHz, which I would like to convert to 8kHz > sampling rate, efficiently/quickly but > professionally & accurately (i.e. no aliasing etc.) > > Could anyone recommend me a tool for doing that (free > software or Matlab)? > > (For example I know GoldWave is bad for this purpose > since its anti-aliasing filter is unprofessional.) >
You might want to check audacity (audacity.soureceforge.net). HTH Martin