### Author Topic: Frequency and Channels of a Custom Sound  (Read 2351 times)

0 Members and 1 Guest are viewing this topic.

#### Hot_Dog

• If you can't find a cat, look for its tail.
• CoT Emeritus
• LV11 Super Veteran (Next: 3000)
• Posts: 2966
• Rating: +445/-10
##### Frequency and Channels of a Custom Sound
« on: August 18, 2010, 12:32:28 am »
For those of you who think you will laugh and point at me for asking a reasonable question, please leave immediately.

So, this is part of the code for PlayWav:

Code: [Select]
 di            ld   a, 0FDh out  (01h), a  main: ld   a, (hl)  and  0Fh ld   c, a     call Label15 ld   a, (hl)  srl  a        srl  a        srl  a        srl  a        and  0Fh ld   c, a push iy pop  iy ;slow this down a little call Label15 inc  hl       dec  de       ld   a, d     push iy ;slow this down a little pop  iy or   e        jr   nz,main ei          ret          quit: pop af pop af ;fix the stack pop af retLabel15: ld   b, c     inc  b        ld   a, 0D3hLabel18: out  (00h), a   djnz Label18 ld   a, 10h sub  c        ld   b, a     ld   a, 0D0hLabel19: out  (00h), a   djnz Label19 ret
1. If I were to use a custom sound, one single recorded note, would it be possible to adjust the frequency and duration of that sound to allow more notes?
2. Would it be possible to have 2--or even 4--channels of said single recorded notes at said frequencies and durations?

I'm not asking for code (cause I have an idea of what I want to do), I'm just asking if it's reasonably possible.
There are people who can speak two languages, and they are called bilingual.  There are people who speak three languages and are therefore trilingual.  Then there are people who speak one language, and these people are called Americans.

#### DJ Omnimaga

