Get the Flash Player to see this player.
Flash Image Rotator Module by Joomlashack.
Fractal
Fractal
Fractal
Fractal
Fractal

Sampler Report V1 E-mail

This script reports general information about an AKAI sampler through M.E.S.A. and saves the results as a "SimpleText" document to the desktop. Since this script uses M.E.S.A. to determine the various information about the sampler make sure M.E.S.A. knows about the latest changes to any data in the sampler. The easiest way to do this is to hit COMMAND + F while in M.E.S.A. This forces the sampler to be "found" again, which also updates any changes to programs or samples indicated in M.E.S.A.

Note: This is an AppleScript designed for older (S-series) AKAI samplers. This AppleScript works through a free utility written by AKAI called M.E.S.A. The latest generation of samplers from AKAI are much more versatile and powerful than the S-series, but a lot of people still use the S-series samplers so I have made some of my favorite M.E.S.A. scripts avaialble.


-- ***********************************************************************
-- VERSION 1.0
-- DATE: 10-28-99
--
-- This script reports general information about an AKAI sampler through
-- M.E.S.A. and saves the results as a "SimpleText" document to the
-- desktop. Since this script uses M.E.S.A. to determine
-- the various information about the sampler make sure
-- M.E.S.A. knows about the latest changes to any data
-- in the sampler. The easiest way to do this is to hit
-- COMMAND + F while in M.E.S.A. This forces the sampler
-- to be "found" again, which also updates any changes to
-- programs or samples indicated in M.E.S.A.
--
-- Feel free to borrow from or change anything you like.
-- I tried to comment the code so it's easy to follow.
--
--
--        Ken Loge
--        http://dreamsteep.com
--
-- ***********************************************************************


on initialize() -- PROMPT THE USER TO CHOOSE THE TYPE OF SAVE

    global myFileRef

    makeNewTextFile() -- Create a new text file

end initialize



on checkSampler() -- INITIALIZE VARIABLES AND MAKE SURE THE SAMPLER IS ONLINE

    global theSampler, gNumPrograms, gNumSamples

    tell application "MESA II"

        set theSampler to sampler 1 -- assign variable to sampler object

        if (is online in theSampler) then -- is the sampler online?

            set gNumSamples to count samples in theSampler -- count samples in memory

            set gNumPrograms to count programs in theSampler -- count programs in memory

        else

            error "Sampler is offline. Please check connections, then try again."

        end if

    end tell

end checkSampler



on getProgramName(n) -- GET A SINGLE PROGRAM NAME

    global gProgramName, theSampler

    tell application "MESA II"

        set gProgramName to name of program n in theSampler

    end tell

    return gProgramName

end getProgramName



on getSampleName(n) -- GET A SINGLE SAMPLE NAME

    global gSampleName, theSampler

    tell application "MESA II"

        set gSampleName to name of sample n in theSampler

    end tell

    return gSampleName

end getSampleName



on getSampleLength(n) -- GET THE LENGTH OF A SAMPLE IN KILOBYTES

    global gSampleLength, theSampler, gTheUnits

    tell application "MESA II"

        set theSample to sample n in theSampler

        set gSampleLength to sample length of theSample

    end tell

    if gSampleLength < 1024 then -- show actual size for small sample

        set gSampleLength to (gSampleLength / 1024) * 2

        set gTheUnits to "KB"

    else if gSampleLength > 1024 and gSampleLength < 1024000 then

        set gSampleLength to round ((gSampleLength / 1024) * 2) -- convert to kilobytes

        set gTheUnits to "KB"

    else if gSampleLength > 1024000 then

        set gSampleLength to round (((gSampleLength / 1024) * 2) / 1024) -- convert to megabytes

        set gTheUnits to "MB"

    end if

end getSampleLength



on sampleMemoryUsed() -- SUM TOTAL AMOUNT OF MEMORY USED BY SAMPLES

    global gMemoryUsed, gSampleLength, gNumSamples, theSampler

    set gMemoryUsed to 0 -- initialize global

    tell application "MESA II"

        repeat with n from 1 to gNumSamples

            set theSample to sample n in theSampler

            set gSampleLength to sample length of theSample -- get individual sample size

            set gMemoryUsed to gMemoryUsed + gSampleLength -- sum it up

        end repeat

    end tell

