Using CSharpSynth/Midi in windows phone

Mar 3, 2013 at 10:21 PM

Im recording audio from microphone in windows phone, and I would like to know if is possible save data from MemoryStream object like MIDI file with SynthProject ....

Tnks !!!!
Mar 5, 2013 at 4:28 PM
Edited Mar 5, 2013 at 4:36 PM
If you are asking about saving the output of the synthesizer object then yes this is possible.
The current source supports both reading and writing of basic pcm wave files.
These classes are located in the Wave namespace, but I am not 100% on their ability to work cross-platform.

Here is some code to do this with the current source release.
//create a synth, sequencer, and buffer
Synthesizer synth = new Synthesizer(44100, 2);
MidiFileSequencer mfseq = new MidiFileSequencer(synth);
byte[] buffer = new byte[synth.RawBufferSize];

//load a bank and a midi
synth.LoadBank("-Insert Bank File Here-"); //Load the bank file
mfseq.LoadMidi(new MidiFile("-Insert Midi File Here-")); //Load a midi

//create the wave writer and start the sequencer
WaveFileWriter wfw = new WaveFileWriter(synth.SampleRate, synth.Channels, 16, "-Wave File Name Here-");        

//main process loop stops when midi ends
while (mfseq.isPlaying)
wfw.Close(); //Do not forget to do this!
If this is not what you meant let me know.
Mar 5, 2013 at 6:09 PM

I will try to see what happend ... Tnks !!!