Author Topic: Sound in BASIC-programs  (Read 23423 times)

0 Members and 1 Guest are viewing this topic.

Offline p2

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 849
  • Rating: +51/-11
  • I'm back :)
    • View Profile
Sound in BASIC-programs
« on: June 14, 2011, 11:36:41 am »
If I want to create a BASIC-Program, which should contain sound, I'll have to use Axe.

BUT how to create a program with sounds, if it should run on a TI-84+ without any special APPs, too?  ???

Maybe I need to sent 2 PRGMs to another TI:
One BASIC-program and one ASM-subprogram
(Michael Lee has told me that)

But I've never learned ASM-programming, just Basic.  :banghead:
*insert supercool signature*

Offline ralphdspam

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 841
  • Rating: +38/-1
  • My name is actually Matt.
    • View Profile
Re: Sound in BASIC-programs
« Reply #1 on: June 14, 2011, 12:07:58 pm »
If I want to create a BASIC-Program, which should contain sound, I'll have to use Axe.
BUT how to create a program with sounds, if it should run on a TI-84+ without any special APPs, too?  ???
If you compile a program in Axe, you should be able to run it among all 83+ family calculators without the Axe app.
Axe is a compiled language, meaning that the parser reads your source file and creates an Asm program.  You can run that Asm program on any calculator without the parser (given that your program does not need a shell).

Maybe I need to sent 2 PRGMs to another TI:
One BASIC-program and one ASM-subprogram
In order to run an Asm program from BASIC, you use "Asm(" (without quotes) followed by the name of the program.

But I've never learned ASM-programming, just Basic.  
You don't really need to know Asm to make a program in Assembly; Axe compiles into Assembly.  Well, if you really want to learn Asm, Hot_Dog made a wonderful, well-worded tutorial.  http://www.omnimaga.org/index.php?action=downloads;sa=downfile&id=594

If you would like any clarifications, feel free to ask.  :)
BTW, welcome to Omnimaga!
« Last Edit: June 14, 2011, 12:09:36 pm by ralphdspam »
ld a, 0
ld a, a

Offline p2

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 849
  • Rating: +51/-11
  • I'm back :)
    • View Profile
Re: Sound in BASIC-programs
« Reply #2 on: June 14, 2011, 12:13:30 pm »
So I could create a program with sounds with Axe.
And if i'll send it somebody, he'll be able to hear the sounds even he hasn't loaded Axe on his TI?
That's super!
*insert supercool signature*

Offline p2

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 849
  • Rating: +51/-11
  • I'm back :)
    • View Profile
