Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sound assets in project?

in Questions Posts: 760

I've found sound files for my Asteroids exercise. If I DL them, unzip them, and put them in Dropbox.assets, I can access them as one would hope. Is there a way to move the files into the actual project, so that they'll export with it? The only folders that show up under Codea in Files are Craft, Dropbox.assets, and Examples. None of my projects show up as folders.




  • edited May 29 Posts: 760

    Follow-up question: once I play a sound with loop=true, is there some way to stop it?

    ANS: Secret method sound:stop(). s = sound(...); s:stop;

  • Posts: 565

    @RonJeffries in the asset picker click on edit (top right) then you should be able to move assets to the project assets or the documents assets. Beware, if moving .obj files in this way the associated .mtl file is not moved (Grrrr!).

  • Posts: 1,863
    @RonJeffries - you can copy files to you project.codea file using the assets facility. I can never remember how to do this so - what I do is create a project folder in the documents(ie Codea route) and add the plist and icons file into it together with graphics sound etc resources. This gives a project root folder in the asset facility with your own icon and resources so accessing assets is easy by using asset.documents.project. ....

    I posted a description of this some time ago so I'll dig out the link, but may have to make a vid of this.
  • Posts: 760

    @piinthesky if you mean the asset picker under Assets on the front page of Codea, it does not show my project, so I can't move my files from Dropbox.assets into it.

    @Bri_G I don't understand what you said here so hope you can find and verify a description of how to do this. I hope it doesn't include editing a plist file ...

  • Posts: 565

    @RonJeffries no, inside the code when you click on the sound() to choose the asset. I hope when Simeon finalises the new asset system, we will be able move assets around outside of the code.

  • edited May 29 Posts: 1,863
    @RonJeffries - on the plist front you don't have to edit it. Just load a minimal one in, it seems to auto-update (or ignore) the actual contents of it but it works.

    Will post the link later - still searching.


    This thread is one:

    And this one
  • Posts: 760

    @piinthesky wow, I didn't even know that was there. It adds them without comment, but works a treat. Excellent, thanks!

  • Posts: 253
    I'm having trouble loading sound assets into my programs, it looks like I'm not the only one...Simon, where are you ? Help !
  • Posts: 760

    at the bottom of the linked article, i show how i moved some sound assets into my project. hoping to help ...

  • SimeonSimeon Admin Mod
    Posts: 5,418

    @kendog400 what type of files do you have?

  • Posts: 253
    I've downloaded wav. files from internet. They are card game sounds, shuffle and deal card. This diffulcty of getting sounds into a project gives the impression apple does not want sounds in projects because their may be some sort of copy infringment.....
  • Posts: 760

    in the linked article, i show how i moved was files into my codea project.

  • SimeonSimeon Admin Mod
    Posts: 5,418

    @kendog400 definitely take a look at @RonJeffries post (the section titled "Update" down the bottom)

    To put your wav files into Codea you can also use the Files app. If you save the wav files into your On My iPad -> Codea folder in the Files app, they will show up in your sound picker under the Documents folder

  • Posts: 253
    Nothing shows up in documents folder, can't seem to paste items in folder, seem to be locked out....
    IMG-0074.PNG 96.8K
  • Posts: 253
    Is there any way to get files into this folder ?....
    IMG-0075.PNG 46.6K
  • Posts: 253
    Seem to be stuck with poor sound selection, Help !!!!!
    IMG-0077.PNG 66.2K
  • Posts: 760

    did you check my article and do like it says?

  • Posts: 253
    I took a peek, it looks like I have to put files into a dropbox folder and sync that with documents folder ??...I thought there would be an easier way.....
  • Posts: 760

    it's a few steps but works fine.

  • dave1707dave1707 Mod
    Posts: 8,668

    I posted something like this before, but I thought I’d clean it up a little. You can queue up multiple wav or mp3 files and download them. These examples are small wav files, so they download faster than you can queue them up. If you have larger mp3 files, then you can queue them up to download one by one. Just tap a file name to queue/download it. The files are saved in the Codea Dropbox folder. You can load them from the Dropbox folder into a projects Project folder. Open the project you want the files to go into. At the beginning of the program put sound() or music() statements. Then depending on what kind of file you downloaded, tap within the () of sound or music to show the asset list. Select Dropbox, then in the upper right, select Edit. Tap each file you want to move to the Project folder, then tap Add To at the lower right. Then tap the Project folder name. The files should be copied to the Project folder and can be Deleted from the Dropbox folder when done. Then remove the sound or music statement you added to the code. The tune table should contain the url of the file to download and the name you want to save it as. Include the .wav or .mp3 extension with the name.

    PS. The files don’t show up in this code until you close and reopen it. They should show when you open the project you want to move them to.

    function setup()
        -- table of addresses and the names to save them as. 
        queTable={} -- table of files waiting to download
    function draw()
        background(40, 40, 50)
        for a,b in pairs(tuneTable) do
        text("To download",350,HEIGHT-10)
        for a,b in pairs(queTable) do
        if #queTable>0 then
            if not downloading then            
            text("Downloading --  "..tuneTable[pos][2],WIDTH/2,100)
    function touched(t)
        if t.state==BEGAN then
            for z=1,#tuneTable do
                if t.x>0 and t.x<200 and 
                        t.y>HEIGHT-40*z-20 and t.y<HEIGHT-40*z+20 then
    function notFound()
        print("error with file..."..tuneTable[pos][1])
    function didLoadMusic(data,status,headers)
    function writeFile(fileName, data)
        print("begin write file")
        local file=os.getenv("HOME").."/Documents/Dropbox.assets/"..fileName
        local wFd,, "w")
        if wFd==nil then
            print("Error creating file "..fileName.."\n\nError: "..err)
        print("done writing  "..fileName)
  • Posts: 253
    OK, thanks...I finally got it, but I don't even know how I figured it more question or spot to show, when I get to the documents section, I have no buttons or arrow to go back...Is it just me ?....I get stuck right at the documents, then I have to close codea pgm down and restart over....
    IMG-0079.PNG 96.8K
  • Posts: 791

    @kendog400 just tap outside the asset selector to close it. No need to reset program

  • Posts: 253
    I tried to tap everywhere, I think because I'm using an i-phone (6s), some of the screen is tucked away...I had an i-pad 5 long ago, but it became outdated, and codea PGM wouldn't run, now i got I-pad everything runs but screen missing some realestate.....
Sign In or Register to comment.