Author Topic: An Axe piano with 5 octaves  (Read 10648 times)

0 Members and 1 Guest are viewing this topic.

Offline ZippyDee

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 729
  • Rating: +83/-8
  • Why not zoidberg?
    • View Profile
Re: An Axe piano with 5 octaves
« Reply #15 on: April 28, 2011, 04:28:40 pm »
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
There's something about Tuesday...


Pushpins 'n' stuff...


Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: An Axe piano with 5 octaves
« Reply #16 on: April 28, 2011, 04:29:22 pm »
Does Wabbit record sound, too?

It does, you just have to 'tick' that option in the menu.

Offline Adriweb

  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1708
  • Rating: +229/-17
    • View Profile
    • TI-Planet.org
Re: An Axe piano with 5 octaves
« Reply #17 on: April 28, 2011, 04:34:55 pm »
Nice !

Looks like what I programmed back in the days ...
http://www.ticalc.org/archives/files/fileinfo/405/40553.html



EDIT :

Actually, this composer is what I meant :
http://ti.bank.free.fr/index.php?mod=archives&ac=voir&id=986
« Last Edit: April 28, 2011, 04:37:13 pm by adriweb »
My calculator programs
TI-Planet.org co-admin.
TI-Nspire Lua programming : Tutorials  |  API Documentation

Offline ralphdspam

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 841
  • Rating: +38/-1
  • My name is actually Matt.
    • View Profile
Re: An Axe piano with 5 octaves
« Reply #18 on: April 28, 2011, 10:39:48 pm »
Sounds like a great program!  I'm so glad to see the new programs with sound.  :)
« Last Edit: April 28, 2011, 10:42:31 pm by ralphdspam »
ld a, 0
ld a, a

Offline Michael_Lee

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1019
  • Rating: +124/-9
    • View Profile
Re: An Axe piano with 5 octaves
« Reply #19 on: April 29, 2011, 01:42:55 am »
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
My website: Currently boring.

Projects:
Axe Interpreter
   > Core: Done
   > Memory: Need write code to add constants.
   > Graphics: Rewritten.  Needs to integrate sprites with constants.
   > IO: GetKey done.  Need to add mostly homescreen IO stuff.
Croquette:
   > Stomping bugs
   > Internet version: On hold until I can make my website less boring/broken.

Offline zero44

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 128
  • Rating: +21/-0
  • <!--//www.ustr.net/infrared/infrared1.shtml-->
    • View Profile
    • zero44
Re: An Axe piano with 5 octaves
« Reply #20 on: May 07, 2011, 02:54:14 pm »
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.
____________

Offline thepenguin77

  • z80 Assembly Master
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1594
  • Rating: +823/-5
  • The game in my avatar is bit.ly/p0zPWu
    • View Profile
Re: An Axe piano with 5 octaves
« Reply #21 on: May 07, 2011, 03:14:31 pm »
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)
zStart v1.3.013 9-20-2013 
All of my utilities
TI-Connect Help
You can build a statue out of either 1'x1' blocks or 12'x12' blocks. The 1'x1' blocks will take a lot longer, but the final product is worth it.
       -Runer112

Offline ralphdspam

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 841
  • Rating: +38/-1
  • My name is actually Matt.
    • View Profile
Re: An Axe piano with 5 octaves
« Reply #22 on: May 07, 2011, 04:16:24 pm »
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.  ;)
« Last Edit: May 07, 2011, 04:18:20 pm by ralphdspam »
ld a, 0
ld a, a

Offline zero44

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 128
  • Rating: +21/-0
  • <!--//www.ustr.net/infrared/infrared1.shtml-->
    • View Profile
    • zero44
Re: An Axe piano with 5 octaves
« Reply #23 on: May 08, 2011, 03:24:40 pm »
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 .

____________

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: An Axe piano with 5 octaves
« Reply #24 on: May 09, 2011, 07:30:14 am »
Actually, aeTIos made a music composer & player in Axe, looking very good.

Offline Yeong

  • Not a bridge
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3739
  • Rating: +278/-12
  • Survivor of Apocalypse
    • View Profile
Re: An Axe piano with 5 octaves
« Reply #25 on: May 09, 2011, 07:53:05 am »
really? Can I haz a link?
Sig wipe!

Offline ZippyDee

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 729
  • Rating: +83/-8
  • Why not zoidberg?
    • View Profile
Re: An Axe piano with 5 octaves
« Reply #26 on: May 09, 2011, 08:09:45 am »
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:

Code: [Select]
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.
There's something about Tuesday...


Pushpins 'n' stuff...


Offline zero44

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 128
  • Rating: +21/-0
  • <!--//www.ustr.net/infrared/infrared1.shtml-->
    • View Profile
    • zero44
Re: An Axe piano with 5 octaves
« Reply #27 on: May 09, 2011, 08:51:00 am »
How do you find the piano ?
I'm trying interrupts, with what ralphdspam said.

EDIT: I've no headphones here ... -_-'
« Last Edit: May 09, 2011, 09:35:55 am by zero44 »
____________

Offline aeTIos

  • Nonbinary computing specialist
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3915
  • Rating: +184/-32
    • View Profile
    • wank.party
Re: An Axe piano with 5 octaves
« Reply #28 on: May 09, 2011, 09:26:24 am »
Actually, aeTIos made a music composer & player in Axe, looking very good.
It was Michael_Lee i think, I never made a sound program. :)
I'm not a nerd but I pretend:

Offline zero44

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 128
  • Rating: +21/-0
  • <!--//www.ustr.net/infrared/infrared1.shtml-->
    • View Profile
    • zero44
Re: An Axe piano with 5 octaves
« Reply #29 on: May 09, 2011, 02:27:54 pm »
Interrupts does not work.
____________