Difference between revisions of "ECE497 Project Music Server"
|Line 129:||Line 129:|
== Conclusions ==
== Conclusions ==
Wish I could have done more with the hardware, like a lightshow tied to the audio or something. But it took a lot of time to learn the different languages/styles/formats I needed for the project. It was all high-
Wish I could have done more with the hardware, like a lightshow tied to the audio or something. But it took a lot of time to learn the different languages/styles/formats I needed for the project. It was all high-(mostly), but there's a bunch of little gotcha's that will trip you up if you're not careful. Probably would have helped if I had a partner to double-check my work.
Revision as of 18:44, 17 November 2013
Embedded Linux Class by Mark A. Yoder
This project focused on creating a music server hosted on the BeagleBone. The server contains a number of MP3 files which will be playable from the Beagle via either direct access or network access over ethernet/wireless. Currently (all from your web browser) you can upload and download songs, add to and subtract from the playlist, play your custom playlist over hdmi or headphone jack, adjust the output volume, load new media, etc.
We realize it's an odd choice to have a project that focuses solely on software, rather than a combination of that and hardware (ignoring the audio output). But when approaching the project, we wanted to build something that we would actually use afterwards, and not just relegate to the dust bin of history. I would happily say we succeeded.
What's in the repo
- Server files
- node module files
- Basically all files I created/used
What's NOT in the repo
- Any node module dependencies. If you receive any errors regarding the node modules, you will want to download and install NPM (NodeJS Package Manager) and reinstall whichever module is throwing the errors. This will also grab any dependencies it requires that you do not already have. If, when trying to reinstall, it won't let you download the module, this is most likely due to a conflict between NPM and your distro. You'll need to download the files on another distro, port them over, and use node-gyp (https://github.com/TooTallNate/node-gyp) to compile them locally, and install their dependencies manually. Have fun!
- NPM. It's a separate program that you may or may not need, depending on the above.
- NodeJS version 0.8.xx or higher. Again, you need to install this. May work with 0.6.12, hasn't been tested. I use the Express module, which supposedly required NodeJS 0.8 and higher, but who knows. I personally used the 0.9.9 (unstable) build for Debian. Ubuntu shouldn't have any issues.
- For USB audio, you'll need to edit a config file. Those details are below.
1) Go to https://github.com/Guiltygate/beaglebone-classwork and clone the umbreon folder somewhere on your laptop. NOTE:Does not work on Windows. Does not play nicely with IE. Should work with Firefox, Chrome, maybe Safari.
FOR USB-Audio and browser volume control 1a) If you want to use a USB-audio device, you need to set it to default. I used the guide here http://crunchbang.org/forums/viewtopic.php?id=9852 . Also make sure that you have alsamixer, as the sound controls in-browser use command-line arguments sent to amixer, a module of alsamixer. If you don't have alsamixer, you simply won't be able to adjust the volume from the browser.
2) You will need NodeJS, v.0.8.xx or higher, along with NPM. While I include the different node_modules in the git repo, installing them through NPM also installs their dependencies. If you run into issues with the distro not allowing module installation, use node-gyp here: https://github.com/TooTallNate/node-gyp .
3) Due to the whole 'unable-to-reflash-with-Angstrom' problem, I am unable to guarentee this will work on a standard BBB. However, I only use general linux architecture features, so feasibly as long as you can install Express 3.xx on Angstrom, it should be perfectly fine.
See the README for further detail, but here's the basics.
Run this command
if you wish to automatically mount your current usb drive. Server will start at 192.168.7.2:0121.
If you'd rather just start the server without auto-mounting, run
To play the current playlist (initializes to all .mp3 files in the top directory of your flash drive), hit the big arrow button. To view the current playlist/remove songs from it, hit the '-' button on the right. To view the entire directory of mp3 files and possible add them to the playlist, hit the '+' button on the left.
To swap out flash drives, physically switch them and hit the 'Load Media' button below. To stop the current playlist from playing, hit the 'Stop Playlist' button. WARNING:This doesn't always work now, but will add a second 'unload' button to properly unmount it. Should work then.
To download the current track, hit the 'Download' button at the bottom of the page. To upload, simply drag-and-drop the desired file.
- Previously, hitting the 'play' button while songs are already playing will cause a system crash. HOWEVER, this SHOULD be fixed. I haven't been able to replicate it since fixing it, at least.
- Previously, the load button stopped working for some reason and kept new media from being loaded. It had to do with pulling out the USB before unmounting it, so now users should press the 'eject' button before removing the flash drive, then plugging in the new media and pressing the 'load' button.
- Cannot skip songs backwards. The button is disabled, as I couldn't find a time-effective way of implementing this.
- Stopping and forward skipping 'works', but only if pressed in the first three seconds of a song beginning playback. The entire playlist will still stop (if pressing the 'stop' button), but not the current track.
- GUI font/style is ugly. Which is kind of a bug.
Theory of Operation
Using express framework in NodeJS. Enables user to upload songs for playing, download the currently playing song, view playlist, edit playlist, add songs from the directory, change media by swapping out usb drives, etc.
Everything was planned for maximum user convenience, as I plan on using this in my dorm room once I obtain a wireless router for the bone.
I would like to point out this wouldn't have taken so long if I hadn't had to learn NodeJS, Express, NPM, alsa, CSS, html, and all the little quirks associated with them. On top of my Beagle dying Sunday and refusing to reflash to Angstrom. Spent all day trying to reflash it, had to switch to Debian Wheezy and re-dowload all the software.
Server Features-------Eric------30hrs (minimum)
- Beginning with Express, NodeJS, NPM, als-arch, :: 18hrs (last Friday and Saturday. Sunday was spent praying and trying to fix the Beagle. Monday was spent swapping over to express.)
- Playlist viewing----20min
- Playlist editing----20min
- Radio-Stream--------6 hrs - partially included in the 'Beginning' section
- Basic GUI-----------1hr
- Enhanced GUI--------4hrs
- Song uploads--------6hrs
- Song downloads------1hr
Initial Planning and Discussion----------Both---------2hrs
Editing the Wiki/Writing Installation Guide---------Eric---------5hrs
1) Add wireless router for easy streaming, no ethernet cord hassle.
2) Fully implement the Stop and Skip buttons. Currently, they can't stop the audio stream currently outputting, only the rest of the playlist.
3) Add a 'reboot server' button, in case of server failure. Tying into this, the server needs to be able to start on boot- I lost the config files when my board self-destructed on Monday.
4) Due to not knowing CSS or html, the current GUI is a bit crap. I'd like to build a GUI I can actually be proud of, rather than the slap-a-dash affair I have now.
5) Song playback bar, graphically lets you know time remaining.
6) Button feedback. It's weird to select a song and having no feedback if it worked or not. Annoying.
7) The audio modules I use only process .mp3 files, so adding additional modules to process .ogg and other popular audio files would be something nice to add. I myself only have/use .mp3s, so no guarantee I'll do this.
Wish I could have done more with the hardware, like a lightshow tied to the audio or something. But it took a lot of time to learn the different languages/styles/formats I needed for the project. It was all high-level (mostly), but there's a bunch of little gotcha's that will trip you up if you're not careful. Probably would have helped if I had a partner to double-check my work.
As time-intensive as it was, what with other classes, I had a blast learning so much, and I'm looking forward to continuing to work on this over break and into the future. I also want to look into what other useful applications I could run on the bone with nodejs/express web-servers. Many, many possibilities...
Embedded Linux Class by Mark A. Yoder