04 August 2023, 16:32 | #21 |
Registered User
Join Date: Sep 2017
Location: Kansas, USA
Posts: 327
|
You're not going to get "real" positional audio working on a 68K based Amiga, the math for doing positional audio correctly is complex which is why it was generally done with custom ASICs and DSPs when it first starting being a thing in PC gaming.
The wikipedia articles https://en.wikipedia.org/wiki/Sound_localization and https://en.wikipedia.org/wiki/Head-r...nsfer_function give a brief overview. |
07 August 2023, 11:03 | #22 | |
Registered User
Join Date: Aug 2010
Location: Germany
Posts: 532
|
Quote:
The code I came up with uses constant power panning which, if the documentation is correct, was picked by Disney as the method preferred by the audience (could be that this research is as old as the movie "Fantasia"). Here are my brief notes and the links to the material which I made use of: Code:
Note: for the panning to work the angle should be between -45..45 degrees, with 0 being the centre. -45 degrees would be the extreme left, and 45 degrees the extreme right. radians = (degree * PI) / 180 pan_left = sqrt(2) / 2.0 * (cos(radians) - sin(radians)) pan_right = sqrt(2) / 2.0 * (cos(radians) + sin(radians)) This "panning law" is called "Constant power panning" which avoids making the sound in the centre softer than it is at the edges of the field (with "linear panning"): https://www.cs.cmu.edu/~music/icm-online/readings/panlaws/index.html https://dsp.stackexchange.com/questions/13149/digital-panning-effect Code:
int pan_left_table[91]; int pan_right_table[91]; double radians; /* Create lookup tables for panning for angles of -45..45 degrees. * An angle of 0 means dead centre, -45 degrees are the extreme left * and 45 degrees the extreme right. The table values cover the range * of 0..256 and must be divided by 256 before they are used as * an amplitude factor. */ for(i = 0 ; i <= 90 ; i++) { radians = ((i - 45) * PI) / 180.0; pan_left_table[i] = floor(256 * sqrt(2.0) / 2.0 * (cos(radians) - sin(radians)) + 0.5); pan_right_table[i] = floor(256 * sqrt(2.0) / 2.0 * (cos(radians) + sin(radians)) + 0.5); } Last edited by Olaf Barthel; 07 August 2023 at 11:10. |
|
07 August 2023, 14:43 | #23 | |
Registered User
Join Date: Jul 2023
Location: UK
Posts: 25
|
Maybe there's something helpful in here regarding simulating a sound coming from behind (provided any of it is actually possible on the Amiga hardware of course)?
https://www.reddit.com/r/edmproducti...unds_like_its/ Quote:
|
|
10 August 2023, 10:30 | #24 | |
Registered User
Join Date: Aug 2010
Location: Germany
Posts: 532
|
Quote:
Code:
* The following implements digital Schroeder reverberation, using * information gleaned from: * * https://medium.com/the-seekers-project/coding-a-basic-reverb-algorithm-an-introduction-to-audio-programming-d5d90ad58bde * https://medium.com/the-seekers-project/coding-a-basic-reverb-algorithm-part-2-an-introduction-to-audio-programming-4db79dd4e325 * https://github.com/Rishikeshdaoo/Reverberator * * This involves four comb filters and two all-pass filters with * predefined delay and decay intervals. The Schroeder reverberation * produces a slightly metallic tinge in the tone of the reverberation. * This is fine for our purposes, which attempts to produce a sound like * the boing ball demo sound sample. * * The Schroeder reverberation algorithm is described in a paper by * M. R. Schroeder, "Natural sounding artificial reverberation" * published in the "Journal of the Audio Engineering Society", * July 1962, Volume 10, Number 3. |
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Amiga sound cutting out on games | pauliekins | support.WinUAE | 2 | 28 March 2016 04:24 |
buggy sound on some DOS games | clauddio | Retrogaming General Discussion | 3 | 29 September 2012 19:07 |
Sound lags while recording on certain games | bLAZER | support.WinUAE | 46 | 05 December 2010 12:51 |
sound prob on some games using 1.5.3, okay on 1.2 | kirk | support.WinUAE | 5 | 16 April 2009 07:51 |
Film Sound FX into Games | Dastardly | Nostalgia & memories | 8 | 23 June 2004 01:51 |
|
|