Graphic, Sound & Coding Tips/Tricks/FX/Etc. Tools for Development

Started by TurboXray, 12/03/2014, 01:39 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

TurboXray

Quote from: elmer on 12/28/2016, 02:37 PMNice! It's always good to fix a bug and have it make a noticeable improvement.   :)
Definitely! Still one odd behavior I need to work out, but it's low priority.


WIP:
/pic2pce_wip.png

I added a bunch of stuff including pixel drawing - etc. I'm working on a queue circular-stack system now so I can have undo/redo functionality. I still need to make a flood fill routine, but I'll probably use a stack for that instead of a queue.

blueraven

The image converter is really cool. Is it available to download anywhere? And for risk of blasphemy can you run it on a mac?

NightWolve

#152
Quote from: ccovell on 11/17/2016, 09:05 AMHere are some graphics that fit the spec.  You don't have to give me credit in your final game.
https://chrismcovell.com/images/GameMap1.gif
Boy, uh, that ccovell doesn't dick around when it comes to helping out, heh... Looks like you got a bit overly excited on this one...

X.X.XSEED Games' Jeff DeuceBag Nussbaum was last heard crying, "See, see, I'm not the only one that flashes cock-shots around on gaming forums... Everybody does it and odds are good most will click to view them! Hypocrites! Hmph! I AM vindicated!!!"

touko

Good converter tom, but i see you have the same issue than pce image converter when multiple palettes are used .
Some tiles look wrong .

elmer

Quote from: TurboXray on 01/03/2017, 10:51 PMI added a bunch of stuff including pixel drawing - etc. I'm working on a queue circular-stack system now so I can have undo/redo functionality. I still need to make a flood fill routine, but I'll probably use a stack for that instead of a queue.
Neat! I look forward to seeing your progress.

It is *really* hard (IMHO) to do good palette reduction (with/without dithering) and simultaneous tile-palette (or sub-palette, or whatever you choose to call things) conversion.

What algorithm have you chosen to use for your base-conversion?


The best palette reduction & dithering that I've personally played with was the Neuquant neural-net algorithm as used by ...

http://pngnq.sourceforge.net/


When doing the Zeroigar title screen, which needed to be color-reduced in order to a clean conversion to the PC-FX's 16-bit YUV colorspace, I ended up using the free Ximagic Quantizer plugin (which supports 12-bit and 15-bit colorspace) ...

http://www.ximagic.com/q_index.html

TurboXray

Quote from: blueraven on 01/04/2017, 04:25 AMThe image converter is really cool. Is it available to download anywhere? And for risk of blasphemy can you run it on a mac?
Actually, yes. Well.. I need to get a Mac first, but yeah Win, Mac, Linux. The GUI is completely internal (my own code) and the interface is SDL. I'm on the hunt for a cheap but capable mac book.

QuoteGood converter tom, but i see you have the same issue than pce image converter when multiple palettes are used .
Some tiles look wrong .
Those artifacts are from other conversion apps (promotion or image2pce - I forget which).

QuoteIt is *really* hard (IMHO) to do good palette reduction (with/without dithering) and simultaneous tile-palette (or sub-palette, or whatever you choose to call things) conversion.

What algorithm have you chosen to use for your base-conversion?


The best palette reduction & dithering that I've personally played with was the Neuquant neural-net algorithm as used by ...

http://pngnq.sourceforge.net/
The app isn't a lossy conversion app like Image2pce, Promotion, Quither, or NitroCharacter Studio. The focus here is lossless sorting of palettes; it's a tool for different types of image conversions. Automated tools are nice, but they only get you so far. For still pics, conversions by hand are better. The lossy reduction programs are a great starting point when doing stuff by hand too. But this tool allows you to work directly with tiles and palettes for editing out errors of above programs. It also tends to do a reduction sort (lossless) into fewer palettes than the other lossy programs output (usually by 1 or 2.. depending), so it's a nice way to use it to fix more apparent errors in those conversions (again, by hand using this app).

 It has a bunch of other purposes and features/outputs, but I'm too lazy to write what they are right now - haha. It's pretty close to a public release.

