This is an archived, read-only copy of the United-TI subforum , including posts and topic from May 2003 to April 2012. If you would like to discuss any of the topics in this forum, you can visit Cemetech's Your Projects subforum. Some of these topics may also be directly-linked to active Cemetech topics. If you are a Cemetech member with a linked United-TI account, you can link United-TI topics here with your current Cemetech topics.

This forum is locked: you cannot post, reply to, or edit topics. Project Ideas/Start New Projects => Your Projects
Author Message
Seren


Newbie


Joined: 14 Aug 2009
Posts: 27

Posted: 14 Aug 2009 10:04:25 pm    Post subject:

Hi all, none of you know me, because I haven't posted before... because I have had nothing to contribute to this community... until now.

Over the last few months (working on and off), I have developed my first game asm, Guitar Calculator. This is an imitation of Guitar Hero. The game is fully functional, and I do not see any bugs, although it could still do with a few tweaks. I would ask that you people try it out and give me some feedback, before I fully and truly release it to the world to prey upon.

This game was developed on a Ti-84 Plus. To my surprise, the processor of this calculator is actually slightly faster than that of the regular Ti-83+, I have discovered to my dismay. This means that songs will run at 100% on the Ti-84+, but only around 90-95% on the Ti-83+. In my final release, there will be a version for both the 84+ and 83+, but until then, I'm afraid this is all I have.



Guitar Calculator (or GuitCalc for short) uses MirageOS (despite the fact that it uses none of the routines provided within). To play songs you need to have both the main game program (GUITCALC.8XP) and any additional song files (located in the Songs folder). So far I have 5 songs that run in my program, although many more will be included later (all Guitar Hero 1 & 2 songs). There are two types of files in each folder. A file is labled either numerically or alphanumerically. The most important files are the latter (SongNameA.8xv, SongNameB.8xv, SongNameC.8xv, SongNameD.8xv). Each file is a difficulty level of the song (Easy, Medium, Hard, and Expert). YOU NEED THIS TYPE OF FILE TO PLAY THE SONG. On the other hand, the numbered files are not absolutely necessary. This files provide sound for the song. The song can be played perfectly fine even if these files are not included. However, if you have a 3.5mm>2.5mm adaptor and are willing to sacrifice a significant portion of ROM for the sound, please do so. It can be much more enjoyable with it. All of the related song files (which are AppVars, by the way) must be present in the archive, and not the RAM, or else they will not be recognized.

To play (for more detail read the included readme.txt), run the program. After the splash screen, on the left you will be able to scroll up and down to select the song you would like to play. On the right, basic information about the song is provided, as well as the difficulty level (corresponding to the letter), and the top 3 hiscores. Once you have selected a song, you must press GRAPH to play.

The song will commence immediately. Please refer to the included image file "QuickInstructions.PNG" for the proper way of holding the calculator (to avoid catostrophic injuries and apocalypses). Hold the calculator sideways with the screen on the right, and use the thumb of your right hand to press the GRAPH button to strum while holding down on the proper frets (buttons STO>, LN, LOG, X², X-1). You must strum as the circles pass the line at the bottom of the screen (you may notice a small line appear along this line to show you which frets you are pressing down).

Beside the board, you will notice 3 numbers. The first is your score. You get 5 points times your multiplier every time you hit a note or chord. The middle is your current notestreak, which resets to 0 every time you miss a note. The last is your multiplier, which goes up to 4X, changing at a notestreak of 10, 20 and 30. When you get a notestreak of 30 you will enter a "starpower" mode (you shall see... if you are good enough).

When the song is over, if you have a score that reaches the hiscores, you will be able to type in your name (8 characters, letters only) and press ENTER to immortalize yourself in your hiscore list for the specific song.

Press DEL at any time to quit.

So that's the end of my "short" instructions. Fuller instructions (ha!) are in the readme.txt, which includes version history, practice mode, and maybe another thing or two I failed to mention.


Any feedback would be appreciated!

Thanks,
Seren

PS: For those interested, the sound quality is rated at PCM 8.000 kHz, 1 bit, Mono. Yes, that's 1 bit. The quality can be quite good at times (see "Hey" by "Honest Bob" and "Hey You" by "The Exies"), but at other places it suffers a lot, depending on many factors.

