Downloading mp3 files onto iPad then putting them in Codea

Hello All,

I am trying to download a .mp3 file to use in one of my games, I have the dropbox app downloaded, but I can’t get the “Open with” message to appear.

Help?

P.S. this is the link

If it’s in your Dropbox folder, you just need to link your Dropbox to Codea then access it there (I think). There should be a folder in Dropbox called apps > codea, and put it in there.

The problem is I cant download it from the site, the “Open in dropbox” option doesnt appear

I haven’t gotten sound files to download from a website onto my iPad. I use my PC for downloading sounds, then edit them in audacity, and drop into dropbox.

Ok, I dont have a computer so thats why

You can download the file directly to Codea, if you want - just send an HTTP request to the file, and with the success function, use the io module built-in to Codea/Lua to save it.

Edit: here’s a basic couple of functions for file IO, based on an example from @dave1707

Install

= {
--[[
--------

    writeFile
    Easy function for writing data into a file

fileName: Name of the target file in Dropbox.assetpack, including extension
data: Data to write into target file

--------
--]]
writeFile = function(fileName, data)
    local file = os.getenv("HOME") .. "/Documents/Dropbox.assetpack/" .. fileName
    wFd, err = io.open(file, "w")
    if wFd == nil then
        error("\
\
Error creating/editing file " .. fileName .. "\
\
Error: " .. err)
        --assert(wFd ~= nil, "Error creating/editing file " .. fileName)
    end
    wFd:write(data)
    wFd:close()
    print("File " .. fileName .. " installed!")
end,
--[[
--------

    readFile
    Easy function for reading data from a file

fileName: Name of the target file in Dropbox.assetpack, including extension

--------
--]]
readFile = function(fileName)
    local file = os.getenv("HOME") .. "/Documents/Dropbox.assetpack/" .. fileName
    rFd, err = io.open(file, "r")
    if rFd == nil then
        error("\
\
Error reading file " .. fileName .. "\
\
Error: " .. err)
        --assert(wFd ~= nil, "Error creating/editing file " .. fileName)
    end
    local ret = rFd:read("*all")
    rFd:close()
    return ret
end
}

So, basically…

function setup()
    http.request(file_url_here, function(data)
        Install.writeFile(file_name_here, data)
    end)
end

(Pseudo-code, and requiring the above Install functions)

Ok, so it syncs with Dropbox, but now i cant load it into codea bc Dropbox doesnt support .mp3 files, do I need a computer for this?

@CodeaNoob Dropbox supports any kind of file. What do you mean, it doesn’t support mp3s? (Make sure you put any files in your /Dropbox/Apps/Codea/ folder)

This:

PicPaste: image-OZxwRfEV.jpg

@CodeaNoob Odd, the Dropbox app should be able to play mp3 files. But either way, that’s just the preview. Try re-syncing your Dropbox asset pack in Codea, or maybe even un-linking and re-linking your Dropbox account to Codea.

I found a work around. Using File Manager Free I dowloaded it and uploaded it to dropbox. Posted for future users with this same problem

@CodeaNoob I think Codea uses m4a files

mp3 seems to work for me

@erickyamato Codea supports .mp3s, .m4as, .wavs, and something else I can’t remember.

@SkyTheCoder I never tried!

Thank you!