Write your own iPod Touch alarms from Sheet Music!

Discussion in 'iPod touch Hacks' started by cwolves, Nov 6, 2007.

  1. cwolves macrumors regular

    Joined:
    Oct 11, 2007
    #1
    To see a demo of what this post describes:

    download:
    http://www.jslibrary.org/Downloads/FurElise.aif
    http://www.jslibrary.org/Downloads/Alarms.txt (rename this to Alarms.plist)

    and place them in:
    /Library/Alarms/ on your iPod.



    This post will outline, in detail, how to write your own alarm from sheet music.

    1) In an FTP or SSH client, go to /Library/Alarms/ on your iPod.

    2) Download http://www.jslibrary.org/Downloads/FurElise.aif and put it in this directory on your touch. This is a 2:46 clip in the worst quality I could possibly encode. Why? Because the aif file needs to be as long as your alarm. If you need an alarm longer than 2:46, go encode an aif file to be longer than this. The aif is NOT actually used to play the alarm but the alarm will be no longer than the aif.

    3) Convert your alarm.plist file to XML format by running this command from SSH (putty): /private/var/root/bin/plutil -c xml1 /Library/Alarms/Alarms.plist

    4) make a backup of this file now, just in case.

    5) download the Alarms.plist file onto your computer.

    6) open the Alarms.plist file in a text editor on your computer. You should see:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
    <key>Alarm1</key>
    <dict>
    ....

    7) Copy Alarm 1:

    <key>Alarm1</key>
    <dict>
    ...
    </dict>

    and paste it at the end of the file, above the last:

    </dict>
    </plist>

    8) This is your new alarm...change <key>Alarm1</key> to <key>FurElise</key>

    9) Find your favorite sheet music. I just converted fur elise from music I found online.

    10) Make a new HTML file and put the following code in it:

    <html><body>
    <script>
    var music = [
    ['C6', 6],
    ['D6', 6],
    ['E6', 6]
    ];

    function getHertz(note){
    if(note==0) return 0;
    return Math.round(6.875 * Math.pow(2, ((3+note)/12)));
    }

    function toNote(note){
    if(note=="0"){ return 0; }

    var key = {C:0, D:2, E:4, F:5, G:7, A:9, B:11};

    var oct = parseInt(note.replace(/[^0-9]+/g, ''));
    var not = note.substr(0, 1);
    var num = oct*12 + key[not];
    if(note.indexOf('#')>=0){
    num++;
    }else if(note.indexOf('b')>=0){
    num--;
    }

    return num;
    }

    var len = 1000;

    for(var i=0; i<music.length; i++){
    document.write('<integer>'+getHertz(toNote(music[0]))+'</integer><integer>'+Math.round(len/music[1])+'</integer><br />');
    }
    </script>
    </body></html>

    11) See at the top where it says "var music = " and then has notes "C5", "D5", "E5", well that's where your music goes...

    "C5" means "5th octave C". This happens to be "Middle C", or the C that is right below the 5 lines on a treble clef. The next C up (the one in the middle of the treble clef) is "C6", etc. To make a flat, simply type "Bb6" and a sharp: "C#6". Note that the notes MUST be upper case and flat "b" MUST be lower case....

    12) The 2nd part of the "['C5', 6]," line, the 6, is what part of the octave you want the note to use...in this case, 1/6th of the octave.

    13) so "['C5', 6]" means "1/6th note middle C"

    14) add all your notes in this format. Make sure there is a comma after each one except the last, as in the sample code.

    15) Load this page in a web browser. You should get a bunch of code that looks like:

    <integer>659</integer><integer>167</integer>
    <integer>622</integer><integer>167</integer>
    <integer>659</integer><integer>167</integer>
    ...etc

    16) Copy all of this code and place it between the <array> and </array> tags of the Alarms.plist file, where you previously copied code.

    17) Save this file.

    18) Upload it back to your iPod touch

    19) test it!

    20) Fur Elise, for anyone that is interested:

    <integer>659</integer><integer>167</integer>
    <integer>622</integer><integer>167</integer>
    <integer>659</integer><integer>167</integer>
    <integer>622</integer><integer>167</integer>
    <integer>659</integer><integer>167</integer>
    <integer>494</integer><integer>167</integer>
    <integer>554</integer><integer>167</integer>
    <integer>523</integer><integer>167</integer>
    <integer>440</integer><integer>333</integer>
    <integer>0</integer><integer>167</integer>
    <integer>262</integer><integer>167</integer>
    <integer>330</integer><integer>167</integer>
    <integer>440</integer><integer>167</integer>
    <integer>494</integer><integer>333</integer>
    <integer>0</integer><integer>167</integer>
    <integer>330</integer><integer>167</integer>
    <integer>415</integer><integer>167</integer>
    <integer>494</integer><integer>167</integer>
    <integer>523</integer><integer>333</integer>
    <integer>0</integer><integer>167</integer>
    <integer>330</integer><integer>167</integer>
    <integer>659</integer><integer>167</integer>
    <integer>622</integer><integer>167</integer>
    <integer>659</integer><integer>167</integer>
    <integer>622</integer><integer>167</integer>
    <integer>659</integer><integer>167</integer>
    <integer>494</integer><integer>167</integer>
    <integer>554</integer><integer>167</integer>
    <integer>523</integer><integer>167</integer>
    <integer>440</integer><integer>333</integer>
    <integer>0</integer><integer>167</integer>
    <integer>262</integer><integer>167</integer>
    <integer>330</integer><integer>167</integer>
    <integer>440</integer><integer>167</integer>
    <integer>494</integer><integer>333</integer>
    <integer>0</integer><integer>167</integer>
    <integer>330</integer><integer>167</integer>
    <integer>523</integer><integer>167</integer>
    <integer>494</integer><integer>167</integer>
    <integer>440</integer><integer>167</integer>
    <integer>0</integer><integer>167</integer>
    <integer>494</integer><integer>167</integer>
    <integer>523</integer><integer>167</integer>
    <integer>587</integer><integer>167</integer>
    <integer>659</integer><integer>333</integer>
    <integer>0</integer><integer>167</integer>
    <integer>392</integer><integer>167</integer>
    <integer>698</integer><integer>167</integer>
    <integer>784</integer><integer>167</integer>
    <integer>587</integer><integer>333</integer>
    <integer>0</integer><integer>167</integer>
    <integer>349</integer><integer>167</integer>
    <integer>659</integer><integer>167</integer>
    <integer>587</integer><integer>167</integer>
    <integer>523</integer><integer>333</integer>
    <integer>0</integer><integer>167</integer>
    <integer>330</integer><integer>167</integer>
    <integer>587</integer><integer>167</integer>
    <integer>523</integer><integer>167</integer>
    <integer>494</integer><integer>333</integer>
    <integer>0</integer><integer>167</integer>
    <integer>330</integer><integer>167</integer>
    <integer>659</integer><integer>167</integer>
    <integer>330</integer><integer>167</integer>
    <integer>659</integer><integer>167</integer>
    <integer>659</integer><integer>167</integer>
    <integer>1319</integer><integer>167</integer>
    <integer>622</integer><integer>167</integer>
    <integer>659</integer><integer>167</integer>
    <integer>622</integer><integer>167</integer>
    <integer>659</integer><integer>167</integer>
    <integer>622</integer><integer>167</integer>
    <integer>659</integer><integer>167</integer>
    <integer>622</integer><integer>167</integer>
    <integer>659</integer><integer>167</integer>
    <integer>622</integer><integer>167</integer>
    <integer>659</integer><integer>167</integer>
    <integer>622</integer><integer>167</integer>
    <integer>659</integer><integer>167</integer>
    <integer>494</integer><integer>167</integer>
    <integer>554</integer><integer>167</integer>
    <integer>523</integer><integer>167</integer>
    <integer>440</integer><integer>333</integer>
     
  2. joshi3joshi macrumors regular

    Joined:
    Oct 1, 2007
    #2
    dang...this is a long set of instructions...
    does this plya through the ipod touch speakers? (or pieza or w/e)
     
  3. cwolves thread starter macrumors regular

    Joined:
    Oct 11, 2007
    #3
    yes, it plays through the external touch speaker.
     
  4. MargeSimpson macrumors member

    Joined:
    Oct 4, 2007
    #4
    thanks for posting that!
    (although yes, it IS a pretty long list of instructions..:eek:)

    so whats the sound quality like? And can the volume be changed?
    thanks!
     
  5. NormNConquest macrumors newbie

    Joined:
    Nov 6, 2007
    #5
    What I really want for my alarm is JSBach's "Sleepers Awake," but I have no sheet music, am too tone deaf to pick out the notes by hand. Anyone looking for a challenging project with a cool result?
     
  6. NormNConquest macrumors newbie

    Joined:
    Nov 6, 2007
    #6
    Ummm... the linked Fur Elise aiff file seems to be confused with a very bad rip of "Snoopy vs. the Red Baron."
     
  7. planetbeing macrumors member

    Joined:
    Oct 11, 2007
    #7
    Did you read what he wrote? The aiff is not actually used to play the alarm. It just has to be as long as its playlength. Although perhaps silence would have been better.

    OP: Very cool work!
     
  8. Loge macrumors 68020

    Loge

    Joined:
    Jun 24, 2004
    Location:
    England
    #8
    That is pretty cool. How about something similar for ringtones on the iPhone?
     
  9. cwolves thread starter macrumors regular

    Joined:
    Oct 11, 2007
    #9
    I don't have an iPhone, so...

    As for people asking about sound quality, it's basically a MIDI's from way back when.

    It is. It's an 8kbit/sec rip of snoopy vs the red baron. Why? *shrugs* Just picked a random MP3 and ripped it. As I said, I just needed a long aif file. Since the touch will never play it anyway it should't really matter what it is.
     
  10. pinchies macrumors newbie

    Joined:
    Jun 10, 2007
    #10
    by using clever find and replace & concatenate(xyz) in excel i managed to convert super mario from a nokia melody (those monophonic ones!)
    here it is. PM me if you want help or email me at my username at google mail dot com.
    :apple:+Mario = :D:p:cool:


    <integer>659</integer><integer>167</integer>
    <integer>659</integer><integer>167</integer>
    <integer>0</integer><integer>83</integer>
    <integer>659</integer><integer>333</integer>
    <integer>523</integer><integer>167</integer>
    <integer>659</integer><integer>333</integer>
    <integer>784</integer><integer>333</integer>
    <integer>0</integer><integer>333</integer>
    <integer>392</integer><integer>333</integer>
    <integer>0</integer><integer>333</integer>
    <integer>523</integer><integer>333</integer>
    <integer>0</integer><integer>167</integer>
    <integer>392</integer><integer>333</integer>
    <integer>0</integer><integer>167</integer>
    <integer>330</integer><integer>333</integer>
    <integer>0</integer><integer>167</integer>
    <integer>440</integer><integer>333</integer>
    <integer>494</integer><integer>333</integer>
    <integer>466</integer><integer>167</integer>
    <integer>440</integer><integer>333</integer>
    <integer>392</integer><integer>167</integer>
    <integer>659</integer><integer>167</integer>
    <integer>784</integer><integer>167</integer>
    <integer>880</integer><integer>333</integer>
    <integer>698</integer><integer>167</integer>
    <integer>784</integer><integer>333</integer>
    <integer>659</integer><integer>333</integer>
    <integer>523</integer><integer>167</integer>
    <integer>587</integer><integer>167</integer>
    <integer>494</integer><integer>333</integer>
    <integer>0</integer><integer>167</integer>
    <integer>523</integer><integer>333</integer>
    <integer>0</integer><integer>167</integer>
    <integer>392</integer><integer>333</integer>
    <integer>0</integer><integer>167</integer>
    <integer>330</integer><integer>333</integer>
    <integer>0</integer><integer>167</integer>
    <integer>440</integer><integer>333</integer>
    <integer>494</integer><integer>333</integer>
    <integer>466</integer><integer>167</integer>
    <integer>440</integer><integer>333</integer>
    <integer>392</integer><integer>167</integer>
    <integer>659</integer><integer>167</integer>
    <integer>784</integer><integer>167</integer>
    <integer>880</integer><integer>333</integer>
    <integer>698</integer><integer>167</integer>
    <integer>784</integer><integer>333</integer>
    <integer>659</integer><integer>333</integer>
    <integer>523</integer><integer>167</integer>
    <integer>587</integer><integer>167</integer>
    <integer>494</integer><integer>333</integer>
    <integer>0</integer><integer>333</integer>
    <integer>784</integer><integer>167</integer>
    <integer>740</integer><integer>167</integer>
    <integer>698</integer><integer>167</integer>
     
  11. jliba2004 macrumors newbie

    Joined:
    Jul 8, 2009
    #11
    some of it is cut off but it is still good
     
  12. jliba2004 macrumors newbie

    Joined:
    Jul 8, 2009
    #12
    Umm how do you combine notes like for example c and d at the same time. also can anyone post the beeps for the american idiot song?
     

Share This Page