Edit: See http://www.unitedti.org/index.php?showtopi...st&p=135621 for the new sound quality developped for the game (the game itself does not run in this version, only the sound though)


Last edited by Guest on 18 Aug 2009 12:10:58 pm; edited 1 time in total
Back to top
magicdanw
pcGuru()


Calc Guru


Joined: 14 Feb 2007
Posts: 1110

Posted: 14 Aug 2009 11:32:43 pm    Post subject:

Awesome! I believe this is the first finished guitar game with sound for the calculator! I'd try it out right now, but I don't know where my calculator and headphone adapter are. Lately I'm a pathetic excuse for a calculator coder Razz
Back to top
Taricorp


Member


Joined: 09 Mar 2006
Posts: 188

Posted: 14 Aug 2009 11:52:57 pm    Post subject:

Neat! (And welcome to UTI.) I can't see this getting a whole lot of use, but looks like a well-done project. Here's hoping you keep developing- we could use some fresh blood around here.

magicdanw wrote:
Lately I'm a pathetic excuse for a calculator coder Razz

Agreed. Being depressed does wonders for your productivity. Rolling Eyes
Back to top
JoeYoung


Advanced Member


Joined: 15 Nov 2008
Posts: 316

Posted: 15 Aug 2009 12:01:05 am    Post subject:

OH MY GOD

Playing it, its extremely impressive! But I have two qualms:

The frets are hard to hit, but I was able to make do with a thumb. The notes are tough to nail, though, perhaps if you made them bigger?

The sound quality. really needs work. I wish it was louder, but not a big deal. 1 bit may not be enough. could you make do with something better?
Back to top
tiuser1010


Member


Joined: 23 Apr 2009
Posts: 100

Posted: 15 Aug 2009 01:03:58 am    Post subject:

Wow this is an absolutly great game and i was just about to post a topic about how sound works on computers (or calculators) How does it work, if its not too off topic
Back to top
Seren


Newbie


Joined: 14 Aug 2009
Posts: 27

Posted: 15 Aug 2009 02:21:41 pm    Post subject:

metagross111 wrote:
OH MY GOD

Playing it, its extremely impressive! But I have two qualms:

The frets are hard to hit, but I was able to make do with a thumb. The notes are tough to nail, though, perhaps if you made them bigger?

The sound quality. really needs work. I wish it was louder, but not a big deal. 1 bit may not be enough. could you make do with something better?


Do you mean that the frets are hard to hit because the buttons are too closely together? I experimented with several configurations (On/0/./(-)/ENTER), (ON/LN/X²/MATH/2ND), but for the first the buttons are not properly aligned on the 84+, and for the second, even though you have extra space, it was too hard to press on the right buttons (given that you can only have 4 fingers at once, and you need to move over 2 buttons to move up or down). With my current configuration, I generally play with 2 fingers, and occasionally 3. For chords with two adjacent frets, I sometimes use 1 finger to press both. This configuration was really the one that worked out the best, despite its drawbacks.

I could try making the notes bigger, although it means that there won't be room for the score on the side (maybe put it on top of the scrolling notes?). Does anyone else agree with this idea? (to save me a lot of time in changes)

