Bad Apple!! in Love2D

Show off your games, demos and other (playable) creations.
User avatar
pgimeno
Party member
Posts: 3674
Joined: Sun Oct 18, 2015 2:58 pm

Re: Bad Apple!! in Love2D

Post by pgimeno »

Sulunia wrote:I'm so inclined on implementing a partial IT tracker on my decoder... But love already plays IT files! Should i just bite the bullet and do it for the sake of "do everything yourself"? I think it's better to parse an IT file instead of a full blown MIDI one. Besides the fact i always wanted to try implementing a tracker player by hand.

Thoughts?
IT is kinda complicated for a first. MOD is more straightforward, yet some effects take some effort to get right. I'd try to start with MOD.
User avatar
zorg
Party member
Posts: 3468
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Bad Apple!! in Love2D

Post by zorg »

Sulunia wrote:Thoughts?
Plays, yes. Doesn't allow access to notation and instrumentation data tho!

I'd say that, out of the 4 major tracker formats, S3M is easiest to implement (without ad-lib support, that is; MOD was first, but that has dozens of sub-types, and it has a kinda stupid way of denoting period values (for various historical reasons, but suffice to say, it is a fustercluck); i don't remember what i had against XM... maybe that it tried to be MOD-compatible, so it also had the same period value shenanigans... maybe; and IT is, without doubt, the most complex of the four.)

