I have just started using the Music Module and have realised that the Play() method wants a byte array but I would like to play a file larger than the 4.5mb flash memory on the Spider. When I try and play my file I get a System.OutOfMemoryException (I can’t remember the exact exception name but it’s to that effect).
I am playing the sound files from an SD Card using the SD module which can return a System.IO.FileStream object to the file, but the music module doesn’t seem to be able to take a FileStream object as input.
Is there any way around this? Or any plans for writing a way to play a FileStream rather than a byte dump? Or will I just have to work with smaller sound files?
On a seperate note, I was just looking at the RecordOggVorbis() function for audio in and was wondering how we use this function? I don’t really understand what the parameters are asking for.
It’s up to GHI if they want to put my code in the official driver. I don’t think a semi-beginner like me is in the position to decide on that.
I did have stuttering with some 192kbps MP3’s, but not all the time. A 128kbps MP3 played fine. I also managed to play a 128kbps MP3 stream from internet for more than 5 hours without interruption.
The code I used is far from completion and probably has more bugs than lines of code. :-[ I put the streaming project to the side untill I have more experience with .NETMF.
What I did was create a new thread that reads chunks of data from the ResponseStream and writes it to a MemoryStream. I then send the MemoryStream to the music module.
You are too modest, Mischa. The driver is fine for the SD Card, and it makes it possible to use a Stream from Internet. My low-bandwidth usage online is far better than not being able to load files larger than 600k.
If you don’t mind, I’ll write this up as an example on my blog with all the steps to using your driver with Stream parameter of Play method.
It is not streaming audio per se, but it is using a Stream object, which makes it feasible to play files larger than the memory of the mainboard. This file cannot be played by downloading it to byte[] array,
This modified driver is great but I have some problems using it with the micro framework 4.2
I expirience enormous stottering with 128kbps files from the very first second.
Does anyone else have this problem and does anyone know what to do against it?
@ Andre, thanks this looks promising.
But as far as I can see it’s just for the Panda II board and as I said before I’m using the Spider 1.
I don’t know if njbuch is capable and willing to port the project to the spider…
I’m pretty sure managed code is the reason for the stottering.
The funny thing is: With the .net mf 4.1 it was working (using the modified driver from Mischa).
I really don’t know if I’m able to help njbunch, 'cause I’m not used to write native c/c++ code…