|
|
|||||||
| Home | Register | Downloads | FAQ | Members List | Calendar | Arcade | Mark Forums Read |
» Less advertising throughout
» Post and participate in discussions
» Network with other forum members
» Free private messaging
![]() |
|
|
Thread Tools | Display Modes |
|
|
#41 | |
|
Registered User
![]() Join Date: Sep 2011
Location: Australia
Posts: 89
|
No problem... Quote:
I should look into Chip16 after I finish sound emulation in my GBC emu (which is almost done). |
|
|
|
|
| Advertisement | [Remove Advertisement] | ||
|
|
|
#42 |
|
Linux's worst nightmare..
![]() ![]() ![]() ![]() ![]() Join Date: Feb 2004
Location: USA
Posts: 1,505
|
I liked your 3d racing game! Wish it was open sauce... On topic: we could really use some more cool games/demos
__________________
OS: WinXP Professional Service Pack 3 CPU: Intel pentium 4 3.0GHz Video: Nvidia Geforce 8400GS Sound: ASUS Xonar DS 7.1 Channels 24-bit 192KHz PCI Interface Audio Card Memory: 512 MB HD: [C:] 140.36/449.09 GB Connection: Marvell Yukon 88E8053 PCI-E Gigabit Ethernet Controller |
|
|
|
|
|
#43 |
|
Registered User
![]() Join Date: Sep 2011
Location: Australia
Posts: 89
|
Glad you like it. All textures were taken from cgtextures.com and their license terms says no open source projects allowed or something like that... that was why I didn't make it open source. But I think I should email them and ask if it's ok or not, they are really friendly (not a sarcasm). ![]() Maybe now is the time to start making a compiler for chip16? Hmmm... maybe I should try and build one, I always wanted to know more about compilers and how they work and this seems like a perfect opportunity... |
|
|
|
|
|
#44 | |
|
Registered User
![]() ![]() Join Date: Sep 2011
Location: Australia, Tasmania
Posts: 180
|
Quote:
![]() If you want to make one as well, then I highly recommend this resource: http://compilers.iecc.com/crenshaw/ I have used it to make simple scripting languages/compilers in the past that use similar recursive-descent parsers ![]() It is fun, and an educational experience to make a compiler ![]() cheers, Paul |
|
|
|
|
|
|
#45 | ||
|
Registered User
![]() Join Date: Sep 2011
Location: Australia
Posts: 89
|
Quote:
Quote:
|
||
|
|
|
|
|
#46 |
|
Registered User
![]() ![]() Join Date: Sep 2011
Location: Australia, Tasmania
Posts: 180
|
Hey all, I have gotten somewhere with sound generation using some of my proposed sound stuff I posted earlier ![]() I can output triangle, sawtooth, pulse wave (limited to square ATM), and noise just like in the C64 SID chip at a frequency (0..65535 Hz)! I am using the waveform data to produce a WAV file formatted output stream using the user's frequency and duration, which I am saving as a test so I can examine and play it externally for now (will be played internally by an emulator of course!). I am generating a 44100Hz sample rate WAV file using mono 8-Bit format (unsigned)... I just have to get the output to be modulated by the ADSR settings too ![]() Here is a screenshot of the waveforms in the free Audacity audio editor: ![]() cheers, Paul |
|
|
|
|
|
#47 |
|
Sober coder
![]() ![]() ![]() Join Date: Aug 2010
Location: London, UK
Posts: 433
|
That looks great! Also, you speak of a 44100 Hz sample rate. This is just for the WAV files right, I seem to remember variable sample rates being mentioned? Because 44KB for 1 second of sound is not feasible! ![]() One of your previous posts mentioned a 4-bit ADSR envelope, is that encoded in the PCM, or will it be encoded in the instruction?
__________________
|
|
|
|
|
|
#48 | ||
|
Registered User
![]() ![]() Join Date: Sep 2011
Location: Australia, Tasmania
Posts: 180
|
The bottom sound is the pseudo-random noise waveform, just like in the C64 ![]() Quote:
![]() So, for a 1 second sound encoded with my current scheme requires: 44100 x 1 (bytes per sample) x 1 (number of channels), or around 4.4KB. We could reduce this by using 22050 sampling rate instead...it is entirely up to us (or the creator of the emulator) as to what sound quality we use ![]() Quote:
eg. a typical ADSR envelope which could modulate a waveform's output amplitude might look like this: Code:
volume
1 /\
| / \_______
| / \
| / \
0 A D S R
cheers, Paul |
||
|
|
|
|
|
#49 | |||
|
Sober coder
![]() ![]() ![]() Join Date: Aug 2010
Location: London, UK
Posts: 433
|
Quote:
![]() Quote:
Quote:
__________________
|
|||
|
|
|
|
|
#50 |
|
PCSX2 Coder
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jan 2004
Location: Plymouth, UK
Posts: 10,037
|
For downloads of RefChip16 please follow this link http://code.google.com/p/refchip16/downloads/list
__________________
http://www.pcsx2.net Intel i7 920 @ 3.4Ghz, POV GTX 570 1.3Gb, 1.8Tb HD space, 6Gb OCZ Reaper PC3-14400 Triple Channel Dont PM me for help, use the forums, thats what its for! My Chip16 Emulator RefChip16 http://code.google.com/p/refchip16/
Last edited by refraction; March 9th, 2012 at 16:10.. |
|
|
|
|
|
#51 |
|
Registered User
![]() ![]() Join Date: Sep 2011
Location: Australia, Tasmania
Posts: 180
|
@tykel: Ok, it is closer to around 43KB in size, I was lazy and didn't calculate it like I should have LOL As to the sound quality, I thought this was up to the emulator since the Chip16 sound instructions only define frequency and duration, not sound sampling rates, etc.? @refraction: Neat! thanks for sharing your emulator + code ![]() cheers, Paul |
|
|
|
|
|
#52 |
|
PCSX2 Coder
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jan 2004
Location: Plymouth, UK
Posts: 10,037
|
Nps you might wanna get the updated version, it fixes a few memory leaks which Prads kindly pointed out to me!
__________________
http://www.pcsx2.net Intel i7 920 @ 3.4Ghz, POV GTX 570 1.3Gb, 1.8Tb HD space, 6Gb OCZ Reaper PC3-14400 Triple Channel Dont PM me for help, use the forums, thats what its for! My Chip16 Emulator RefChip16 http://code.google.com/p/refchip16/
|
|
|
|
|
|
#53 |
|
Registered User
![]() ![]() Join Date: Sep 2011
Location: Australia, Tasmania
Posts: 180
|
Well, I have gotten ADSR modulation into my sound creation class now ![]() I have attached a simple retro-sounding explosion generated by my sound class using these parameters: Duration: 310mS Frequency: 100Hz Attack: 2mS Decay: 6mS Sustain: 15 (volume level) Release: 300mS PS. I was thinking that a delay, wait, or sleep command might be useful for timing events in a Chip16 program, like in sound generation, or just a general pause...how about it? Something like this maybe? Code:
D0 00 LL HH WAIT HHLL Wait HHLL miliseconds before continuing Paul |
|
|
|
|
|
#54 |
|
Sober coder
![]() ![]() ![]() Join Date: Aug 2010
Location: London, UK
Posts: 433
|
Nice example, suitably retro sounding! Also, sorry for insisting on this, but would this sound take up 100Hz * 0.310s * 1B = 31B? Or am I not getting this? Another thing, wouldn't it be better to use sound instructions rather than ports for modulation, for better orthogonality? Also, for timing, you can currently use VBLNK if you don't mind waiting for multiples of 16ms ![]() If anyone else is interested in a WAIT instruction, please make your voice heard!
__________________
|
|
|
|
|
|
#55 |
|
PCSX2 Coder
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jan 2004
Location: Plymouth, UK
Posts: 10,037
|
As I think I've said previously, if you need custom wait times you can write a number to a register and do a sub then compare zero cond, hell you could even do other stuff then like Compare test reg Inst Inst Inst Sub 5 from test reg Compare test reg It's handy knowing each Inst is 1 cycle
__________________
http://www.pcsx2.net Intel i7 920 @ 3.4Ghz, POV GTX 570 1.3Gb, 1.8Tb HD space, 6Gb OCZ Reaper PC3-14400 Triple Channel Dont PM me for help, use the forums, thats what its for! My Chip16 Emulator RefChip16 http://code.google.com/p/refchip16/
|
|
|
|
|
|
#56 | |||
|
Registered User
![]() ![]() Join Date: Sep 2011
Location: Australia, Tasmania
Posts: 180
|
Quote:
Ok, to find out how much a sound takes up in memory (ignoring any headers and other stuff, just raw sound data), you can use this formula (I am pretty sure I didn't stuff up this time ):Code:
SoundSize = Round(BytesPerSample * NumberOfChannels * Duration_mSec * SampleRate / 1000) So I get this: Code:
SoundSize = Round(BytesPerSample * NumberOfChannels * Duration_mSec * SampleRate / 1000) SoundSize = Round(1 * 1 * 310 * 44100 / 1000) SoundSize = 13671 SoundSize = 13.3505859375 KB Quote:
![]() None of this is set in stone yet...we can use sound instructions for playing sounds AND changing the sound's waveform + ADSR parts too... Ok, so how about this then: Code:
...
09 00 00 00 SND0 Stop playing sounds.
0A 00 LL HH SND1 HHLL Play 500Hz tone for HHLL miliseconds (uses current sound generator settings; ADSR, etc.).
0B 00 LL HH SND2 HHLL Play 1000Hz tone for HHLL miliseconds (uses current sound generator settings; ADSR, etc.).
0C 00 LL HH SND3 HHLL Play 1500Hz tone for HHLL milliseconds (uses current sound generator settings; ADSR, etc.).
0D 0X LL HH SNP Play Sound for HHLL miliseconds at the tone specified in address pointed to by Register X (uses current sound generator settings; ADSR, etc.).
0E AD SR VT SNG Sound generator (applies to all sound tones which follow).
A = attack (0..15)
D = decay (0..15)
S = sustain (0..15, volume)
R = release (0..15)
V = volume (0..15)
T = type of sound:
00 = triangle wave
01 = sawtooth wave
02 = pulse wave (is just square for now)
03 = noise
non-valid values default to 0 output
// Jumps
10 00 LL HH JMP HHLL Jump to the specified address.
...
Quote:
![]() cheers, Paul Last edited by paul_nicholls; November 25th, 2011 at 19:58.. |
|||
|
|
|
|
|
#57 | |
|
Registered User
![]() ![]() Join Date: Sep 2011
Location: Australia, Tasmania
Posts: 180
|
Quote:
![]() cheers, Paul |
|
|
|
|
|
|
#58 |
|
PCSX2 Coder
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jan 2004
Location: Plymouth, UK
Posts: 10,037
|
Very true but if you are doing background music or sound, the game will have to pause while the sound plays, which could be a little annoying if its a long sound tho I guess you don't have to use it
__________________
http://www.pcsx2.net Intel i7 920 @ 3.4Ghz, POV GTX 570 1.3Gb, 1.8Tb HD space, 6Gb OCZ Reaper PC3-14400 Triple Channel Dont PM me for help, use the forums, thats what its for! My Chip16 Emulator RefChip16 http://code.google.com/p/refchip16/
|
|
|
|
|
|
#59 | |
|
Registered User
![]() ![]() Join Date: Sep 2011
Location: Australia, Tasmania
Posts: 180
|
Quote:
![]() Well, thinking about it most sound libraries allow sounds to play and the user doesn't have to wait for them to finish before continuing...so I don't think we need the wait instruction for sound playing anymore (maybe for other tasks though...don't know). Ok everyone, what do you think of the proposed sound instructions then? If you all like the idea of the ADSR and waveform generation being put into the Chip16, I will share my code...it is in Delphi (Object Pascal) code but should be easily converted over to other languages like C++ or similar ![]() cheers, Paul |
|
|
|
|
|
|
#60 |
|
Sober coder
![]() ![]() ![]() Join Date: Aug 2010
Location: London, UK
Posts: 433
|
I think it looks good. Once there is a consensus I will be able to add it to the next revision of the spec, along with PAL. Just clarify one thing for me, what is the frequency for? How does it differ from the sample rate?
__________________
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|