Welcome, Guest. Please login or register.
Amiga Kit Amiga Store Hollywood MAL AMIStore App Store A600 Memory

AuthorTopic: Programming "Chip Tunes"  (Read 1388 times)

0 Members and 1 Guest are viewing this topic.

Offline Karlos

Re: Programming "Chip Tunes"
« Reply #15 on: March 26, 2005, 02:42:25 PM »
@Piru

Hey, here's a silly idea for you. According to the HW manual, one channel can directly modulate the volume of another.

Suppose we encoded 16-bit data into a simple float-like format with a signed 8-bit mantissa and an unsigned 6 bit exponent.

We could split it into 2 buffers. The first buffer contains the 6 bit exponent data, being read for channel 0. This is then used to modulate the volume of channel 1, which is reading the 8-bit data.

Both channels are using the exact same period, so you get to reproduce 14-bit data again.

If both chip ram buffers are being read via DMA (as you would expect) you can do this at a low overhead in terms of CPU interrupts etc.

Encoding from normal 16-bit data to the required format could be achieved using a simple LUT - you can even do calibration for non-linearity when making this table.

Of course this all hinges on the assumption that the hardware channels would be perfectly in sync and remain so.
int p; // A
 

Offline minator

Re: Programming "Chip Tunes"
« Reply #16 on: March 26, 2005, 02:52:15 PM »
Quote
Amplitude modulation affects the volume of the waveform. It is often used to produce vibrato or tremolo effects. Frequency modulation affects the period of the waveform. Although the basic waveform itself remains the same, the pitch is increased or decreased by frequency modulation.


Actually what you've described is a means to produce vibrato - rapidly modulating the pitch.

The whole idea of FM synthesis is to make the wavefrom itself change.  It's the same thing as pitch modulation but applied on much smaller time scales.  In the case of the Amiga you would have to alter the sample rate for every sample.


Quote
The real Amiga audio system by default was designed for playing samples. Contrast this to the C64's SID chip that used Attack, Decay, Sustain, Release circuits (hyrbid analog-digital). Both have advantages. I advocated adding ADSR circuits to the Amiga audio. But oh well. The Amiga does have a mode that goes beyond sample playing however. See Karlos's posting above.


SID used analogue oscillators and an alalogue filter so yes it's a hybrid technology.  I'm surprised it wasn't used in synths at the time - it is now!

As for ADSR you don't need hardware in the Amiga for that, you can calculate the evvelope in software and write the values into the volume register.

Quote
>To properly emulate the Amiga sound system *accurately*
>will rather ironically, require some pretty high end (read expensive) kit.

Same is true of the video hardware. Though the Amiga videographic circuits are relatively incomplete by some modern standards, most graphics chips today lack sprites (it's true), color compression modes... and yes, most lack multiple playfields like the Amiga had. Instead they rely on brute force and fancy blitters. Sad but true.


I reckon Cell could do a killer chipset emulation.

As for the audio the reaon I'm saying it'll be difficult is because if you rely on using different sample rates for playback they'll introduce distortion at diffferent frequencies and this distortion is part of the sound.  This wont make much of a difference at high smple rates but you'd be surprised how many mods used 8.3 KHz samples - and played them at lower rates.

At low rates the distrotion is going to be an integral part of the sound so has to be recreated to be accurate.  Even these low sample rates wont "fit" properly into 44KHz so you'll need a sampling rate a lot higher to generate even accurate-ish waveforms.

Another way would be to use additive systhesis to add in the distortion, this might actually be *easier* but will require per sample calculation of the correct noise levels / frequency.

Then of course any inaccuracies in the DACs have to be modelled as well as the impact of later analogue components in the audio O/P system.

You may think that you don't want the distortion but it's an integral part of the sound and you'll most likely actually prefer it included.
The early Fairlight CMI samplers were only 8 bit but the users actually preffered their sound to the later 16 bit models.

--

Hmm: I don't think I want to go into this level of complexity but this is giving me ideas for a new kind of Oscillator to add to my synth - I think I may a "Retro Sampler" module to the list...
I'm thinking of using 192KHz as the sampling rate anyway so should be able to do different sample playback rates fairly well.


 

Offline Karlos

Re: Programming "Chip Tunes"
« Reply #17 on: March 26, 2005, 03:32:56 PM »
@minator

I've studied FM synthesis in some detail in the past. There is fundamentally nothing different about the vibrato effect and FM other than the ratio of modulator/carrier frequency and the strength of the modulation. Vibrato effects (pitch based - tremelo is volume based) occur when the modulation strength is both very small (modifying the pitch of a note by a few cents) and the frequencty of the modulation is *much* lower than the carrier wave (ie a few Hz).

If you increase the modulation frequency until it is the same order of magnitude as the carrier wave, you start to get your FM synthesis effects.

If you look at the spectrum, you see more and more sidebands beginning to converge around your carrier frequency as your modulator frequency increases.

When your modulator frequency is a rational fraction (or multiple) of your carrier frequency, you get nice waveforms that are rich in harmonics and resemble other commonly encountered waveforms, eg square, sawtooth etc.

As you change that to non rational frequencies you get more complex frequencies that can sound anything from very disharmonic to metallic.

The documentation says that one channel can be used to modulate the period (of which frequency is a function) of another. I see no reason why this could not be used to create a basic 2 operator FM synthesis. As I said it would be a bit more complex, but I don't see a reason it could not be done.

If you have a 22kHz sample waveform (comprising 16-bit period values) derived from a 1kHz tone as your modulation and a 22kHz sample waveform of the same 1kHz tone as normal samplesas your carrier, I see no reason why, with appropriate programming, one could not correctly modulate the other.
int p; // A
 

Offline minator

Re: Programming "Chip Tunes"
« Reply #18 on: March 26, 2005, 07:23:31 PM »
Quote
've studied FM synthesis in some detail in the past. There is fundamentally nothing different about the vibrato effect and FM other than the ratio of modulator/carrier frequency and the strength of the modulation.


I know, as I said it's a question of scale.

Quote
The documentation says that one channel can be used to modulate the period (of which frequency is a function) of another. I see no reason why this could not be used to create a basic 2 operator FM synthesis. As I said it would be a bit more complex, but I don't see a reason it could not be done.


Doesn't sound (pun intended) like it would produce very interesting results but who knows...  I wonder did anyone ever try?  

If they stay in sync the technique could be used to apply PWM to the sample.

--

I'm wonder what would happen if you combined the properties of the C64 and the Amiga by using SID's analogue filter with Paula's digital "oscillators" to generate the waveforms.  Could be interesting and definately retro.

...begins thinking about how to write a "Paula boings SID" module
:lol:
 

Offline Trev

Re: Programming "Chip Tunes"
« Reply #19 on: March 26, 2005, 08:21:55 PM »
@leirbag28

This topic has veered pretty far from my initial question. :-) I'm actually writing a PC speaker emulator for m68k/Paula to include in a PC BIOS emulator that's part of a new project I'm working on. So, I'll be setting up a simple sine or square wave, and modifying the appropriate registers based on emulated access to PC I/O ports 42h, 43h, and 61h.

As far as writing music goes, the C64 is great. The C64 Programmer's Reference Manual seems fairly complete. But I'm not into composing right now. Some day. (And I've lost count of the number of SID-capable devices I have lying around.)

@minator

I really dig the distortion and aliasing effects introduced by older Amiga parallel port samplers. Sending the output of a C64 (or other SID thingy) through one of those (maybe not the DSS8, which is a little too smooth--I like the AMAS) and using the Paula for real-time manipulation (if you could swing it) would be cool.

Trev