Script Editor – Adding lines and recording audio

Making some good progress today!!!  I have added the ability to create lines for the script, delete lines, move lines up and down, record audio, and the like.  Here are some screenshots: 

 

image

The JavaSonic ListenUP applet records things as a .wav.  I will need to join these together.  I found a function to do this:

 

www.splitbrain.org/blog/2006-11/15-joining_wavs_with_php

 

function joinwavs($wavs){
    $fields = join('/',array( 'H8ChunkID', 'VChunkSize', 'H8Format',
                              'H8Subchunk1ID', 'VSubchunk1Size',
                              'vAudioFormat', 'vNumChannels', 'VSampleRate',
                              'VByteRate', 'vBlockAlign', 'vBitsPerSample' ));
    $data = '';
    foreach($wavs as $wav){
        $fp     = fopen($wav,'rb');
        $header = fread($fp,36);
        $info   = unpack($fields,$header);
        // read optional extra stuff
        if($info['Subchunk1Size'] > 16){
            $header .= fread($fp,($info['Subchunk1Size']-16));
        }
        // read SubChunk2ID
        $header .= fread($fp,4);
        // read Subchunk2Size
        $size  = unpack('vsize',fread($fp, 4));
        $size  = $size['size'];
        // read data
        $data .= fread($fp,$size);
    }
    return $header.pack('V',strlen($data)).$data;
}

It streams it out to the client.. .I will want to save it to the filesystem and use LAME to convert it into MP3.

This is the next step…  After I am able to join them and convert them, then I will be at the point that I will have all the technical know how to do what I’m trying to do.  Then it will be a matter of cleaning up the design, (in fact redesign (ok.. ok… not much of  design now… just to design it)), make it look pretty, test test test… (I’m going to try to put the 15 scripts we have done so far for HabloHindu in there and see how that works), I need to add some authentication/security to it, then I will upload it and have Sara give it a try to see what she thinks…

Leave a Reply

Your email address will not be published. Required fields are marked *