Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email
?
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Home
About
Team
Rules
Stats
Status
Sitemap
Chat
Downloads
Forum
News
Our Projects
Major Community Projects
Recent Posts
Unread Posts
Replies
Tools
SourceCoder3
Other Things...
Omnimaga Radio
TI-83 Plus ASM File Unsquisher
Z80 Conversion Tools
IES TI File Editor
Free RAM areas
Comprehensive Getkeyr table
URL Shortener
Online Axe Tilemap Editor
Help
Contact Us
Change Request
Report Issue/Bug
Team
Articles
Members
View the memberlist
Search For Members
Buddies
Login
Register
Omnimaga
»
Forum
»
Calculator Community
»
Other Calc-Related Projects and Ideas
»
TI Z80
»
Sound
« previous
next »
Print
Pages: [
1
]
2
Go Down
Author
Topic: Sound (Read 4977 times)
0 Members and 3 Guests are viewing this topic.
SirCmpwn
Guest
Sound
«
on:
October 23, 2010, 03:07:27 pm »
Hello,
How do I output sound through the link port in pseudocode? And a textual explanation would be nice too.
Thanks!
Logged
thepenguin77
z80 Assembly Master
LV10
31337 u53r (Next: 2000)
Posts: 1594
Rating: +823/-5
The game in my avatar is bit.ly/p0zPWu
Re: Sound
«
Reply #1 on:
October 23, 2010, 03:22:29 pm »
You are probably going to want to play 8 bit music, so I'll go with that. You need to turn the link port on an off for varying amounts for each different byte. So say you have 257 units to work with. For byte 0 it would be 1 off and 256 on. Byte 1 would be 2 off and 255 on. Byte 2 would be 3 off and 254 on. And it continues on...
But to do this accurately and very fast, (<200 t-states of switching code if you want good quality), you need to sacrifice space for speed. This means making a huge table of code for every single possible byte. The way you do this can vary, but you basically have to have dedicated code if you want quality.
Also, using this technique, you have to have music of at least 20KHz sample rate. Any lower and those with really good hearing will be in pain.
That's not really pseudo code, but that's how I do it.
«
Last Edit: October 23, 2010, 03:23:29 pm by thepenguin77
»
Logged
+2/-0 karm for this message
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
SirCmpwn
Guest
Re: Sound
«
Reply #2 on:
October 23, 2010, 03:24:08 pm »
Thanks, but I want to play wav files.
«
Last Edit: October 23, 2010, 03:25:01 pm by SirCmpwn
»
Logged
thepenguin77
z80 Assembly Master
LV10
31337 u53r (Next: 2000)
Posts: 1594
Rating: +823/-5
The game in my avatar is bit.ly/p0zPWu
Re: Sound
«
Reply #3 on:
October 23, 2010, 03:30:21 pm »
Those are wav files. I mean 8-bit wav files. Not midi's. I have no idea how those work.
The instructions are for what you do once you have read the header and are going to play music for real.
Logged
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
SirCmpwn
Guest
Re: Sound
«
Reply #4 on:
October 23, 2010, 03:40:32 pm »
Oh, I see. So each byte of the music represents the sound? So if I open up a wav file and move past the header, and the first byte is 0x10, I'll do 0x10 "units" with both link port lines pulled high, and 0xEE "units" with both lines low?
And what "units" would be good?
Logged
DJ Omnimaga
Clacualters are teh gr33t
CoT Emeritus
LV15
Omnimagician (Next: --)
Posts: 55943
Rating: +3154/-232
CodeWalrus founder & retired Omnimaga founder
Re: Sound
«
Reply #5 on:
October 23, 2010, 03:41:29 pm »
I wonder if the source of this could be useful?
http://www.ticalc.org/archives/files/fileinfo/176/17685.html
Logged
SirCmpwn
Guest
Re: Sound
«
Reply #6 on:
October 23, 2010, 03:43:58 pm »
Thanks DJ! That looks useful.
Logged
DJ Omnimaga
Clacualters are teh gr33t
CoT Emeritus
LV15
Omnimagician (Next: --)
Posts: 55943
Rating: +3154/-232
CodeWalrus founder & retired Omnimaga founder
Re: Sound
«
Reply #7 on:
October 23, 2010, 03:48:26 pm »
Yeah I wasn't sure how optimized it was, though, since it was made several years ago, before many today's tricks were discovered. I just rememebered using that back then. It did 11 KHz 8 bit music, if I remember. A 3 second audio file is 20 KB on-calc, though...
«
Last Edit: October 23, 2010, 03:48:44 pm by DJ Omnimaga
»
Logged
SirCmpwn
Guest
Re: Sound
«
Reply #8 on:
October 23, 2010, 03:55:22 pm »
Don't worry about that
Logged
thepenguin77
z80 Assembly Master
LV10
31337 u53r (Next: 2000)
Posts: 1594
Rating: +823/-5
The game in my avatar is bit.ly/p0zPWu
Re: Sound
«
Reply #9 on:
October 23, 2010, 04:13:08 pm »
For units, this is basically the most amount of t-states that you can fit within your time constraints. So a bit of math: 15,800,000 t-states / 22500 hz = 702 t-states per byte. Now, we need 257 units, but to be safe around the edges (1 unit is usually impossible) we'll call it 260 units. So your options for units are either 1 or 2 t-states. 1 t-state will give you 442 t-states for note switching but low volume. With cheap headphones, it probably won't be audible. 2 t-states is what I use and that gives you 182 t-states to switch. That's plenty of time for optimization if space is an issue, or time for compression
.
So I would recommend that you use 2 t-states as your unit of time. This is so small that you can see why you need dedicated code. And you correctly understood what I said the first time.
Oh, and I used 15.8 MHz as the calculator speed because that's the average speed that I have found in calcs. I have seen some as slow as 14.8 and as fast as 16.2.
Logged
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
SirCmpwn
Guest
Re: Sound
«
Reply #10 on:
October 23, 2010, 04:16:06 pm »
So... if I had 90 MHz to work with...
Logged
DJ Omnimaga
Clacualters are teh gr33t
CoT Emeritus
LV15
Omnimagician (Next: --)
Posts: 55943
Rating: +3154/-232
CodeWalrus founder & retired Omnimaga founder
Re: Sound
«
Reply #11 on:
October 23, 2010, 04:18:28 pm »
You could port MTV Music Generator to the TI-Nspire.
Logged
thepenguin77
z80 Assembly Master
LV10
31337 u53r (Next: 2000)
Posts: 1594
Rating: +823/-5
The game in my avatar is bit.ly/p0zPWu
Re: Sound
«
Reply #12 on:
October 23, 2010, 04:20:50 pm »
Wow, unexpected development.
You would have 4,000 t-states per byte. I would use between 10 and 12 t-states as your unit. And then use those spare 1,140 to decode MP3.
Edit:
No. You have so much ram that that's not even necessary. Decode the MP3 beforehand and then play it as a wav.
«
Last Edit: October 23, 2010, 04:23:09 pm by thepenguin77
»
Logged
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
SirCmpwn
Guest
Re: Sound
«
Reply #13 on:
October 23, 2010, 04:24:48 pm »
Well, TI-Nspire plus TI-84+ keypad gives me 90 MHz and an I/O port to work with.
At 90 MHz, with a music frequency of 44100 Hz, I have 2040.8 t-states per byte to work with. With 257 units, we have 1783 t-states at one t-state per byte. At 4 t-states per byte, we get 1012 t-states per byte. 6 t-states per byte leaves us 498 t-states per byte. Shouldn't be a huge problem
(I just guessed at your calculations. Care to elaborate how you got these numbers?)
And as for decoding the MP3, I would just do it in real time to save the user the issue of waiting.
«
Last Edit: October 23, 2010, 04:25:51 pm by SirCmpwn
»
Logged
Munchor
LV13
Extreme Addict (Next: 9001)
Posts: 6199
Rating: +295/-121
Code Recycler
Re: Sound
«
Reply #14 on:
October 23, 2010, 04:27:05 pm »
http://www.ticalc.org/archives/files/fileinfo/176/17685.html
That looks very good!
Logged
Print
Pages: [
1
]
2
Go Up
« previous
next »
Omnimaga
»
Forum
»
Calculator Community
»
Other Calc-Related Projects and Ideas
»
TI Z80
»
Sound