27 January 2016, 13:00 | #121 |
Registered User
Join Date: Jan 2016
Location: Knivsta / Sweden
Posts: 20
|
You're right that the handtuned version would be much more complex to handle. But it should be doable. The idea was to go "all in" for speed. The various routines could be auto-generated from code based on an analysis of what the song to be played needs.
Ok, but wouldn't the general version have that problem as well? |
27 January 2016, 13:11 | #122 | |
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,355
|
Quote:
Not with normal mixing code, no. |
|
27 January 2016, 13:45 | #123 |
Registered User
Join Date: Jan 2016
Location: Knivsta / Sweden
Posts: 20
|
Well, unless you want to waste cpu cycles by advancing at fractional rates for both virtual voices, you need to change the hardware playback frequency every now and then, even with normal mixing code.
An interrupt is generated when a prepared and latched buffer starts playing, so I suppose it would be ok to change hardware frequency when that interrupt occurs. If the code keeps track of what's in the buffer that is due to be played next, and starts a new buffer everytime there's a switch from one note to the next, then frequency changes should be in sync with the sample data. I don't see why such a strategy whouldn't work for audio data mixed by handtuned code sections as well. I am assuming then, that those are written so that they can generate a given number of output bytes (not just a multiple of what the inner loop generates) Last edited by drhex; 27 January 2016 at 13:52. |
27 January 2016, 14:14 | #124 | |||
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,355
|
Quote:
Quote:
Taking as granted that the audio interrupt will come at exactly the right time, is usually a big mistake. Quote:
The only way you can prove me that it can work is by actually doing it. |
|||
27 January 2016, 14:45 | #125 | |
Code Kitten
Join Date: Aug 2015
Location: Montreal/Canadia
Age: 52
Posts: 1,178
|
Quote:
Having an interest in the topic does not imply code must follow. Imagine we are all around a few beers in a pub. No computers, no coding possible, just figuring out what could be done and nothing else. |
|
27 January 2016, 14:51 | #126 |
Registered User
Join Date: Jan 2016
Location: Knivsta / Sweden
Posts: 20
|
Aha! Well, then I understand why hardware frequency playback changes will not be an issue.
The trick of sequencing a suitable number of reads from (a1)+ or (a1) (or alternatively inserting extra addq #1,a1 once in a while) can of course be applied to a0 (the other virtual voice) as well, so that a constant hardware playback rate can be used, if one is worried about interrupts that rank higher than audio. |
27 January 2016, 15:02 | #127 | ||||
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,355
|
Quote:
Quote:
Quote:
Quote:
|
||||
27 January 2016, 15:12 | #128 | ||
Code Kitten
Join Date: Aug 2015
Location: Montreal/Canadia
Age: 52
Posts: 1,178
|
Quote:
Also, this is a generalization, I see plenty of people coding on the EAB. Quote:
Waiter! Swap these beers with lemonade please! |
||
27 January 2016, 19:58 | #129 | |
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,355
|
Quote:
So either this thread gets moved elsewhere, or it remains about coding and not pure theory. |
|
27 January 2016, 20:02 | #130 |
Glastonbridge Software
Join Date: Jan 2012
Location: Edinburgh/Scotland
Posts: 2,243
|
how about...
on loading the mod, we downsample all the samples and interpolate them. Resampling on the fly could be achieved with look-up tables, and 32 bit masks. We have something like this: Code:
; first get A0 and D3 from a look up table based on the note to play move.l (A0)+,D0 moveq.l #31,D1 .loop lsl.l D0 addx.w D3,D2 move.b (A1,D2),D7 add.b D7,(A6)+ dbra D1,.loop |
27 January 2016, 20:10 | #131 | |
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,355
|
Quote:
|
|
27 January 2016, 20:13 | #132 |
Glastonbridge Software
Join Date: Jan 2012
Location: Edinburgh/Scotland
Posts: 2,243
|
not exactly, no... you fill the bit mask as per bresenham, so you can get more accurate period tables this way, and uses only 3 data registers rather than 4.
Edit: so can fit two resamplings in same loop: Code:
move.l (A0)+,D0 move.l (A1)+,D1 moveq.l #31,D6 .loop lsl.l D0 addx.w D4,D2 move.b (A2,D2),D7 lsl.l D1 addx.w D5,D3 add.b (A3,D3),D7 move.b D7,(A6)+ dbra D6,.loop Edit3: and can also use longword sample indexes D2 & D3. Last edited by Mrs Beanbag; 27 January 2016 at 20:26. |
27 January 2016, 20:20 | #133 |
Registered User
Join Date: Jun 2010
Location: PL?
Posts: 2,888
|
Trying to not misunderstand you - are you able explain this example - i see nothing wrong to play signal sampled with 5kHz at 6kHz sample rate.
|
27 January 2016, 20:30 | #134 | ||
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,355
|
Quote:
For grabbing data regs there are other ways, like this : Code:
add.w a0,d1 addx.w d2,d3 add.w a1,d4 addx.w d5,d6 Quote:
Isn't there more distortion when you upsample 5khz to 6khz, in comparison to something like 5khz to 15khz ? |
||
27 January 2016, 20:34 | #135 | |
Glastonbridge Software
Join Date: Jan 2012
Location: Edinburgh/Scotland
Posts: 2,243
|
Quote:
Using a Bresenham-like approach however, Paula's frequency tables could be matched exactly. |
|
27 January 2016, 23:49 | #136 | |
Code Kitten
Join Date: Aug 2015
Location: Montreal/Canadia
Age: 52
Posts: 1,178
|
Quote:
Drhex has a different hunch than you do, he might be wrong but who cares? Given enough counter arguments he or you will eventually see the light. Arguing that the matter needs to be settled by code make it sound like a western duel to death at sunset. |
|
28 January 2016, 09:12 | #137 | |
Registered User
Join Date: Jun 2010
Location: PL?
Posts: 2,888
|
Quote:
With above example it looks more like DDS http://en.wikipedia.org/wiki/Direct_digital_synthesizer than Wavetable http://en.wikipedia.org/wiki/Table-lookup_synthesis but not sure if this can work with CPU (i feel that jitter may be outcome of this so copper should be used instead CPU). |
|
28 January 2016, 11:32 | #138 | |||||
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,355
|
Quote:
Quote:
No quality gain (difference not hearable). No speed gain (as i've shown). Quote:
Quote:
I have given arguments at many places, and they usually get ignored when the other guy can't counter them. For example, what has Drhex to say for the fact there are too many combinations of possible code even for a very limited set of possible frequencies ? Nothing. I didn't get any reply. And this, because he has no clear idea of what he is talking about. Quote:
This is why i ask for code. |
|||||
28 January 2016, 13:21 | #139 | |
Registered User
Join Date: Jan 2016
Location: Knivsta / Sweden
Posts: 20
|
Quote:
But with 200kb dedicated and, say 200 bytes per routine, there could be 1000 of them. If you skip disc activity and receiving of serial data while playing (whose interrupts have priority over audio) the occational sample played at wrong period shouldn't cause more noise than is already caused by non-interpolation, and so the hardware can control the frequency of one of the virtual voices. With every instrument sampled once per octave, there will only be 12 possible playback frequencies, 12*12/2 = less than a hundred mixing routines required. |
|
28 January 2016, 13:46 | #140 | |
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,355
|
Quote:
Amiga periods for a soundtracker look like this : $0358,$0328,$02fa,$02d0,$02a6,$0280,$025c,$023a,$021a,$01fc,$01e0,$01c5 As you see, nothing like a simple 0.8 ratio. What will your mixing code look like for e.g. two notes played at a period of $358 for one and $328 for the other ? If you're just skipping pointer updates like in your 0.8 cases, then most routines can eventually end up a lot larger than the expected 200 bytes... You could perhaps sample for every 12 possible notes ; then the mixing code only has to deal with 2^n ratios (it'll do the octave changes). But you'll very soon be out of mem... Last question : is a 8ch effectless music taking lots of cpu and huge memory buffers any better than a 4ch music using full set of fx and taking only a small memory footprint with virtually no cpu time ? |
|
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 |
|
|