| |
The Shadow
Registered: Oct 2007 Posts: 304 |
Digitizing Sound Effects
For the purposes of digitizing voices and other sounds for game sound effects, all suggestions are welcome. The ideal parameters are for a good program that can convert sound samples into a C=64 format. An ideal program is one that can have the sound effects take as little memory as possible and reasonably light on rastertime, without compromising sound quality. Ideas? |
|
| |
Frantic
Registered: Mar 2003 Posts: 1648 |
Can't really give any theoretical/mathematical arguments to support this but:
My impression is that higher sample rate (such as 7200hz versus 3600hz) is more important to the perceived quality of the sample than higher bit depth (8bit versus 4bit). Hence, I would rather go for 4bit and 7200 hz than 8bit and 3600hz. That depends on the sound itself though. The quality difference will be most clearly audible for sounds that contain a bigger load of higher frequencies.
A common way to store 4bit sample data on the c64 is to have two 4bit sample values stored in the same byte as hi nibble and lo nibble respectively (or vice versa), to save some memory (compared to wasting four bits in each byte, as one would do when storing only one 4bit value in each byte in RAM).
Perhaps this helps somewhat? |
| |
The Shadow
Registered: Oct 2007 Posts: 304 |
Yes Frantic that helps alot. The general aim is to have something compact enough to fit in a game. Would 4bit and 7200 hz be much smaller in space? |
| |
Frantic
Registered: Mar 2003 Posts: 1648 |
4bit/7200hz (A) is equal in space to 8bit/3600hz (B), since (A) takes half the amount of RAM for each sample compared to (B), but on the other hand (A) uses twice as many samples each "time unit" than (B), so it evens out.
By the way.. I use a command line utility called "SOX" which is available for many different platforms to do conversion to C64-ish sample rates. Perhaps you can use that too? In addition, you will need some script or something that stuffs two 4bit values into one byte (in case you use 4bit samples).
Anyway.. As I said.. What sample rate that will be acceptable is a highly subjective judgement, and it also depends on the actual frequency contents of the actual sound that you are trying to play. Hence you should do some tweaking to find a sample rate that gives you a reasonable result. Perhaps you want that oldschool touch to the sound? In that case 4bit sound may be even "better" than 8bit sound, if you see what I mean.. |
| |
The Shadow
Registered: Oct 2007 Posts: 304 |
Very cool. Any good programs for this purpose are needed. |
| |
Frantic
Registered: Mar 2003 Posts: 1648 |
By the way, I realized that I wrote the wrong sample rates... I was thinking of 7800hz versus 3900hz rather than 7200hz versus 3600hz.
...and even more exactly 7820hz versus 3910hz; at least on a PAL system with 312 raster lines and a clock frequency of 50.125hz.
7820hz is every second raster line on a PAL system, and 3910hz is every fourth raster line. Anyway.. You seem to be on NTSC, so the exact rates you would be using would be slightly different in any case. |
| |
enthusi
Registered: May 2004 Posts: 677 |
Hi, in
Heartlight 64 Preview I used the original sample-WAVs from the PC game. Sampled down to 4bit 8Khz with a few lines of C code.
4 bit give you the big advantage of high/low-nibble data.
Also you can easyly use different sample-rates for different fx which is partially integrated in the preview above. Surely not all kinds of sounds require 8 khz. Also at 8 khz you dont have THAT much CPU time left. In Heartlight the NMI sample player is active permanently and merely feed with data when an fx is triggered. Don't judge the sample quality of HL64 - final optimization not done yet... |
| |
MagerValp
Registered: Dec 2001 Posts: 1078 |
If you have a few CPU cycles to spare, I'd suggest using delta compression (as invented by Robin Harbron) for the samples:
bit d418
0 no change
10 -1
11 +1 at ~8 kHz it's nearly lossless, uses about 1.5 bits per sample instead of 4, and is simple to unpack.
|
| |
algorithm
Registered: May 2002 Posts: 705 |
Alternatively 1 bit dynamic delta modulation can be used. eg per specific amount of chunk values (256 samples) the encoder can determine an optimum step size then encode the value with an unset bit as minus the step value and set bit as plus the step value.
The encoder can work with several future samples to generate least error.
Two bit delta modulation gives the possibility of two step values.
Even less processor intensive decoding would be via the Vector Quantisation route, but the encoder would be complex in comparison (this can be combined ofcourse with the dynamic deltamodulation :-)) |
| |
The Shadow
Registered: Oct 2007 Posts: 304 |
Alternately, is there a possible way to blend music and sound effects together such as music playing with sound effects interrupting the music seamlessly? |
| |
algorithm
Registered: May 2002 Posts: 705 |
You can use the 8 bit audio method but the non-cycle important method would use 2 sid channels (one seeking to the desired level) while the other one is set etc which will only give you one sid channel for music.
Alternatively the standard 4 bit method via $d418 (but on new sid this may be problematic (although may be be solved by using a null channel to boost the digi)
Another method would be to synthesize the sound effect using sid waveforms (but this would not really be that useful with a single channel)
|
... 3 posts hidden. Click here to view all posts.... |
Previous - 1 | 2 - Next |