Synthpopalooza Posted April 3, 2020 Share Posted April 3, 2020 (edited) Ok ... Having a bit of trouble. I am using zeros in the music data of this, to get them to silence ... problem is, the code I use to filter them out and replace with silence, is destroying the timing of the track. Can anyone have a look at this and see what is going wrong? Thanks ... strangerthings.asm strangerthings.s strangerthings.xex Edited April 3, 2020 by Synthpopalooza Quote Link to comment Share on other sites More sharing options...
TGB1718 Posted April 4, 2020 Share Posted April 4, 2020 Had a quick look, can't see anything obvious yet, but will have another look later. One thing I did notice, in your deferred VBI routine, you save A,X and Y on the stack , then restore them, I believe the OS does this anyway, so no real need for you to do it, DLI routines need to do it tho. Quote Link to comment Share on other sites More sharing options...
matosimi Posted April 11, 2020 Share Posted April 11, 2020 maybe it would be good if you put some comments to your code so there would be no time wasted by guessing what you mean btw the *.asm file made my day, mixed caps, 4types of indentation ... looks like intentional joke to me 1 Quote Link to comment Share on other sites More sharing options...
+playsoft Posted April 22, 2020 Share Posted April 22, 2020 One thing I noticed is that the volume is not protected against decrementing below 0. I changed: DEC FREQCNT,X ;REDUCE THE NUMBER OF FRAMES UNTIL NEXT DECAY BNE TUNNEXT ;IF WE AREN'T AT ZERO YET, DON'T DECAY LDA DCYSTOR,X ;RESET THE DECAY FOR THE NEXT COUNT STA FREQCNT,X DEC CTLVOL,X ;DECREMENT THE VOLUME LDA CTLVOL,X LDY TUNCHANNEL AND MUTEMASK,Y STA AUDC0,Y JMP TUNNEXT ;GO TO NEXT CHANNEL To: DEC FREQCNT,X ;REDUCE THE NUMBER OF FRAMES UNTIL NEXT DECAY BEQ DEC_VOLUME JMP TUNNEXT ;IF WE AREN'T AT ZERO YET, DON'T DECAY DEC_VOLUME LDA DCYSTOR,X ;RESET THE DECAY FOR THE NEXT COUNT STA FREQCNT,X LDA CTLVOL,X ;IF VOLUME ALREADY 0 DO NOT DECREMENT AND #$0F BEQ TUNNEXT DEC CTLVOL,X ;DECREMENT THE VOLUME LDA CTLVOL,X LDY TUNCHANNEL AND MUTEMASK,Y STA AUDC0,Y JMP TUNNEXT ;GO TO NEXT CHANNEL I'm not sure it affects timing, but it sounds cleaner to me, see what you think. strangerthings.s strangerthings.obx 1 Quote Link to comment Share on other sites More sharing options...
Synthpopalooza Posted August 5, 2020 Author Share Posted August 5, 2020 Sorry for the late response. That actually cleaned up the knocking sounds I get when using 16 bit or SKCTL mode. Thanks! Quote Link to comment Share on other sites More sharing options...
Synthpopalooza Posted September 11, 2020 Author Share Posted September 11, 2020 So I have fixed the zero frequency problem ... Resurrecting this again though, because I am wanting to use this code to address double POKEY. That is have the channel indexes 4 thru 7 to address second POKEY. Apart from adding in the extra equates, what code mods would I need to do to make the second POKEY play? Quote Link to comment Share on other sites More sharing options...
miker Posted September 12, 2020 Share Posted September 12, 2020 (edited) I don't know if I understand tight your question right but while 1st POKEY uses address range $D200 - $D20F, 2nd one has $10 offset and so its address range is $D210 - $D21F respectively. Edited September 12, 2020 by miker typo Quote Link to comment Share on other sites More sharing options...
ivop Posted September 12, 2020 Share Posted September 12, 2020 21 hours ago, Synthpopalooza said: what code mods would I need to do to make the second POKEY play? Proper init. From the RMT player source code: IFT STEREOMODE>0 lda #0 sta $d208 sta $d218 ldy #3 sty $d20f sty $d21f ldy #8 si1 sta $d200,y sta $d210,y dey bpl si1 ELS lda #0 sta $d208 ldy #3 sty $d20f ldy #8 si1 sta $d200,y dey bpl si1 EIF HTH 1 Quote Link to comment Share on other sites More sharing options...
Synthpopalooza Posted September 12, 2020 Author Share Posted September 12, 2020 Yep, I kinda got all that ... I'll look through the code and see what I can wrangle. My code is not RMT based, as I want to use a lot of non-RMT settings such as 16-bit $Cx, two-tone, reverse 16-bit, etc. Quote Link to comment Share on other sites More sharing options...
ivop Posted September 12, 2020 Share Posted September 12, 2020 (edited) 2 hours ago, Synthpopalooza said: Yep, I kinda got all that ... I'll look through the code and see what I can wrangle. My code is not RMT based, as I want to use a lot of non-RMT settings such as 16-bit $Cx, two-tone, reverse 16-bit, etc. Yeah, I know it's your own player. But not properly initializing the second pokey (first is done by the OS) bit me in the behind once with atarisid4 or something sid2gumby not working on Altirra and real hardware, so I thought I'd mention it. Just in case. I merely checked the RMT source to see what Raster did and posted that as an example Edit: BTW what is reverse 16-bit? Edit2: it was sid2gumby, obviously, as that one uses a second pokey. Edited September 12, 2020 by ivop 1 1 Quote Link to comment Share on other sites More sharing options...
Synthpopalooza Posted September 12, 2020 Author Share Posted September 12, 2020 (edited) Standard 16-bit usage silences the first channel and plays the second. This is usually accompanied by a 1.79 mhz clock setting. Reverse 16-bit silences the second channel and plays the first. This setting may or may not necessarily use the 1.79 mhz clock. Some unusual properties can be had. I have a WIP POKEY note table on the 7800 forum that has documented three such settings. In the $Ax setting you use the standard 64 khz clock. You get the standard 8-bit note table, then an octave of 25% duty cycle pulse wave notes from about A#2 to B3, then some lower range 25% bass notes starting at about A#1 or so. On $4x or $8x plus poly 9, you get guitar distortions with a pulsing vibrato that can be modulated by vibration rate. These require the 1.79 clock to work properly. Edited September 12, 2020 by Synthpopalooza 3 Quote Link to comment Share on other sites More sharing options...
ivop Posted September 14, 2020 Share Posted September 14, 2020 (edited) Are you composing these new tables all by hand or do you use some sort of FFT to determine the base frequency of each setting? 8-bit, 16-bit and reverse 16-bit (and maybe "double" 16-bit i.e. set both channels to non silent) Then for each all combinations of poly 9/poly17 with all three clocks (15kHz, 64kHz, 1.79MHz) for each distortion 7 distortions * 3 clocks * 2 polys * 256 audfs = 10752 7 * 3 * 2 * 65536 = 2752512 10752 + 2752512 + 2752512 = 5515776, which is well over 5.5 milion combinations. If it took you one second to evaluate one setting, and work 24/7, it'll take ~64 days. If it took you one minute to evaluate one setting, and work 24/7, it'll take you ~10.5 years Edit: btw do you use real hardware or a pokey emulation? Edited September 14, 2020 by ivop 1 Quote Link to comment Share on other sites More sharing options...
ivop Posted September 15, 2020 Share Posted September 15, 2020 Good, that Stephen found this amusing Partly it was meant as such. But my questions were serious. Do you tune acoustically or use software to determine the base freqeuncy, and do you use a real pokey or emulation? I think it could largely be automated, but I don't want to reinvent the wheel if you have already done so. Quote Link to comment Share on other sites More sharing options...
+Stephen Posted September 16, 2020 Share Posted September 16, 2020 5 hours ago, ivop said: Good, that Stephen found this amusing Partly it was meant as such. But my questions were serious. Do you tune acoustically or use software to determine the base freqeuncy, and do you use a real pokey or emulation? I think it could largely be automated, but I don't want to reinvent the wheel if you have already done so. Sorry - I only "laughed" at that post because it was so "math nerd" cool. Fascinating topic, one that I am interested in but probably have nothing to contribute. Sorry for the diversion. Quote Link to comment Share on other sites More sharing options...
ivop Posted September 16, 2020 Share Posted September 16, 2020 11 hours ago, Stephen said: Sorry - I only "laughed" at that post because it was so "math nerd" cool. Fascinating topic, one that I am interested in but probably have nothing to contribute. Sorry for the diversion. No worries My math is not complete BTW I forgot high pass filtering and two tone mode. If you would work 8 hours a day, it will take you a life time. So hopefully @Synthpopalooza has already some automation in place. If not, it might be interesting to look into myself. 1 Quote Link to comment Share on other sites More sharing options...
Synthpopalooza Posted September 16, 2020 Author Share Posted September 16, 2020 It's done by hand so far ... and I have managed to eliminate some settings which don't produce music tones, so that cuts down the numbers some. Also 16-bit and 2-tone don't work together. Everything is tuned using Altirra which has a very good pokey emulation, and by ear using standard $Ax tables as a reference. Quote Link to comment Share on other sites More sharing options...
Synthpopalooza Posted September 16, 2020 Author Share Posted September 16, 2020 Also: double 16-bit hasn't yet provided anything useful to me ... tho maybe in conjunction with hi pass or two tone, but that's way down the track right now. Also the poly 9 settings only work with $8x or $0x settings, and so far only the 1.79 clocks. Quote Link to comment Share on other sites More sharing options...
Synthpopalooza Posted September 16, 2020 Author Share Posted September 16, 2020 If you've any ideas for automating this process I am all for it. Quote Link to comment Share on other sites More sharing options...
ivop Posted September 16, 2020 Share Posted September 16, 2020 (edited) 30 minutes ago, Synthpopalooza said: If you've any ideas for automating this process I am all for it. My idea is to write a small (basic) program that loops through, say, 256 AUDF values and plays each note for a short period of time, followed by an equal amount of silence. Record as WAV and run through a FFT (Fast Fourier Transform) to determine the lowest dominant frequency. Dump to CSV file. Depending on the window size of the FFT needed to reliably determine the frequency, it could still take quite a while, but you can do something else in the mean time For example, 0.1s window (4410 samples; hopefully enough) and a 16-bit pokey configuration: 65536 * 0.1 / 60 / 60 = 1.82 hours (~1 hour and 50 minutes) Also, it would be nice to have a small program which alows you to manipulate all pokey registers by either typing in its new value or go up/down. That way it would be easier to find settings that might be interesting to fully explore with automation. What would happen if you set Pokey to two 16-bit channels (1/2 and 3/4) and enable high pass filtering (either 1/3 or 2/4 or both)? Do you end up with a single channel? Edited September 16, 2020 by ivop 1 Quote Link to comment Share on other sites More sharing options...
Synthpopalooza Posted September 16, 2020 Author Share Posted September 16, 2020 I have written some basic programs which do some of that. Will post those later. They've helped cut some of the work. And yes, double 16 bit with hi pass on 2nd and 4th in $Ax is one huge channel. Among other things you can get the swirling hum effect and repeating hum effects in Defender this way. and commodore 64 SID swirls. I've already documented standard hi pass mode in $Ax anyway, so this one will not be too hard. You have to extend the standard $Ax note table down several octaves though. 2 Quote Link to comment Share on other sites More sharing options...
RevEng Posted September 16, 2020 Share Posted September 16, 2020 49 minutes ago, ivop said: Depending on the window size of the FFT needed to reliably determine the frequency, it could still take quite a while, but you can do something else in the mean time For example, 0.1s window (4410 samples; hopefully enough) and a 16-bit pokey configuration: 65536 * 0.1 / 60 / 60 = 1.82 hours (~1 hour and 50 minutes) A sample that's the period of 1/10th of a second will net you an effective FFT resolution of 10Hz, which doesn't cut it for music frequencies. This is a bit more obvious if you think about your bucket of 4410 samples turning into a bucket of 2205 FFT values that represent the power spread across the entire frequency spectrum your sample rate can represent. (The less obvious underlying physical reason for this limitation, is the smaller capture length makes nearby frequencies indistinguishable from each other, because the FFT never sees a full cycle of difference between those nearby frequencies. i.e. FFT can't detect a partial frequency cycle.) I became fairly well acquainted with this limitation in FFT resolution when attempting WAV to TIA conversion at 60Hz. In your case you at least have the workaround to just increase the length of capture, though you'll need a full second of capture to get a frequency resolution of 1Hz. (i.e. a bucket size of 22048 FFT values) 1 1 Quote Link to comment Share on other sites More sharing options...
ivop Posted September 16, 2020 Share Posted September 16, 2020 (edited) Did some quick research and reading up on FFTs and 4410 samples won't cut it. Frequency resolution is Fs/N, where Fs is the sample frequency (44100Hz) and N are the number of data points (4410). The frequency resolution in this case is 10Hz, which is too high for the lower notes. We need at least 1Hz, maybe even less for the lower bass frequencies. Edit: LOL that's what RevEng said at about the same time Edit2: so we need at least 36.4 hours of data for a full 16-bit sweep. The "generator" program should disable all interrupts and ANTIC, and then run Altirra at turbo mode Resulting WAV (mono) will be around 5.38 GB Edit3: the pause between notes could be made shorter, as long as it is predictable where each new note begins. Edited September 16, 2020 by ivop 2 Quote Link to comment Share on other sites More sharing options...
Synthpopalooza Posted September 16, 2020 Author Share Posted September 16, 2020 Well, if it helps ... I will post my program tonight that I am using to make the tables. To begin with, I am doing the reverse 16-bit and two-tone modes. Of these, I have documented the following already: Reverse 16-bit: $Ax @64 @15, $4x @1.79, $8x @1.79 9-bit Two-tone: $Ax @64, @64+1.79, @15, $4x @1.79 (partially) Hi-pass: $Ax @64 @15, working on $2x ones now. Some of these are already on my POKEY table on the 7800 forum. 1 Quote Link to comment Share on other sites More sharing options...
Synthpopalooza Posted September 16, 2020 Author Share Posted September 16, 2020 The real tricky part is, some of these settings will have multiple tables, especially $4x in two-tone, which behaves alot like $Cx with it's mod 3 polycounter properties. Quote Link to comment Share on other sites More sharing options...
ivop Posted September 16, 2020 Share Posted September 16, 2020 1 minute ago, Synthpopalooza said: The real tricky part is, some of these settings will have multiple tables, especially $4x in two-tone, which behaves alot like $Cx with it's mod 3 polycounter properties. I understand. That's why I mentioned a possible program similar to what you already have If you can raise/lower the AUDF registers and hear what happens, I reckon mod 3 or 5 etc... can easily be detected. That information could also be fed to a program that determines base frequencies. I wonder what an FFT would make of our pink noise distortions. In 16-bit mode, does it matter if both channels have the same distortion or are different? Perhaps in reverse 16-bit mode it does? That's something I would not ask if I had a program to easily test it myself Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.