English Amiga Board


Go Back   English Amiga Board > Coders > Coders. General

 
 
Thread Tools
Old 03 October 2013, 10:04   #21
Codetapper
2 contact me: email only!
 
Codetapper's Avatar
 
Join Date: May 2001
Location: Auckland / New Zealand
Posts: 3,182
I know very little about audio but just wondering if any software ever "cheated" by having anything played on one of the channels having an identical sampling rate/frequency to allow very fast mixing?

If the sound effects for a game were all tuned to the same frequency as whatever else you played on that channel, presumably you could do something simple like add the 2 samples together and divide by 2 (with a shift), or maybe just use the highest value? You'd get 5 channels that way, very easy computationally and you could "merge" in sound effects with the music as long as it was a drum or something on that channel.

Would that work?
Codetapper is offline  
Old 03 October 2013, 14:21   #22
Mrs Beanbag
Glastonbridge Software
 
Mrs Beanbag's Avatar
 
Join Date: Jan 2012
Location: Edinburgh/Scotland
Posts: 2,243
I remember reading the docs of a sound effects engine that worked that way, years ago, but I never tried it out.
Mrs Beanbag is offline  
Old 07 December 2014, 17:28   #23
Mrs Beanbag
Glastonbridge Software
 
Mrs Beanbag's Avatar
 
Join Date: Jan 2012
Location: Edinburgh/Scotland
Posts: 2,243
so there is more insight from Chris Huelsbeck today about how the 7 voice routine works
[ Show youtube player ]

how it came about, Jochen Hippel wrote a TFMX player for the Atari ST, that did software mixing to produce all four channels from one output, essentially emulating the Amiga's sound. Chris then took the source code for that back to the Amiga. So there are four channels software mixed into a single channel, with the remaining 3 as native Amiga channels!
Mrs Beanbag is offline  
Old 07 December 2014, 19:21   #24
Shoonay
Global Caturator
 
Shoonay's Avatar
 
Join Date: Aug 2004
Location: Porando
Age: 43
Posts: 6,105
Any time stamps? This thing's long...
Shoonay is offline  
Old 07 December 2014, 20:09   #25
mc6809e
Registered User
 
Join Date: Jan 2012
Location: USA
Posts: 372
Quote:
Originally Posted by alexh View Post
I am curious to know the history of software mixing on 16-bit systems. Who was the first to attempt it etc.

I know that the 7-channel replay routine used by Huelsbeck was written by Jochen "Mad Max" Hippel. He was Thalion's original musician and their Amiga programmer. He's even credited in Turrican 3 which was released long after Jochen "retired".
Does the MC6809e count? It had a 16-bit accumulator with 16-bit index registers and 16-bit arithmetic operations and a 8x8->16bit multiply.

A pair of articles in November 1983 and December 1983 give theory and source code. The player uses fixed point arithmetic and multiplication to give four voices.

The assembly is fairly easy to understand.
mc6809e is offline  
Old 08 December 2014, 19:42   #26
Mrs Beanbag
Glastonbridge Software
 
Mrs Beanbag's Avatar
 
Join Date: Jan 2012
Location: Edinburgh/Scotland
Posts: 2,243
Quote:
Originally Posted by Shoonay View Post
Any time stamps? This thing's long...
sorry, i finished listening to the whole thing before i thought to post about it here. but fortunately i remembered correctly, if you skip ahead to the 20 minutes mark, he talks about it for about 5 minutes.

What amazes me now is that they even managed to get the same Amiga 7-voice Turrican II theme on the Atari ST version!
Mrs Beanbag is offline  
Old 10 December 2014, 20:46   #27
pandy71
Registered User
 
Join Date: Jun 2010
Location: PL?
Posts: 2,741
Sample interleaving may be useful to produce more than one channel however at a cost of sampling rate.
pandy71 is offline  
Old 10 December 2014, 21:20   #28
Mrs Beanbag
Glastonbridge Software
 
Mrs Beanbag's Avatar
 
Join Date: Jan 2012
Location: Edinburgh/Scotland
Posts: 2,243
would you not hear a constant high-pitched whine though?

i've been thinking actually about taking the advantage of the opportunity of doing realtime effects on the sample data, even such simple things as overdrive distortion. one channel could be dedicated to guitar (polyphonic), for instance, and some exciting sounds could be produced.
Mrs Beanbag is offline  
Old 10 December 2014, 21:25   #29
alexh
Thalion Webshrine
 