I don't see how to improve the quality past 1 bit, unfortunately. The sound already takes a massive amount of space on the calculator, and, as far as I can tell, the I/O port works only bitwise, (0 volt and 5 volt, I think). Usually a modulator allows for variable voltage (0,1,2,3,4,5,etc), which would be equivilant to multiple bits, but the calculator doesn't have one, given that it isn't supposed to play sound. I don't know how to improve the sound quality any further (apart from changing it from Mono to Stereo, but really, I don't think that double the memory is worth the tiny improvement it gives). Anyone who has worked with sound before have anything on this subject?

tiuser1010 wrote:
Wow this is an absolutly great game and i was just about to post a topic about how sound works on computers (or calculators) How does it work, if its not too off topic


Well, a computer uses a sound card, a piece of hardware to make sound. I don't know how that works - look it up.


Sound is represented by a wave - to play the sound with speakers, you need to change the voltage following the wave.
So let's say for example for the next 5 "ticks" of sound the wave follows (100sin(0.5X)), making the following:

0     0
1     2.4
2     4.2
3     5.0
4     4.5
5     3.0

So to make the sound, you would send out a voltage of 0V to your speakers/earpieces, then 2.4V, then 4.2V, etc. This makes the air vibrate in the pattern shown above (a simple sin wave), which makes the sound.

The calculator's I/O port uses bit data to send information so it can only have 0 volts or 5 volts, so the above would be represented like this:

0     0
1     0
2     5
3     5
4     5
5     5
6     0

which is obviously less precise.

Hope I didn't lose you there.

The lowest quality of sound you generally get on your computer is 8.000 kHz, 8-bit, which means that there are 8000 datapoints following the curve of the wave per second, and each point is a number from 0 to 255 (giving 256 possibilities of heights for the vibration). CD quality is 48.000 kHz, and 16-bit, I think.


Last edited by Guest on 15 Aug 2009 02:24:38 pm; edited 1 time in total
Back to top
calc84maniac


Elite


Joined: 22 Jan 2007
Posts: 770

Posted: 15 Aug 2009 02:33:52 pm    Post subject:

http://en.wikipedia.org/wiki/Pulse-width_modulation
Back to top
fullmetalcoder


Member


Joined: 01 Aug 2009
Posts: 139

Posted: 15 Aug 2009 02:38:49 pm    Post subject:

You should take a look at Real Sound for ideas on how to improve the output (and a demonstration that more than 1bit is possible) : http://www.ticalc.org/archives/files/fileinfo/385/38513.html

Obviously the increase in quality implies bigger size for sound files and probably uses more CPU time so you'll have to make compromises but a 2 or 3 bit output should be a lot better already.
Back to top
tiuser1010


Member


Joined: 23 Apr 2009
Posts: 100

Posted: 15 Aug 2009 03:40:23 pm    Post subject:

Quote:
The calculator's I/O port uses bit data to send information so it can only have 0 volts or 5 volts, so the above would be represented like this:

0 0
1 0
2 5
3 5
4 5
5 5
6 0

which is obviously less precise.

Hope I didn't lose you there.

The lowest quality of sound you generally get on your computer is 8.000 kHz, 8-bit, which means that there are 8000 datapoints following the curve of the wave per second, and each point is a number from 0 to 255 (giving 256 possibilities of heights for the vibration). CD quality is 48.000 kHz, and 16-bit, I think.


Is that why it's called 1-bit because it can only hold two states
Back to top
Seren


Newbie


Joined: 14 Aug 2009
Posts: 27

Posted: 15 Aug 2009 04:39:26 pm    Post subject:

calc84maniac wrote:


Yes, I've thoguht about that (although I didn't know the name and couldn't find something like that on the net), but I'm not sure how to incorporate it. If I use the term from wikipedia, I don't know how I am to figure out the "duty cycle" of the sound at each given point. That's why I ended up simply rounding the information in each byte to either a 0 or 1. Any ideas?

tiuser1010 wrote:
Is that why it's called 1-bit because it can only hold two states


Right. The information for each point on the wave is stored in a bit (0 or 1).
Back to top
calc84maniac


Elite


Joined: 22 Jan 2007
Posts: 770

Posted: 15 Aug 2009 05:55:49 pm    Post subject:

It's a lot like grayscale, really. So if you went 2-bit, for 00 you would want the voltage off, for 01 you would want it off 2/3 of the time and on 1/3 of the time, for 10 you need it off 1/3 of the time and on 2/3 of the time, and for 11 you would want it on all the time.
Back to top
Seren


Newbie


Joined: 14 Aug 2009
Posts: 27

Posted: 15 Aug 2009 06:15:16 pm    Post subject:

calc84maniac wrote:
It's a lot like grayscale, really. So if you went 2-bit, for 00 you would want the voltage off, for 01 you would want it off 2/3 of the time and on 1/3 of the time, for 10 you need it off 1/3 of the time and on 2/3 of the time, and for 11 you would want it on all the time.


But that's not it. You make sound by the fluctuation in the sound wave, not by its "height". For example, when there is no sound, the value (8-bit) stays at 80h. I do not want it rapidly alternating between on and off for 50% of the time - which would create a very high-pitched noise all the time (C on the 8th octave). So I need to monitor the dips in the wave, and I do not know how to quantify this information for the PWM.

It isn't like grayscale.
Back to top
JoeYoung


Advanced Member


Joined: 15 Nov 2008
Posts: 316

Posted: 15 Aug 2009 06:35:53 pm    Post subject:

Seren wrote:
metagross111 wrote:
OH MY GOD

Playing it, its extremely impressive! But I have two qualms:

The frets are hard to hit, but I was able to make do with a thumb. The notes are tough to nail, though, perhaps if you made them bigger?

The sound quality. really needs work. I wish it was louder, but not a big deal. 1 bit may not be enough. could you make do with something better?


Do you mean that the frets are hard to hit because the buttons are too closely together? I experimented with several configurations (On/0/./(-)/ENTER), (ON/LN/X²/MATH/2ND), but for the first the buttons are not properly aligned on the 84+, and for the second, even though you have extra space, it was too hard to press on the right buttons (given that you can only have 4 fingers at once, and you need to move over 2 buttons to move up or down). With my current configuration, I generally play with 2 fingers, and occasionally 3. For chords with two adjacent frets, I sometimes use 1 finger to press both. This configuration was really the one that worked out the best, despite its drawbacks.

I could try making the notes bigger, although it means that there won't be room for the score on the side (maybe put it on top of the scrolling notes?). Does anyone else agree with this idea? (to save me a lot of time in changes)

I don't see how to improve the quality past 1 bit, unfortunately. The sound already takes a massive amount of space on the calculator, and, as far as I can tell, the I/O port works only bitwise, (0 volt and 5 volt, I think). Usually a modulator allows for variable voltage (0,1,2,3,4,5,etc), which would be equivilant to multiple bits, but the calculator doesn't have one, given that it isn't supposed to play sound. I don't know how to improve the sound quality any further (apart from changing it from Mono to Stereo, but really, I don't think that double the memory is worth the tiny improvement it gives). Anyone who has worked with sound before have anything on this subject?

tiuser1010 wrote:
Wow this is an absolutly great game and i was just about to post a topic about how sound works on computers (or calculators) How does it work, if its not too off topic


Well, a computer uses a sound card, a piece of hardware to make sound. I don't know how that works - look it up.


Sound is represented by a wave - to play the sound with speakers, you need to change the voltage following the wave.
So let's say for example for the next 5 "ticks" of sound the wave follows (100sin(0.5X)), making the following:

0 0
1 2.4
2 4.2
3 5.0
4 4.5
5 3.0

So to make the sound, you would send out a voltage of 0V to your speakers/earpieces, then 2.4V, then 4.2V, etc. This makes the air vibrate in the pattern shown above (a simple sin wave), which makes the sound.

The calculator's I/O port uses bit data to send information so it can only have 0 volts or 5 volts, so the above would be represented like this:

0 0
1 0
2 5
3 5
4 5
5 5
6 0

which is obviously less precise.

Hope I didn't lose you there.

The lowest quality of sound you generally get on your computer is 8.000 kHz, 8-bit, which means that there are 8000 datapoints following the curve of the wave per second, and each point is a number from 0 to 255 (giving 256 possibilities of heights for the vibration). CD quality is 48.000 kHz, and 16-bit, I think.


You didn't lose me :P

The only thing I can think of at this point is manufacture new music minus lyrics, like a song made of beeps. It won't sound as impressive, maybe, but it will be clear, and I think, more fun. as for the frets, they ARE possible to use, but with the no-nonsense note detection it's pretty hard to work them accurately. I think you could fix this by expanding the area of hit detection, if that makes sense, instead of making the notes bigger.
Back to top
Graphmastur


Advanced Member


Joined: 25 Mar 2009
Posts: 360

Posted: 15 Aug 2009 06:48:54 pm    Post subject:

calc84maniac wrote:
It's a lot like grayscale, really. So if you went 2-bit, for 00 you would want the voltage off, for 01 you would want it off 2/3 of the time and on 1/3 of the time, for 10 you need it off 1/3 of the time and on 2/3 of the time, and for 11 you would want it on all the time.

is that high/low lines? If so, I might try this.
Back to top
Seren


Newbie


Joined: 14 Aug 2009
Posts: 27

Posted: 15 Aug 2009 07:10:24 pm    Post subject:

metagross111 wrote:
You didn't lose me :P

The only thing I can think of at this point is manufacture new music minus lyrics, like a song made of beeps. It won't sound as impressive, maybe, but it will be clear, and I think, more fun. as for the frets, they ARE possible to use, but with the no-nonsense note detection it's pretty hard to work them accurately. I think you could fix this by expanding the area of hit detection, if that makes sense, instead of making the notes bigger.


Well, sure - any song works. I've noticed that Hey by Honest Bob sounds nice a clear (in comparaison). But for now I'll be getting all of the GH1 and 2 songs, since I can quickly acquire them without inventing note patterns for new songs.

Well, I myself have no trouble hitting the notes when I see them (on Easy, Medium, and often on Hard - Expert can get difficult (except Rock N Roll)), although I might add I tend to hit the notes earlier then the "middle" point - I hit them as soon as the note touches the line. (Maybe it's a matter of a bit of practice - but I'm quite able to get 100% on Easy and some Mediums now already with the "no nonsense" detection) I think the problem is that the notes are not perfectly aligned with the song - I'm noticing that the notes are about a second late by the end of Hey and Hey You. Perhaps if I fix that it'll go better.

Graphmastur wrote:
calc84maniac wrote:
It's a lot like grayscale, really. So if you went 2-bit, for 00 you would want the voltage off, for 01 you would want it off 2/3 of the time and on 1/3 of the time, for 10 you need it off 1/3 of the time and on 2/3 of the time, and for 11 you would want it on all the time.

is that high/low lines? If so, I might try this.


Yes, we are talking about the high/low lines. There are actually 2 lines, and each corresponds to 1 speaker (meaning the calculator has stereo sound). However, each line only operates at a bit level.


Last edited by Guest on 15 Aug 2009 07:11:47 pm; edited 1 time in total
Back to top
FloppusMaximus


Advanced Member


Joined: 22 Aug 2008
Posts: 472

Posted: 15 Aug 2009 08:00:44 pm    Post subject:

This is quite impressive. Especially for your first assembly program!

With regard to PWM: yes, the idea is to cycle very rapidly - at least 20,000 times per second, and ideally somewhat higher, so that it will be inaudible. With a bit of work (including writing your own code to access the LCD driver) I think it should be possible to acheive this. The question is, how much does precision in amplitude (more bits per sample) matter to you, as opposed to precision in frequency (more samples per second?)

Edit: Oh, and Seren: it would be nice if you could set the "archive" bit on your appvar files, so they'd be transferred to the archive by default.


Last edited by Guest on 15 Aug 2009 08:05:45 pm; edited 1 time in total
Back to top
Seren


Newbie


Joined: 14 Aug 2009
Posts: 27

Posted: 15 Aug 2009 08:43:46 pm    Post subject:

FloppusMaximus wrote:
This is quite impressive. Especially for your first assembly program!

With regard to PWM: yes, the idea is to cycle very rapidly - at least 20,000 times per second, and ideally somewhat higher, so that it will be inaudible. With a bit of work (including writing your own code to access the LCD driver) I think it should be possible to acheive this. The question is, how much does precision in amplitude (more bits per sample) matter to you, as opposed to precision in frequency (more samples per second?)

Edit: Oh, and Seren: it would be nice if you could set the "archive" bit on your appvar files, so they'd be transferred to the archive by default.


I am using my own code to access the LCD driver - the memory part I'm using to map to the screen is only 130 bytes in size. (5x2x13 - frets x edge/middle of circle x columns (+1 to let the circle overflow a bit to the right - it's faster than checking if it's completely on the screen, and I don't draw the 13th column))

