Blog
Page: 0 ... 5 9 10 11 12 13 14 15 16 17 ... 20 ... 25 ... 30 ... 35 ... 40 ... 45 ... 50 ... 55 ... 60 ... 65 ... 70 ... 75 ... 80 ... 85 ... 90 ... 95
Converting audio samples to dB and back
Date: 26/4/2012
Tags: audio
I've been writing a tool to normalize lots of audio files at once, as well as convert between various loss-less formats (particularly FLAC and WAV). In doing that I needed a way of converting between the raw audio sample maximum and dB. So I present to you my C functions for doing so:
double LinearToDb(int32 linear, int bitDepth)
{
    uint32 MaxLinear = (1 << (bitDepth - 1)) - 1;
    uint32 ab = linear >= 0 ? linear : -linear;
    return log10((double)ab / MaxLinear) * 20.0;
}

int32 DbToLinear(double dB, int bitDepth)
{
    uint32 MaxLinear = (1 << (bitDepth - 1)) - 1;
    double d = pow(10, dB / 20);
    return d * MaxLinear;
}
Another code snippit for Google to index.
(0) Comments | Add Comment

XCode: error from debugger: the program being debugged is not being run.
Date: 14/4/2012
Tags: mac xcode
If you are getting this in your XCode run log:
Running...
No executable file specified.
Use the "file" or "exec-file" command.
No executable file specified.
Use the "file" or "exec-file" command.
The program being debugged is not being run.
The program being debugged is not being run.
After copying a project and renaming everything... then you missed the "executable name" on the target. Click your Target, and "Get Info", then click the Properties tab, and rename the Executable to the same name as the Product Name in the Build settings.
(0) Comments | Add Comment

DeleteFile failure on long paths.
Date: 8/3/2012
Tags: win32api
Symptom: DeleteFile fails with ERROR_PATH_NOT_FOUND (3) when passed a path with a length greater than 260 characters.

This manifested for me when I copied a Windows XP home folder to a backup drive. The "Temporary Internet File" folder contains a lot of files with very long names. When you put those in a sub-folder with a long name, the total path length of those files tips over the 260 character limit. At that point Windows Explorer just fails to do anything useful on those files. In my case I just want to delete them. So I was poking around with i.File in an attempt to work out why these files can't be deleted. Turns out DeleteFile simply fails with super long paths.

The way around this is to share the drive with the long paths on it. Then map a drive to a deep sub-folder to reduce the file's path length to under 260 characters. THEN delete it using traditional methods.
(0) Comments | Add Comment

Mac OS X Software Update fails to update installed application.
Date: 20/2/2012
Tags: macosx
I've just managed to "fix" an issue that I was seeing on 10.6 where Software Update would not update Logic Express. According to Software Update, Logic wasn't even installed, however the app was there in /Applications and would run fine.

It seems that getting Software Update to re-scan that app is as simple as renaming the app. I changed the name of Logic Express from "Logic Express 9.0.1" to just "Logic Express", ran Software Update again and the latest release for Logic magically appeared. Hmmm.

So the next time Software Update is ignoring your installed apps you know what to do!
(0) Comments | Add Comment

iconv v1.9.1 win32/win64
Date: 12/11/2011
Tags: iconv
I've posted a source and binaries zip of iconv for win32 and win64 on the Libraries page.
(0) Comments | Add Comment

Axefx Foot Controller
Date: 21/6/2011
Tags: axefx
After some months of work I've finally got my Axefx foot controller kit up for sale. I've updated the index page to have both software and hardware sections... because apparently I do hardware too now :)
(0) Comments | Add Comment