27 September 2013, 19:36 | #1 |
Glastonbridge Software
Join Date: Jan 2012
Location: Edinburgh/Scotland
Posts: 2,243
|
More than 4 sound channels - how it works?
Does anybody have any insider information on how Jochen Hippel's 7 voice routine or Octamed 8 voice works? Or any source code?
|
27 September 2013, 19:55 | #2 |
move.l #$c0ff33,throat
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,863
|
Basically it just mixing of the samples, 2 samples -> 1 sample (simplest approach: add both sample bytes and divide by 2). That way you can have 8 virtual channels even though only 4 real channels are available. Check the StarTrekker replayer for an example.
|
27 September 2013, 20:13 | #3 |
Puttymoon inhabitant
|
I have seen Chris Hülsbeck podcast, he was talking about it, but I do not know where
|
27 September 2013, 20:16 | #4 |
Glastonbridge Software
Join Date: Jan 2012
Location: Edinburgh/Scotland
Posts: 2,243
|
Thanks StingRay but I know that much already!
I need more technical details to actually write such a thing. How do they mix together two samples at arbitrary different periods and volumes, and make it fast enough? |
27 September 2013, 21:00 | #5 |
Registered User
Join Date: Dec 2011
Location: Northamptonshire, UK
Age: 42
Posts: 1,236
|
i'm just guessing here, but perhaps it uses something similar to the way interlace video works? where on frame 1 you have odd lines and frame 2 you have even. perhaps the samples are spliced.
does the audio quality seem more noisy when you cram those two samples into one channel? would love to see it played through a spectrometer to look at the waveforms |
27 September 2013, 21:30 | #6 |
move.l #$c0ff33,throat
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,863
|
Why do you ask how 8 channel replayers work then?
I gave you a hint where to look! It's not that multichannel replayer sources are hard to find anyway... StarTrekker, DigiBooster ect. pp. |
27 September 2013, 21:49 | #7 |
Glastonbridge Software
Join Date: Jan 2012
Location: Edinburgh/Scotland
Posts: 2,243
|
Because I want to know how they work in detail, not just the most basic operating principle that isn't enough to actually implement one in practice.
I could spend all week looking at someone else's source code trying to work it out, I just wondered if anyone here could give me some pointers on the theory, like how to resample in good quality on-the-fly, how to handle independent channel volumes (which naively requires a multiplication, and 8 muls 22k times a second is a lot of work), how to sync with Paula to keep it fed with data at the correct rate. But if you have any links to the source code they'd be appreciated because Google isn't helping much right now. |
27 September 2013, 22:06 | #8 | ||
Registered User
Join Date: Mar 2012
Location: Norfolk, UK
Posts: 1,157
|
Quote:
If your aim is games, by the way, consider devoting three channels to audio, and mixing multiple virtual channels of sound effects into a single fourth channel - sound effects can be resampled in advance, if necessary, since they're generally only required to play at one pitch. Quote:
|
||
27 September 2013, 22:23 | #9 | |
HOL/FTP busy bee
Join Date: Sep 2006
Location: Germany
Age: 46
Posts: 31,960
|
Quote:
StarTrekker_v1.2.lha -> Source/8ChannelReplay.s |
|
27 September 2013, 23:43 | #10 | |
Glastonbridge Software
Join Date: Jan 2012
Location: Edinburgh/Scotland
Posts: 2,243
|
Quote:
Wow... they didn't like writing comments, did they? |
|
29 September 2013, 20:23 | #11 | |
Glastonbridge Software
Join Date: Jan 2012
Location: Edinburgh/Scotland
Posts: 2,243
|
Quote:
After looking at that source code for a while, it looks like they don't bother with volume control, and it appears to be fixed-point arithmetic for the resampling, nearest neighbour. I tried writing a resampler once (although with no intention of speed), I had to add interpolation for it to sound any good, nearest neighbour sounded dreadful. But Octamed et al don't sound bad. |
|
30 September 2013, 10:15 | #12 |
Registered User
Join Date: Dec 2007
Location: The World
Age: 50
Posts: 476
|
Octamed Soundstudio did full software mixing with better quality than the old halved channel way. Expensive though I guess ( it barely allowed 8 channels on my original unexpanded 1200.
|
30 September 2013, 10:28 | #13 |
Thalion Webshrine
Join Date: Jan 2004
Location: Oxford
Posts: 14,465
|
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". |
02 October 2013, 11:01 | #14 |
Registered User
Join Date: Dec 2011
Location: Gummersbach
Posts: 18
|
I wrote a Protracker replayer for the good old C64: http://csdb.dk/release/?id=112365
The mixing of 4 channels at 7800hz including different periods and volume needs about 50% of the cpu power of an unxepanded C64 running at ~1 Mhz. The other half of the cpu time is needed to output the 8 bit samples using NMI. In theory it should be possible to have at least 8 full featured channels running on a stock Amiga 500 without any problems. Using double bufferd mixing buffers and clever use of tables should do the trick. There's no need for any expensive instructions. Even the Protracker replay logic uses a few rasterlines on the c64 using my approach. |
02 October 2013, 13:00 | #15 |
Registered User
Join Date: Aug 2006
Location: Scunthorpe/United Kingdom
Posts: 2,087
|
I would be interested to know how to mix samples effectively. Stingray's suggestion of adding two samples and dividing by 2 seems wrong to me - if I have a loud sample and a quiet sample, then the averaging operation will decrease the volume of the louder sample and correspondingly increase the volume of the quieter sample. How would this be avoided?
D. |
02 October 2013, 13:56 | #16 | |
Unregistered User
Join Date: Sep 2012
Location: Copenhagen / DK
Age: 44
Posts: 4,190
|
Quote:
|
|
02 October 2013, 14:29 | #17 | |
Registered User
Join Date: Dec 2011
Location: Gummersbach
Posts: 18
|
Quote:
Another solution would be to combine two paula channels to get nearly 14 bit output and clipping or dividing won't matter. I didn't do any 68k coding since the nineties, but I think 8 channels with 14 bit output should be doable. I don't know how high the mixing rate will be, but I could do some calculations. |
|
02 October 2013, 14:57 | #18 | |
Unregistered User
Join Date: Sep 2012
Location: Copenhagen / DK
Age: 44
Posts: 4,190
|
Quote:
And mixing 4x6 bit samples into one 8 bit is exactly the same. Then you divided your original samples by 4 before adding them together (as you could have used 8 bit samples). |
|
02 October 2013, 15:14 | #19 | |
Registered User
Join Date: Jun 2010
Location: PL?
Posts: 2,875
|
Quote:
Use 16 bit arithmetic, add all channels (with 256 8-bit channels you need more than 16 bit) at the end rescale result and now story begins. You can truncate/round 16 bit to 8 bit and output directly to DAC loosing lower 8 bit (thus create problem you already mention) or perform error processing (Error Feedback Rounding) - rest from truncation can be added to next 16 bit sample, this is simplest way and it can sound good - oversampling recommended - higher - better. http://www.google.com/patents/US6801925 If there is plenty of CPU power then formal noiseshaping with dithering can be performed (based on scientific publications - correctly noise shaped and dithered 8 bit system with 4 times oversampling can provide over 120 dB dynamics). This remain me my previous idea. Copper audio with DMA - set Audio DMA period high - few times higher than allowed and push audio samples interleaved by zero with Copper. Suggested 14 bit can work also. And probably some LUT's are unavoidable on Amiga (lack of DSP). |
|
02 October 2013, 20:08 | #20 |
Glastonbridge Software
Join Date: Jan 2012
Location: Edinburgh/Scotland
Posts: 2,243
|
I did wonder about mixing all channels into 14 bit, I don't see why it would be especially more expensive to do it that way. Of course we could use 16 bit samples as well AND use noiseshaping if we were really enthusiastic.
Use of copper to load Paula is interesting idea too. But is any time lost due to vertical blank? |
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 |
|
|