16 April 2023, 15:21 | #1 |
Registered User
Join Date: Jul 2015
Location: The Netherlands
Posts: 3,411
|
Audio Mixer v3.1 released (including C integration)
After seeing my audio mixer being used in several productions, I decided to revisit it and turn it from a simple example into a more complete project, with multiple examples, new features, reworked code, the ability to use it in C programs and full documentation.
The result is my new mixer, version 3.1. I'm quite happy with the new features Here's a quick overview of the mixer and it's new features: Features:
**) in practice, this is limited by the largest maximum single block of free RAM that exists. A system with multiple memory expansions will be limited to a much smaller maximum sample size than the total RAM size would seem to indicate. You can find the new mixer and it's full documentation here: https://powerprograms.nl/projects/audio_mixer.html I'm particularly happy the mixer now supports samples looping and samples that aren't multiples of the entire mixer buffer in size. Hope it's useful for you guys Edit: version 3.2 has been released. It fixes a bug in the way I set up the XREF directives (this cause errors on several assemblers, notably vasm 1.9d) Last edited by roondar; 01 May 2023 at 22:30. Reason: Version 3.2 released |
16 April 2023, 23:14 | #2 |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,474
|
Thanks roondar!
I bookmarked the link |
17 April 2023, 00:12 | #3 |
Registered User
Join Date: Jul 2015
Location: The Netherlands
Posts: 3,411
|
No problem, hope you find it useful!
--- One thing I forgot to make clear in my original post is that the mixer configuration does let you pick from several optimisation options (exchanging some flexibility/RAM use for some peformance). The 3.7% CPU time figure is without taking those options into account. If you use those options, the mixer performance can get very similar to the old version (3.3% CPU time on A500 with 11KHz x4 samples), but also has the same requirement as the old mixer regarding the sample length needing to be a multiple of the per-frame mixer buffer size. I chose not to use those optimisations for the named figure because I personally find the added flexibility of 4 byte-multiple samples to be worth more than the extra CPU time. But for those who'd rather have the extra speed, the option is there |
17 April 2023, 00:21 | #4 |
Registered User
Join Date: Sep 2019
Location: Italy
Age: 50
Posts: 292
|
Fantastic Roondar, going from 4 channels to 16 channels seems like a miracle for the Amiga.
Congratulations.Can't wait for it to spread to future games. I dream that such a routine will also be integrated into the Scorpion Engine someday. And of course a tracker and tools to create music with it. p.s. will it be possible to mix music and sounds within a multiplexed channel? For example in a configuration 3 real channels (music) + 2 multiplex channels (music) + 2 multiplex channels sounds ? |
17 April 2023, 11:43 | #5 | |
Registered User
Join Date: Feb 2018
Location: Poland
Posts: 352
|
Thanks @roondar! I was waiting for this and try to break something there...
Quote:
Why woudn't it be? Everything is a sound. Taking into account some limitations and side effects it should work. I have an idea to exploit an existing tracker format. |
|
17 April 2023, 13:56 | #6 | ||||||
Registered User
Join Date: Jul 2015
Location: The Netherlands
Posts: 3,411
|
Quote:
At 16 channels the mixer uses over 15% CPU time on an A500. So this is probably something better suited for A1200 level computers. (and of course, using all 4 hardware channels for mixer playback means existing music players will definitely not be able to play back any music) Quote:
Quote:
Quote:
--- Quote:
Quote:
That said, there's a couple of issues that you'd need to take into account, though:
That said, I'd be interested to see what you come up with |
||||||
18 April 2023, 14:52 | #7 |
Registered User
Join Date: Jun 2010
Location: PL?
Posts: 2,769
|
Technically with such low sample rates simple sample interleaving can double number of channels - one channel in lower byte and second channel in upper byte of same DMA word, samples need to be same length and sampled at half but null stuffing (replacing non existent samples by 0) can be used to partially overcome this requirement. Of course Paula channel sample rate must be twice rate of samples.
bonus is that they can be 8 bit so no loss of SNR. I didn't analyzed your code roondar so appolgies if this is method used by you. |
18 April 2023, 15:15 | #8 |
Thalion Webshrine
Join Date: Jan 2004
Location: Oxford
Posts: 14,354
|
Thanks for all the hard work.
|
18 April 2023, 15:29 | #9 | |
Registered User
Join Date: Jul 2015
Location: The Netherlands
Posts: 3,411
|
Quote:
No problem, hope it's useful |
|
18 April 2023, 20:30 | #10 |
Registered User
Join Date: Jun 2010
Location: PL?
Posts: 2,769
|
|
18 April 2023, 20:43 | #11 |
Registered User
Join Date: Jul 2015
Location: The Netherlands
Posts: 3,411
|
Ah, no sorry - I may not have been very clear. I had looked into the option of interleaving samples back when I made the first version of the mixer. At that time, I found several posts on forums (including EAB if I recall) saying there was a audible whine when going this route. This ultimately was the reason for me to not try it out this way.
AFAIK the given reason for the audible whine was that interleaving on the Amiga could not be done at high enough frequencies to push said 'whine' outside of audible range - but I may be misremembering that. Hope that's more clear |
18 April 2023, 21:07 | #12 | |
Registered User
Join Date: Jun 2010
Location: PL?
Posts: 2,769
|
Quote:
THX! |
|
18 April 2023, 22:36 | #13 |
Alien Bleed
Join Date: Aug 2022
Location: UK
Posts: 4,165
|
Sample interleaving would produce a lot of unwanted harmonics if it didn't go through a filter.
Fun fact, the Yamaha DX7 used interleaving for each voice (total DAC frequency is hundreds of kHz) and relies entirely on an analogue filter stage on the output to basically mix the discrete values into a continuous signal. |
19 April 2023, 14:50 | #14 |
Registered User
Join Date: May 2013
Location: Grimstad / Norway
Posts: 839
|
|
19 April 2023, 20:07 | #15 | |
Registered User
Join Date: Jun 2010
Location: PL?
Posts: 2,769
|
Quote:
Sharing/interleaving resources is very common practice - i bet more than 90% of musical synthesizers use resource sharing. From mathematical perspective this is OK That's why mentioned by roondar 'whine' triggered my curiosity. |
|
19 April 2023, 21:19 | #16 |
Alien Bleed
Join Date: Aug 2022
Location: UK
Posts: 4,165
|
To properly mix the interleaved samples the filter needs to be defined correctly. In this sense it's not that much different than a typical reconstruction filter.
|
20 April 2023, 09:39 | #17 | |
Registered User
Join Date: Jul 2015
Location: The Netherlands
Posts: 3,411
|
Quote:
This is because the current form of mixing simply reads and adds together a bunch of longwords (using movem.l for one of the sources), but such interleaving would need to shift all those bytes into position, which is a slow operation. |
|
20 April 2023, 10:24 | #18 | |
Registered User
Join Date: Jun 2010
Location: PL?
Posts: 2,769
|
Quote:
But OK - lets finish at this moment to not derail completely your thread - and as always roondar - great work! Thx! |
|
20 April 2023, 10:59 | #19 |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,474
|
This type of mixing would pair well with copper audio, that as it is now it accepts 16-bit samples and high frequencies, but definitely it require an high amount of memory by the audio stream.
The trick is (well known ): Code:
move.w (stream_1)+,d_data move.w (stream_2)+,-(sp) move.b (sp)+,d_data move.w d_data,(output)+ |
21 April 2023, 01:20 | #20 |
Registered User
Join Date: Sep 2019
Location: Sydney
Posts: 357
|
Great that you've continue to develop this Roondar. I had bodged in support for looping sounds as well as volume control and custom memory allocations, but it looks like they are all officially supported now + more!
EDIT: Being able to set the channel/mode at run time rather than compile time would be nice, although I appreciate it could have implications on code size. Last edited by Muzza; 21 April 2023 at 01:56. |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
NoWinED (2012) including Sources released on Aminet | AMIGASYSTEM | News | 4 | 13 September 2020 12:23 |
Looking for working audio mixer in AmigaOS 3.1.4 + Mediator | spudje | support.Apps | 8 | 02 February 2020 12:53 |
Vintage Audio Player Released | AMIGASYSTEM | News | 4 | 02 October 2019 14:31 |
Audio Evolution 4 released | Paul | News | 0 | 21 November 2004 12:07 |
Picasso IV 4 Audio Channel Mixer setup | Tony Landais | support.Hardware | 0 | 25 December 2003 15:45 |
|
|