RogueMP3 Arduino Library

Rogue Robotics MP3 Playback Module Interface Library Usage

DOWNLOAD: http://code.google.com/p/rogue-code/downloads/list?q=library+roguemp3

NOTE: You will need to make some small changes to the Arduino serial libraries to use this library.

This Library has been provided to ease the communications with the Rogue Robotics MP3 Playback Modules:

The MP3 Playback modules can communicate through standard TTL serial at speeds from 2400 bps up to 460800 bps. SD or SDHC cards are accepted and can be formatted in FAT12, FAT16 or FAT32. MicroSD and MiniSD cards can be used with an appropriate adapter.

Data can be stored on or retrieved from cards using a card reader on a computer.

Compatibility with Arduino 1.0+

The current version 003 has some issues with the 1.0+ version of Arduino programming environment. There is an unofficial work around by changing the RogueMP3 files that should allow your projects to build and upload. The following procedure is reported by several people to work but may have issues and thus should be used with caution. This has been tested with 1.0.1 but should work for all 1.0+ versions.

After downloading the Arduino-Library-RogueMP3-V0003.zip, unzip it and modify the following files before adding it to your Arduino installation.

In the file RogueMP3.h change line 155:

   void write(uint8_t);  // needed for Print

to

   size_t write(uint8_t);  // needed for Print
   

In the file RogueMP3.cpp change line 518:

   void RogueMP3::write(uint8_t c)

to

   size_t RogueMP3::write(uint8_t c)

The reason for this is the Arduino folks changed the write function from no return value to return a number of characters written.

uMP3 firmware

The library will work with earlier versions of firmware for the uMP3 (≤ 110.12), but performance will be better with later firmware. Information on updating module firmware can be found here:

Instantiation

// Example for connecting to a Rogue Robotics uMP3.
// Arduino pin 4 is connected to the uMP3's "T" pin
//         pin 5 is connected to the uMP3's "R" pin
#include <NewSoftSerial.h>
#include <RogueMP3.h>
 
NewSoftSerial ump3_serial(4, 5);
 
RogueMP3 ump3(ump3_serial);
 
void setup()
{
  ump3_serial.begin(9600);
 
  ump3.sync();
}

Datatypes/Structures

  • playbackinfo - A struct which contains playback information.
    • struct playbackinfo {
                            uint16_t position;
                            uint8_t samplerate;
                            uint16_t bitrate;
                            char channels;
                          };

Properties

  • LastErrorCode - If an error occurred in a previous method, this will contain the most recent error code.

Methods

  • sync() - synchronizes communications with the module.
  • changesetting(char setting, unsigned int value) - changes a setting.
  • unsigned int getsetting(char setting) - gets a setting.
  • int version() - gets the version of the module firmware.
  • byte getmoduletype() - returns the module type (uMMC = 1, uMP3 = 2, rMP3 = 3).
  • playfile(char *filename) - plays a file.
  • playfile_P(prog_char *filename) - plays a file (string is in PROGMEM).
  • unsigned int getvolume() - gets the current volume.
  • setvolume(byte newvolume) - sets the volume (both left and right to same value).
  • setvolume(byte leftvolume, byte rightvolume) - sets the volume for each channel.
  • setloop(byte loopcount) - sets the individual play loop count.
  • jump(unsigned int newtime) - jumps to a new time in the file (newtime is in seconds).
    • NOTE: only works on CBR MP3 files. Unpredictable results on VBR or non-MP3 files.
  • setboost(…) - sets the audio boost enhancement.
  • fade(byte newvolume, unsigned int fadems) - fades the volume to newvolume, over fadems milliseconds.
  • fade_lr(byte leftvolume, byte rightvolume, unsigned int fadems) - fades the given volume over fadems milliseconds.
  • playpause() - plays (if paused) or pauses playback.
  • stop() - stops playback.
  • playbackinfo getplaybackinfo() - gets the current playback info.
  • char getplaybackstatus() - gets the current playback status: 'P' = playing, 'D' = paused, 'S' = stopped.
  • Bookmark at
  • Bookmark "RogueMP3 Arduino Library" at del.icio.us
  • Bookmark "RogueMP3 Arduino Library" at Digg
  • Bookmark "RogueMP3 Arduino Library" at Google
  • Bookmark "RogueMP3 Arduino Library" at StumbleUpon
  • Bookmark "RogueMP3 Arduino Library" at Technorati
  • Bookmark "RogueMP3 Arduino Library" at Facebook
  • Bookmark "RogueMP3 Arduino Library" at Twitter
  • Bookmark "RogueMP3 Arduino Library" at Slashdot
  • Bookmark "RogueMP3 Arduino Library" at Yahoo! Bookmarks
  • Bookmark "RogueMP3 Arduino Library" at Furl
  • Bookmark "RogueMP3 Arduino Library" at Reddit
  • Bookmark "RogueMP3 Arduino Library" at Ask
  • Bookmark "RogueMP3 Arduino Library" at BlinkList
  • Bookmark "RogueMP3 Arduino Library" at blogmarks
  • Bookmark "RogueMP3 Arduino Library" at Ma.gnolia
  • Bookmark "RogueMP3 Arduino Library" at Netscape
  • Bookmark "RogueMP3 Arduino Library" at ppnow
  • Bookmark "RogueMP3 Arduino Library" at Rojo
  • Bookmark "RogueMP3 Arduino Library" at Shadows
  • Bookmark "RogueMP3 Arduino Library" at Simpy
  • Bookmark "RogueMP3 Arduino Library" at Socializer
  • Bookmark "RogueMP3 Arduino Library" at Spurl
  • Bookmark "RogueMP3 Arduino Library" at Tailrank
  • Bookmark "RogueMP3 Arduino Library" at Live Bookmarks
  • Bookmark "RogueMP3 Arduino Library" at Wists
  • Bookmark "RogueMP3 Arduino Library" at Yahoo! Myweb
  • Bookmark "RogueMP3 Arduino Library" at BobrDobr
  • Bookmark "RogueMP3 Arduino Library" at Memori
  • Bookmark "RogueMP3 Arduino Library" at Faves
  • Bookmark "RogueMP3 Arduino Library" at Favorites
  • Bookmark "RogueMP3 Arduino Library" at Newsvine
  • Bookmark "RogueMP3 Arduino Library" at myAOL
  • Bookmark "RogueMP3 Arduino Library" at Fark
  • Bookmark "RogueMP3 Arduino Library" at RawSugar
  • Bookmark "RogueMP3 Arduino Library" at LinkaGoGo
  • Bookmark "RogueMP3 Arduino Library" at Mister Wong
  • Bookmark "RogueMP3 Arduino Library" at Wink
  • Bookmark "RogueMP3 Arduino Library" at BackFlip
  • Bookmark "RogueMP3 Arduino Library" at Diigo
  • Bookmark "RogueMP3 Arduino Library" at Segnalo
  • Bookmark "RogueMP3 Arduino Library" at Netvouz
  • Bookmark "RogueMP3 Arduino Library" at DropJack
  • Bookmark "RogueMP3 Arduino Library" at Feed Me Links
  • Bookmark "RogueMP3 Arduino Library" at funP
  • Bookmark "RogueMP3 Arduino Library" at HEMiDEMi
code/library/arduino/roguemp3.txt · Last modified: 2012/12/31 14:13 by tekmage
Valid CSS Recent changes RSS feed Valid XHTML 1.0