Difference between revisions of "Didj MP3 Streaming"

From eLinux.org
Jump to: navigation, search
(Created page with '==Overview== This page describes how to play mp3 format audio streams and files on your Didj using madplay, a command-line mp3 player. ==Prerequisites== In this example we assum…')
 
(Building madplay)
 
(8 intermediate revisions by 3 users not shown)
Line 1: Line 1:
==Overview==
+
== Summary ==
 
This page describes how to play mp3 format audio streams and files on your Didj using madplay, a command-line mp3 player.
 
This page describes how to play mp3 format audio streams and files on your Didj using madplay, a command-line mp3 player.
  
 
==Prerequisites==
 
==Prerequisites==
In this example we assume you are using the buildcross-generated cross compiler environment http://elinux.org/Didj_Build_Environment and have properly set your environment variables for cross-compilation.
+
[[LeapFrog_Pollux_Platform:_Build_Environment| Set up the Build Environment]]
  
Download the latest sources for the following packages:
+
In order to stream a networked MP3 stream, first set up networking.
 +
* [[Didj_Enable_Networking| Enable Networking via USB Gadget]]
 +
* [[LeapFrog_Pollux_Platform:_Internet_Access| Internet Access from Device]]
  
madplay-0.15.2b.tar.gz  http://sourceforge.net/projects/mad/files/
 
  
libmad-0.15.1b.tar.gz  http://sourceforge.net/projects/mad/files/
+
== Software Needed ==
 +
