Author Topic: Graphic, Sound, & Coding Tips / Tricks / Effects / Etc. Tools for development  (Read 15757 times)

touko

  • Hero Member
  • *****
  • Posts: 953
Re: Graphic, Sound, & Coding Tips / Tricks / Effects / Etc. Tools for development
« Reply #165 on: December 14, 2017, 07:24:09 PM »
For timer interrupt code,it's ~300 cycles per voice, and for exemple, playing a 7khz sample, a timer interrupt is fired every 32768 cycles .

Sounds cool!  Is there a 7khz/32 overtone or sound glitch for every time you have to reload the PCE wave buffer?
For now i tested only on mednafen sorry, the driver needs some adjustments but it's ok, no glitches or something else .
I'll do some tests on my SGX this week end to see if all is really ok.  :pray:

Quote
Very cool, thanks for sharing the info! Is this something that is available for homebrew use, and if so can I ask on behalf of DarkKobold how to go about learning/trying to use it
I want validate it on real hardware first, and if the driver is ok, I first want to validate it on real hardware, and if the driver is correct, i'll try to help you to use it with Huc.
« Last Edit: December 15, 2017, 01:23:35 AM by touko »

touko

  • Hero Member
  • *****
  • Posts: 953
Re: Graphic, Sound, & Coding Tips / Tricks / Effects / Etc. Tools for development
« Reply #166 on: December 17, 2017, 04:28:26 AM »
i tested on my SGX and it works fine .

spenoza

  • Hero Member
  • *****
  • Posts: 2751
Re: Graphic, Sound, & Coding Tips / Tricks / Effects / Etc. Tools for development
« Reply #167 on: December 17, 2017, 09:54:34 AM »
Does it still generate noise when changing waveforms as is normal with the standard Hu6280?
<a href="http://www.pcedaisakusen.net/2/34/103/show-collection.htm" class="bbc_link" target="_blank">My meager PC Engine Collection so far.</a><br><a href="https://www.pcenginefx.com/forums/" class="bbc_link" target="_blank">PC Engine Software Bible</a><br><a href="http://www.racketboy.com/forum/" c

touko

  • Hero Member
  • *****
  • Posts: 953
Re: Graphic, Sound, & Coding Tips / Tricks / Effects / Etc. Tools for development
« Reply #168 on: December 17, 2017, 08:08:10 PM »
Does it still generate noise when changing waveforms as is normal with the standard Hu6280?
i don't know, i have only a SGX for testing .

« Last Edit: December 17, 2017, 08:16:48 PM by touko »

elmer

  • Hero Member
  • *****
  • Posts: 2153
Re: Graphic, Sound, & Coding Tips / Tricks / Effects / Etc. Tools for development
« Reply #169 on: December 18, 2017, 05:59:12 AM »
Does it still generate noise when changing waveforms as is normal with the standard Hu6280?

Unless touko has come up with some brand-new way to reload the channel's waveform buffer that doesn't involve turning the channel off for 250 cycles, then "yes", it'll still generate noise/distortion on a standard Hu6280.

I tested the technique with michirin9801 last-year/this-year and abandoned it myself for use on a regular PCE (not an SGX).

But perhaps touko is doing something really clever to reload the waveform data that avoids turning the channel off.

touko: Would you mind sharing your code for reloading the waveform?


P.S. I tried switching the channel to high-speed (6 cycles-per-sample) and then loading the waveform buffer without turning the channel off ... but that introduced another unpleasant distortion.


touko

  • Hero Member
  • *****
  • Posts: 953
Re: Graphic, Sound, & Coding Tips / Tricks / Effects / Etc. Tools for development
« Reply #170 on: December 18, 2017, 06:27:28 AM »
Quote
But perhaps touko is doing something really clever to reload the waveform data that avoids turning the channel off.
no, i use the standard method:
lda     #%010_00000
sta     $0804      
stz     $0804

Quote
touko: Would you mind sharing your code for reloading the waveform?
Yes of course  :wink:

