Christmas Project – Part 2

Most of sound examples I have seen revolve around visualization of the sound wave.  The application architecture has 2 threads – thread #1 plays the music, thread #2 runs as a continual loop.  In that loop, the app polls the sound card’s buffer and reads inforamtion out of that buffer.  Based on that information, it updates the display.  None of the examples I have seen actaully describe that buffer in detail – what each value of the return array means, for example.  I hope to get a better understanding via the MSDN documentation.  Also, I wonder what the maximum speed the mechanical switch of the phiget can run – can it keep up with 8th notes Con Brio?  We soon shall see…
 
Advertisements

Christmas Project – Part 1

In 2007, I put together a basic Holiday light show based on a great article in Coding4Fun by Brain Peek.  For 2008, I wanted to extend concept by reading any sound file and having the circuits respond to ‘major events’ in the audio file – much like the Visualizer in Windows Media Player does.  
 
Step one of the project is to figure out how to capture the sounds with the correct data (frequency, volume, direction) that I can pass to the light switches.  I first looked at using WMP SDK but that does not allow you to access the actual sound waves. 
 
I then looked on Codeplex and there are a bunch of old articles (2003) using Managed DirectSound and .NET 1.1 that allow you to capture the waves and inspect their values.  Unfortunately, they did not explain some of the data strucutres well enough for my needs.  I wondered if there is a more recent SDK with examples from Microsoft that I can use. This  task is not  as easy as it sounds because of the number of SDKs they put out there, the fact that some say they support C# but don’t include any samples or documentation (can you really call that support?), and the fact that some of their samples just don’t work.  Here is a list of the DirectX SDKs:
August 2008 – Only C++ and the samples  don’t work out of the box (missing ‘xaudio2.h’)
June 2008 – Only C++ samples – at least the samples work
March 2008 – Only C++ samples – this is getting annoying
November 2007 – Pre-release of XAudio2.  Only C++ examples
August 2007 – Pre-release of XAudio2.  Eurika!  Managed Samples (though only for .NET 1.1)
June 2007 –
April 2007 –
August 2006 –
 
So it looks like no .NET 2.0+ samples for Managed Code.  I wonder how long until MSFT gives an update.