• CodeWalrus staff & retired Omni founder
• CoT Emeritus
• LV15 Omnimagician (Next: --)
• Posts: 55811
• Rating: +3145/-232
• Remember when the walrus started to fly
##### Re: Frequency and Channels of a Custom Sound
« Reply #1 on: August 18, 2010, 01:14:42 pm »
For those of you who think you will laugh and point at me for asking a reasonable question, please leave immediately.
Don't worry that won't happen here (if someone does, he won't be able to do it more than twice)
In case you are wondering where I went, I am still regularly active in the TI community. I just left Omnimaga several months ago for various reasons. You can now reach me on CodeWalrus at http://codewalr.us . Sorry for the inconveniences.

#### calc84maniac

• Epic z80 roflpwner
• Coder Of Tomorrow
• LV11 Super Veteran (Next: 3000)
• Posts: 2881
• Rating: +455/-17
##### Re: Frequency and Channels of a Custom Sound
« Reply #2 on: August 18, 2010, 06:52:23 pm »
So are you wanting some sort of WAV playback, or do you want beeps?
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman

#### Hot_Dog

• If you can't find a cat, look for its tail.
• CoT Emeritus
• LV11 Super Veteran (Next: 3000)
• Posts: 2966
• Rating: +445/-10
##### Re: Frequency and Channels of a Custom Sound
« Reply #3 on: August 18, 2010, 07:03:17 pm »
So are you wanting some sort of WAV playback, or do you want beeps?

WAV.  What I'm looking at is a recorded note (such as .1 seconds of violin, like they do with midi), and since the code above can play waves, I'm wondering if that note can be adjusted for length and pitch, and played in two or 4 channels.
There are people who can speak two languages, and they are called bilingual.  There are people who speak three languages and are therefore trilingual.  Then there are people who speak one language, and these people are called Americans.

#### Runer112

• Moderator
• LV11 Super Veteran (Next: 3000)
• Posts: 2175
• Rating: +623/-31
##### Re: Frequency and Channels of a Custom Sound
« Reply #4 on: August 18, 2010, 10:00:39 pm »
Your routine is built to play how many bits per sample, and at what sample rate?

#### Hot_Dog

• If you can't find a cat, look for its tail.
• CoT Emeritus
• LV11 Super Veteran (Next: 3000)
• Posts: 2966
• Rating: +445/-10
##### Re: Frequency and Channels of a Custom Sound
« Reply #5 on: August 18, 2010, 10:17:17 pm »
Your routine is built to play how many bits per sample, and at what sample rate?

Well, it's not actually my routine.  But it is 11 Khz, 8-bit mono
There are people who can speak two languages, and they are called bilingual.  There are people who speak three languages and are therefore trilingual.  Then there are people who speak one language, and these people are called Americans.

#### calc84maniac

• Epic z80 roflpwner
• Coder Of Tomorrow
• LV11 Super Veteran (Next: 3000)
• Posts: 2881
• Rating: +455/-17
##### Re: Frequency and Channels of a Custom Sound
« Reply #6 on: August 18, 2010, 10:19:40 pm »
It's actually 4-bit, I believe.
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman

#### Hot_Dog

• If you can't find a cat, look for its tail.
• CoT Emeritus
• LV11 Super Veteran (Next: 3000)
• Posts: 2966
• Rating: +445/-10
##### Re: Frequency and Channels of a Custom Sound
« Reply #7 on: August 18, 2010, 10:23:41 pm »
It's actually 4-bit, I believe.

Alright, granted, but that still doesn't answer my questions

EDIT:  At least the file sent and converted to a program is 8-bit
« Last Edit: August 18, 2010, 10:24:57 pm by Hot_Dog »
There are people who can speak two languages, and they are called bilingual.  There are people who speak three languages and are therefore trilingual.  Then there are people who speak one language, and these people are called Americans.

#### ztrumpet

• The Rarely Active One
• CoT Emeritus
• LV13 Extreme Addict (Next: 9001)
• Posts: 5714
• Rating: +364/-4
• If you see this, send me a PM. Just for fun.
##### Re: Frequency and Channels of a Custom Sound
« Reply #8 on: August 18, 2010, 10:24:52 pm »
This also looks like an interesting topic.  I'm curious as well.  Thanks for asking a great question Hot Dog.
If I'm wrong, please correct me!
Unfinished Projects:
 Elmgon 14% Basic Movement Demo Homescreen Game Pack 80% Basic Latest Release Cube Droid Saves the Galaxy 65% Axe Demo Detonate 70% Axe
Completed Projects:
Exodus | Midnight |Drifter | Axe Snake | Jump! | Factory Theta | Spider | Plot Drop | Papi Jump | Numb3rs | Nibbler | Boost | Duel Tile Map Editor | Homescreen Map Editor | Key Group Check | Oasis

#### Hot_Dog

• If you can't find a cat, look for its tail.
• CoT Emeritus
• LV11 Super Veteran (Next: 3000)
• Posts: 2966
• Rating: +445/-10
##### Re: Frequency and Channels of a Custom Sound
« Reply #9 on: August 18, 2010, 10:26:02 pm »
This also looks like an interesting topic.  I'm curious as well.  Thanks for asking a great question Hot Dog.

Well, I'm tossing around the idea with having about 16 "midi" instruments and making music for S.A.D. for 15 Mhz calculators.  If I can't get enough channels and can't change single notes, however, it ain't going to happen
There are people who can speak two languages, and they are called bilingual.  There are people who speak three languages and are therefore trilingual.  Then there are people who speak one language, and these people are called Americans.

#### calc84maniac

• Epic z80 roflpwner
• Coder Of Tomorrow
• LV11 Super Veteran (Next: 3000)
• Posts: 2881
• Rating: +455/-17
##### Re: Frequency and Channels of a Custom Sound
« Reply #10 on: August 18, 2010, 10:28:19 pm »
This also looks like an interesting topic.  I'm curious as well.  Thanks for asking a great question Hot Dog.

Well, I'm tossing around the idea with having about 16 "midi" instruments and making music for S.A.D. for 15 Mhz calculators.  If I can't get enough channels and can't change single notes, however, it ain't going to happen

So you're planning to run this on top of a game? :O I'm not sure how possible this is when using all of the processing time.
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman

#### Hot_Dog

• If you can't find a cat, look for its tail.
• CoT Emeritus
• LV11 Super Veteran (Next: 3000)
• Posts: 2966
• Rating: +445/-10
##### Re: Frequency and Channels of a Custom Sound
« Reply #11 on: August 18, 2010, 10:30:10 pm »
This also looks like an interesting topic.  I'm curious as well.  Thanks for asking a great question Hot Dog.

Well, I'm tossing around the idea with having about 16 "midi" instruments and making music for S.A.D. for 15 Mhz calculators.  If I can't get enough channels and can't change single notes, however, it ain't going to happen

So you're planning to run this on top of a game? :O I'm not sure how possible this is when using all of the processing time.

Like I said, it's an idea I'm tossing around.  But if nobody knows if it's possible for many channels, as well as if it's possible to have a single recorded note and change pitch and duration...

* Hot Dog runs off to experiment

EDIT:  I'll keep up on this post as to what I find out, for those of you curious
« Last Edit: August 18, 2010, 10:32:41 pm by Hot_Dog »
There are people who can speak two languages, and they are called bilingual.  There are people who speak three languages and are therefore trilingual.  Then there are people who speak one language, and these people are called Americans.

#### calc84maniac

• Epic z80 roflpwner
• Coder Of Tomorrow
• LV11 Super Veteran (Next: 3000)
• Posts: 2881
• Rating: +455/-17
##### Re: Frequency and Channels of a Custom Sound
« Reply #12 on: August 18, 2010, 10:32:45 pm »
I believe that with WAV sound, the pitch/speed are linked. This is why typically when speeding up the sound goes higher and slowing down it goes lower. Apparently changing the speed without changing the pitch or vice versa is a problem even on PCs.
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman

#### Hot_Dog

• If you can't find a cat, look for its tail.
• CoT Emeritus
• LV11 Super Veteran (Next: 3000)
• Posts: 2966
• Rating: +445/-10
##### Re: Frequency and Channels of a Custom Sound
« Reply #13 on: August 18, 2010, 10:35:14 pm »
Well if it can be sped up or down, that's not an issue.  I don't care about the speed since most notes will repeat (in order to be held out) anyways.  After all, on computer midi, if you start with a single recorded note (like a piano note), the sound will run faster and faster the higher up you go.
« Last Edit: August 18, 2010, 10:35:56 pm by Hot_Dog »
There are people who can speak two languages, and they are called bilingual.  There are people who speak three languages and are therefore trilingual.  Then there are people who speak one language, and these people are called Americans.

#### Hot_Dog

• If you can't find a cat, look for its tail.
• CoT Emeritus
• LV11 Super Veteran (Next: 3000)
• Posts: 2966
• Rating: +445/-10
##### Re: Frequency and Channels of a Custom Sound
« Reply #14 on: August 19, 2010, 04:38:12 pm »
Looks like I should leave the improbable to calc84maniac.  Using a short note to make a long note (such as a string orchestra) is almost impossible without hearing some clicks and pops, and if I have all short notes and no long background notes, it's not worth using recorded sounds instead of having all beeps (especially since beeps have no issues with long notes).

However, I'm still thinking about music for 15 Mhz S.A.D. if I can think of some decent beep-beep music.  It's likely I'll do some 4 channel stuff
« Last Edit: August 19, 2010, 04:43:54 pm by Hot_Dog »
There are people who can speak two languages, and they are called bilingual.  There are people who speak three languages and are therefore trilingual.  Then there are people who speak one language, and these people are called Americans.