I set the timer to 31, and the used psg voice to 512 .
Code: [Select]
User_Timer_Irq:
stz $1403 ; // ACK TIMER

; // On reactive les interruption pour pas bloquer
; // Les interruptions HSYNC
cli

; // Save REG A
pha

; // We save the banks 3 and 4
; // We assume bank 4 is always bank3 +1
tma     #3
pha

; // If voice is on
bbr0 <sample_voix1_on , Fin_Timer_Int

lda <sample_bank_voix1
tam #3
inc A
tam #4

lda #VOIX_PCM1
sta $800

; // Reset the wave pointer
lda     #%010_00000
sta     $0804
                stz     $0804

; // We fill the wave buffer
TIN_Buffer_Voix1:
tin $0000 , $806 , 32

        ; // Enable the voice 1
lda #%10011111
sta $804  

; // ---------------------------------------------
; // Processing for the next 32 bytes to send
; // ---------------------------------------------

; // If all samples are < 16ko
lda #32
clc
adc MODIFIE_TIN_VOIX1
sta MODIFIE_TIN_VOIX1
bcc .pas_add_high
inc MODIFIE_TIN_VOIX1 + 1

; // Else
;lda #32
;clc
;adc MODIFIE_TIN_VOIX1
;sta MODIFIE_TIN_VOIX1
;bcc .pas_add_high
;inc MODIFIE_TIN_VOIX1 + 1
;bpl .pas_add_high
; // Si changement de bank, on remape la nouvelle bank sur le mpr3
;lda #$60
;sta MODIFIE_TIN_VOIX1 + 1
;inc <sample_bank_voix1

  .pas_add_high:
; // we decrement the number of remaining buffer fill
dec <taille_sample_voix1
bne Fin_Timer_Int
dec <taille_sample_voix1 + 1
bpl Fin_Timer_Int

stz <sample_voix1_on
stz     $804

Fin_Timer_Int:
; // we restore the banks 3/4
; // We assume bank 4 is always bank 3 + 1
pla
tam #3
inc A
tam #4

; // We restauring REG A
pla

rti

I place the timer code in RAM because i use some self modifying code .
The channel is turned off for 209 cycles(the TIN duration), at 6992 htz you have 1024 cycles before the buffer start to process the next sample .

Maybe a little bit dirty, but not seems to work so bad for my use, i'll definitely go with that for my future games .
Of course you can do some optimisations, like using a ZP buffer rather than directly in ROM at the expense of CPU used for preparing data done after all the transferts.

i'll post a regular .pce rom soon for testing.

EDIT: Ok here is a standard PCE rom if someone want to test :
https://www.dropbox.com/s/q7zrmts9ov9e8ny/test_samples.pce?dl=0
« Last Edit: December 20, 2017, 04:36:17 AM by touko »

touko

  • Hero Member
  • *****
  • Posts: 953
i have an idea, i'll test ASAP this technique with the bonk's 4 channels mixing for outputing 4, 8bits samples into the 10bits paired channels .
The CPU usage should be negligible <4% i think for 7khz .

EDIT: I experienced some bad noise with high-pitched sounds  :?
This is that elmer spoke .
« Last Edit: January 05, 2018, 12:18:22 AM by touko »

touko

  • Hero Member
  • *****
  • Posts: 953
i found this on bonk's site :
https://pcedev.wordpress.com/2015/10/31/pcm-player/

You can see it plays a 56khz sample with the buffer technique, and it sound not bad at all !!!

Gredler

  • Guest
Re: Graphic, Sound, & Coding Tips / Tricks / Effects / Etc. Tools for development
« Reply #173 on: February 19, 2018, 06:21:29 AM »
I am trying my hand at some beginner programming to create some tools for myself for making art, and am having trouble finding the latest version of HuC. The public facing links seem super old, and one Elmer hooked us up with a couple years ago is dead too (a dropbox link, I think he hosted it there personally).

In case anyone is curious I trying to just load one fmp with various tilemap pcxs that have different pallets per pcx, and then use the d-pad to pan the camera around to see the extents of the compiled fmp+tilemaps

