It is time for a new post!
Added SD Card, S3M and visualizer support see here link.
Recently I got myself a Stellaris Launchpad board by TI and thought what I could do with it.
I decided to create a simple MOD player with the bear minimum of extra parts and so here is the
result:
The details:
The code I've ported from a Microchip pic32 MIPS based MCU that was done here by SERVEURPERSO:
http://www.youtube.com/watch?v=i3Yl0TISQBE
Had to redo all the PWM/Timers/Buttons/File system and other stuff.
Learned a lot from the PWM tutorial for Stellaris here:
http://codeandlife.com/2012/10/30/stellaris-launchpad-pwm-tutorial/
The video recording was done using PC LINE IN and in stereo and because of that there is a faint whine in the background but the sound that comes directly from the board is much better.
The board supports only 4 channel MODs technically you can put a MOD with more channels but there is no memory allocated for them, so the results are unpredictable.
There is enough space on the device for 213Kb of MODs.
Right now the code is set to take up-to 6 MODS, you can change it if you want (as long as you keep below the 213Kb limit)
Because I did not have an SD card breakout board I had to load the files from somewhere
so I've created VFS (Virtual File System) which helped a lot during development, the files reside inside the
flash of the MCU.
It should be fairly easy to switch to FatFs since I've used the same prototype functions.
SD support will probably come in the future (when I get a SD breakout board)
Technical difficulties:
While porting this I've encountered several difficulties:
1. The amount of RAM on the pic32 device was 3 times what we had (96K vs our 32K)
had to shrink the buffers a lot, will see how it affects while reading from SD card.
2. PWM code completely different, had to understand both architectures and settings to rewrite
it correctly.
3. Timing for the sampler interrupt is CRITICAL even a small difference in invocation
would cause popping and beeping in sound.
4. Interrupt priorities, after adding the buttons handling (which are polled using the systick interrupt) I've noticed that the sound would be distorted, which I've concluded was due to the sampler interrupt not getting enough time to run or was itself was being interrupted, a code to set priorities to interrupts was added.
Hardware:
1 x Stellaris Launchpad
1 x Audio Jack
Schematics:
Take the audio jack connect the GND pin to the GND pin on the board J3.2
LEFT channel is J1.7 (PB4)
RIGHT channel is J2.7 (PB6)
Usage:
Right button next song
Left button previous song.
If connected to computer the serial terminal writes some info about the song that is playing.
File:
Attached is the whole project, source, binary and convert tool for mods.
Download project.
To use the convert tool: after extracting the project to Stellarisware directory.
NOTICE: My Stellarisware directory is called Stellarisware2 so some adjustments might be necessary in order to compile the sources, the project should be placed next to the other projects:
C:\StellarisWare2\boards\ek-lm4f120xl\modplayer
go into the tools directory copy all your wanted MODS to that dir and run "runconvert.bat"
To get more mods go to: http://modarchive.org/
Hope that helps anybody.
R.K.
Added SD Card, S3M and visualizer support see here link.
Recently I got myself a Stellaris Launchpad board by TI and thought what I could do with it.
I decided to create a simple MOD player with the bear minimum of extra parts and so here is the
result:
The details:
The code I've ported from a Microchip pic32 MIPS based MCU that was done here by SERVEURPERSO:
http://www.youtube.com/watch?v=i3Yl0TISQBE
Had to redo all the PWM/Timers/Buttons/File system and other stuff.
Learned a lot from the PWM tutorial for Stellaris here:
http://codeandlife.com/2012/10/30/stellaris-launchpad-pwm-tutorial/
The video recording was done using PC LINE IN and in stereo and because of that there is a faint whine in the background but the sound that comes directly from the board is much better.
The board supports only 4 channel MODs technically you can put a MOD with more channels but there is no memory allocated for them, so the results are unpredictable.
There is enough space on the device for 213Kb of MODs.
Right now the code is set to take up-to 6 MODS, you can change it if you want (as long as you keep below the 213Kb limit)
Because I did not have an SD card breakout board I had to load the files from somewhere
so I've created VFS (Virtual File System) which helped a lot during development, the files reside inside the
flash of the MCU.
It should be fairly easy to switch to FatFs since I've used the same prototype functions.
SD support will probably come in the future (when I get a SD breakout board)
Technical difficulties:
While porting this I've encountered several difficulties:
1. The amount of RAM on the pic32 device was 3 times what we had (96K vs our 32K)
had to shrink the buffers a lot, will see how it affects while reading from SD card.
2. PWM code completely different, had to understand both architectures and settings to rewrite
it correctly.
3. Timing for the sampler interrupt is CRITICAL even a small difference in invocation
would cause popping and beeping in sound.
4. Interrupt priorities, after adding the buttons handling (which are polled using the systick interrupt) I've noticed that the sound would be distorted, which I've concluded was due to the sampler interrupt not getting enough time to run or was itself was being interrupted, a code to set priorities to interrupts was added.
Hardware:
1 x Stellaris Launchpad
1 x Audio Jack
Schematics:
Take the audio jack connect the GND pin to the GND pin on the board J3.2
LEFT channel is J1.7 (PB4)
RIGHT channel is J2.7 (PB6)
Usage:
Right button next song
Left button previous song.
If connected to computer the serial terminal writes some info about the song that is playing.
File:
Attached is the whole project, source, binary and convert tool for mods.
Download project.
To use the convert tool: after extracting the project to Stellarisware directory.
NOTICE: My Stellarisware directory is called Stellarisware2 so some adjustments might be necessary in order to compile the sources, the project should be placed next to the other projects:
C:\StellarisWare2\boards\ek-lm4f120xl\modplayer
go into the tools directory copy all your wanted MODS to that dir and run "runconvert.bat"
To get more mods go to: http://modarchive.org/
Hope that helps anybody.
R.K.
Congrats, this is really an awesome project!
ReplyDeleteSome of your mods sound like FM synthesis.
They are called chiptunes (because they sound like commodore 64 SID chips) I've chosen them because of their small size.
DeleteCan I make an assumption that this will not work with the msp430 value line Launchpad?
ReplyDeleteTrevor, your assumption is correct.
DeleteThe stellaris launchpad is an ARM device
the msp430 is a 16-bit architecture that is much weaker.
Thanks! After watching this I want to get myself one of these now.... even though it took me the better part of a year to pull my msp launchpad out of the drawer to do something with it!
DeleteThanks for sharing this project, it was very cool!
I can confirm that this works; I have two Stellaris Launchpads and I just tested. Sound quality is great, but consider adding a filter cap from each PWM output to ground to reduce the high frequency from the PWM.
ReplyDeleteYou could use the MSP430 Launchpad breakout. I'm not sure how you would handle the dual row issue though.
ReplyDeletehttp://store.43oh.com/index.php?route=product/product&filter_name=sdcard&product_id=66
Thanks for the info, but I'm going to use just some chep
Delete1.6$ SD breakout board and a bunch of jumper cables.
Maybe make it backward compatible with this shield though.
Just got this working ... sounds great!
ReplyDeleteIf you installed the stellarisware to the default location like I did then you need to edit the .project and .cproject files and change all references to "stellarisware2" to "stellarisware" in a text editor before importing the project into your workspace.
Works great "as is", I have just uploaded .bin file in Launchpad. Can't wait for SD card support for unlimited music ^_^
ReplyDeleteNice!
ReplyDeleteChiptunes will never die.
Seems we will see the SD attachment in New 2013 Year, so Happy New Year to all of You.
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteHi, great work. I looking for mod player many years. Do you have any SD card support? Thanks.
ReplyDeletehere you go:
Deletehttp://mobile4dev.blogspot.co.il/2013/01/stellarplayer-mod-s3m-module-player.html
I want to play my own audio file, is it possible
ReplyDeletekindly help me ,
Just an audio file like a WAV ?
DeleteYou need to remove the code that handles decoding of the module files and read from memory the 16-bit values for each channel (left and right) put them in the sound buffers, and keep the code as it is, but you will have to do some modification in timing of the interrupt depending on the sample-rate of the WAV.
R.K.