Howdy, Stranger!

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

beta 1.3

24567

Comments

  • SimeonSimeon Admin Mod
    Posts: 5,700

    I completely forgot. This build also seriously enhances the sound() API thanks to Dylan's work. Have a look at the Sounds Plus example if you're interested. No docs yet.

  • Posts: 2,161

    On the other hand, bounding box and slant angle are very useful for a character.

    However, those look plenty to be going on with.

    I'll update to the beta after tomorrow - I'm going to use Codea in a lecture in the morning and don't want to risk my code suddenly failing just beforehand!

    I'd love to test out the sound stuff, but for some reason I've never been able to get any sound in Codea. I tried turning-off-and-on-again. Should I just reinstall Codea? Will installing the beta be enough?

  • SimeonSimeon Admin Mod
    Posts: 5,700

    Some people (two that I know of so far) have had to reinstall or restart their iPads to get sound working.

    Regarding bounding box: I believe it's the bounding box for all characters, the docs refer to it as the 'design bounding box for a font'. Slant angle is only available for a font, it's a metric for italic fonts.

  • Posts: 2,161

    Yes, I discovered how useless the font bounding box was with my bitmap class. I thought it would be a "generic" character size so that I could use it for variable-width fonts if I wanted to make a box that was roughly 80 characters wide. Turned out it was more like the largest character size, including double-width characters. So instead I worked with the widths of x and m.

    Hmm, slant angle might have something to do with italic correction. If I ever need it, I'll bug you again!

    Regarding sound, I was hoping not to have to reinstall to get it. I guess I'll do a complete backup before installing the beta anyway so I may as well uninstall to try to get sound working.

  • Posts: 2,161

    Incidentally, there was a suggestion (by Bortels, I think) of including my cube project as an example. If so (and it's fine if not), I should probably update it to use the new stuff, such as fonts.

  • SimeonSimeon Admin Mod
    Posts: 5,700

    I think it was me who asked about it. Would still love to include it. If you're planning a big update for it then I'll hold off until you're ready.

  • Posts: 2,161

    First and foremost, you can include any of my code as and when you like. As I think has been said on the competition thread, having ones code in the "examples" is the "Holy Grail" for Codea users!

    Regarding updates, I'm not planning any particular feature changes. It's just to ensure that it first works with 1.3 and second that it makes use of the new features that are coming in which replace some of the hacks that I developed. After all, if fonts are built in then it seems a little silly shipping a 5000 line 3Mb file containing all the font information! (Not that I'll throw away my font stuff - might still come in handy as I've said elsewhere for the mathematics.)

  • SimeonSimeon Admin Mod
    edited January 2012 Posts: 5,700

    Okay fontMetrics() has been added to version 1.3 (4). It returns a table of advanced font parameters (everything except the design bbox). Here's some code that draws the table of font parameters in the font itself, and lets you adjust the size.

    function setup()
        font("AmericanTypewriter")
        print( font(), fontSize() )
    
        parameter("FontSize", 13, 35, 20)
    end
    
    function draw()
        background(37, 37, 45, 255)
    
        fontSize(FontSize)
    
        -- Need textWrapWidth to do multi-line text
        textWrapWidth(1000) 
        textAlign(LEFT)    
        fill(255)
    
        metrics = fontMetrics()
    
        local str = ""
        for k, v in pairs(metrics) do
            str = str..k.." = "..v.."\n"    
        end
    
        text(str, WIDTH/2, HEIGHT/2) 
    end
    
    

    Font Metrics

    Let me know if this gives you the data you need, @Andrew_Stacey.

  • Posts: 2,161

    That looks brilliant. I have quite a few text-based programs that I can now update with that! Hopefully, I can just provide a drop-in replacement for my Font library and be done with it (oh the joys of OO programming!).

    Incidentally, is there a page with a picture of all the fonts that one can get in iOS? For a couple of programs, I want a font that is as close to the kind of letters that children learn as possible, for example the a shouldn't have the top part.

  • SimeonSimeon Admin Mod
    Posts: 5,700

    http://iosfonts.com has some, but not all are rendered in the fonts themselves. When you install Codea you'll see most of them in the font picker tool.

    Also note that iOS 5 adds a huge number of fonts over iOS 4. So anyone on iOS 4 will miss a lot of the bold-italic and italic variations of fonts.

  • BortelsBortels Mod
    Posts: 1,557

    Woof - I go to sleep for 5 hours you add major new features! I should sleep more often :-)

    A+ on font metrics. I wonder - is there a way to determine if a given glyph position in a font has a valid character? I'm asking that weirdly, but just woke up. My thought was being able to enumerate all visible characters in a font, largely for exploration.

    And I hear bounding box is useless, but is there a way to say "render a string, and tell me the minimal bounding box of the result"?

  • Posts: 2,161

    The bounding box we're talking about is some information encoded in the font. It's meant as some sort of "standard bounding box" of characters, if individual characters don't override it. So it's not the bounding box of a piece of rendered text. Simeon's put that in already.

    I second the "missing glyphs" feature. Sort of like how HTML/CSS does it with a list of fonts saying "Take it from this one if it has it, if not then this one, or that one, or fall back on emoji".

  • BortelsBortels Mod
    edited January 2012 Posts: 1,557

    Portrait mode! (imagine my surprise) J/K, I saw the tweet, but I was still surprised - I didn't think it was in this build.

    Is there a way to force modes? or did I miss it?

    I notice that it auto-rotates, and preserves center-screen (or... no, I guess I am doing so by using HEIGHT/WIDTH. That's cool. :-) )

  • SimeonSimeon Admin Mod
    edited January 2012 Posts: 5,700

    Portrait only: supportedOrientations(PORTRAIT_ANY)

    To preserve the old behaviour: supportedOrientations(LANDSCAPE_ANY)

    Standard portrait only: supportedOrientations(PORTRAIT)

    Inverted portrait only: supportedOrientations(PORTRAIT_UPSIDE_DOWN)

    Standard portrait and landscape left: supportedOrientations(PORTRAIT, LANDSCAPE_LEFT)

    And so on. The default is to use ANY orientation.

    Note that it is recommended you call supportedOrientations outside of your setup() function. At the top of Main, usually. The reason for this is by the time setup() is evaluated the view is already displaying. So if you call it in setup() it will still work, but it will allow the view to assume whatever rotation the editor was initially in until you next rotate the device, then it will lock. The documentation explains this too.

    When it's called outside of setup() it gets evaluated before the view is displayed, allowing it to force an initial orientation. This is just the way iOS works. You can't programmatically set a view orientation once it is displayed. And since we want to allow drawing in setup(), setup must be evaluated after display.

  • BortelsBortels Mod
    Posts: 1,557

    Hmmm - I thought drawing was prohibited outside of draw()? Maybe I'm thinking of Love2D...

  • SimeonSimeon Admin Mod
    Posts: 5,700

    One of the updates added the ability to draw in setup().

    You can do this for example:

    function setup()
        backingMode(RETAINED)
        background(0)
        -- Draw some stuff
    end
    
    function draw()
        -- Draw nothing
    end
    
  • Posts: 447

    in the latest version 1.3(4) when I'm in a game and turn the ipad the screen goes black while it rotates. Is that intended?

  • SimeonSimeon Admin Mod
    Posts: 5,700

    It does that because it looks weird if the GL view is temporarily stretched. So I black it out and fade it back in. This only happens when you rotate to a different orientation (portrait->landscape or landscape->portrait). If you rotate portrait->portrait or landscape->landscape it should be fine.

  • SimeonSimeon Admin Mod
    Posts: 5,700

    Just sent out a new beta - 1.3 (5). It contains a sound() function picker that lets you audition sound effects directly in the code editor. Let me know what you think.

    At the moment, if you put a seed in as an argument it will let you preview that sound (it plays when you tap it the first time). It will also pre-fill the picker with the random seed you chose, so you can keep playing the sound by tapping the table cell.

  • Posts: 447

    Fred might be a good beta for sound stuff (but again not sure how freely you're giving those betas out - well you gave it to me so it can't be a very restrictive club :))

  • BortelsBortels Mod
    Posts: 1,557

    Aw - not to look a gift horse in the mouth, this is better than nothing, but I had hoped the sound picker was more like http://thirdcog.eu/apps/cfxr

    The problem I have with this kind of sound picker is you can't tweak things - if you get a sound similar to what you want, but not exactly there - you have no way to say "that's perfect, just sustain a bit longer" or "Ok - I want that tone, but a note up". I think what people are looking for is a way to program the sfxr thing directly, and then save off the sounds. I know it's a lot of parameters - I'm thinking you could pack them all in a base64 string, so when someone found the sound they wanted, it could be

    $explosion = "83BA93744CC294F3AD4"
    sfx($explosion)
    
  • SimeonSimeon Admin Mod
    edited January 2012 Posts: 5,700

    We tried, but the base64 string is really long. Causing a lot of text wrapping. Which looks pretty horrible.

    Edit: You can actually pass sound() a base64 encoded string of all the SFXR values, or a table of them (see Sounds Plus).

  • BortelsBortels Mod
    Posts: 1,557

    perhaps it could save the resulting sounds to local storage?

    But - if i read right, you can already do this??? where is Sounds plus?

  • BortelsBortels Mod
    Posts: 1,557

    Oho - found it!

    Ok - that'll do. You're talking to a man who passed his image thru netpnm and copied it into lua
    code to make an image from it - a few hundred random bytes don't scare me. :-)

  • SimeonSimeon Admin Mod
    Posts: 5,700

    Hey if you can find a way to compress the 21 float parameters + 1 waveform parameter of SFXR into a short string like your example, I'll look at implementing an advanced picker.

    I'm happy to throw away most of the precision for a system like that (i.e. 1 byte, or even half a byte per float would be fine).

  • BortelsBortels Mod
    Posts: 1,557

    The cut and paste from cxfr is 29 lines of data - let's call it 30 for the math. 4 bytes per, 120 bytes total. base 64 encoded, you're at 160 bytes. That's perfectly reasonable to save to persistent storage, or to move around with admittedly nasty data lines. If you throw away precision (I wouldn't) or compress (I would! there's a lot of 'nil's there in my sample), you could get it smaller, but if you're doing an advanced picker - do it like spritely, have it get a name, and save it to persistent storage. (I am still optimistic we'll get some legitimate way to move around blobs - .codea worked, if they allow export we can get closer). Worst case is to spit it all out as a base64 blob of text.

    I see this the same way I see images (gif/jpeg/png) - they're too big to be convenient for sure, but they're things we want/need.

    An alternative would be building in an ABC compatible tone generator - that's the chief reason we (or I at least) want this type of control, so we can set the frequency directly. I personally am still hoping for proper sound sampling, and that's nasty in terms of volumes of data.

  • SimeonSimeon Admin Mod
    Posts: 5,700

    I would throw out precision for the picker version of the encoded string. You're only going to have sliders that are about 200 pixels wide. 128, or even 64 discrete values along those sliders is more than enough to toy with to generate sounds.

  • BortelsBortels Mod
    Posts: 1,557

    good point... but if you're saving to persistent, there is no need. (my concern about throwing out precision is purely for the frequency - a little change means the notes sound off).

    Not that it matters, really - for pure note generation, we can plug the values in directly, a picker wouldn't be used for that.

  • Posts: 2,161

    Right, I'm now on the beta.

    Still no sound! I deleted Codea and then installed from TestFlight. Should I have switched off and on again in the meantime?

  • SimeonSimeon Admin Mod
    Posts: 5,700

    @Andrew_Stacey it can't hurt to try a restart. iPad 1? OS 4 or 5?

  • Posts: 2,161

    I switched off and on again after reinstalling Codea, but not before. (iPad 2, iOS5)

  • SimeonSimeon Admin Mod
    Posts: 5,700

    I know this is a stupid question, but sound works everywhere else and your iPad isn't on silent, is it?

    This is the reply I got from someone else who experienced the sound issue (iPad 1 though):

    Thanks for a quick answer. I was just about to write down some more data about my iPad, when I decided to try yet another reset. I rebooted the iPad and removed/reinstalled Codify, and now it works!
    
    I've tried to recreate the problem, but no combination of apps seem to trigger it. Being a professional programmer myself, I know when to quit and pretend this never happened :-)
    
  • Posts: 2,161

    Sound works in my music player app, but that's not iTunes. It also recently stopped in something else, so I wonder now if there's an app that has "claimed" the sound output and won't let anything else have it.

  • SimeonSimeon Admin Mod
    Posts: 5,700

    It's an odd thing that it can persist throughout restarts.

  • Posts: 2,161

    Hmm. I just double-clicked the "home" button and swiped left, and found something that looked as though the "mute" was on. Have to experiment tomorrow, now.

  • SimeonSimeon Admin Mod
    Posts: 5,700

    Ah that's the silent switch. If you change your side button to orientation-lock, silent gets put in the tray. It always gets me because it's so hard to tell if it's on or off.

  • Posts: 2,161

    Yay! Sound!

    What must've happened is this: when I upgraded to iOS5.1 then it reset the side switch to mute. I must have switched it before realising. But my music player app somehow ignores it so I never guessed that the solution was so simple. *bangs head repeatedly on brick wall - in time to the music from Fred's excellent sound player*

  • SimeonSimeon Admin Mod
    Posts: 5,700

    Music and videos on iOS ignore the silent switch, which makes some sense when you think about it, since you're explicitly telling it to play something. VLC on the other hand honours the silent switch, which always confuses me when I try to play a video on it.

  • Posts: 2,161

    That sounds wrong to me. If I've said "mute", I should mean mute.

    Nonetheless, it does explain why my kids don't get sound in their games but do when they watch the videos that are sometimes embedded (which is good for me as it tells me when they're doing something I need to supervise!)

  • SimeonSimeon Admin Mod
    Posts: 5,700

    It sounds wrong. But it feels so much more wrong when you've told something to play a video, or music, and it comes out with no sound, so you have to double tap the home button scroll to the right and untick a box.

    In fact, the music player should definitely be immune to the silent switch. If you are telling something to play music, what are the odds you want it to play music silently?

  • Posts: 2,161

    Then the music player should have a button that clearly signifies whether or not the global sound is muted and gives the option to unmute it.

    When I'm watching movies on my computer, I often get it set up ahead of time while making a cup of tea or something. Then that irritating start-up music keeps on looping through - mute is fantastic!

    For audio, I can see that there's not a lot of difference between mute and pause+fast forward, but even so, mute should mute!

    Anyway, as neither of us can fix it, I'll settle for simply remembering that mute is strange on the iPad.

    On more important things - any chance of getting the screen recording into beta?

  • SimeonSimeon Admin Mod
    Posts: 5,700

    Probably on screen recording. Trying to get a lot of stuff in at once.

  • SimeonSimeon Admin Mod
    Posts: 5,700

    Beta 1.3 (7) is being delivered. iOS 5 only from now on.

    It has screen recording. Awesome new sound picker. Updated sound() API with volume.

    I am considering making the "Advanced" sound picker an in-app purchase for one or two dollars. Would anyone object to this? All current users would get every other aspect of Codea 1.3 for free, except the "Advanced" tab of the sound picker would be locked until you upgraded it. Have a look at the feature and let me know what you think.

  • edited January 2012 Posts: 384

    Hi everyone, thanks for bringing me into the beta! Hopefully we will get some fun sounds and music happening, which will soothe your aching head, @Andrew_Stacey! :)

    I'll start playing with the next build to give a musical perspective. My comments on how to deal with the parameters would be to note that some of the parameters need more precision than others to be musically useful. If you skimp on starting pitch resolution, then one of the main things people will want to tweak will be less than satisfactory. That said, the outer ends of the spectrum are not as useful as the middle bit.

    I understand that we will still be able to plug values in with code, and from @Simeon's post of sample code that you were trying to use exponential parameters to demonstrate the range of values. I expect someone will write Spritely for sound, and it shall be called Soundly. That might be me, or one of you guys, but it will be as good as the sfxr web page and allow as much control.

    By the way, although this beta thread is limited, I noticed each of our comments is readable from our Comments tab on our user pages, and is indexed by Google.

    Ooo @Simeon has been up all night and sent me a beta code, so I shall have a play now! :)

  • Posts: 384

    Oops, just saw your plans for an advanced sound picker...:)

  • BortelsBortels Mod
    Posts: 1,557

    re. in-app purchases:

    I am, in general, opposed to in-app purchases for paid apps; it often feels to me like they "held back" part of what I was buying, in order to milk me for more cash. I feel the same for freemium stuff, EXCEPT when the in-app purchase is for things you can earn in-game (ie. there's no difference in content, you are just getting it faster by paying).

    I hope it isn't my pro-Codea bias showing, but I think Codea is both an exception to this, and can follow the same rule. What I'd suggest is this - so long as code written with advanced features (like the sound-picker) can run on any Codea - having it as an in-app purchase is a convenience, and is a reasonable thing. Besides - to fragment the base is a bad thing.

    I don't think a lot of people realize that a giant chunk of what Codea is isn't the language - it's the environment, the editor and such. Anyone can embed lua - I can point out a free github project to do it. The value adds here for Codea are the nice editor, and the libraries. It makes sense to put a price on optional add-ons for that editing environment.

    I would argue that screen recording, and a really nice sprite editor/importer (assuming the sprites went into project storage, and we solve the whole import problem), would fall into the same category; things you could reasonably sell as an add-on.

  • Posts: 384

    Although the Sound picker crashed me, I had great fun with the programmatic interface... :). Ha ha try this in draw():

    sound({StartFrequency = DeltaTime})
    

    and then lightly stroke the Output window... :)

  • Posts: 447

    My hunch would be to follow alvelda's advice and test it out. I would guess no one will buy the sound picker if you make them pay even $1, but would be curious to see.

  • Posts: 2,161

    I may just have to get a YouTube account now ... that recording feature is fantastic.

    Is there an inline function that can call it? It's fine being able to do the recording "live", but it would also be nice to be able to set up a "playlist": particularly with not having sound, I can envision writing something on the screen about what's going to happen, then doing it, and then writing something more, and so forth. (Also, in my "finished" apps then I use FULLSCREEN_NO_BUTTONS and have replaced the various buttons by my own menu functions, it'd be nice if I could do the same with the recording one.)

    (Unfortunately, my first video was too long to email so it has to wait until I cable my iPad to my computer before I can upload it anywhere.)

  • BortelsBortels Mod
    Posts: 1,557

    Love the recording feature... But:

    I want to do instructional videos - so what I really want is the entire ui, including the editor. So a new user can see how you can iterate between run/edit, adding complexity. Just the output window is not so useful for that.

    Suggestion: I don't mind "made by Codea" - but some will. Make that be the paid add-on (or rather, let a paid add-on user edit or eliminate that text.

    Pushing video is easy - http://bortels.posterous.com/video

    Trying YouTube as well.

Sign In or Register to comment.