end sampleMemoryUsed



on returnProgramNames() -- RETURN THE NAMES OF ALL PROGRAMS IN MEMORY

    global gUserPref, gMyFileRef, gProgramName, gNumPrograms

    repeat with n from 1 to gNumPrograms

        getProgramName(n)

        if n < 10 then -- insert leading zero to line up columns

            set theNumber to n as text

            set n to "0" & theNumber

        end if

        write "Program " & n & ": " & gProgramName & return to gMyFileRef

    end repeat

end returnProgramNames


on returnSampleNames() -- RETURN THE NAMES OF ALL SAMPLES IN MEMORY

    global gMyFileRef, gSampleName, gSampleLength, gNumSamples, gTheUnits

    repeat with n from 1 to gNumSamples

        getSampleName(n) -- gets the name of the sample

        getSampleLength(n) -- gets the length of the sample

        if n < 10 then -- insert leading zero to line up columns

            set theNumber to n as text

            set n to "0" & theNumber

        end if

        write "Sample " & n & ": " & gSampleName & "     (" & gSampleLength & " " & gTheUnits & ")" & return to gMyFileRef

    end repeat

end returnSampleNames



on getDesktopPath() -- GET THE PATH TO THE DESKTOP

    global gFilePath

    copy (the path to the desktop as text) to gFilePath

end getDesktopPath



on saveFile() -- SAVE THE FILE TO DISK

    getDesktopPath()

    closeTextFile()

end saveFile



on makeNewTextFile() -- MAKE A NEW TEXT FILE FROM SCRATCH

    global gFilePath, gMyFileRef

    getDesktopPath()

    set myFile to gFilePath & "AKAI Report File.txt" as text

    set gMyFileRef to (open for access file myFile with write permission)

end makeNewTextFile



on closeTextFile() -- CLOSE TEXT FILE

    global gMyFileRef

    close access gMyFileRef

end closeTextFile



on insertBlankLine() -- INSERT A BLANK LINE IN THE FRONTMOST BBEDIT WINDOW

    global gMyFileRef

    write return to gMyFileRef

end insertBlankLine



on displayGeneralInfo() -- DISPLAY GENERAL SAMPLER INFORMATION

    global gNumPrograms, gNumSamples, gMemoryUsed, gTheUnits, gMyFileRef

    display dialog "It may take up to a minute to assimilate the " & gNumSamples & " samples resident in memory." buttons {"OK"}

    sampleMemoryUsed() -- determine how much memory resident samples are using

    if gMemoryUsed < 1024 then -- show actual size for small sample

        set gMemoryUsed to (gMemoryUsed / 1024) * 2

        set gTheUnits to "KB"

    else if gMemoryUsed > 1024 and gMemoryUsed < 1024000 then

        set gMemoryUsed to round ((gMemoryUsed / 1024) * 2) -- convert to kilobytes

        set gTheUnits to "KB"

    else if gMemoryUsed > 1024000 then

        set gMemoryUsed to round (((gMemoryUsed / 1024) * 2) / 1024) -- convert to megabytes

        set gTheUnits to "MB"

    end if

    -- write out sampler text data to the file

    write "************************" & return to gMyFileRef

    write "*   Report for AKAI Sampler   *" & return to gMyFileRef

    write "************************" & return to gMyFileRef

    write return to gMyFileRef

    write "There are " & gNumPrograms & " programs and " & gNumSamples & " samples in memory." & return to gMyFileRef

    write return to gMyFileRef

    write "The total amount of memory used by all resident samples is " & gMemoryUsed & " " & gTheUnits & "." to gMyFileRef

    write return to gMyFileRef

end displayGeneralInfo



-- THE FOLLOWING DETERMINES THE ORDER IN WHICH THE HANDLERS ARE CALLED

checkSampler()

initialize()

displayGeneralInfo()

insertBlankLine()

returnProgramNames()

insertBlankLine()

returnSampleNames()

insertBlankLine()

saveFile()

-- THAT'S ALL FOLKS...    

Trackback(0)
Comments (0)Add Comment

Write comment

busy