Howdy, Stranger!

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

playing music files but not in draw function - amended help question

edited June 2014 in General Posts: 318

AMENDED QUERY -

so after the help below I've got the AAC files in a M4a wrapper (an AAC in the right format) and its coming in through dropbox and saved in my documents now.

I'm looking to trigger the code for music. I usually trigger things in the draw function but as the reference states - don't continuously call it in draw but instead start, stop or change it.

So I'm wondering where I should put it if its not in draw.

Will it go in set up and then I use an event to change the file it plays?

Thanks,
Major

ORIGINAL QUERY:

Hi, so I'm exploring the new music playing features of codea 2.0. I have a dropbox account and I email files, or save them to my dropbox yet when I go into drop box on my iPad they are there, but the files and folders aren't showing up on the dropbox option in codea. I must be missing something simple.

Any help greatly appreciated !

Tagged:

Comments

  • dave1707dave1707 Mod
    Posts: 8,447

    @Majormorgan Only files with a .png extension show on the iPad. Hopefully a future release will show files with any extension. As you already know, you can read the files, you just can't see them.

  • Posts: 1,976

    Make sure the assets are in your /Dropbox/Apps/Codea/ folder, and when in Codea in the Dropbox assetpack, press "sync."

    @dave1707 In Codea 2.0, any supported image/music/sound file will appear in the asset browser. What do you mean, only .png?

  • dave1707dave1707 Mod
    Posts: 8,447

    @SkyTheCoder I'm talking about the Dropbox or Documents folders. I think those only display .png files for now.

  • Posts: 318

    hi thanks guys I managed to find the folder now. It does sync and see 6 files, but won't display them. I have them as AAC files. should they be something else? Thanks

  • Posts: 1,976

    @Majormorgan I'm not sure if AAC files are supported. Could you try .mp3?

    @dave1707 I am sure that the Documents/Dropbox assetpacks display files other than .png. If you want to see it for yourself, I can send you a screenshot, or a program than downloads and installs .mp3 and .wav files.

  • dave1707dave1707 Mod
    Posts: 8,447

    @SkyTheCoder I believe you. I never tried to save .mp3 or .wav files to those folders. I have .txt files there and those don't show up.

  • Posts: 1,976

    @dave1707 Currently only file types used by Codea are shown (images, sounds, music), and nothing else.

  • dave1707dave1707 Mod
    Posts: 8,447

    @SkyTheCoder I think all file types should show and hopefully in a future release they will.

  • Posts: 425

    You can use iTunes on your computer/mac to convert sound files

  • Posts: 318

    Hi, thanks. I thought AAC was the format supported for sound in codea. Any idea which formats I should use? MP3, wav or m4a? Or something else. Ideally compressed so not wav

  • edited June 2014 Posts: 425

    I think wav & ma4 work for music but I'm not sure about sound

  • Posts: 1,976

    mp3 and m4a files are music, and wav is sound. I think there's one other sound type supported, but I can't remember it.

  • Posts: 318

    Thanks Sky, I've amended my original query as I now can see the m4a files.

    Now what I need to do is trigger the music but not in an endless draw way.

    any ideas anyone?

    thanks,
    major

  • Posts: 784

    One solution would be to create a variable in setup, say

    playmusic=0
    

    Then in draw() to call the music command once

    if playmusic==0 then
        --play the music command
        playmusic=1
    end
    
  • Posts: 318

    Thanks @west

    Sorry I should have thought of that before as I'm using variables in that way to change animation states.

    I can then use another variable to change which track the music is during different parts of the game or even set playmusic back to 0 to then run a track change then set music back to 1 again.

    thanks,
    Major

  • Posts: 425

    maybe something like (i'm on my pc so haven't tested this)

    function draw()
        if music.name==nil then
             music("name")
        end
        -- draw stuff
    end
    
Sign In or Register to comment.