Omnimaga
Calculator Community => Other Calc-Related Projects and Ideas => TI Z80 => Topic started by: zero44 on April 28, 2011, 04:12:13 pm
-
Hello,
I less than 1 hour, I made a piano in Axe, which can play sound on five octaves.
(Axe sound in Hertz : Freq(32768/Hz, TIME) )
I add a picture, a mix of 8 white keys, 5 blacks, and a hole at the end of each key :
When we press a key, I make sound, and a X ( for blacks ) or a little donut ( whites ) go out of the key :hyper:
You need to take your calc with the screen on your left, and the port on your right.
To play a note, press the key as it were a real piano : the [2nd] to [->] keys are the 8 whites, and to play black keys, its the key just over the white :
C note is [2nd], C# is [mode], D is [alpha], D# is [xtOn], etc.
with [▲] or [apps] you can go down of an octave, and go up with [▼] or [1].
I'll put codes soon, and a gif in 2 weeks ( no wabbitemu here, in vacations ... :'()
-
oooh nice.
Does it support multiple notes?
I tried to do it one time, and I managed to make it produce 2 notes at a same time, but it barely works so XP
-
Very cool, nice! I don't know much about music, but I want to make a sound player on my calc now XD
-
?!.
How can you make two sounds with axe ?
If two notes are pressed, only the higher is played.
Just a bug : the sound quality is ... :banghead: (like this ^^)
I tried interrupts, but can you explain me how it works ? After many seconds I've no more sound... :(
-
This is great! I was thinking about making a guitar program at some point. :P I'll have to find a way to defy reality and play 6 notes at once though xD
?!.
How can you make two sounds with axe ?
If two notes are pressed, only the higher is played.
One way is to alternate back and forth between the two frequencies very quickly.
-
Maybe you have to detect both keys and then play one after the other real fast? Is there a way to really "mix" sounds?
-
well, as i said, it barely works.
This is what I did:
for(A, 0, 100
freq(314,400
pause 10
freq(284,400
pause 10
End
Doesnt work on most of it(it sounds wierd) but it works.
EDIT: oh btw, i tried when i was porting music
EDIT2: ninja'd, ninja'd. pity me.
-
Yeah, I thought too to a guitar...
I wanted to do guitar hero ^^
But have you an easy-to-do game idea with this ?
-
Technically, when you're hearing multiple notes it's really just a combination of the frequencies. But that's just simple physics of adding and subtracting waves.
-
supporting "real" multiple notes is what I really want in Axe.
-
Cool! I made a guitar hero like game that used sound, but not in Axe :/
-
good night .
XD.
-
If you release it I could make a video of Wabbit with sound :D This looks cool though
-
Sounds nice.
I wish you luck with it!
-
Does Wabbit record sound, too?
-
supporting "real" multiple notes is what I really want in Axe.
Conceptually that's pretty simple. Say you have the equation for three notes, f(t) g(t) h(t). The amplitude at any given t would just be f(t)+g(t)+h(t). Sum them all up. But it's not quite as easy when it comes to actually writing that out so it runs fast enough to produce the correct sound output with a chip like the z80 :P
-
Does Wabbit record sound, too?
It does, you just have to 'tick' that option in the menu.
-
Nice !
Looks like what I programmed back in the days ...
http://www.ticalc.org/archives/files/fileinfo/405/40553.html (http://www.ticalc.org/archives/files/fileinfo/405/40553.html)
(http://www.ticalc.org/archives/files/ss/767/76713.gif)
EDIT :
Actually, this composer is what I meant :
http://ti.bank.free.fr/index.php?mod=archives&ac=voir&id=986 (http://ti.bank.free.fr/index.php?mod=archives&ac=voir&id=986)
(http://tiforge.info/zcontest/screens/alpha2.gif)
-
Sounds like a great program! I'm so glad to see the new programs with sound. :)
-
This is great! I was thinking about making a guitar program at some point. :P I'll have to find a way to defy reality and play 6 notes at once though xD
?!.
How can you make two sounds with axe ?
If two notes are pressed, only the higher is played.
One way is to alternate back and forth between the two frequencies very quickly.
The problem with oscillation is that if you go too fast, it sounds like crap, but if you go too slow, it doesn't sound blended.
The problem becomes even worse if you press like five keys at the same time X.X
-
how to use interrupts in axe ?
I could make a better sound ...
-_-" I lost the pic needed by the program ...
I have to remake it.
-
supporting "real" multiple notes is what I really want in Axe.
Conceptually that's pretty simple. Say you have the equation for three notes, f(t) g(t) h(t). The amplitude at any given t would just be f(t)+g(t)+h(t). Sum them all up. But it's not quite as easy when it comes to actually writing that out so it runs fast enough to produce the correct sound output with a chip like the z80 :P
Yep, that is all it takes to play multiple notes at once. Just add up all the sine waves and output the new weird looking wave.
However, the calculator can only output a 1 or a 0, so how do you pull off all the intermediate steps of the new wave? That is where the real trouble comes in to play. For this, you would have to make your own version of freq() whereby using Pulse Width Modulation, (turning the link port on and off really fast), you simulate say, 32 different voltage steps. (That might be the most grammatically strange sentence I've written on Omni)
-
how to use interrupts in axe ?
I could make a better sound ...
Yep, just use FnInt(LBL, FREQ)
Freq is 0-6, 6 being the slowest.
Make sure that the LBL location is formatted as a sub program (with a Return at the end).
Also, you can't use L2 while you are running custom interrupts.
At the end of the program, make sure to use LnReg. If you don't, it will cause a ram clear. ;)
-
What do FnOn and FnOff ?
I tried with interupts, I had sound for 2 seconds, but I don't remember if I used FnOn or FnOff ... ::)
I remade the picture, I give you codes .
-
Actually, aeTIos made a music composer & player in Axe, looking very good.
-
really? Can I haz a link?
-
Yep, that is all it takes to play multiple notes at once. Just add up all the sine waves and output the new weird looking wave.
However, the calculator can only output a 1 or a 0, so how do you pull off all the intermediate steps of the new wave? That is where the real trouble comes in to play. For this, you would have to make your own version of freq() whereby using Pulse Width Modulation, (turning the link port on and off really fast), you simulate say, 32 different voltage steps. (That might be the most grammatically strange sentence I've written on Omni)
It's exactly as thepenguin77 said: use Pulse Width Modulation. To explain PWM a bit better, why don't I give an example of some basic PWM.
An nice, simple example would be something like having an LED fade on and off. LEDs have two states: ON and OFF. So how do you fade it? The idea is the same as grayscale on a monochrome calculator screen: some of the time it's turned on, and some of the time it's turned off. But the switch is done very quickly. You can think of it as pulsing on and off. Pulse Width Modulation means changing the width (length) of the on/off pulses.
In this case, thepenguin77 mentioned simulating 32 voltage steps. Basically, that means that every 32 1's or 0's you send represents one pulse. You then change how much of that time you're sending a 1 or sending a 0 to change the pulse frequency. So for fading an LED, the pulses would look something like:
00000000000000000000000000000000 (Lowest possible step);
10000000000000000000000000000000
11000000000000000000000000000000
...
11111111111111110000000000000000
11111111111111111000000000000000
11111111111111111100000000000000
...
all the way up to
...
11111111111111111111111111111100
11111111111111111111111111111110
11111111111111111111111111111111 (Highest possible step)
That would fade it from being completely off, to completely on. The same idea goes for varying the frequencies that you are playing, though it's obviously a lot less linear.
-
How do you find the piano ?
I'm trying interrupts, with what ralphdspam said.
EDIT: I've no headphones here ... -_-'
-
Actually, aeTIos made a music composer & player in Axe, looking very good.
It was Michael_Lee i think, I never made a sound program. :)
-
Interrupts does not work.
-
Hey !
I'm back here.
Big update for TI-Piano (see under), with a menu with options to change keys.
Now you can modify 'note density' and keys to change of octave.
To compile it:
Launch PIAN0 (TI-Basic prgm which will draw & store pic)
Restore backup AXEPIANO.8xv and compile it.
I'm not sure that it will work on Axe 1.*.*; but add spaces and it should be working.
Enjoy !
(I make a 7-octaves piano, but on old version ... )
-
Wow, that looks awesome! /me will download
-
O.O wow XD
... and the new emoticon...
:trollface:
-
?!.
How can you make two sounds with axe ?
Alternate between them, really fast.
EDIT: Okay, that was basically useless. My bad. I'll be sure to check out this program as soon as I can!
-
So, is the current version supports multi notes?
-
I like these kind of things...
*DualBLDR downloads, and then rocks himself out of this world :trollface:
-
Hey,
I post it just to say you that the current downloadable version is the 1.1bêta, the final 1.0 will be finished in july.
Upcoming Features:
- Recording songs in appvars
- Playing music from an appvar
- Maybe multinotes ( if I found how to play them :angel: )
- New Design and no more external Pic
Please post a lot if you liked the flying donuts, 'cause I'll replace them by A, C#, F, etc. soon if nobody disagrees.
EDIT: I'll try too to adjust sound frequences, actually it's in 8-bit datas, I'll make high-quality 16-bit numbers =)