views:

240

answers:

3

Any ideas or working solutions for achieving polyphonic audio in Silverlight?

It is possible to play individual notes using sound files (e.g. wmv), but holding samples of every combination of the 3, 4, 5 or more note combinations in a chord based on any one of twelve root notes is unworkable. In WinForms I can use APIs to access the soundcard or MIDI device and generate the notes and their durations to play simultaneously.

How close can I get to this in Silverlight?

A: 

It is possible that you can do this with Silverlight 3. The ability to specify a MediaStreamSource will allow you to perform your own mixing of source files.

There is however no access at all to a MIDI device from Silverlight, either for input or output, so the input would need to come from mouse/keyboard and you would need to play and mix the samples yourself.

Mark Heath
Thanks - I knew there was no API access - I will take a look at the MediaStreamSource class to see if I can blend individual note samples.
Gordon Mackie JoanMiro
+3  A: 

Charles Petzold blogged about A Simple Electronic-Music Sequencer for Silverlight 3 just the other day - he has posted a Silverlight 3 example and source code.

HTH

CraigD
Thanks - it looks interesting - I will need to look at the code to see if it can be changed to work polyphonically though...
Gordon Mackie JoanMiro
+2  A: 

Here's the Silverlight synthesizer I wrote back in January/February. I updated it for RTW and released the source. It may help you get on your way.

It uses MediaStreamSource to generate sounds in real-time.

Silverlight Synthesizer Source Code

Rather than use algorithms to create the waveforms, you could read in a sample file or files (wavetable) and use a lookup + skipping algorithm to get hte right frequencies.

Pete

Pete