Omnimaga

Calculator Community => TI Calculators => General Calculator Help => Topic started by: p2 on June 14, 2011, 11:36:41 am

Title: Sound in BASIC-programs
Post by: p2 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:
Title: Re: Sound in BASIC-programs
Post by: ralphdspam 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!
Title: Re: Sound in BASIC-programs
Post by: p2 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!
Title: Re: Sound in BASIC-programs
Post by: p2 on June 14, 2011, 12:29:31 pm
But how to make sounds?
I just know that I should use freq( for it.
Title: Re: Sound in BASIC-programs
Post by: JosJuice 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. :)
Title: Re: Sound in BASIC-programs
Post by: p2 on June 14, 2011, 12:34:14 pm
OK
So he must write
asm( prgmSOUND

But what to do for sounds?
freq( ???, ???
Title: Re: Sound in BASIC-programs
Post by: ben_g 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
Title: Re: Sound in BASIC-programs
Post by: p2 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?
Title: Re: Sound in BASIC-programs
Post by: ben_g 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.
Title: Re: Sound in BASIC-programs
Post by: p2 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?
Title: Re: Sound in BASIC-programs
Post by: ben_g 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.
Title: Re: Sound in BASIC-programs
Post by: p2 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??
Title: Re: Sound in BASIC-programs
Post by: p2 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?
Title: Re: Sound in BASIC-programs
Post by: p2 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....
Title: Re: Sound in BASIC-programs
Post by: JosJuice on June 14, 2011, 02:11:54 pm
Did you have any Axe source code programs?
Title: Re: Sound in BASIC-programs
Post by: p2 on June 14, 2011, 02:14:30 pm
This time there are Lines on my screen:

.._    .._   .._   .._   .._   .._   .._
:.  .   ._    :._  .._   .._   .._   .._

And so on.

But this lines are colour-inverting; in the bachground I can see COMPLETE  No Shell.

Don't looks good...
Title: Re: Sound in BASIC-programs
Post by: DJ Omnimaga on June 14, 2011, 02:16:32 pm
Note: With the Asm() command, sounds will slow down your game considerably, even if the program containing sounds is in pure assembly language, such as Playwav. The best way IMHO to have sound in BASIC is to use Omnicalc, as its parser hook-based sound command is much faster to execute.
Title: Re: Sound in BASIC-programs
Post by: p2 on June 14, 2011, 02:16:57 pm
I've pressed enter and now the screen is darker agan.
I'm an the menue, but at the right side still are the lines and points.

AND EVERYTHING IS UPSIDE DOWN



who has made thiss APP, which is killing my TI??
Title: Re: Sound in BASIC-programs
Post by: JosJuice on June 14, 2011, 02:17:09 pm
I ask again: Did you have any Axe source code programs?
Title: Re: Sound in BASIC-programs
Post by: p2 on June 14, 2011, 02:19:08 pm
Cool!
After I've pressed the down-key, I've the menue upside down on the left AND the same menue upside down and mirrored on the right side.

Is that a good sign?
Title: Re: Sound in BASIC-programs
Post by: p2 on June 14, 2011, 02:20:02 pm
No, I've just the APP



looks funny, all upside down.
Title: Re: Sound in BASIC-programs
Post by: ben_g on June 14, 2011, 02:20:59 pm
AND EVERYTHING IS UPSIDE DOWN
I had that too once. Turn your calc of to avoid that your ram will get cleared when pulling a battery, then pull a battery, and when you turn your calc back on, everything should be right again.
Title: Re: Sound in BASIC-programs
Post by: JosJuice on June 14, 2011, 02:21:32 pm
You need to write some Axe code using the calculator's program editor before you compile using the Axe app.
Title: Re: Sound in BASIC-programs
Post by: p2 on June 14, 2011, 02:22:05 pm
What should I do?
Quit the APP?
Title: Re: Sound in BASIC-programs
Post by: p2 on June 14, 2011, 02:26:03 pm
I've selectet EXIT
Now It's again:

ERR:MEMORY
1:Quit





I've preassed Enter.



TI is off




Pressed on.
The same as before:

∫ŋ∫ŋ∫ŋ∫ŋ∫ŋ∫ŋ∫ŋ∫ŋ
ŋ∫ŋ∫ŋ∫ŋ∫ŋ∫ŋ∫ŋ∫ŋ∫ŋ
∫ŋ∫ŋ∫ŋ∫ŋ∫ŋ∫ŋ∫ŋ∫ŋ
ŋ∫ŋ∫ŋ∫ŋ∫ŋ∫ŋ∫ŋ∫ŋ∫ŋ
∫ŋ∫ŋ∫ŋ∫ŋ∫ŋ∫ŋ∫ŋ∫ŋ
ŋ∫ŋ∫ŋ∫ŋ∫ŋ∫ŋ∫ŋ∫ŋ∫ŋ
∫ŋ∫ŋ∫ŋ∫ŋ∫ŋ∫ŋ∫ŋ∫ŋ
ŋ∫ŋ∫ŋ∫ŋ∫ŋ∫ŋ∫ŋ∫ŋ∫ŋ

and then

              TI 84+
               2.43
          Ram Cleared

Title: Re: Sound in BASIC-programs
Post by: ben_g on June 14, 2011, 02:26:55 pm
Install an other version of the app
Title: Re: Sound in BASIC-programs
Post by: p2 on June 14, 2011, 02:29:17 pm
I should write a PRGM with some AXE-Codes in it, before I start Axe?

I don't have the Command freq(
Ind this is the only one, I know!
Title: Re: Sound in BASIC-programs
Post by: Michael_Lee on June 14, 2011, 02:30:16 pm
Okay, stop.

First, get out of the app, then go to the memory menu and clear your ram (don't forget to archive programs you want to keep).

Then, copy the code you were writing here and let us look at it.
Title: Re: Sound in BASIC-programs
Post by: p2 on June 14, 2011, 02:30:30 pm
Ive version 0.5.3
Where could I get another version?

searching in the Axe-forum?
Title: Re: Sound in BASIC-programs
Post by: Michael_Lee on June 14, 2011, 02:31:31 pm
Version 0.5.3 is fine -- I think it might be your program that's the problem.
Title: Re: Sound in BASIC-programs
Post by: ben_g on June 14, 2011, 02:31:33 pm
You have to run the axe app, and then, you should have new tokens in the catalog ( [2nd] [ 0 ] ).
Title: Re: Sound in BASIC-programs
Post by: p2 on June 14, 2011, 02:32:20 pm
Er....
I havn't written anything:


I should write a new prgm.
-ok

With axe-codes in it.
-In CATALOG under F is no command FREQ(

What now?
Title: Re: Sound in BASIC-programs
Post by: Michael_Lee on June 14, 2011, 02:33:47 pm
You can find Freq( under S.

What Axe does is that it takes the tokens you normally use, and temporarily transforms them.
Title: Re: Sound in BASIC-programs
Post by: p2 on June 14, 2011, 02:33:53 pm
Augment
bal
connected
degree
DependAsk
...

there are some new commands.
Are they from axe?
Title: Re: Sound in BASIC-programs
Post by: ben_g on June 14, 2011, 02:35:42 pm
try this as your program: (The //'s are just coments, don't type them in your program)
Code: (Program:AXESND) [Select]
:.SOUND //header
:repeat Getkey(15)  //repeat and Getkey from the prgm menu
:Freq(10,100 //Search the catalog after running the axe app
:End //prgm menu
And compile this. Then type Asm(prgmSOUND in the home screen. This should give a sound untill you press clear
Title: Re: Sound in BASIC-programs
Post by: p2 on June 14, 2011, 02:36:05 pm
should I write a new PRGM with one of the new commands in it?

what command should I use?
Title: Re: Sound in BASIC-programs
Post by: p2 on June 14, 2011, 02:38:30 pm
The :.SOUND

should that be in Text mode?



Freq should be under S
Freq is with F at the beginning and I cant find it at S and also not at F
Title: Re: Sound in BASIC-programs
Post by: ben_g on June 14, 2011, 02:39:05 pm
Axe helloworld program:
Code: [Select]
:.HELLO
:Disp "Hello Wolld

Compile and run that
Title: Re: Sound in BASIC-programs
Post by: Michael_Lee on June 14, 2011, 02:39:44 pm
Clarification on ben_g's post: Don't add anything after the '//' marks: those are comments.

And yes, Axe does add new tokens.

Also, 10 is a bit of a low number: try using Freq(264, 528) or something.

Edit

1] Go to the home screen
2] Hit [PGRM] and make a new program
3] Copy the program ben_g gave you.
4] Hit [APPS] and scroll until you see Axe.
5] Open Axe, and select 'Compile'
6] Choose the program you just wrote.
7] Select it, and wait until it finishes.
8] Go to the home menu, and type in 'Asm(pgrmSOUND)'.
Title: Re: Sound in BASIC-programs
Post by: DJ Omnimaga on June 14, 2011, 02:39:59 pm
As a rule of thumb p2: Don't double-post on the forums unless it has been 6 hours between your two consecutive posts. Instead, use the edit button. ;)
Title: Re: Sound in BASIC-programs
Post by: ben_g on June 14, 2011, 02:40:26 pm
The :.SOUND