What I'm doing is I update the sound, then process the game a tiny bit, and then update the sound again. I update the sound every 782 clock ticks (Ti-84+, should be around 762 for the 83+, but will have to confirm), and this is at 8.000 kHz. When there are no complications (loading the next AppVar file, or changing bytes of information (as I operate bitwise)), I use the extra clock cycles (594) to process a bit more of the game in a sort of madeshift interrupt (although I don't use the actual interrupts since I find I have less control over them - and I never really was interested in them - and they'd mess up the sound). This means every second I can run 7000 of my "interrupts" - which is enough to update the dots at a sufficient speed, but I fear that if I increase my speed to 20.000 kHz, then each "interrupt" would only last 124 ticks... which isn't way near enough to cover the game side of, well, the game.

I don't know how I increase the amplitude past a single bit (sent an email to the guy who made RealSound, but of course he hasn't answered yet), so I can't give a definite answer to that. However, it would probably still eat up some of my time so I'd have left time for my "interrupts."

On a side note, I am using a primitive form of PWM although at 8,000 times per cycle I guess.

As for the AppVars, I didn't find any documentation for the files on the computer so I kinda figured them out myself (using a (mostly) empty program file). I did notice an Archive flag at one point, but it was after I had created the files I uploaded here. Now I can't really remember which byte in the file to modify to make it go to the Archive by default, so could you please enlighten me?