If you want, i can share my working s3m importer with you; it will alleviate ~half the work :3 (Leaving only the playroutine to implement, though unless you have an idea how to implement such a thing without pushing small buffers in realtime onto the soundcard, i can also share (before i fix a few things, and release it) my AudioDevice lib.

Or just discuss stuff relating to it, pointers, whatever; could be beneficial for both of us. :D
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
User avatar
Sulunia
Party member
Posts: 203
Joined: Tue Mar 22, 2016 1:10 pm
Location: SRS, Brazil

Re: Bad Apple!! in Love2D

Post by Sulunia »

pgimeno wrote: IT is kinda complicated for a first. MOD is more straightforward, yet some effects take some effort to get right. I'd try to start with MOD.
zorg wrote:
Sulunia wrote:Thoughts?
Plays, yes. Doesn't allow access to notation and instrumentation data tho!

If you want, i can share my working s3m importer with you; it will alleviate ~half the work :3 (Leaving only the playroutine to implement, though unless you have an idea how to implement such a thing without pushing small buffers in realtime onto the soundcard, i can also share (before i fix a few things, and release it) my AudioDevice lib.

Or just discuss stuff relating to it, pointers, whatever; could be beneficial for both of us. :D
:monocle:
When i mean "implementing a tracker" by hand i meant "just enough" to play this specific song for the video. That way, we could guarantee the video and the audio would run in full sync. There would be no need to implement audio effects, like portamento, pitch bending and such, since these are not used in the converted IT file. All we would need is to find out when a sample plays and for how long and then play it back (i believe this is as minimal as it gets).

Hell, we can even strip out the samples and include them in the .love file, using the IT file solely as a notation reference of when to play stuff. Low level access to audio would still be needed though (as in, working with buffers and sending these to the audio card).

(Btw, i'll edit this soon and post my "wip" version. I'll have to split it since the video file is quite big and i had not the time to compress it in any way.)
Don't check my github! It contains thousands of lines of spaghetti code in many different languages cool software! :neko:
https://github.com/Sulunia
User avatar
zorg
Party member
Posts: 3468
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Bad Apple!! in Love2D

Post by zorg »

Well, i believe your IT can be converted neatly to s3m, my importer imports it in into a useable representation. From then on, the playroutine can be as simple as you want, meaning if you don't wants effects and such implemented, just notes and the instruments, it can be done that way too.

Also, my importer already converts the samples into SoundData, so yeah. ^^

Sadly, often with audio, just enough means more than what one bargained for; you'll probably not be successful if you tried to do this with normal sources :c

Regarding my Bad Apple Encoder, took it 9 minutes to encode 6572 frames... and this is with 6-way encoding per-frame, without the BWT implemented... not that bad i guess. Output size at 22340 Bytes, already smaller than the 733059 Segfaultd had, so i guess i can call it a success :3 (Edit: Or not, it may have been outputting garbage after all...)
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
User avatar
Sulunia
Party member
Posts: 203
Joined: Tue Mar 22, 2016 1:10 pm
Location: SRS, Brazil

Re: Bad Apple!! in Love2D

Post by Sulunia »

So, here's my version ATM:
https://www.mediafire.com/?rudl2g4x8d4t1l2 << Video input file
badapplePlayer.love << attached to this post.

To run it, run the ".love" file and drop the "badapple.video" on Love window.

Code: Select all

Information: 
Audio >> 263Kb 8bit-esque
Video >> 26.431Kb uncompressed raw file
Video specs >> 255x255 30FPS Black-or-White
Notes:
- Video goes unsync with Audio. That is expected i guess, altough i tried to "alleviate" the problem.
- The player actually requires a beefy CPU to run properly.
- Some frames blink, due to a badly implemented optimization. :?

And i just had an idea on another file format i could use.. Hmm :roll:
Attachments
badapplePlayer.love
The actual video file is up there!
(172.67 KiB) Downloaded 68 times
Don't check my github! It contains thousands of lines of spaghetti code in many different languages cool software! :neko:
https://github.com/Sulunia
User avatar
zorg
Party member
Posts: 3468
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Bad Apple!! in Love2D

Post by zorg »

Neat! Though looks like you went the easy way with the audio :3
Still, the current stats are:

Code: Select all

- Segfautld: video:  1bit(2 shades)  64 x  64 @    733 059 Bytes,     audio: mp3 @ 654 696 Bytes
- Sulunia:   video:  1bit(2 shades) 256 x 256 @ 27 064 334 Bytes,     audio:  it @ 269 076 Bytes
- zorg:      video:  3bit(5 shades)  64 x  64 @  2 997 885 Bytes (*), audio: To Be Made
*With me writing out bits as the strings '0' and '1', combining those to 3-bit runs in normal 8-bit string characters makes it worse, using ~4.6 MB. Kinda don't want to write the decoder, since it'd be somewhat pointless :c
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
User avatar
Sulunia
Party member
Posts: 203
Joined: Tue Mar 22, 2016 1:10 pm
Location: SRS, Brazil

Re: Bad Apple!! in Love2D

Post by Sulunia »

zorg wrote:Neat! Though looks like you went the easy way with the audio :3
Just for now... I'm still going to try another file format/drawing routine and then mess around with the audio. I'm clearly not happy with a 27mb file format you see xD


Btw, what res you're aiming for?
Don't check my github! It contains thousands of lines of spaghetti code in many different languages cool software! :neko:
https://github.com/Sulunia
User avatar
zorg
Party member
Posts: 3468
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Bad Apple!! in Love2D

Post by zorg »

For the video? The plan was to encode a 128x128 sized input format into 64x64, but using a very primitive form of antialiasing on the edges, so my output would not be 1-bit monochrome, but would have had these levels: 0, 25, 50, 75, 100 % lightness.

And yes, i wasn't happy with a 3MB one either :)
But to be fair, even if i continued coding the decoder, my biggest issue would be that i'd probably had to modify the encoder a bit as well, since i might not be able to detect the sizes of the frames without storing them explicitly... after the last encoding step, anyway.
To be honest, i'd rather create examples for my AudioDevice implementation so i can share that instead. (even if i considered using this as an example too)
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
User avatar
Sulunia
Party member
Posts: 203
Joined: Tue Mar 22, 2016 1:10 pm
Location: SRS, Brazil

Re: Bad Apple!! in Love2D

Post by Sulunia »

zorg wrote:For the video? The plan was to encode a 128x128 sized input format into 64x64, but using a very primitive form of antialiasing on the edges, so my output would not be 1-bit monochrome, but would have had these levels: 0, 25, 50, 75, 100 % lightness.

And yes, i wasn't happy with a 3MB one either :)
Yup, i need to work on my video as well. But i don't know, messing with audio surely seens way more fun.
Filesize went from 269 076 Bytes to 50 635 Bytes, besides sounding better and having another bass instrument (triangle).
I guess i have no other excuses for not messing around with the video now..
Attachments
BadApple ImpulseTracker Improved.zip
Stupidly improved IT BadApple conversion
(16.06 KiB) Downloaded 84 times
Don't check my github! It contains thousands of lines of spaghetti code in many different languages cool software! :neko:
https://github.com/Sulunia
User avatar
zorg
Party member
Posts: 3468
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Bad Apple!! in Love2D

Post by zorg »

Your triangle's a bit detuned though, around pattern 23-25, when high notes are played with it; change the frequency to around 43k from 44.1k, sounds much better. :3
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest