Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

MP3 files help

  • 11-09-2007 5:21pm
    #1
    Registered Users, Registered Users 2 Posts: 12,379 ✭✭✭✭


    Hey, I created a topic about this a while ago, can't find it...

    Anyway, I was thinking of creating some sort of mp3/music player as my final year project, and i'm looking for a way of getting either Java or C# to play mp3 files.

    In my old thread people gave me a few libraries to try (BASE was one I can remember) but all the sites gave was the actual library file thing, no decent documentation. Some alright gave some sample code, but it was very in depth with little or no commenting.

    So what i'm wondering is if there is a definitive way of programming either java or c# to play mp3 files. I have to have a proposal in by Friday (the proposal part is easy, it'll only take half an hour to throw together) and if i'm to go with the music player i'd like to be able to play 1 song and get at the id tags (or at least know how to)

    Any help? Good websites or books??


Comments

  • Registered Users, Registered Users 2 Posts: 981 ✭✭✭fasty


    There's no one website that'll tell you everything you need to get things up and running.

    I dunno what the problem with BASS is, I downloaded it and googled a few tutorials and had MP3s playing back in no time.

    Another option is using FMOD, a very common and awesome audio library. I don't think it's got native .Net bindings but you can use the unmanaged dlls using DLLIMPORT in C#.

    No idea about Java I'm afraid, it's years since I've touched it.


  • Registered Users, Registered Users 2 Posts: 6,949 ✭✭✭SouperComputer


    perhaps the open-source softsqueeze which is a Java-Based MP3 playing client for slimserver can give you some pointers.

    It can be used in conjunction with the Java MP3 plugin.

    I'm not a programmer so I'm not sure if this is of much help!


  • Registered Users, Registered Users 2 Posts: 12,379 ✭✭✭✭dulpit


    fasty wrote:
    There's no one website that'll tell you everything you need to get things up and running.

    I dunno what the problem with BASS is, I downloaded it and googled a few tutorials and had MP3s playing back in no time.

    Another option is using FMOD, a very common and awesome audio library. I don't think it's got native .Net bindings but you can use the unmanaged dlls using DLLIMPORT in C#.

    No idea about Java I'm afraid, it's years since I've touched it.


    OK, so I found a decent blog by some dude with pretty concise step by step instructions on using BASS with C#, which seems to work...

    I don't have link (it's at home, i am not) but i'll post it later...


  • Registered Users, Registered Users 2 Posts: 981 ✭✭✭fasty


    Do you mean this blog? http://blog.stevemedley.net/?postid=9

    Found it on a Google search for BASS.net and C#

    I downloaded BASS.net last night to see if I could put together a tutorial for you but that came up on Google so I thought I'd link you to it!


  • Closed Accounts Posts: 669 ✭✭✭pid()


    If you wanted to be uber lazy you could just use the windows media player control in c#. :)


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 12,379 ✭✭✭✭dulpit


    fasty wrote:
    Do you mean this blog? http://blog.stevemedley.net/?postid=9

    Found it on a Google search for BASS.net and C#

    I downloaded BASS.net last night to see if I could put together a tutorial for you but that came up on Google so I thought I'd link you to it!


    That's the one... If only he'd continue on with it a small bit...

    I'd like to be able to know how to access the id tags of the various mp3s...


  • Registered Users, Registered Users 2 Posts: 11,989 ✭✭✭✭Giblet


    ID3 v1 tags are easy. Basically you can just use RandomAccessFile in java to check for the presence of the tag.
    public String scanFile(int byteStart, int length) throws IOException
    {			
    	String field="";		
    	File f = new File(this.getFile());		
    	raf = new RandomAccessFile(f, "r");	 
    	byte [] tagBytes = new byte[length];		
    	this.setTagStart(byteStart,f);
    	raf.read(tagBytes,0,length);
    }
    
    
    Then have functions like this, which scans the file (starting from 127bytes from the end of the file, and checking the next 3 bytes). You could use the scanfile method to pull in other data as well.
    if(this.scanFile(0,3).equalsIgnoreCase("tag"))
    {
    	return true;
    }
    public void setTagStart(long byteStart, File fi) throws IOException
    {
    	raf.seek((fi.length()- 127) +byteStart);	
    }
    
    public String getId3Album() throws IOException
    {
    	return this.scanFile(63,30); //gets the albumname
    }
    

    If it doesn't exist, just mark the fields "unknown".
    I did this for my 2nd year project and it worked well.

    ID3v2 is a little harder, and you might want a library.


  • Registered Users, Registered Users 2 Posts: 12,379 ✭✭✭✭dulpit


    I was able to grab the tag details from a song, after asking over in the BASS forums...

    So looks like I have a project proposal :D


Advertisement