alexh's Avatar
 
Join Date: Jan 2004
Location: Oxford
Posts: 14,331
Lethal Xcess had 7 voices in 1991 too. I wonder which came first? 7-voice Turrican II or 7-voice Lethal Xcess?

If you want the source code then you could ask Jochen or more approachable Grazey of PhF (he's the king of Jochen's music and players in today's era)
alexh is offline  
Old 10 December 2014, 22:28   #30
Thorham
Computer Nerd
 
Thorham's Avatar
 
Join Date: Sep 2007
Location: Rotterdam/Netherlands
Age: 47
Posts: 3,751
Quote:
Originally Posted by Mrs Beanbag View Post
would you not hear a constant high-pitched whine though?

i've been thinking actually about taking the advantage of the opportunity of doing realtime effects on the sample data, even such simple things as overdrive distortion. one channel could be dedicated to guitar (polyphonic), for instance, and some exciting sounds could be produced.
An alternative for accelerated machines is to have the music as two large samples, and mix the sound effects into the sample buffer with the music at the right time. This way you can have 12 bit stereo music with six sound effects (three left, three right).
Thorham is offline  
Old 11 December 2014, 01:55   #31
Don_Adan
Registered User
 
Join Date: Jan 2008
Location: Warsaw/Poland
Age: 55
Posts: 1,957
Quote:
Originally Posted by alexh View Post
Lethal Xcess had 7 voices in 1991 too. I wonder which came first? 7-voice Turrican II or 7-voice Lethal Xcess?

If you want the source code then you could ask Jochen or more approachable Grazey of PhF (he's the king of Jochen's music and players in today's era)
First Amiga 7V soundformat was Jochen Hippel 7V, created in 1990 year.
Second Amiga 7V soundformat was TFMX 7V.
Third Amiga 7V soundformat was Mugician II (aka Mugician 7V).
All Amiga 7V soundformats has 3 normal channels and 4 mixed channels.
Many years ago I asked Chris Huelsbeck's about TFMX 7V details, and he wrote
that Jochen Hippel was author (idea and mixing code) of 7V routine (exactly
mixing 4 channels in 1 channel).
Many years ago I asked also Reinier van Vliet (Mugician author), he wrote
that he created Mugician II replay, after Turrican 2 was published.
Turrican 2 TFMX 7V music was inspiration for him.
All Amiga 7V replays with sources code are available on the Wanted Team page.
Don_Adan is offline  
Old 11 December 2014, 13:32   #32
Mrs Beanbag
Glastonbridge Software
 
Mrs Beanbag's Avatar
 
Join Date: Jan 2012
Location: Edinburgh/Scotland
Posts: 2,243
Quote:
Originally Posted by Thorham View Post
An alternative for accelerated machines is to have the music as two large samples, and mix the sound effects into the sample buffer with the music at the right time. This way you can have 12 bit stereo music with six sound effects (three left, three right).
14 bit, surely?

But then a single pattern of a tracker mod mixed down into 4 channels at 22kHz would take about 700k! So we don't have much chip ram left for our game. Well perhaps we could store the music in fast ram and copy it to a buffer in chip. But i don't even want to talk about Amigas with fast ram tbh, let alone accelerators.

Stock A1200 or bust, that's my motto.

Really i'd only worry about fancy super-multi-channel music on title sequence &c.

But i already generated some of my guitar chord samples using software mixing and overdrive effect, and it sounds good. Now to do it in real time...

Echo effect is also easy.
Mrs Beanbag is offline  
Old 11 December 2014, 14:18   #33
Thcm
Registered User
 
Join Date: Dec 2011
Location: Gummersbach
Posts: 18
Quote:
Originally Posted by Mrs Beanbag View Post
14 bit, surely?

But then a single pattern of a tracker mod mixed down into 4 channels at 22kHz would take about 700k! So we don't have much chip ram left for our game. Well perhaps we could store the music in fast ram and copy it to a buffer in chip. But i don't even want to talk about Amigas with fast ram tbh, let alone accelerators.

.
You don't need that much space for the mixing buffers. With doublebuffering you only need about ~3.5kb for 2 14bit voices @ 22kHz.
Thcm is offline  
Old 11 December 2014, 15:41   #34
Thorham
Computer Nerd
 
Thorham's Avatar
 
Join Date: Sep 2007
Location: Rotterdam/Netherlands
Age: 47
Posts: 3,751
Quote:
Originally Posted by Mrs Beanbag View Post
14 bit, surely?
With four channels per side it becomes 12 bit per channel.

Quote:
Originally Posted by Mrs Beanbag View Post
But i don't even want to talk about Amigas with fast ram tbh, let alone accelerators.

Stock A1200 or bust, that's my motto.
This method is sadly no good for stock machines.
Thorham is offline  
Old 11 December 2014, 15:56   #35
Thcm
Registered User
 
Join Date: Dec 2011
Location: Gummersbach
Posts: 18
Uh, I always thought combining 2 channels would result in ~14 Bit quality. One channel playing at full volume and one channel playing at volume 1.
Thcm is offline  
Old 11 December 2014, 17:14   #36
robinsonb5
Registered User
 
Join Date: Mar 2012
Location: Norfolk, UK
Posts: 1,153
Quote:
Originally Posted by Thcm View Post
Uh, I always thought combining 2 channels would result in ~14 Bit quality. One channel playing at full volume and one channel playing at volume 1.
Yes, that's right - the mixed stream will have roughly 14-bit resolution. When you mix two samples by addition, though, the least significant bit of each is lost, and if you're mixing four samples, you lose the two least significant bits of stream. Thus, if you mix one stereo music stream and six sound effects, as suggested, the music's effective resolution will be roughly 12-bit.
robinsonb5 is offline  
Old 11 December 2014, 17:24   #37
Thcm
Registered User
 
Join Date: Dec 2011
Location: Gummersbach
Posts: 18
The least significant bit ist only lost when dividing the result by 2. I'd prefer proper clamping and try to avoid too much clipping using proper samples, but either way still some resolution will be lost.
Thcm is offline  
Old 11 December 2014, 19:57   #38
Megol
Registered User
 
Megol's Avatar
 
Join Date: May 2014
Location: inside the emulator
Posts: 377
Quote:
Originally Posted by Thcm View Post
The least significant bit ist only lost when dividing the result by 2. I'd prefer proper clamping and try to avoid too much clipping using proper samples, but either way still some resolution will be lost.
The difference being that using scaled samples always loses bits while clamping/saturation only does in very unlikely situations. But scaling is cheaper cycle-wise on most processors...
Megol is offline  
Old 11 December 2014, 21:16   #39
Mrs Beanbag
Glastonbridge Software
 
Mrs Beanbag's Avatar
 
Join Date: Jan 2012
Location: Edinburgh/Scotland
Posts: 2,243
Quote:
Originally Posted by robinsonb5 View Post
Yes, that's right - the mixed stream will have roughly 14-bit resolution. When you mix two samples by addition, though, the least significant bit of each is lost, and if you're mixing four samples, you lose the two least significant bits of stream. Thus, if you mix one stereo music stream and six sound effects, as suggested, the music's effective resolution will be roughly 12-bit.
Mixing four 8-bit samples at equal volume would result in 10-bit data.

But they are not necessarily equal volume! So it is quite plausible that mixing only two samples could result in 15 bit data if they are at different volumes. For instance one at volume 64 and the other at volume 1.
Mrs Beanbag is offline  
Old 12 December 2014, 18:41   #40
Phantasm
Not a Rebel anymore
 
Phantasm's Avatar
 
Join Date: Apr 2005
Location: UK
Age: 51
Posts: 497
Quote:
Originally Posted by Mrs Beanbag View Post
so there is more insight from Chris Huelsbeck today about how the 7 voice routine works
[ Show youtube player ]

how it came about, Jochen Hippel wrote a TFMX player for the Atari ST, that did software mixing to produce all four channels from one output, essentially emulating the Amiga's sound. Chris then took the source code for that back to the Amiga. So there are four channels software mixed into a single channel, with the remaining 3 as native Amiga channels!
i wondered why it was 7 channels. That always seemed like a very strange number.
Phantasm is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Sound channels switched? bLAZER support.WinUAE 21 28 October 2014 08:43
A600: missing sound channels cosam support.Hardware 28 23 May 2010 06:43
More that 4 Sound Channels??? Dragon3d support.WinUAE 8 01 February 2008 17:30
shufflepuck cafe 4 channels sound is crazy turrican3 support.WinUAE 5 08 November 2007 15:41
help sound 4 channels turrican3 support.WinUAE 37 13 April 2007 09:17

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 11:18.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.10720 seconds with 13 queries