Lee O'D

Members
  • Content count

    32
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Lee O'D

  1. Lee O'D

    Working with I2S audio CODECs

    Hi there, I'm starting a new project to provide basic audio mixing in the digital domain, using a bunch of 2 in / 2 out audio CODECs. They all seem to be very similar in spec, and typically use a 16 or 24 bit transport over I2S (though you can configure other protocols such as raw 16 or 24 bit frames). I would drive all the CODECs (probably 8 of them) from common system, bit and channel clocks, and just have individual pins for the data in and outs which should keep the pin count down. I have two main challenges to begin with, and I was wondering if anyone could offer some advice: 1. Providing a master I2S interface (with the CODECs running as slaves), there are a few example VHDL libraries out there (eg http://opencores.org/project,i2s_interface ), but if anyone has had success with any libraries out there, or used the other protocols to interface the CODECs if it's simpler? 2. Providing a synthesized clock of the right rate. Depending on the sample rate (44.1 or 48kHz) I would need to provide either 11.2896 or 12.288 MHz CODEC system clock, with the other clocks being divided/counted from that. Clearly these are odd rates to derive from the 32MHz crystal, and would ideally need to be fairly accurate. Any pointers / recommendations on how to start on this please on the Spartan 6, this has clearly been tackled for eg video clock generation? Many thanks everyone Lee
  2. Lee O'D

    NoteOff Issues

    Received my retrocade synth and papillio pro yesterday - very pleased. Quality of the PCB manufacture is excellent (plus the layout is great - well done!) :-) Maybe I just didn't read the spec carefully enough, but I was expecting 2 x jack outputs (ie one stereo channel) so it was only after wondering why the jacks were stereo (initially I thought perhaps a contact switching dual mono/single stereo jack arrangement) and then after looking at the schematic that I realised that there's two sets of stereo outs! Well done on going above and beyond on the design!! I think i've found an issue with the MIDI input handling (should be an easy fix in the sketch/c libs) - I only had a few minutes last night, will check further but if there's a note-off close to a note-on sometimes it stops sounding on that channel. My keyboard also squrts out active sensing data so perhaps that's an issue - I'll try a different one to check in the next couple of days and also take a look through the code. Many thanks! Lee
  3. Lee O'D

    Working with I2S audio CODECs

    Sure, I'll share what I can when it's up and working. I will be making something vaguely wing form factor, depending on how much hardware I can fit onto the board (and whether i'll split off the analogue section to reduce noise). Cheers
  4. Lee O'D

    Working with I2S audio CODECs

    Thanks Steve, I managed to get simulation running ok. Managed to get some issues with the clocks resolved once the simulation was online. Now sounding 100% Next step is to get the data in, de-serialised and start doing things with it! Lee
  5. Lee O'D

    Working with I2S audio CODECs

    Hi all, So i've had a bit of time, managed to hack together the Wolfson 8569 onto a DIL breakout board and wire it up to receive clocks from the Papilio (C0=MCLK, C1=BCLK, C2=LRCLK for now). I used the PLL with 28x multiplier and 73 divider to get 12.274MHz MCLK (which is only 0.11% slow from 12.288MHz), and then used RTL to divide by 4 for the BCLK and by 64 for the LRCLK. For now i'm just looping the ADC digital out into the DAC in - getting the data into the FPGA will be the next step. I used hardware mode which means that I don't need to mess around with the SPI registers, and I can get 24 bit right justified out, which also means I don't need to implement I2S. I measured all the clocks on my scope and they were looking correct (though I only have a single channel scope, so checking the phase wasn't possible). Annoyingly I got zero output from the chip. Having given up last night, I checked everything today and same result. Then I realised that I hadn't selected fast slew on the clock outputs. Strangely, it works 100% when I have fast slew on the MCLK and BCLK, but leave the LRCLK with standard slew rate - weird! I don't have a proper PCB etc so perhaps there's some jitter getting in or something. Anyway, it sounds 100% with this configuration. I decided to use the onboard PLL, as when the design is done I will add a proper 12.288 or 24.576MHz crystal to an input pin and get all the clocks 100% accurate. I'm still finding my feet a bit around ISE etc (haven't done VHDL/FPGAs for over a decade, back in those days it was XACTstep and XC4000s), and I'm not entirely sure how to set simulation up - so I'm quite pleased to have something working in hardware after half a day! Cheers Lee
  6. Lee O'D

    Working with I2S audio CODECs

    Hi Steve, Yes I think for the final project implementation I would get a precise 12.288MHz crystal which are readily available, this was basically so I could get a basic prototype running with the parts I have to hand (Pap Pro, Wolfson 8569 CODEC, SSOP to DIL breakout board) to get moving on the HDL front. It should be easy later to swap out this temporary clock generator with a low jitter accurate one. I'll have a go with Hamster's code, solder up the parts and see if I can get any sampling going! Any thoughts on benefits of I2S vs right justified mode (the chip default is 16 bit right justified, I think this may be the simplest as it's just clocking data in/out MSB first,,,)? Thanks
  7. Lee O'D

    Working with I2S audio CODECs

    Hi all, Many thanks for all the info. Some great food for thought there. So I had tried using the clock wizard in ISE, but this couldn't get close to the desired clock frequency (and the jitter seemed pretty big too). This was using PLL_BASE, would DCM be any more accurate? Hamster - your code seems really interesting, using the same calculation, for me to generate a 12.288MHz clock (which is 48kHz x 256 as the ideal clock), then I'd get: 32 MHz -> 12.288 MHz= 32000000 / 12288000 = 2.604166666666666= 2 + 7424000 / 12288000= 2 + 29/48 (NB I assume FPGA clock at 32MHz, obviously if I decided to run the rest of the system faster I would need to scale up the values here, eg 96MHz source came out as = 7 + 39 / 48...) These values seem quite reasonable, do you think these values should work with your code (ie they are quite a lot smaller ratios than your SPDIF example)? I guess I will give it a go and see.. How can you estimate the amount of jitter - it is just +/- half the period of the source clock? Is this the period of the system clock (if I multiply up) or the physical crystal speed? Very interesting thoughts anyway, I must admit generating clocks ourselves rather than using the inbuilt clock generation isn't something that had occurred to me! The rest of the project (which will include EQ etc) will also be a challenge, but I'm starting small by just trying to get data in and out of the CODEC intact, then some simple summations etc - and go on from there. Cheers Lee
  8. Hi, I wasn't sure whether this belongs in the Pap Pro or Retrocade forum... So I've been meaning to find the time to pull down the git repos for the Pap Pro with the Retrocade peripherals such that I can finally start having a play with the HDL. As per the readme.txt in the retrocade ZPUino_SOC directory I was hoping that there would be an ISE project file so that I can pull in the project with all the components into ISE easily, but there doesn't seem to be an ISE directory or file within the retrocade variant as per the instructions: "To load the ZPUino RetroCade variant install Xilinx ISE Webpack and open:zpuino\boards\papilio-pro\S6LX9\variants\retrocade\ise\ise.xise" There is an ise file for the Pap One (retrocade lite) however which loads up fine... Is this missing from the repo, intentionally not there or just me being daft? :-) Thanks guys Lee
  9. Lee O'D

    ISE file for Retrocade (Pro)

    Thanks Alvie. I quite surprised myself by being able to get the design to synthesize, implement (all constraints met from the ucf), and generate a bit file - which worked (after putting back the sketch)!! There were loads of warnings during the process, but nothing that looked abnormal - is this what you get? Many thanks!
  10. Lee O'D

    SID Filters

    Yep - fully aware of the FPGA64, was just thinking that the SID would be so much better now... :-)
  11. Lee O'D

    NoteOff Issues

    Excellent glad I could help get you fixed.
  12. Lee O'D

    SID Filters

    Just been giving the new bit file a run through - I think we're pretty much there, I've listened to a few tunes and I can't spot any obvious issues! Well done guys, mightily impressed with the coding and turnaround time on these issues! I've noticed also since the direct register writing fix, the timing seems to be better. I think previously all the unnecessary writing to ram and then copying to registers was slowing down the ZPUino player too much, seems to sound a lot tighter now. Just as an aside, although my primary interest is for a standalone SID / POKEY / YM MIDI synth module (a hardware version of Plogue chipsounds is basically what I'm after!), I'm wondering from the papilio arcade side of the house, is there a desire to produce a full C64 as an output - a full SID with filters is obviously a big (and most exciting!) part, the PLA/CIAs are dead easy though the VIC-II would take some work (although obviously there's other HDL out there already for that)? Well done guys
  13. Lee O'D

    SID Filters

    Excellent, will give this a try tonight when I get home!
  14. Lee O'D

    SID Filters

    I agree that the envelope triggering issue is fixed with the direct register writing, which is great. There's definitely still something amiss with the voicing. Compare these attachments for Ghostbusters 2 - it's Sidplay and the retrocade (with the latest code from above). The drums sound completely different / very hard to hear on the retrocade? Any ideas? Thanks guys GHOSTBU2.mp3 GHOSTBU2_Retro.mp3
  15. Lee O'D

    SID Filters

    Brilliant, you know I was looking at the same thing last night before I ran out of time. I was mainly thinking about whether there was anything that was triggered if the same values were written into the register would perhaps restart the envelope... not the answer but I was close! Wouldn't it be better to arrange the code as: while (1) {while (!tick);tick=0;int clocks = cpuJSR(play_addr,0);//printf("Ticck? %d\n",clocks);.... Just because in the order it's in at the moment, it will do the code (with reg updates) and then wait for the tick. If there's any serial activity (or future code) it would slow down the time before reaching the next code execution? In this way it's closer to the real ISR in that the VBI would start the next round of code (and reg updates) immediately? Glad to see it's all working, yay! Alvie - very keen to see the new HDL when you can publish it please! Cheers
  16. Lee O'D

    SID Filters

    Just had a look, tried a couple of songs and I couldn't see any reads or writes to VIC, CIA1 or CIA2, or reads from SID (D000-D800, DC00-DDFF), so not sure... I also checked the IO register and that was set to all RAM mapped in, and I/O from D000-DFFF (no ROM) in the unlikely event that they were somehow reading stuff from the ROMs... Jack, so the one thing your combination didn't list as trying was ACID64 playing into the SID with filters? Just to fully rule out the VHDL side? In that case it should sound fine if the tinySID / SIDdumper is suspected as not emulating correctly...? Cheers
  17. Lee O'D

    SID Filters

    Yep, i've just done the same thing with a couple of songs - no reads from the SID (including 'ghost' register sets). Might have a look at the other non-RAM blocks now, though the processor port mapping the RAM in and out makes this slightly more convoluted..
  18. Lee O'D

    SID Filters

    Wow, that is interesting Jack.. You never know what those crazy C64 music coders might have been doing, I did read this myself and wondered who would ever want to do this: ENV 3 (Register $1C)Same as OSC 3, but this register allows the microprocessor to read the output of the Voice 3 Envelope Generator. This output can be added to the Filler Frequency to produce harmonic envelopes, WAH WAH, and similar effects. “Phaser” sounds can be created by adding this output to the frequency control registers of an oscillator. The Voice 3 Envelope Generator must be gated in order to produce any output from this register. The OSC 3 register, however, always reflects the changing output of the oscillator and is not affected in any way by the Envelope Generator. ... but I guess it's easy to report on any reads to $D400..D7FF to check the theory ?
  19. Lee O'D

    SID Filters

    Nice one Jack - yes that correlates with the thoughts / evidence I was seeing around the voices fading out, and also seeing issues when the gate was triggered, but lacking another hardware SID to drive from the sketch limited my debugging! Hopefully it's just a minor fix in the VHDL... So it is only voice 1 that you think is affected? The reason I ask is that the SID have the weird ability to read back the envelope generator for voice 3 via a read register which could confirm what it's doing during the fade issue. Of course, you could always temporarily add a port to all the voices to read back the 8 bit envelope value which may be trivial to do? Anyway, i'm sure now it's narrowed down it will be a quick fix, though I'm as confused as you as how adapting the netSID code would have changed the ADSR behaviour! On another note, if there was room on the FPGA wouldn't it be cool in the future to have a version that provided 32 multiplexed voices like Bob Yannes originally wanted to do for the SID? :-)
  20. Lee O'D

    SID Filters

    Just also had a play with Sanxion which sounds a bit odd, some strange 'bell like sounds'. I decided to mask out the registers so it only played voice 1 (regs 0..6 and volume), and the plinky sound occured at this transition: R: 38 52 0 8 21 10 0 R: 38 52 0 8 20 10 0 Which is where the gate bit is changed... Not sure if this is behaving differently / used in a weird way on this tune? This voice is being used to ring modulate voice 2 by the way, so it could be a ring modulator issue?
  21. Lee O'D

    SID Filters

    Hi Alvie, I've had a little play around - so i'm not sure how to properly disable the filters (in HW), but if I modify the player such that it ignores anything for registers 21..23 and masks out the upper nibble of register 24 then nothing should get written to the filter registers. I did this with modifying the play loop: for (i=0;i<25;i++) {if(i<21) {sid.writeData(i, sidregs); }if(i==24) {sid.writeData(i, (sidregs & 0x0F)); }} But I couldn't tell any difference. Also the register dump didn't seem to be trying to write anything to those registers either. I tried to capture some register dump around the weird sound - I'll also attach the sid file here so you can try, it's quite near the start just towards the end of the intro - one of the voices fades out and clicks (almost like a DC offset). As it's near the start it should be fairly easy to compare register dumps. Voices 1 and 2 look fairly plain (just frequency changes). Voice 3 is messing around with the PW and ADSR at the time the problem occurs. The file sounds fine on eg sidplay. What this sounds like on a version of the SID HW without filters I'm not sure? R: 176 14 0 0 33 10 192 112 14 0 0 33 10 192 52 6 128 7 65 141 0 0 0 0 15 R: 176 14 0 0 33 10 192 112 14 0 0 33 10 192 68 6 208 7 65 141 0 0 0 0 15 R: 176 14 0 0 33 10 192 176 14 0 0 33 10 192 52 6 32 8 65 141 0 0 0 0 15 R: 176 14 0 0 33 10 192 240 14 0 0 33 10 192 36 6 208 7 65 141 0 0 0 0 15 R: 176 14 0 0 33 10 192 176 14 0 0 33 10 192 20 6 128 7 65 141 0 0 0 0 15 R: 136 15 0 0 33 10 192 72 15 0 0 33 10 192 12 5 48 7 65 14 16 0 0 0 15 R: 136 15 0 0 33 10 192 72 15 0 0 33 10 192 12 5 224 6 65 14 16 0 0 0 15 R: 136 15 0 0 33 10 192 136 15 0 0 33 10 192 28 5 144 6 65 14 16 0 0 0 15 What does register 25 do? I noticed the code to toggle it on and off by "e" and "d" - is this controlling the filter by any chance? Very nice description of the filter above, by the way... :-) Cheers music.zip
  22. Lee O'D

    SID Filters

    I'm almost certain it's an ADSR issue. Try Ghostbusters 2 - I can't see how it would happen looking at the code, but it almost sounds like the ADSR is 'rolling over' so that loud sounds are becoming quiet erroneously...
  23. Lee O'D

    SID Filters

    Sorry for so many posts, just a bit excited. Are there any details on how the filters have been implemented? Were the DSP slices heavily used, and are they IIR based? Ta!
  24. Lee O'D

    SID Filters

    Just tried the Sanxion tune - good workout for the filters! Though some more odd glitches, and the timing of the playback seems a bit iffy - haven't got my head around the sketch yet to see how the timing is controlled, I would have thought with emulating the VBI through the ZPUino interrupt that the timing would be spot on. On another I couldn't get one of my favourite tunes - Ocean Loader by Martin Galway to play at all. Not to worry, I know you're not focusing on a sid player! Any thoughts yet how you plan to expose the filters for live MIDI use? I'm very keen on the thought of a bank store on the retrocade synth to control multiple voices (to thicken up live play), I'm very short on time at the moment though and development seems to be coming on quite fast that I would probably be overtaken! Many thanks Lee
  25. Lee O'D

    SID Filters

    Wow - great news to have this out! I'm up and running with the bit file / sketch. Thanks so much. There is some debugging to be done for sure though. Impressive that the whole 6510 emulation is so tiny in the sketch :-) But the songs do sound a bit strange, the filter parts sound ok, the main problems seem to be around sound balance between the voices, and some occasional odd timing things in songs where notes seem to skip (i've tried about 8 songs so far), and perhaps it's the ADSR piece as voices seem to fade away when they should still be playing? I can hear the filters working though and the overall sound isn't nasty, so hopefully the hardware side is close. Still - great achievement!