Edit: It isn't my first Assembly program, but my first real one. I've fooled around with it a bit to figure out its inner secrets (optimizations, ports, whatnot), designing a program to convert an image on the computer into grayscale to be displayed on the calculator (look at my Halo avatar), and opening up other people's programs, but this is the first notable thing I've created that I would consider showing others (which I did).

Edit2: If anyone wants to try any other song from Guitar Hero 1 or 2 that I don't have yet (i.e. your favourites), tell me and I'll probably be able to get it within the hour (that I see you request it).

And, shockingly but randomly, I've played Guitar Hero twice in my life (not including on the calculator).


Last edited by Guest on 15 Aug 2009 08:50:47 pm; edited 1 time in total
Back to top
tiuser1010


Member


Joined: 23 Apr 2009
Posts: 100

Posted: 15 Aug 2009 09:44:12 pm    Post subject:

So seren, is there some sort of command to sound maybe something involving the set insturction
Back to top
FloppusMaximus


Advanced Member


Joined: 22 Aug 2008
Posts: 472

Posted: 15 Aug 2009 09:45:26 pm    Post subject:

It is a difficult problem. RealSound devotes the full CPU power to playing sound; there's no game to worry about. :)

I still think you could do, say, 2-bit sound with 20 kHz PWM. It would take up a substantial amount of CPU time, it's true. But it doesn't really have to get in the way of what you're doing; you could simply do

