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

(Java) Sound Analysis?

Options
  • 11-12-2009 10:34pm
    #1
    Registered Users Posts: 428 ✭✭


    Hi, I'm a third year student doing computer science in UCD and have been thinking about what I would like to do for my final year project. I got the idea of a sound analyser that would take a MIDI file and convert it to sheet music, or even ABC notation.

    I'm just wondering if its possible to make this program in a reasonable time frame or if im being overly optimistic, also, any tips on making this type of program would be greatly appreciated.

    EDIT: The programming languages I am using at the moment are Java and C++, I would prefer to use java but if there is any reason why you think C++ should be used instead, please let me know


Comments

  • Registered Users Posts: 9,579 ✭✭✭Webmonkey


    I don't think you need to do sound analysis. (Can be quite complicated getting into lots of electronic engineering maths with wave analysis/filtering etc...)

    Instead... the midi file format is a standard that you can obtain if you search on internet. Then you can parse the header and get more information about the file as you go through it recording the instruments and notes and time lengths...

    I don't know anything about music though so I could be wrong.


  • Registered Users Posts: 267 ✭✭Tears in Rain


    Are you sure MIDI is what you mean? A MIDI file contains control data for a synthesiser, essentially a sequence of notes, including pitch and volume data. Constructing sheet music from that would not be especially hard, and probably not the standard required for a final year project.

    Because you say sound analysis, I assume you instead refer to audio data, e.g. a WAV file, that contains a time sequence of frequencies. Constructing sheet music from this is a far more interesting task. I have no experience in this area so I don't know how realistic it is to write a program that would extract the sheet music from a pop song in the time you have available, however, for a simple input file of your own construction you should have no difficulty extracting notes from it.

    Are you familiar with the Discrete Fourier Transform? This converts discrete data in the time domain to the frequency domain, the crux of what you would be trying to do. Implementing the bones of this shouldn't take long.

    Do you have any experience in DSP (Digital Signal Processing) already?

    My advice to you would be spend some time this weekend writing a program that implements the DFT algorithm, run it over some simple data and see if you can understand the results. Understand how this would apply to extracting pitch data from audio. Consider what the difficulties are in achieving what might be the ultimate goal for your project, creating sheet music from a real song. (The different tracks, harmonics, noise, drums, etc.). If you understand what the problems are, you're half way there to solving them.

    The beauty of a project like this is that you can start off simply and build progressively, and assuming you work steadily, you will almost certainly have some reasonable end result. However how impressive this result is depends on you, and how good a programmer you are, and this is something only you can assess.

    Final note: Why did you choose Java? Is it because it is the only language you know well enough to write a large program in? If so, then perhaps the best thing to do would be to stick with it, but bear in mind, while Java is very easy to program in, the more mathematical your software is (and there is plenty of mathematics in DSP), the more cumbersome Java becomes, and the slower progress is.


  • Registered Users Posts: 428 ✭✭Joneser


    Thanks for the quick reply. As for the source data, I would ideally like to be able to give my program an audio file such as a WAV file as you mentioned, but thought that if i began with a MIDI file it would be easier, and then adapt my program to work with audio files. Do you think this would be a bad approach, should I just work on audio files from the very start? I dont have any previous experience in signal processing, thats why im researching it now, so i will be capable of doing this project by the time I get back after the summer.

    On why I chose Java, i mainly picked this because of the 2 programming languages I know, java and C++, java is the one im most proficient in, considering C++ is a more efficient language, and that Im only in 3rd year and Im planning my fourth year project, I may work on improving my C++ skills so I could write my program using that instead.


  • Registered Users Posts: 267 ✭✭Tears in Rain


    Joneser wrote: »
    Thanks for the quick reply. As for the source data, I would ideally like to be able to give my program an audio file such as a WAV file as you mentioned, but thought that if i began with a MIDI file it would be easier, and then adapt my program to work with audio files. Do you think this would be a bad approach, should I just work on audio files from the very start?

    On why I chose Java, i mainly picked this because of the 2 programming languages I know, java and C++, java is the one im most proficient in, considering C++ is a more efficient language, and that Im only in 3rd year and Im planning my fourth year project, I may work on improving my C++ skills so I could write my program using that instead.

    Well the only similarity between WAV files and MIDI files in the context of your project would be outputting the musical data. If you're outputting the data as an image of sheet music, with notes placed on a bar etc. then working with MIDI first and then adapting it might be a good idea, as you can then use this graphical output functionality for a WAV file later on. Also, it's easier, which means quicker results and less frustration when starting off, and higher morale. (As a rather slow programmer, I know how annoying it is to start something and not get any results for AGES after). Also, if you have familiarity with MIDI, you might also be able to do some cool stuff like a wav->midi converter.

    As for the language thing, I don't want to start a pissing contest where people go "don't use language X, it's rubbish", at the end of the day, the best language is the one that gets the job done faster, and for something like this you have to take into account how long it takes to get to know a 'better' language (and C++ might not even be the better choice here, for anything mathsy it's probably faster to write, but Java might be faster for writing the OO parts of the project)

    Sorry for being impossibly vague on the language part, but I don't want to send you down the wrong path :) I'll just say, if it was me, I'd write it in C++, but your choice of language probably isn't going to make that much difference in the end, provided you don't do something really thick like write it in COBOL ;)


  • Registered Users Posts: 428 ✭✭Joneser


    Thanks alot for all the feedback, nice to see a general overview of what i want to do written down :) . I think ill just start writing some programs that work with MIDI files since I havn't done this type of programming before


  • Advertisement
  • Registered Users Posts: 3,945 ✭✭✭Anima


    I think I read on the music production forum that such a piece of software exists already. Maybe you should take a look at that first.


  • Registered Users Posts: 428 ✭✭Joneser


    After I came up with the idea for the project I looked for programs for it on the internet and thought they looked pretty good, its just a matter of the programming that im trying to work out as i havn't done much programming to do with audio before, except for a little game I did in second year where I had to add sounds to a game I made


Advertisement