music player code example (original) (raw)


music

| OSdata.com: programming text book | | OSdata.com | | ------------------------------------------------------------------------------------------- | | ---------- |

summary

There are two versions of source code for a music player. The simple player is for beginners and the full player is for experienced programmers.

Simple player: This is a very stripped down player intended to provide instruction and ideas for those who are learning how to program. See the material on simple player.

Full player: This is the full music player source code for experienced programmers. See the material on full player.

This is an example program for teaching computer programming. The example is a free music player, completely legal, that does not have any subscription fees, download costs, or advertisements.

I am posting heavily commented and described open source code for a free music player. A working example (started in February 2012 and having already served more than 12-million music videos) is at www.thissideofsanity.com/musicbox/musicbox.php. This source code is free for any legal non-commercial and/or non-profit and/or educational and/or private purpose. For those who need such a thing, the Apache 2.0 license material is just below.

I have the player running using videos from YouTube and Vimeo, as well as MP3s. The MP3s used are from my band, so I own the copyright. The YouTube and Vimeo materials all strictly follow their respective Terms of Service and allow legal access to real music videos (the heavy lifting on checking copyright validity is done by YouTube, Vimeo, and Vevo).

In addition to posting the raw source code, I am providing step by step instructions, isolating key points for easier undertstanding. Some readers will want to work through the examples for the purpose of learning how to program, while other readers are experienced developers who want to quickly grasp the essence of the techniques and apply the material to working websites. And I hope that some readers will want to help improve this source code.

the value of open source participation

While there is a lot of source code in this example, the real value over the long term is a collection of music and information about music that the general public can share. The large international corporations pay for a work force. The open source community can achieve higher quality through large numbers of social humans.

Bands can share their music with fans and potential fans.

Artists can share their graphics.

Musicians can share the works of their friends and influences.

Listeners can share their favorite music.

Serious fans can create music players for specific genres. This is particularly useful because the biggest two problems with YouTube music videos are (1) finding the best of several options and (2) replacing videos removed for copyright violations.

  1. simple music player code example
  2. adding music
  3. local server
  4. setting start time
  5. music data base
  6. number of songs
  7. song information
  8. actual music player
  9. preprocess

license

This is example code from This Side of Sanity, released under Apache License 2.0.

Copyright 2012, 2013, 2014 Milo

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

simple player

This is an example program for teaching computer programming. The example is a free music player, completely legal, that does not have any subscription fees, download costs, or advertisements.

As a working example for the still unfinished college text book on computer programming (table of contents), I am posting heavily commented and described open source code for a free music player. A working example (started in February 2012 and having already served more than twelve million music videos) is at www.thissideofsanity.com/musicbox/musicbox.php. This source code is free for any legal non-commercial and/or non-profit and/or educational and/or private purpose.For those who need such a thing, the Apache 2.0 license material is above.

If you don’t have access to a remote web server (at school or under your own account), you can install a working Apache web server, MySQL data base, and PHP scripting language and run this entire programming project from your local computer in your favorite web browser. There are free programs that pre-load these items for you for Macintosh at MAMP and Windows at WAMP. See local server.

The project starts with a very simple music player code example (simplified from my first experiments in this area).

I do provide resources for you to run the music player from your own computer.

  1. simple music player code example
  2. adding music
  3. local server
  4. setting start time
  5. music data base
  6. number of songs
  7. song information
  8. actual music player
  9. preprocess

See also song list.

full (advanced) player

I will be posting the complete source code for the full music player. This will include explanation aimed at experienced programmers.

contact

comments, suggestions, corrections, criticisms

UNIX used as a generic term unless specifically used as a trademark (such as in the phrase “UNIX certified”). UNIX is a registered trademark in the United States and other countries, licensed exclusively through X/Open Company Ltd.