Re: Sound in BASIC-programs
« Reply #3 on: June 14, 2011, 12:29:31 pm »
But how to make sounds?
I just know that I should use freq( for it.
*insert supercool signature*

Offline JosJuice

  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1344
  • Rating: +66/-14
    • View Profile
Re: Sound in BASIC-programs
« Reply #4 on: June 14, 2011, 12:29:35 pm »
So I could create a program with sounds with Axe.
And if i'll send it somebody, he'll be able to hear the sounds even he hasn't loaded Axe on his TI?
That's super!
Yes. All he has to do is to use the Asm( command to run the program. :)

Offline p2

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 849
  • Rating: +51/-11
  • I'm back :)
    • View Profile
Re: Sound in BASIC-programs
« Reply #5 on: June 14, 2011, 12:34:14 pm »
OK
So he must write
asm( prgmSOUND

But what to do for sounds?
freq( ???, ???
*insert supercool signature*

Offline ben_g

  • Hey cool I can set a custom title now :)
  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1002
  • Rating: +125/-4
  • Asm noob
    • View Profile
    • Our programmer's team: GameCommandoSquad
Re: Sound in BASIC-programs
« Reply #6 on: June 14, 2011, 01:12:06 pm »
freq(number, time

The higher the number, the lower the frequency. Time is in microseconds (if I am right), and if number > time, you won't hear anything

example: try this:

Code: [Select]
:Repeat Getkey(15)
:freq(10,100
:End

That should give sound untill you press clear
My projects
 - The Lost Survivors (Unreal Engine) ACTIVE [GameCommandoSquad main project]
 - Oxo, with single-calc multiplayer and AI (axe) RELEASED (screenshot) (topic)
 - An android version of oxo (java)  ACTIVE
 - A 3D collision detection library (axe) RELEASED! (topic)(screenshot)(more recent screenshot)(screenshot of it being used in a tilemapper)
Spoiler For inactive:
- A first person shooter with a polygon-based 3d engine. (z80, will probably be recoded in axe using GLib) ON HOLD (screenshot)
 - A java MORPG. (pc) DEEP COMA(read more)(screenshot)
 - a minecraft game in axe DEAD (source code available)
 - a 3D racing game (axe) ON HOLD (outdated screenshot of asm version)

This signature was last updated on 20/04/2015 and may be outdated

Offline p2

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 849
  • Rating: +51/-11
  • I'm back :)
    • View Profile
Re: Sound in BASIC-programs
« Reply #7 on: June 14, 2011, 01:33:27 pm »
Cool, thanks! :)

And how to create ditterent sounds?
For example this scale:    C D E F G A H C
How to modifi the high of a sound?
*insert supercool signature*

Offline ben_g

  • Hey cool I can set a custom title now :)
  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1002
  • Rating: +125/-4
  • Asm noob
    • View Profile
    • Our programmer's team: GameCommandoSquad
Re: Sound in BASIC-programs
« Reply #8 on: June 14, 2011, 01:35:51 pm »
Try changing the first argument (You can use a variable for that).

But don't set the time argument (2nd argument) to something very high. It would make your program react very slowly on key presses.
My projects
 - The Lost Survivors (Unreal Engine) ACTIVE [GameCommandoSquad main project]
 - Oxo, with single-calc multiplayer and AI (axe) RELEASED (screenshot) (topic)
 - An android version of oxo (java)  ACTIVE
 - A 3D collision detection library (axe) RELEASED! (topic)(screenshot)(more recent screenshot)(screenshot of it being used in a tilemapper)
Spoiler For inactive:
- A first person shooter with a polygon-based 3d engine. (z80, will probably be recoded in axe using GLib) ON HOLD (screenshot)
 - A java MORPG. (pc) DEEP COMA(read more)(screenshot)
 - a minecraft game in axe DEAD (source code available)
 - a 3D racing game (axe) ON HOLD (outdated screenshot of asm version)

This signature was last updated on 20/04/2015 and may be outdated

Offline p2

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 849
  • Rating: +51/-11
  • I'm back :)
    • View Profile
Re: Sound in BASIC-programs
« Reply #9 on: June 14, 2011, 01:40:39 pm »
For what is the second Var in the Command freq( A , B?
A is the high of the tone.
But B?
*insert supercool signature*

Offline ben_g

  • Hey cool I can set a custom title now :)
  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1002
  • Rating: +125/-4
  • Asm noob
    • View Profile
    • Our programmer's team: GameCommandoSquad
Re: Sound in BASIC-programs
« Reply #10 on: June 14, 2011, 01:43:12 pm »
B is for how long to play the tone.

If you set that to something too low, you won't hear anything, but too high and your program will become very slow.
Try to use something in between.
My projects
 - The Lost Survivors (Unreal Engine) ACTIVE [GameCommandoSquad main project]
 - Oxo, with single-calc multiplayer and AI (axe) RELEASED (screenshot) (topic)
 - An android version of oxo (java)  ACTIVE
 - A 3D collision detection library (axe) RELEASED! (topic)(screenshot)(more recent screenshot)(screenshot of it being used in a tilemapper)
Spoiler For inactive:
- A first person shooter with a polygon-based 3d engine. (z80, will probably be recoded in axe using GLib) ON HOLD (screenshot)
 - A java MORPG. (pc) DEEP COMA(read more)(screenshot)
 - a minecraft game in axe DEAD (source code available)
 - a 3D racing game (axe) ON HOLD (outdated screenshot of asm version)

This signature was last updated on 20/04/2015 and may be outdated

Offline p2

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 849
  • Rating: +51/-11
  • I'm back :)
    • View Profile
Re: Sound in BASIC-programs
« Reply #11 on: June 14, 2011, 01:50:05 pm »
OK Thanks.
I'll try it. :) :)
If I get my headphones...  :-\

The freq( command is like For( , or?
I mean, that it won't work in backround, so that the PROG could do other things during the sound.
That isn't possible, or is it??
*insert supercool signature*

Offline p2

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 849
  • Rating: +51/-11
  • I'm back :)
    • View Profile
Re: Sound in BASIC-programs
« Reply #12 on: June 14, 2011, 02:08:56 pm »
Now I've opened Axe the first time on my TI.
In the menue I've chosen COMPILE
Then I've chosen NO SHELL
It didn't react.
After one minute it reacted:
My screen became barker (contrast changed) and dhere was written "ERR:MEM"
BUT: It was written Upside down!!!!!!! ??? ???
After a few seconds there was written:
∫ŋ∫ŋ∫ŋ∫ŋ∫ŋ∫ŋ∫ŋ∫ŋ
ŋ∫ŋ∫ŋ∫ŋ∫ŋ∫ŋ∫ŋ∫ŋ∫ŋ
∫ŋ∫ŋ∫ŋ∫ŋ∫ŋ∫ŋ∫ŋ∫ŋ
ŋ∫ŋ∫ŋ∫ŋ∫ŋ∫ŋ∫ŋ∫ŋ∫ŋ
∫ŋ∫ŋ∫ŋ∫ŋ∫ŋ∫ŋ∫ŋ∫ŋ
ŋ∫ŋ∫ŋ∫ŋ∫ŋ∫ŋ∫ŋ∫ŋ∫ŋ
∫ŋ∫ŋ∫ŋ∫ŋ∫ŋ∫ŋ∫ŋ∫ŋ
ŋ∫ŋ∫ŋ∫ŋ∫ŋ∫ŋ∫ŋ∫ŋ∫ŋ


Then It was:

 :banghead: :banghead: :banghead: :banghead: :banghead: :banghead: :banghead:
:banghead:              TI 84+                       :banghead:
 :banghead:          Ram Cleared                :banghead:

 :banghead: :banghead: :banghead: :banghead: :banghead: :banghead: :banghead:


Is that normal, or is it because I have had more than 60 half-finishd PRGMs on my TI?
« Last Edit: June 14, 2011, 02:09:47 pm by p2 »
*insert supercool signature*

Offline p2

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 849
  • Rating: +51/-11
  • I'm back :)
    • View Profile
Re: Sound in BASIC-programs
« Reply #13 on: June 14, 2011, 02:11:46 pm »
Now I'v choosen the same things again.
No reaction yet.

The same like a minute ago....
*insert supercool signature*

Offline JosJuice

  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1344
  • Rating: +66/-14
    • View Profile
Re: Sound in BASIC-programs
« Reply #14 on: June 14, 2011, 02:11:54 pm »
Did you have any Axe source code programs?