Shop OBEX P1 Docs P2 Docs Learn Events
Polyphonic SIDcog synth - WIP - Page 3 — Parallax Forums

Polyphonic SIDcog synth - WIP

13»

Comments

  • onewheeltomonewheeltom Posts: 40
    edited 2012-11-18 09:26
    So, I've been running the debug terminal in both USE_STEREO_DUTY and USE_SPDIF modes.

    Initialization (in both modes) looks normal up to the output :

    [CC] *** ALL NOTES OFF ***
    GM Reset

    If I am using USE_STDUTY, I start to see active sensing messages from the MIDI keyboard (continuous output) after the GM Reset output :

    Sys message byte FE
    System FE

    When I press keys on the MIDI keyboard, I can see the associated output from DEBUG, and hear the output.

    When I compile with USE_SPDIF, the last output I get from the debug terminal is :

    [CC] *** ALL NOTES OFF ***
    GM Reset

    I do not see the active sensing messages (FE) or any MIDI data. No audio output either.

    So, using SPDIF appears to be blocking the incoming MIDI data stream.

    As I mentioned before, If I run the SPDIF test programs, the proper audio output is generated.

    I will continue to investigate. If this behavior looks familiar, or there is something else I should try, please let me know.

    Thanks,
    Tom
  • onewheeltomonewheeltom Posts: 40
    edited 2012-11-19 08:38
    I worked through the problems I was having :
    - Using P12 for MIDI in does not work when using S/PDIF on the default ports. Changed to P3.
    - Error with labeling pins P0-P3 on SD card interface header. Doh.

    I'm using the simple voltage divider level converter for the output to the D/A converter.

    It is working, but with significant distortion. I'm going to try it this evening using the standard TV out circuit on my Quick Proto board.

    Where has everyone gone?

    --tom
  • AntoineDoinelAntoineDoinel Posts: 312
    edited 2012-11-19 15:11
    I worked through the problems I was having :
    - Using P12 for MIDI in does not work when using S/PDIF on the default ports. Changed to P3.
    - Error with labeling pins P0-P3 on SD card interface header. Doh.

    I'm using the simple voltage divider level converter for the output to the D/A converter.

    It is working, but with significant distortion. I'm going to try it this evening using the standard TV out circuit on my Quick Proto board.

    Where has everyone gone?

    --tom

    Hi Tom

    When using P13 for SPDIF and P12 for MIDI, and not thru the TV dac, have you tried uncommenting this line...
    #define SPDIF_TVOUT_COAX
    
    ...at the beginning of spdifOut_mod?
    That line activates biasing on P12..P15 (intended to match levels of an external voltage divider), but when using single pins as in the PMC that's probably going to interfere with the MIDI input on P12.

    I guess you're right that some combinations of input/output need MUCH more testing, the last update was kind of rushed,

    There are definitely more options to try, including use of a TDA1543 I2S DAC (already waiting in the parts bin). Together with a 2nd order low pass it should be adequate for high quality output.

    But if you hear noise in SPDIF output, I'm afraid that's not down to the output method for the single sample, but more likely either, as Ahle2 suggested, the mismatch of SIDcog vs output driver sample rates, or the tick frequency of the modulation thread creating "zipping" noise.
    The first must be addressed, I tried to avoid it but now I've come to the conclusion it's necessary.
    The second will require rewriting the modulation thread in PASM. Probably not enough to push it out of audio band, but sure it won't hurt.

    Lately I'm not getting enough time to do anything more than reading the forums (and compulsively pledging kickstarters :lol:), but I hope to be able to work a bit on this in one of the next week ends.

    Alessandro
  • onewheeltomonewheeltom Posts: 40
    edited 2012-11-20 08:46
    Antoine,

    I moved the circuit to another proto board that had the TV out circuitry built in. Sound quality was about the same.

    (This may be a dumb question but....) Is it possible to split the processing load for SIDCog across 2 cogs? I would rather have fewer higher quality sounding SID engines.

    My next experiment will be to try analog out with separate outputs for each SID. Is there an optimum output circuit to use?

    Thanks,
    Tom
  • AntoineDoinelAntoineDoinel Posts: 312
    edited 2012-11-20 11:40
    Antoine,

    I moved the circuit to another proto board that had the TV out circuitry built in. Sound quality was about the same.

    (This may be a dumb question but....) Is it possible to split the processing load for SIDCog across 2 cogs? I would rather have fewer higher quality sounding SID engines.

    My next experiment will be to try analog out with separate outputs for each SID. Is there an optimum output circuit to use?

    Thanks,
    Tom

    Tom,

    if you're going with the separate outputs only, in that case the output driver has no useful function anymore, as the separate outputs are driven directly by SIDs.

    So, in that case the SID sample rate will remain at its original value, something around 31KHz if I recall correctly, and no need to split processing (it would be quite a lot of work anyway!).

    As a first test I would try something as simple as this:


    passivemix.jpg


    Where P4..P7 are the separate outputs, to be changed if necessary.
    Note this circuit has mono output. Values are not critical, but they will change the filtering frequency: those shown are for a cutoff approximately 4 times higher than the filter on the demo board, which is regarded as "too dark" by many forum members.

    Obviously an active low pass would do a much better job, a sallen-key topology could be used for a 2nd order with a single op-amp.
    Maybe some other forum member with more experience on analog can advise you on that.

    If it works well enough, I have thought of some sligtly more complex alternatives, for trying to retain the "fake" stereo implemented with StereoSpatializer.
    Also, this would potentially free one COG, useable for something else like your idea to connect knobs directly.

    Alessandro
    357 x 363 - 26K
  • Ahle2Ahle2 Posts: 1,179
    edited 2012-11-20 12:11
    (This may be a dumb question but....) Is it possible to split the processing load for SIDCog across 2 cogs? I would rather have fewer higher quality sounding SID engines.
    That is possible, but not trivial; I have thought about making a HQ version of SIDcog using more than one cog many times over the years.
    In this case, however, I am pretty sure that like 80% of the "lofi" comes from the aliasing produced when converting 31 kHz to 48 kHz (or whatever is used).
    Imagine resizing an image from 320x200 to 380x240 without any interpolation, that's pretty much what's happening but for sound.
  • Ahle2Ahle2 Posts: 1,179
    edited 2012-11-20 12:31
    After looking at the spatializer code I can say that it's even worse than anticipated. It actually get's DOWNsampled to 20 kHz.
    It might be possible to modify the spatializer code to sync 1:1 to the sample rate of SIDcog. But to be honest I suspect that chips code uses most of the cycles at 20 kHz. :(
    Knowing what I know now, I can say that you probably will get significant increase in quality if doing the mixing outside the propeller like described in post #66.

    (Btw, doing 1:1 mixing in a single cog with stereo sound is possible, but maybe not with chips code)

    /Ahle2
  • onewheeltomonewheeltom Posts: 40
    edited 2012-11-21 21:52
    Antoine,

    I tried your circuit with the separate SID outputs and the sound is definitely improved over mixing internally and generating digital output. The less post processing of SID output, the better, I would think. In the background with no keys pressed, I can hear some digital "noise" which could probably be filtered out.

    I'll upload a sound sample later today.

    --tom
  • Ahle2Ahle2 Posts: 1,179
    edited 2012-11-22 02:02
    The less post processing of SID output, the better, I would think.
    While that's true, it's still ONE aspect of the post processing that makes like 95% of the distortion.
    And that single aspect is downsampling to a "non power of two" sample rate (A LOT of aliasing).To be honest I think downsampling to 31 kHz/2 = 15.5 kHz would have sounded better actually; Even though it's 25% lower sample rate.
    Making chips code run at 31 kHz would solve almost all issues. But because of the complexity of the code, I'm pretty sure that's not possible. :(

    I could hack something together that pretty much does the same thing as the analog external solution in a single cog synced 1:1 to SIDcog.
    That shouldn't be many rows of assembly and it will not take very long to do. A fun weekend hack.
    Of course it will be nothing like the spatializer in terms of adding warmth and "increasing the soundscape".

    /Johannes
  • AntoineDoinelAntoineDoinel Posts: 312
    edited 2012-11-22 03:45
    Ahle2 wrote: »
    While that's true, it's still ONE aspect of the post processing that makes like 95% of the distortion.
    And that single aspect is downsampling to a "non power of two" sample rate (A LOT of aliasing).To be honest I think downsampling to 31 kHz/2 = 15.5 kHz would have sounded better actually; Even though it's 25% lower sample rate.
    Making chips code run at 31 kHz would solve almost all issues. But because of the complexity of the code, I'm pretty sure that's not possible. :(

    I could hack something together that pretty much does the same thing as the analog external solution in a single cog synced 1:1 to SIDcog.
    That shouldn't be many rows of assembly and it will not take very long to do. A fun weekend hack.
    Of course it will be nothing like the spatializer in terms of adding warmth and "increasing the soundscape".

    /Johannes

    Johannes,

    even a 4:1 mix synced at 31KHz would be great.
    And anyway, not performing heavy stuff like in Chip's code leaves it open for adding more in the loop later (i.e. 4:2 mix with level and panpot).
    That sure would help, I'd like to mantain the option for "no additional hardware" (apart from MIDI! :smile:) for this project, at least on common platforms.

    Alessandro
  • onewheeltomonewheeltom Posts: 40
    edited 2012-12-06 07:54
    I was trying to reduce the number of cogs running SIDCog to see if the distortion problem would improve. There is a NUM_VOICES parameter in the sidsynth.spin which is set to 4. If I reduce this number, the code will not compile. There must be another dependency somewhere.

    How difficult would it be to change the code to use just one SIDcog? For simple synth uses, one or two SID chips would be plenty. I would gladly trade away more cogs for less distortion.

    Thanks,
    tom
  • Ahle2Ahle2 Posts: 1,179
    edited 2012-12-06 08:33
    Reducing number of SID cores will not make any difference. The distortion comes from the sample rate conversion between SIDcog and stereo spatializer. As long as no anti aliasing is used and the conversion is a non power of two (like here) , you will get aliasing distortion.
  • cruXiblecruXible Posts: 78
    edited 2015-03-17 18:05
    Ahle2 wrote: »
    Reducing number of SID cores will not make any difference. The distortion comes from the sample rate conversion between SIDcog and stereo spatializer. As long as no anti aliasing is used and the conversion is a non power of two (like here) , you will get aliasing distortion.

    Has anyone created a stereo object that mixes 31khz sample streams yet?

    Would overclocking to 124mhz and slowing down the sidcog so it writes at 31khz work? Stereospatializer would also be sampling at 31khz.
  • leolodreamlandleolodreamland Posts: 1
    edited 2016-11-30 16:18
    I really wanted to get this working with the Pi Propeller Hat but bst was never compiled for arm. is there a way of getting this to work in spin/propelleride?
  • OpenSpin works on ARM. I'm pretty sure it supports BST conditionals (but you might have to pass OpenSpin a flag to enable them). If this doesn't use @@@, then it should compile fine on OpenSpin.
Sign In or Register to comment.