spike1
spike1
Posts

36

Following

22

Followers

13

Hello! My name is Sean and I have a description :)

Joined on July 10, 2013, 3:34 AM Visited on December 4, 2018, 5:52 AM
Badges

spike1 posted on April 13, 2018 at 12:14 PM

I did a website yes!

I really wanted to title this WebDev poop ;(, but something told me not to...
Hey everyone! This post is really boring.

I see a few other people have been having fun with DOS and C++ and whatnot; I've been working in the opposite direction - in the wonderful world of web apps!

I miss C++ :(

A year and a half ago I decided to make a website that could house all the miscellanea I make - but more importantly, one that would itself be enjoyable to navigate. My original target was to have a really fluid style (since all my other websites are a bunch of blocks), with visuals that would imitate pieces of paper on a desk, covered by a moving shadow. I also wanted to support back to IE8, and mobiles.

Then later on (read: a month ago) I decided that, of course, it should have an interactive cassette player, a video playing phone, a book with flip-able pages, and photos that get picked up and placed back on top of each other.

Although web development has become a lot more stable over the last few years, a couple of these things are kinda cutting edge (sorry IE8) and I had a hell of time with the cassette player in particular :P - multiple different speeds, forward and reverse etc...yeah.

I'll detail that one in particular since it has an amusing story behind it XD

A Fable of False Promises HTML5, introduced several years back, has a new <audio> tag which can be used to stream/play audio without using any plugins. So of course in my gleeful naivety, I figured I was to export out a 20 minute long "tape", which I could play through this. Adding to my delight, it turned out that the <audio> tag had a playbackRate property which could be used to speed up, slow down, and theoretically reverse the audio - how simple!

Of course it turned out no major browser supported negative playback, nor speeds over 4x (I needed up to 25x)...and more annoyingly they all used terrible pitch correction which turned the audio into mush.

Introducing the Web Audio API - the other way to do audio in HTML5. This one functions entirely through Javascript, as a high level way of decoding audio codecs into PCM and then scheduling their playback. I figured as long as I could manipulate the raw audio data I'd be able to do any speed including reverse, so this didn't seem too bad.

The first issue was to get the raw data. It turned out that a pretty large number of browser versions still in use have no way to stream data using Javascript - only to download entire files. The second issue was that even if I could stream the data, the Web Audio API had no way to decode partial audio packets. Adding to the problem was even if I could download the whole 20min tape quick enough, decoding the entire thing would take around half a gigabyte of ram - not exactly mobile friendly.

I ended up splitting the file into 1 minute segments, which I would download, decode and queue in sequence while the previous one plays - which limits ram usage to around 20mb.

So now for the speed control! Luckily this time round there was another playbackRate variable, that behaved exactly as I wanted (any speed, without pitch correction), however it could not play backwards. I ended up handling playing backwards by simply reversing the raw audio data (which now that I think about it switches the interleaved stereo channels...oops) - but of course using Array.reverse was the wrong way to do that! For some god forsaken reason, the in-built reverse function is - across browsers - slower than a manual swap loop. ? :(

So after combining all this together, fixing a multitude of asynchronous bugs (Javascript, almost entirely asynchronous but with no concept of mutexes - brilliant!), fixing all the dumb browser specific codec and function naming issues, and creating all the graphical elements, I had a working cassette player! :D

The other pages weren't nearly as bad, although the book was a bit painful at times (HTML5 canvas + PDF rendering something something border-radius bug).

If any of you are curious to see the end result (it's on the Music/Songs page) you can check it out here, although a modern browser is necessary for the full razzmatazz :P

(Any critiques on the website would be greatly appreciated also sorry XD)

Anyway hopefully that wasn't too boring, I never know if programming rants are amusing to anyone other than the ranter :P. But yay now I can get back to ma video editor, time to add exporting!


Also I be not a hipster I swear...I just like how some of ma music sounds at 0.8x speed backwards XD

spike1 posted on January 17, 2018 at 7:39 AM

Languages

I wanted to start this blog off a little differently than normal. I feel, to an extent, bad posting a blog considering how little I've interacted with any of the other ones on here. And more importantly, I wish I could find a way to consistently fix that, to post a comment on every blog that's insightful and witty and gives the poster something back - but for some reason I'm never able to, anywhere. Over the past year I've found myself wanting to say less and less and listen more and more, in an almost selfish capacity that lets me absorb everyone else's stories without contributing any of my own. I feel mine aren't interesting and shouldn't be wanted, and anyone who is interested is lying or deluded :P.

To that end, I wanted to say that there have been some really great posts the last few months - about huge development projects that have spanned years, about small ones made for the enjoyment of creation, about life in general, goofies, etc. and I've greatly enjoyed reading all of them. Many of them (admittedly life ones in particularly) have really resonated with me or brought me enjoyment, and I wish I could write a comment on them - but frankly I already feel super silly writing any of this so that isn't going to happen :P.

Anyway, now about meeeeeeeeeeeeeeeeeeeeeeeeeee-

The last month or so I've been learning two new languages, C++ and Spanish! I've decided I love learning languages (the ones that work on people that is) and want to try and learn as many as possible before I keel over. If any of you have any experiences regarding languages you'd like to share, feel free to :D

My Spanish isn't particularly great - I can read a fair amount, but hearing and forming sentences myself still needs a lot of work. I've been trying to integrate it into the stuff I work on to help speed things up (translation for Shader Sandwich, songs, scripts, etc).

C++ wise, a few months back I was forced by my lack of pragmatism to switch to Linux (I went with Mint Mate for anyone curious...I want to try something else XD) - unfortunately most Linux video editors are pretty bad, and the ones that aren't are too simple for what I want to do. So a month ago I figured screw it! I'll make my own :D - and learn C++ while I do.

C++ is awesome! Coming from C# it feels like all the rigidity and hand holding has been lifted, and frankly I love it. I love being able to copy raw bytes around and manually free memory and work with tons of great libraries easily (primarily SDL2, FFmpeg, GLEW and TinyXML in this case). And my god is it fast. Maybe it just forces me to be a better programmer, or maybe it's just legitimately faster, but yeah it is fast.

So far the interface is rubbish...and doesn't work...but in code I can add clips, resize and reposition them - I've got a command pattern style thing going on so Undo and all that works too. Effects (and exporting :P) will be coming soon. Playback is super fast too, and works in reverse and different speeds and whatnot. So ayad7wdqjkwdqkw

Anyway thanks if you read, hopefully it was slightly lukewarm :).

spike1 posted on June 19, 2017 at 2:37 PM

Pirates and Stick Fingers

I'm lying in bed trying to fall sleep, double pillows keeping my back up and cold, wet towels covering my forehead. Every quarter of an hour or so I manage to dream about anime sword clashes for a few moments, but that gets irritating quickly - especially with the civil war going on! The pirates could be storming through my door any second and here I am trying to get some shut eye!

Alright maybe I can make a change. Sometimes if I lay my head on the other side of my bed I can get to sleep easier. I don't bother transferring the second pillow but I hold the cold towel on anyway, and I move the giant soft toy to the other side in case it tries to kill me during the night. I lie down and face the door, I'm now closer to it. And I wait...and wait...

Luckily the captain underneath my sheets figures he can help and he whispers to me I can finally go to sleep if I take the towels off. I figure what the heck and so I toss them on the ground.

The problem is, I'm going to have to move everything now. The Nerds have been split on the floor and the towels are over here and my feet are over there and I need to move every single item in my room to the other side to fix things. I start to panic and the room grows around me. My fingers have become brittle like a twig and I start cradling them too scared to touch anything - in fact everything is made of broken twigs and bones that have frayed at the ends. I can feel a few tears running down my cheek as I realise it'll take years to rotate the house and I don't know if I even can put things right. I look over to my desk which looks so far away now.

That passes after several minutes, and I manage a dreamless sleep for about an hour before waking up for a bathroom break. After dealing with the forcefield around the toilet I realise I've forgotten part of how to get back to sleep! I rush back into bed and start concentrating really hard on the civil war. Suddenly it hits me - back when I was asleep I'd pulled apart the air in front of me to reveal an orange holographic amusement park. I can almost see it now but it's kinda faint, luckily Frank the pirate lets me go back to sleep. I finally get a few hours sleep, and I wake up to my mum checking up on me which scared off the many hallucinations and illusions.

I'd just had a bad case of tonselitis where my temperature got a bit high, but my gosh it was a bizarre experience XD. I'm fairly certain most of it was dreams and hallucinations but I was definitely awake during the stick finger part, it's just weird knowing how much my perception can be screwed up haha :P. Luckily I was better-ish (I'm still technically sick) in time for my birthday, so yay :D

Thanks for reading!

It's kinda strange though, the weird stick part has happened since then a couple of times in varying degrees, and it never gets any more comfortable feeling like my fingers are made of twigs...lol :P