[http://sourceforge.net/projects/mad/files/ madplay-0.15.2b.tar.gz]
  
libid3tag-0.15.1b.tar.gz  http://sourceforge.net/projects/mad/files/
+
[http://sourceforge.net/projects/mad/files/ libmad-0.15.1b.tar.gz]
  
zlib-1.2.5.tar.gz http://www.zlib.net/
+
[http://sourceforge.net/projects/mad/files/ libid3tag-0.15.1b.tar.gz]
  
==Building madplay==
+
[http://www.zlib.net/ zlib-1.2.5.tar.gz]
Create a folder called madplay_build and then extract these archives into folders in madplay_build.
+
  
Set the following variables:
+
 
<code>
+
== Building madplay ==
 +
Create a folder called madplay_build and then extract the abovementioned archives into folders in madplay_build.
 +
 
 +
In addition to setting your build environment variables, you need to set these variables also.
 
  export CC=arm-linux-uclibcgnueabi-gcc
 
  export CC=arm-linux-uclibcgnueabi-gcc
 
  export CXX=arm-linux-uclibcgnueabi-gcc
 
  export CXX=arm-linux-uclibcgnueabi-gcc
 
  export CPPFLAGS='-I/full/path/to/madplay_build/libmad-0.15.1b -I/full/path/to/madplay_build/libid3tag-0.15.1b -I/full/path/to/madplay_build/zlib-1.2.5'
 
  export CPPFLAGS='-I/full/path/to/madplay_build/libmad-0.15.1b -I/full/path/to/madplay_build/libid3tag-0.15.1b -I/full/path/to/madplay_build/zlib-1.2.5'
 
  export LDFLAGS='-L/full/path/to/madplay_build/libmad-0.15.1b -L/full/path/to/madplay_build/libid3tag-0.15.1b -L/full/path/to/madplay_build/zlib-1.2.5'
 
  export LDFLAGS='-L/full/path/to/madplay_build/libmad-0.15.1b -L/full/path/to/madplay_build/libid3tag-0.15.1b -L/full/path/to/madplay_build/zlib-1.2.5'
</code>
+
 
  
  
Line 30: Line 34:
  
 
Enter the directory zlib-1.2.5 and run:
 
Enter the directory zlib-1.2.5 and run:
 
+
  $ ./configure
<code>
+
  configure
+
</code>
+
 
then run
 
then run
 
<code>
 
 
  make
 
  make
</code>
 
  
  
Line 44: Line 42:
  
 
Enter the directory libid3tag-0.15.1b and type
 
Enter the directory libid3tag-0.15.1b and type
<code>
+
  $ ./configure --host=arm
  configure --host=arm
+
</code>
+
  
 
then type
 
then type
<code>
+
  $ make
  make
+
</code>
+
  
 
after which, type
 
after which, type
<code>
+
  $ cp .libs/libid3tag.a .  
  cp .libs/libid3tag.a .  
+
</code>
+
 
(note the trailing dot)
 
(note the trailing dot)
  
Line 62: Line 54:
 
'''Build libmad'''
 
'''Build libmad'''
  
Enter the directory libmad-0.15.1b and type
+
Enter the directory libmad-0.15.1b  
<code>
+
''Note: Edit 'configure', removing '-fforce-mem' from the CFLAGS directive with the following command.''
  configure --host=arm
+
$ sed -i -e '/fforce-mem/d' configure
</code>
+
 
 +
and then type
 +
  $ ./configure --host=arm
  
''Note: Edit the Makefile, removing '-fforce-mem' from the CFLAGS directive.''
 
  
 
then type
 
then type
<code>
+
  $ make
  make
+
</code>
+
 
+
 
after which, type
 
after which, type
<code>
+
  $ cp .libs/libmad.a .  
  cp .libs/libmad.a .  
+
</code>
+
 
(note the trailing dot)
 
(note the trailing dot)
  
Line 84: Line 72:
  
 
Enter the directory madplay-0.15.2b and type
 
Enter the directory madplay-0.15.2b and type
<code>
+
  $ ./configure --host=arm
  configure --host=arm
+
</code>
+
 
+
 
then type
 
then type
<code>
+
  $ make
  make
+
</code>
+
  
 
Finally, strip the madplay file as follows:
 
Finally, strip the madplay file as follows:
 
+
  $ arm-linux-uclibcgnueabi-strip madplay
<code>
+
  arm-linux-uclibcgnueabi-strip madplay
+
</code>
+
  
  
Line 105: Line 85:
  
 
Make sure the lightning application is stopped.
 
Make sure the lightning application is stopped.
On the Didj:
 
<code>
 
/etc/init.d/lightning stop
 
</code>
 
  
 +
'' On Didj ''
 +
$ /etc/init.d/lightning stop
  
 
==Playing MP3s==
 
==Playing MP3s==
Line 115: Line 93:
 
To execute madplay,  
 
To execute madplay,  
 
On the Didj:
 
On the Didj:
<code>
+
  # madplay yourfile.mp3
  madplay yourfile.mp3
+
</code>
+
  
 
==Streaming MP3s==
 
==Streaming MP3s==
 
In order to stream a networked MP3 stream, first set up networking. (You can using the information in http://elinux.org/Didj_Networking_HOWTO and http://elinux.org/Route_Your_Didj to set up networking and routing)
 
  
 
To stream audio,  wget a stream (the example is NPR news), while piping the stream through madplay:
 
To stream audio,  wget a stream (the example is NPR news), while piping the stream through madplay:
 
+
  # wget -O - http://npr.ic.llnwd.net/stream/npr_live24 | ./madplay -  
<code>
+
  wget -O - http://npr.ic.llnwd.net/stream/npr_live24 | ./madplay -  
+
</code>
+
 
Note that .pls files are not supported in madplay. (but you can open them with a text editor to get the URL)
 
Note that .pls files are not supported in madplay. (but you can open them with a text editor to get the URL)
  
Line 134: Line 105:
 
==References==
 
==References==
 
http://www.mneuroth.de/privat/zaurus/madplay.html
 
http://www.mneuroth.de/privat/zaurus/madplay.html
 +
 +
[[Category:Didj]]
 +
[[Category:LeapFrog Pollux Platform]]

Latest revision as of 16:52, 14 July 2011

Summary

This page describes how to play mp3 format audio streams and files on your Didj using madplay, a command-line mp3 player.

Prerequisites

Set up the Build Environment

In order to stream a networked MP3 stream, first set up networking.


Software Needed

madplay-0.15.2b.tar.gz

libmad-0.15.1b.tar.gz

libid3tag-0.15.1b.tar.gz

zlib-1.2.5.tar.gz


Building madplay

Create a folder called madplay_build and then extract the abovementioned archives into folders in madplay_build.

In addition to setting your build environment variables, you need to set these variables also.

export CC=arm-linux-uclibcgnueabi-gcc
export CXX=arm-linux-uclibcgnueabi-gcc
export CPPFLAGS='-I/full/path/to/madplay_build/libmad-0.15.1b -I/full/path/to/madplay_build/libid3tag-0.15.1b -I/full/path/to/madplay_build/zlib-1.2.5'
export LDFLAGS='-L/full/path/to/madplay_build/libmad-0.15.1b -L/full/path/to/madplay_build/libid3tag-0.15.1b -L/full/path/to/madplay_build/zlib-1.2.5'


Build zlib

Enter the directory zlib-1.2.5 and run:

$ ./configure 

then run

make


Build libid3tag

Enter the directory libid3tag-0.15.1b and type

$ ./configure --host=arm

then type

$ make

after which, type

$ cp .libs/libid3tag.a . 

(note the trailing dot)


Build libmad

Enter the directory libmad-0.15.1b Note: Edit 'configure', removing '-fforce-mem' from the CFLAGS directive with the following command.

$ sed -i -e '/fforce-mem/d' configure

and then type

$ ./configure --host=arm


then type

$ make

after which, type

$ cp .libs/libmad.a . 

(note the trailing dot)


Build madplay

Enter the directory madplay-0.15.2b and type

$ ./configure --host=arm

then type

$ make

Finally, strip the madplay file as follows:

$ arm-linux-uclibcgnueabi-strip madplay


Install madplay

Transfer the file, plus one or more MP3s of your choosing, to your Didj.

Make sure the lightning application is stopped.

On Didj

$ /etc/init.d/lightning stop

Playing MP3s

To execute madplay, On the Didj:

# madplay yourfile.mp3

Streaming MP3s

To stream audio, wget a stream (the example is NPR news), while piping the stream through madplay:

# wget -O - http://npr.ic.llnwd.net/stream/npr_live24 | ./madplay - 

Note that .pls files are not supported in madplay. (but you can open them with a text editor to get the URL)

Enjoy the sound!

References

http://www.mneuroth.de/privat/zaurus/madplay.html