Here's a pic conversion I did by hand with photoshop (80%) and finished it off with my app:
/bitmap_test2f.png
With my app, I was able to squeeze in some more color than I had done in photoshop simply because working directly with palettes in a more direct way, and having the palette sorting algo create a few alternate choices for me. It's at 120 colors currently with all 16 palettes (and 100% pce legal output).

ccovell

Quote from: TurboXray on 01/08/2017, 01:59 PMThe app isn't a lossy conversion app like Image2pce, Promotion, Quither, or NitroCharacter Studio. The focus here is lossless sorting of palettes
Yeah, lossless, fewest palette use as possible, and "smart" colour grouping is pretty much the eternal goal of PCE (/NES/SNES) coders.  Looks good so far!

touko

Quotehaha. It's pretty close to a public release.
Aaaah, that's an intersting news. :wink:

TurboXray

Just got a MacBook Air for school, so I'll start working on porting stuffs over.

Phase

Ok so Bonknuts posted about Nes Contra on the first page so I'll throw these in here, they seem interesting but are from the Genesis.
If you like these videos check out the coding secrets playlist here
https://www.youtube.com/channel/UCfVFSjHQ57zyxajhhRc7i0g/playlists

touko

Hi, i developed a new PCM driver based on the PSG buffer .
For now i'am playing only 7khz samples (only for size reason) ,it works very well and use a very little CPU budget, i was at 5% with my previous driver, and now i'am at 1% for the same quality .
Now with this technique you can play a 32khz sample with the same CPU than the old classic 7khz .

Gredler

Quote from: touko on 12/14/2017, 03:22 AMHi, i developed a new PCM driver based on the PSG buffer .
For now i'am playing only 7khz samples (only for size reason) ,it works very well and use a very little CPU budget, i was at 5% with my previous driver, and now i'am at 1% for the same quality .
Now with this technique you can play a 32khz sample with the same CPU than the old classic 7khz .
Cool I hate to ignorantly ask the question, but is this something that can be used in HuC for implementing music and or sound effects?

touko

Quote from: Gredler on 12/14/2017, 01:17 PMCool I hate to ignorantly ask the question, but is this something that can be used in HuC for implementing music and or sound effects?
No worry ;-)
i think yes it can be integrated in HUC because even if it's coded in ASM,the driver it's not CPU taxing and an user timer interrupt can be defined easily .
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 .

For music you can easily (IMO) play the fragmare's musics with his 32khz samples if the driver don't needs timer for other things than samples playing .

Gredler

Quote from: touko on 12/14/2017, 01:47 PM
Quote from: Gredler on 12/14/2017, 01:17 PMCool I hate to ignorantly ask the question, but is this something that can be used in HuC for implementing music and or sound effects?
No worry ;-)
i think yes it can be integrated in HUC because even if it's coded in ASM,the driver it's not CPU taxing and an user timer interrupt can be defined easily .
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 .

For music you can easily (IMO) play the fragmare's musics with his 32khz samples if the driver don't needs timer for other things than samples playing .
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 DildoKKKobold how to go about learning/trying to use it? Our project's sound has been a struggle, and we are open to options provided by the amazing work of you, Arkhan Dildovich, and Elmer.

ccovell

Quote from: touko on 12/14/2017, 01:47 PMFor 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?

touko

