SD card MOD S3M soundtrack player on PIC32

Show off your projects to others!
serveurperso
Posts: 36
Joined: Tue Sep 13, 2011 5:55 am
Location: Paris
Contact:

Re: Amiga MOD soundtrack file player on PIC32

Post by serveurperso » Thu Dec 01, 2011 8:17 am

fulvio wrote:What kind of information/data can be extracted from the MOD to be displayed via an LCD?
Download the last version, now you have a sound buffer, inside loop you can add your own refreshLCD(); :

void loop() {
fillSoundBuffer();

// You have SAMPLERATE / SOUNDBUFFERSIZE time for any custom code.

}

You can use (My English is Too poor to include in the code) :

Mod.name[20] // Raw 20 bytes from .MOD name
Mod.numberOfchannels // Usually 4

Mod.length; // Number of pattern order in the song.
Mod.numberOfPatterns; // Number of physical (different) pattern.

Player.orderIndex // Current pattern order (0 to Mod.length)
Player.row // Current row (0 to 63)

Player.tick // Player.speed tick per Player.row (default speed is 6 like protracker) is the smallest unit of time of the MOD for inter rows effects.

Mod.order[Player.orderIndex] // Current physical pattern number...

All player logic is inside player() { ... } it is also possible and more accurate to control the LCD from here. To refresh just the information that changes, it's probably what I would do later. before I must read from SDCard

Pascal
(French user) English is not my native language, please forgive my mistakes.

fulvio
Posts: 19
Joined: Tue Nov 29, 2011 5:16 am

Re: Amiga MOD soundtrack file player on PIC32

Post by fulvio » Thu Dec 01, 2011 9:22 am

serveurperso wrote:Can you re download the last version ? I tested It work with Mpide 0022 20110822

(Or reduce MAXCHANNELS to 16 on older version)

Pascal
I'm using the latest version already of the IDE. I have an UNO32 but when I select Max32 from the Board menu it uploads just fine.

Haven't tried changing MAXCHANNELS to 16. I will try and let you know how it goes. Also what PWM output do I use for the headphones?

GND and ?

Also about displaying track information to an LCD. Would this be possible?

Something like this would be amazing:

http://www.youtube.com/watch?v=8WtwkGZn ... ata_player

fulvio
Posts: 19
Joined: Tue Nov 29, 2011 5:16 am

Re: Amiga MOD soundtrack file player on PIC32

Post by fulvio » Thu Dec 01, 2011 12:08 pm

Got it working on my Macbook just fine using the latest MPIDE. No compile errors with Board: chipKIT UNO32 and header file: "trabalash.MOD.h".

Except, I can't actually hear the MOD playing because I'm not sure where to connect my headphone jack.

Do I connect it to PWM 13 (positive) and G (negative)? It doesn't work when I do that.

Not sure how to actually listen to the song! :oops:

serveurperso
Posts: 36
Joined: Tue Sep 13, 2011 5:55 am
Location: Paris
Contact:

Re: Amiga MOD soundtrack file player on PIC32

Post by serveurperso » Thu Dec 01, 2011 1:02 pm

Hi, new version of my player, please re download the entire ZIP archive (sorry). -> it display all MOD playing information inside the basic MPIDE terminal/debug window.

Plug your headphone on GND + PIN 3(left) + PIN 5 (right)

Pin3 is OC1
Pin5 is OC2
(French user) English is not my native language, please forgive my mistakes.

fulvio
Posts: 19
Joined: Tue Nov 29, 2011 5:16 am

Re: Amiga MOD soundtrack file player on PIC32

Post by fulvio » Thu Dec 01, 2011 1:02 pm

Okay, got it working.

I had to add the following for my chipKIT UN032 to work:

Code: Select all

setup() {
   Serial.begin(57600);
   ...
}
I then hooked up a Stereo 3.5mm headphone jack to GND and PWM 3 (left) and PWM 5 (right).

fulvio
Posts: 19
Joined: Tue Nov 29, 2011 5:16 am

Re: Amiga MOD soundtrack file player on PIC32

Post by fulvio » Thu Dec 01, 2011 1:05 pm

serveurperso wrote:Hi, new version of my player, please re download the entire ZIP archive (sorry). -> it display all MOD playing information inside the basic MPIDE terminal/debug window.

Plug your headphone on GND + PIN 3(left) + PIN 5 (right)

Pin3 is OC1
Pin5 is OC2
New version works beautifully on a UNO32. I'm waiting on my LCD to be delivered so I'll modify it to output to LCD and let you know how it goes. I'll take a video or two as well (if you don't beat me to it!) :)

fulvio
Posts: 19
Joined: Tue Nov 29, 2011 5:16 am

Re: Amiga MOD soundtrack file player on PIC32

Post by fulvio » Thu Dec 01, 2011 1:16 pm

Do you know of any BIN2H converters for Mac?

serveurperso
Posts: 36
Joined: Tue Sep 13, 2011 5:55 am
Location: Paris
Contact:

Re: Amiga MOD soundtrack file player on PIC32

Post by serveurperso » Thu Dec 01, 2011 1:44 pm

fulvio wrote:Do you know of any BIN2H converters for Mac?
Do you have a C compiler ? Or an online php version (i can code one) or find a perl version?
(French user) English is not my native language, please forgive my mistakes.

serveurperso
Posts: 36
Joined: Tue Sep 13, 2011 5:55 am
Location: Paris
Contact:

Re: Amiga MOD soundtrack file player on PIC32

Post by serveurperso » Thu Dec 01, 2011 5:14 pm

I coded one in php on my webserver :

http://www.serveurperso.com/temp/bin2array.php (source code inside my ZIP)

Upload your mod and cut-past array data.
(French user) English is not my native language, please forgive my mistakes.

fulvio
Posts: 19
Joined: Tue Nov 29, 2011 5:16 am

Re: Amiga MOD soundtrack file player on PIC32

Post by fulvio » Fri Dec 02, 2011 1:30 am

serveurperso wrote:I coded one in php on my webserver :

http://www.serveurperso.com/temp/bin2array.php (source code inside my ZIP)

Upload your mod and cut-past array data.
I wrote a ruby script that converts a binary file for use with your sketch.
Attachments
mod2h.zip
Converts a given MOD music (binary) file into a format that can be included into a C program as a header file.
(903 Bytes) Downloaded 119 times

Post Reply