Jump to content
IGNORED

PCM audio experiment


Recommended Posts

Yeah, I need to do that again. The last time I did that I ran into some difficulties because there are a bunch of components with different time constants in the audio path, some long and some short, which makes it tricky to model the output. I should probably try some frequency sweeps this time. I tried analyzing the schematic once, but soon discovered that reading The Art of Electronics is not sufficient for that. :P

 

By the way, a version of the emu with disk fixes:

http://www.virtualdub.org/beta/Altirra-2.00-test45.zip

http://www.virtualdub.org/beta/Altirra-2.00-test45-src.zip

Link to comment
Share on other sites

I managed to squeeze a fourth channel into the IRQ routine through a really bad phase update hack, basically updating the 16-bit accumulators round robin. This mixer interrupt executes in 87 cycles and so there's about 20 cycles per scan line (~17% CPU) remaining for mainline. The downside is that the waveform bank is now 8K and almost all of page zero is occupied by code. But hey, it's not like there's much CPU time to do much else. The decreased volume required for mixing four channels brings per-channel precision down to about 4.5 bits, although I could probably spare the 7 cycles per sample for compression again. As I have no musical talent, this is part of a MIDI tune from an old DOS game.

quadchan.zip

  • Like 1
Link to comment
Share on other sites

Yes, if you can cram them into the limited wavetable engine. Each channel references a 256 byte waveform that is repeated 2x in a 512 byte buffer; the per-channel volume is implemented by switching to one of 16 prescaled waveforms. Currently there's only one "instrument," although the tick routine could switch waveforms. The round-robin hack also introduces a slight amount of phase jitter (+/1/256). In this case it's not noticeable as the instrument is just a sine wave with a few low harmonics. Square wave, sine wave, and triangle should be trivial.

 

The ADSR generators are much more relaxed as they run at 123Hz (every 128 scanlines) on an internal 8-bit volume with four ramps, a sustain level, and a gate bit (like SID). In this version, I just locked the four MIDI channel onto one playback channel each and hardcoded the low two and high two channels to have fixed ADSR envelopes. I raised the attack and decay rates on the non-bass channels to get more staccato notes. The profiler says that there is 20% of the CPU available, which should be plenty to multiplex both the waveform selection and the ADSR envelopes if there are more tracks or instruments than channels.

Edited by phaeron
Link to comment
Share on other sites

  • 3 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...