should that be in Text mode?
Yes, you just type that. It's the axe header. It tells the compiler how to name the compiled program. Do not use the same name as the program itself


Freq should be under S
Freq is with F at the beginning and I cant find it at S and also not at F

As a rule of thumb p2: Don't double-post on the forums unless it has been 6 hours between your two consecutive posts. Instead, use the edit button. ;)
Sorry, i just quickly clicked 'quote'
Title: Re: Sound in BASIC-programs
Post by: p2 on June 14, 2011, 02:44:27 pm
I can't find Freq(
The APP has never shown a list where I should have been searching for the Program.
I've just choosed NO SHELL and then it started with doing strange things.

Should the
:.HALLO
be in Text mode?






OK.
I'm doing it.
Title: Re: Sound in BASIC-programs
Post by: ben_g on June 14, 2011, 02:45:43 pm
Should the
:.HALLO
be in Text mode?
Yes
Title: Re: Sound in BASIC-programs
Post by: Michael_Lee on June 14, 2011, 02:47:06 pm
To find Freq(, click [STAT], [RIGHT ARROW].  Scroll down.
Title: Re: Sound in BASIC-programs
Post by: p2 on June 14, 2011, 02:47:13 pm
COOL!
Now I can choose the PRGM AXESND
(I've called it so)


Backing up..


Ready!







There I have:
1-Var Stats
2-Var Stats
Med-Med
LinReg(ax+b)
QuadReg
CubicReg
QuartReg
LinReg(a+bx)
LnReg
ExpReg
PwrReg               <----That is new!!!!
Logistic
SinReg
Manual-Fit
Title: Re: Sound in BASIC-programs
Post by: p2 on June 14, 2011, 02:56:47 pm
What should have the APP made?

I can't open the prgmAXESND

:.Hello is an Error in basic; " should be there


And I can't open it with asm(prgmAXESND


Whatr should I do now?
Title: Re: Sound in BASIC-programs
Post by: Michael_Lee on June 14, 2011, 02:59:33 pm
You have to run asm(pgrmHELLO) -- the name at the top after the period is the new name of the program.

So let's say you make a program named "TEST" and you type in:

Code: [Select]
.HELLO
Disp "Hello"

The program you select in Axe is 'TEST', and the program that you run on the homescreen is 'HELLO'.
Title: Re: Sound in BASIC-programs
Post by: p2 on June 14, 2011, 03:04:11 pm
Called it AXETEST:

Quote
PRGM:AXETEST
:.HALLO
:Disp("HALLO

Starte AXE

...
...

Defragmenting...
...Ready.

asm(HELLO

ERR:SYNTAX
1:QUIT
2:GOTO


asm(prgmHELLO

ERR:INVALID
1:Quit
2:Goto
Title: Re: Sound in BASIC-programs
Post by: z80man on June 14, 2011, 03:05:01 pm
Go to the Axe app. Press compile. Select AXESND. Quit the app. Now when you're on the homescreen enter asm(HELLO
Title: Re: Sound in BASIC-programs
Post by: Michael_Lee on June 14, 2011, 03:06:55 pm
Didn't you name your program 'HALLO', not 'HELLO'?
Title: Re: Sound in BASIC-programs
Post by: p2 on June 14, 2011, 03:11:10 pm
ERR:SYNTAX


But In AXE I've seen, that I've new programs:

COMPILE
 :AXESND
 :AXETEST
 :#AXESND
 :#AXETEST






No.

In each of the 2 PROGs i've written HELLO




You speak German???
Title: Re: Sound in BASIC-programs
Post by: ben_g on June 14, 2011, 03:12:56 pm
Those are programs backuped by axe (to prevent that you'll lose programs on ram clears).

by the way, are you sure you aren't compiling for a shell? You could also try to set the shell to application, and run it from the 'apps' menu
Title: Re: Sound in BASIC-programs
Post by: p2 on June 14, 2011, 03:15:02 pm
I've an APP with the Name HELLO!
But if I start it, nothing happens.
shoud I try the same again, but with a PAUSE after the DISP("HELLO





prgmHALLO

:.HALLO
:Disp("HALLO
:Pause




Nothing.

But now, asm(prgmHELLO
has no ERR!!!
But just because nothing happens.
Title: Re: Sound in BASIC-programs
Post by: Michael_Lee on June 14, 2011, 03:17:50 pm
Add a 'Pause 1000' -- that should pause it briefly.

Also, don't forget to close your parentesis and quotation mark.

Do this:
Code: [Select]
.HELLO
Disp("HELLO")
Pause 1000

Do not do this:
Code: [Select]
.HELLO
Disp("HELLO
Pause 1000
Title: Re: Sound in BASIC-programs
Post by: ben_g on June 14, 2011, 03:18:55 pm
remember: pause doesn't work the same as in basic. In axe, it's Pause Milisecs, where milisecs is the number of milisecounds

EDIT: Ninja'd...
Title: Re: Sound in BASIC-programs
Post by: Ashbad on June 14, 2011, 03:23:34 pm
If you want use BASIC for sound, why not use the music capabilities in Omnicalc?  Its easier to use than axe and all you need is the Omnicalc app, which most calc techies should have anyways.
Title: Re: Sound in BASIC-programs
Post by: p2 on June 14, 2011, 03:24:12 pm
No...
 :banghead:

nothing happens.

But no ERR :o ;D
Title: Re: Sound in BASIC-programs
Post by: z80man on June 14, 2011, 03:26:33 pm
Don't give your source file and your executable the same name. so do something like

Code: [Select]
prgmHALLO
.HELLO
Disp ("Hello")
Pause 1000
And it sounds like you're compiling to an app. Make sure under options you selected no shell or the shell of your choice.
Title: Re: Sound in BASIC-programs
Post by: p2 on June 14, 2011, 03:30:26 pm
IT WORKS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

It was just, because I've chosen Doors_CS7 and not ASM.
NOW I HAVE MY FIRST APP.
COOL.


thanks for helping.



But I have still one Question:



STAT -> CALC

1-Var Stats
2-Var Stats
Med-Med
LinReg(ax+b)
QuadReg
CubicReg
QuartReg
LinReg(a+bx)
LnReg
ExpReg
PwrReg               <----That is new!!!!
Logistic
SinReg
Manual-Fit



WHERE IS FREQ(
Title: Re: Sound in BASIC-programs
Post by: p2 on June 14, 2011, 03:34:25 pm
If I press STAT and then RIGHT (CALC)
Which number should be the freq( command?
Title: Re: Sound in BASIC-programs
Post by: Michael_Lee on June 14, 2011, 03:35:30 pm
When you writing a program, Axe replaces 'SinReg' with 'Freq'.

When you are NOT writing a program, it just displays 'SinReg'.
Title: Re: Sound in BASIC-programs
Post by: p2 on June 14, 2011, 03:37:56 pm
ahh....
I see.
I thought my TI was not ok.


thanks.

I'll test it out to make apps and PRGMs with AXE.

If I need help for the differents between BASIC and ASM, could I write you a PM?



p2
Title: Re: Sound in BASIC-programs
Post by: ben_g on June 14, 2011, 03:40:14 pm
If you need any help, you can just ask it on the forums (or on IRC if you have 40 posts)
Title: Re: Sound in BASIC-programs
Post by: p2 on June 14, 2011, 03:42:02 pm
What do you mean with IRC...
I don't know everything about Omnimaga :-\
Title: Re: Sound in BASIC-programs
Post by: Michael_Lee on June 14, 2011, 03:43:34 pm
Don't worry about IRC -- when you get 40 posts, you'll see it.  You can't miss it.  It's invisible right now.

Feel free to PM me at any time!
Title: Re: Sound in BASIC-programs
Post by: p2 on June 14, 2011, 03:45:50 pm
ok.

thanks.


Bye.

p2