Code:
exx
outi
res 2,l
exx

roughly every 75 clock cycles (and in fact, the res 2,l is only needed every fourth time.) When you read a sample, you'd set HL' to the address of one of four buffers, each aligned to an 8-byte boundary, containing the byte sequences to be output.

To mark a file as archived, set the twelfth byte of the variable header (in this case, byte 0x44 of the file) to 0x80.


Last edited by Guest on 15 Aug 2009 09:48:42 pm; edited 1 time in total
Back to top
Seren


Newbie


Joined: 14 Aug 2009
Posts: 27

Posted: 15 Aug 2009 09:53:55 pm    Post subject:

But that isn't 2-bit sound, is it? It's stereo (well, I guess 2-bit, but you know what I mean). I know I can do stereo sound - but I don't think that it's particularly advantageous, as half would be only going to one ear, and it wouldn't blend.

I haven't thought of the way you suggested with the sound. I think I might try it out in a bit, although does it *really* need to be as high as 20,000 to be an appropriate quality? (and doesn't PWM operate at a single bit level, so that we don't need 2-bit sound? Already with this increase in file size the normal Ti-84+ would only be able to play 1 song)
Back to top
Display posts from previous:   
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
    » Goto page 1, 2, 3  Next
» View previous topic :: View next topic  
Page 1 of 3 » All times are UTC - 5 Hours

 

Advertisement