I am used to having a "test level" where the basics to compile are established. I can then load new art and see how it works in game/code, so I am now very focused on trying to get a handle on the very most basic elements of coding in C.

elmer

  • Hero Member
  • *****
  • Posts: 2153
Re: Graphic, Sound, & Coding Tips / Tricks / Effects / Etc. Tools for development
« Reply #174 on: February 19, 2018, 06:49:04 AM »
I am trying my hand at some beginner programming to create some tools for myself for making art, and am having trouble finding the latest version of HuC. The public facing links seem super old, and one Elmer hooked us up with a couple years ago is dead too (a dropbox link, I think he hosted it there personally).

I've always put the link to my latest build of HuC in the "The new fork of HuC" thread,  and a link to the post is included (with a whole bunch of other stuff) at the top of the stickied "TED v2 Programming Notes" thread.

http://www.pcenginefx.com/forums/index.php?topic=20120.msg436168#msg436168

Arkhan

  • Hero Member
  • *****
  • Posts: 14142
  • Fuck Elmer.
    • Incessant Negativity Software
Re: Graphic, Sound, & Coding Tips / Tricks / Effects / Etc. Tools for development
« Reply #175 on: February 19, 2018, 06:50:56 AM »
I am used to having a "test level" where the basics to compile are established. I can then load new art and see how it works in game/code, so I am now very focused on trying to get a handle on the very most basic elements of coding in C.


and on the Mednafen VRAM looker atter, lol.
[Fri 19:34]<nectarsis> been wanting to try that one for awhile now Ope
[Fri 19:33]<Opethian> l;ol huge dong

I'm a max level Forum Warrior.  I'm immortal.
If you're not ready to defend your claims, don't post em.

Gredler

  • Guest
Re: Graphic, Sound, & Coding Tips / Tricks / Effects / Etc. Tools for development
« Reply #176 on: February 19, 2018, 07:23:43 AM »
http://www.pcenginefx.com/forums/index.php?topic=20120.msg436168#msg436168


Heck yeah! Thank you sir!! :)



and on the Mednafen VRAM looker atter, lol.


Actually there is the same functionality in Bizhawk too. As I derperly stumble around these tutorials I noticed Bonknuts had recommended it in this thread. DK has sent me screenshots of the vram during our discussions in the past, so he's been monitoring it constantly I am sure :)

So educational, thanks fellers!!
« Last Edit: February 19, 2018, 07:25:48 AM by Gredler »

Bonknuts

  • Hero Member
  • *****
  • Posts: 3292
Hey all. Been a while. School is incredibly time consuming and it's easing up haha. I didn't have last summer off, but I plan to take this summer off (though work fulltime at my coding job). I'm planning on re-writing my utils and releasing them, but some of the code is really ugly (stuff from 2007!). It seems a waste not to release it publicly, and I also want to some stuff to put on github for my resume for when I graduate. Gonna re-write some of the utils in Java+fx (framework GUI) , and the others keep in C (my own GUI). I rather do this kinda work with PCE too.. been away too long haha.

 Anyway, good to see the scene is still active.

Black Tiger

  • Hero Member
  • *****
  • Posts: 11242
Thanks for letting us know you're alright. :)
http://www.superpcenginegrafx.net/forum

Active and drama free PC Engine forum

Gredler

  • Guest
Hey all. Been a while. School is incredibly time consuming and it's easing up haha. I didn't have last summer off, but I plan to take this summer off (though work fulltime at my coding job). I'm planning on re-writing my utils and releasing them, but some of the code is really ugly (stuff from 2007!). It seems a waste not to release it publicly, and I also want to some stuff to put on github for my resume for when I graduate. Gonna re-write some of the utils in Java+fx (framework GUI) , and the others keep in C (my own GUI). I rather do this kinda work with PCE too.. been away too long haha.

 Anyway, good to see the scene is still active.

Thanks for letting us know you're alright. :)

Definitely! It brightened my morning seeing you check in, so glad to see your name on some recent posts here!