Quote from: ccovell on 12/14/2017, 08:24 PM
Quote from: touko on 12/14/2017, 01:47 PMFor 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.  [-o<

QuoteVery cool, thanks for sharing the info! Is this something that is available for homebrew use, and if so can I ask on 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.

touko


spenoza

Does it still generate noise when changing waveforms as is normal with the standard Hu6280?

touko

Quote from: guest on 12/17/2017, 05:54 PMDoes 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 .

elmer

Quote from: guest on 12/17/2017, 05:54 PMDoes 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

QuoteBut 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

Quotetouko: 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 .
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

touko

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 .

touko

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

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

Quote from: Gredler on 02/19/2018, 02:21 PMI 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.

https://www.pcengine-fx.com/forums/index.php?topic=20120.msg436168#msg436168

Arkhan Asylum

Quote from: Gredler on 02/19/2018, 02:21 PMI 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.
This "max-level forum psycho" (:lol:) destroyed TWO PC Engine groups in rage: one by Aaron Lambert on Facebook "Because Chris 'Shadowland' Runyon!," then the other by Aaron Nanto "Because Le NightWolve!" Him and PCE Aarons don't have a good track record together... Both times he blamed the Aarons in a "Look-what-you-made-us-do?!" manner, never himself nor his deranged, destructive, toxic turbo troll gang!

Gredler

Quote from: elmer on 02/19/2018, 02:49 PMhttps://www.pcengine-fx.com/forums/index.php?topic=20120.msg436168#msg436168
Heck yeah! Thank you sir!! :)



Quote from: guest on 02/19/2018, 02:50 PMand 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!!

TurboXray

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.

CrackTiger

Justin the Not-So-Cheery Black/Hack/CrackTiger helped Joshua Jackass, Andrew/Arkhan Dildovich and the DildoPhiles destroy 2 PC Engine groups: one by Aaron Lambert on Facebook, then the other by Aaron Nanto!!! Him and PCE Aarons don't have a good track record together! Both times he blamed the Aarons and their staff in a "Look-what-you-made-us-do?!" manner, never himself nor his deranged/destructive/doxxing toxic turbo troll gang which he covers up for under the "community" euphemism!

Gredler

Quote from: TurboXray on 03/19/2018, 11:04 AMHey 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.
Quote from: guest on 03/19/2018, 11:18 AMThanks 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!

touko

QuoteAnyway, good to see the scene is still active.
Active ??, yes but with one foot in the tomb !! . :mrgreen:

OldMan

Bonknuts:
Good to know you're still alive.
Hopefully school is going well.

QuoteIt brightened my morning seeing you check in
+1

ParanoiaDragon

Sweet, glad to see ya!  Had a feeling you were dealing with RL stuffs, glad you're doing ok!
IMG

touko

Hi, a little late but i confirm that my PCM driver works not so bad on my SGX (but really bad on mednafen,and maybe PCE) .
The bad noise/distortion i experienced with mednafen, seems not present on the real thing,or it's really not audible,it's hard to tell.

I'll really use this driver for my next devs on SGX as it use 5x less of CPU power than the classic brute force method for the same frequency .

esteban

Quote from: TurboXray on 03/19/2018, 11:04 AMHey 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.
Wait! Did I just miss my only opportunity to ask you about machining a HuCARD out of platinum?

Comrade: quit school, move to NJ and make gritty films about suburbia with me. LOTS OF SQUIBS.

:)
IMGIMG IMG  |  IMG  |  IMG IMG

TurboXray

Quote from: esteban on 04/15/2018, 08:23 AM
Quote from: TurboXray on 03/19/2018, 11:04 AMHey 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.
Wait! Did I just miss my only opportunity to ask you about machining a HuCARD out of platinum?

Comrade: quit school, move to NJ and make gritty films about suburbia with me. LOTS OF SQUIBS.

:)
Holy crap you know what is squib is??? That's hilarious haha. You must be making gritty films then.

TurboXray

Quote from: touko on 03/24/2018, 12:55 PMHi, a little late but i confirm that my PCM driver works not so bad on my SGX (but really bad on mednafen,and maybe PCE) .
The bad noise/distortion i experienced with mednafen, seems not present on the real thing,or it's really not audible,it's hard to tell.

I'll really use this driver for my next devs on SGX as it use 5x less of CPU power than the classic brute force method for the same frequency .
I think you need to set mednafen to use the alternate 6280A sound mode (I think it's default for anything that's a .sgx file). Otherwise mednafen tries to emulate the noise artifacts of turning the channels on/off of the original 6280.

touko

QuoteI think you need to set mednafen to use the alternate 6280A sound mode
Already tested, and no change  :(

QuoteI think it's default for anything that's a .sgx file
I also think it's enable when you force the SGX mode .
It works fine on real hardware, it's the principal  :D