Shop OBEX P1 Docs P2 Docs Learn Events
Retronitus - Noise from the past! - Page 8 — Parallax Forums

Retronitus - Noise from the past!

15681011

Comments

  • Wuerfel_21Wuerfel_21 Posts: 5,050
    edited 2018-10-26 17:33
    Well, luckily i've been able to somewhat fix this issue myself.

    Also, attached is a little tune I started to cover to get more familiar with writing music for Retronitus. I'm thinking of finishing the cover, because why not?
    (Silly forum! Can't directly upload MKV...)

    A virtual cookie to anyone who recognizes (the beginning of) the tune, I guess.
  • David BetzDavid Betz Posts: 14,516
    edited 2018-10-28 02:11
    Darn! The Mac doesn't seem to know what to do with an MKV file.
  • It's a video file. I'd recommend VLC Media Player.
    But don't worry, it's almost done! And when it's done, I'll of course post the code.
  • Also, here is an mp3 (once again, in a zip) of what I've got now. This is about 50% done. If anyone has any ideas on how to improve the instruments, I'd like to hear them.

    Here's the percussions. They're on the triangle channel, as that one is seemingly better at making noise than the dedicated noise channel.... All of my instruments however are kindof bad, except for the snare, which is ripped straight from NearlyThere.spin
    TRI_PREC 'Triangly Percussion
        long    JUMP,                           -1 *STEPS ''TRG_0 (unused)
        long    JUMP,                           15 *STEPS ''TRG_1 (Shaker)
        long    JUMP,                           24 *STEPS ''TRG_2 (cymbal)
        long    JUMP,                           37 *STEPS ''TRG_3 (low snare)
        long    JUMP,                           0 *STEPS ''TRG_4 (unused)
        long    JUMP,                           0 *STEPS ''TRG_5 (unused)
                                                         ''TRG_6 (Kick)
    
        ''Kick/Base
        long    SET|MODULATION,                 $F0FFF000|$100
        long    SET|VOLUME,                     $FF000000
        long    SET|FREQUENCY,                  $F96F96F9
        long    SET|ENVELOPE,                   $00F80A00|$080
        long    MODIFY|FREQUENCY|(5 *wait_ms),  $B2CF9020
        long    SET|FREQUENCY,                  $003A02A0
        long    SET|VOLUME,                     $FF000000
        long    SET|ENVELOPE,                   $FFFCA200|$008
        long    MODIFY|FREQUENCY|(200 *wait_ms), $00000000
        long    SET|VOLUME,                     $00000000
        long    JUMP,                           -1 *STEPS
    
        ''Shakery something i don't know
        long    SET|MODULATION,                 $FFFFF000|$100
        long    SET|VOLUME,                     $AF000000
        long    SET|ENVELOPE,                   $00059800|$008
        long    SET|FREQUENCY,                  $04444444
        long    SET|VOLUME,                     $6F000000
        long    MODIFY|FREQUENCY|(90 *wait_ms), $B2CF9020
        long    SET|ENVELOPE,                   $FF57F400|$008
        long    MODIFY|FREQUENCY|(10 *wait_ms), $B2CF9020
        long    SET|VOLUME,                     $00000000
        long    JUMP,                           -1 *STEPS
        '' cymbal
        long    SET|MODULATION,                 $FFFFF000|$100
        long    SET|VOLUME,                     $FF000000
        long    SET|FREQUENCY,                  $024C24C2
        long    SET|ENVELOPE,                   $00A80A00|$008
        long    MODIFY|FREQUENCY|(4 *wait_ms),  $B2CF9020
        long    SET|FREQUENCY,                  $04444444
        long    MODIFY|FREQUENCY|(2 *wait_ms),  $FFEB33C8
        long    MODIFY|FREQUENCY|(9 *wait_ms),  $EFFD6FC0
        long    MODIFY|FREQUENCY|(10 *wait_ms), $EFFFE4A8
        long    SET|VOLUME,                     $FF000000
        long    SET|ENVELOPE,                   $FFFE9800|$001
        long    MODIFY|FREQUENCY|(600 *wait_ms), $B2CF9020
        long    SET|VOLUME,                     $00000000
        long    JUMP,                           -1 *STEPS
        '' snare
        long    SET|MODULATION,                 $FFFFF000|$100
        long    SET|VOLUME,                     $FF000000
        long    SET|FREQUENCY,                  $024C24C2
        long    SET|ENVELOPE,                   $00A80A00|$008
        long    MODIFY|FREQUENCY|(4 *wait_ms),  $B2CF9020
        long    SET|FREQUENCY,                  $03483483
        long    MODIFY|FREQUENCY|(2 *wait_ms),  $FFEB33C8
        long    MODIFY|FREQUENCY|(9 *wait_ms),  $FFFD6FC0
        long    MODIFY|FREQUENCY|(10 *wait_ms), $FFFFE4A8
        long    SET|VOLUME,                     $8C000000
        long    SET|ENVELOPE,                   $FFFCA200|$008
        long    MODIFY|FREQUENCY|(250 *wait_ms), $B2CF9020
        long    SET|VOLUME,                     $00000000
        long    JUMP,                           -1 *STEPS
    

    Also, I'm not quite happy with the brass thingy. It can be a little grating, can't it?
    It is played by two Square channels, one octave apart: SQW_BRASS1 is played by the higher pitched channel.
    SQW_BRASS1  'Squeaky Brass (could use some improvement!)
        long    SET|VOLUME,                     $7F100000
        long    JUMP,                           1 *STEPS
    SQW_BRASS2
        long    SET|VOLUME,                     $4F100000
        long    SET|MODULATION,                 $00000000|$119
        long    SET|MODULATION,                 $00000600|$000
        long    SET|ENVELOPE|(5 *wait_ms),      $001A0280|$008
        long    SET|ENVELOPE,                   $FFFFDC00|$008
        long    MODIFY|FREQUENCY|(66 *wait_ms), $00000020
        long    SET|ENVELOPE,                   $00002400|$008
        long    MODIFY|FREQUENCY|(66 *wait_ms), $FFFFFFE0
        long    JUMP,                           -5 *STEPS
    
  • how do you write your music ? Macca's composer is great but write each note/value by hand seems to be impractical, or i mss something

    Can retronitus import some mod or other format?
  • Wuerfel_21Wuerfel_21 Posts: 5,050
    edited 2018-10-29 15:29
    I'm just transcribing from a MIDI by manually entering the note deltas and pattern sequences into a Spin file. I think I will post my code within the next 24 hours, so you'll be to see what that looks like.

    However, I do use composer for making instruments. However, i was unable to find a version of GCC/GAS that could compile a new Player.binary, so I had to resort to hex editing to change the audio pins to match my board....
  • Wuerfel_21 wrote: »
    However, I do use composer for making instruments. However, i was unable to find a version of GCC/GAS that could compile a new Player.binary, so I had to resort to hex editing to change the audio pins to match my board....

    Should work with the version found here http://david.zemon.name:8111/project.html?projectId=PropGCC&tab=projectOverview&guest=1 or on my downloads page here https://www.maccasoft.com/downloads/

    Best regards,
    Marco.
  • Wuerfel_21 wrote: »
    Also, here is an mp3 (once again, in a zip) of what I've got now.
    Thanks for the MP3. This sounds great!
  • Wuerfel_21Wuerfel_21 Posts: 5,050
    edited 2018-10-30 00:38
    IT SHALL BE DONE!

    (silly forum, youtube embed is borken: Here's a link in the meantime!)

    Quoting the video description:
    This is my Retronitus cover/arrangement of "Alice in Wonderland" from the PC-98 game Touhou 5: Mystic square (although I based my cover on an expanded MIDI version, as I couldn't find a 1:1 transcription of the original.)
    DOWNLOAD ALL THE FILES (SOURCE CODE, FLAC FILES AND VIDEO) HERE: https://www.mediafire.com/file/xod7bbtpopv6jmd/ALICEALL.7z/file

    Retronitus is a software synthesizer by Johannes Ahlebrand that can run in a single core of the Parallax Propeller P8X32A chip. Thus, you could call it a real chiptune :)
    For this tune, i slightly modified Retronitus to support simple panning and out-of-phase/surround mixing. However, to do this I had to reduce the sample rate.
    I chose 64 kHz. I could have gotten away with a higher rate, but 64kHz is not only a nice 1.5 multiple of 48kHz, but also leaves me some headroom if I want to add further bloat to Retronitus.
    Retronitus has 8 channels:
    3x Square wave with PWM - drawn as green in the video, all panned to the center.
    3x Sawtooth wave with strange modulation - drawn as white, red and yellow in the video, panned to the left, right and surround-back, respectively.
    1x Triangle wave - drawn as purple in the video, panned to the center.
    1x LFSR Noise - Not used in this tune.

    The oscilloscope view was created by muting all channels but one and then recording just that channel.
    Repeat this for all 7 channels (the NOISE channel isn't used here), of course.
    Then I used a fork of SidWiz2 (available here: https://github.com/Pigu-A/SidWiz/releases ) to create a video from them.
    The audio you hear, however, was of course recorded in one go and in no way post-processed (except for normalization).
    Also, the data for this tune takes only 4028 bytes! Less than 4K! The Retronitus synthesizer is another 1700 bytes, though.

    Also, i've attached the source code to this post....
  • Wow! That's fabulous! Are you saying this is all done with a single COG?
  • Yes, just a single cog and 4K of Hub RAM.... (except the scope video of course, which was rendered on a PC)
  • David BetzDavid Betz Posts: 14,516
    edited 2018-10-30 02:07
    Wuerfel_21 wrote: »
    Yes, just a single cog and 4K of Hub RAM.... (except the scope video of course, which was rendered on a PC)
    Amazing! Maybe I can use it to drive the speaker in the WordFire/Quby console. It's only monophonic though. Is there a way to mix everything down to a single pin? Actually, I suppose that would negate your good work of placing the instruments in a stereo field.
  • Wuerfel_21Wuerfel_21 Posts: 5,050
    edited 2018-10-30 02:34
    Getting it to run on the Quby should be as easy as ripping out the stereo mxing and just adding all the sound into one pin. However, channels that are only mixed to the left or right are only half as loud as ones mixed to the center or surround channel But it seems to sound better with all the channels mixed at the same volume? Whatever. Know what? I'm going to rig up a mono version for you real quick!
  • Here you go! This is my tune and mono 64kHz Retronitus (with half of the surround mixing code still in there....) preconfigured for the Quby. It should(tm) just work. Unless there is some guff that needs to be done to enable the amplifier?
  • Wuerfel_21 wrote: »
    Here you go! This is my tune and mono 64kHz Retronitus (with half of the surround mixing code still in there....) preconfigured for the Quby. It should(tm) just work. Unless there is some guff that needs to be done to enable the amplifier?
    Thanks, I’ll try it in the morning.

  • Ahle2Ahle2 Posts: 1,179
    edited 2018-10-30 08:25
    Great work Wuerfel_21! :)

    I have made a tool that can convert amiga mod files to Retronitus. All you have to do is to make Retronitus instruments that maps to each sample using the built in instrument editor. It kind of works for simple mod files without too much fx. It's still a very early version and it has got som bugs that needs to be fixed.
  • Ahle2Ahle2 Posts: 1,179
    edited 2018-10-30 08:25
    Btw, sometime ago I made a visualization of one of the demo tunes for Retronitus...

  • I'd love to see that MOD converter!
  • Wuerfel_21 wrote: »
    Here you go! This is my tune and mono 64kHz Retronitus (with half of the surround mixing code still in there....) preconfigured for the Quby. It should(tm) just work. Unless there is some guff that needs to be done to enable the amplifier?
    I just tried this. All I did was compile it with the command "openspin main.spin" and then loaded the resulting binary. I hear a little crackling from the speaker but no music. Is there something else I need to do?

  • Try putting
    OUTA[20]~~
    DIRA[20]~~
    
    into main.spin before sound.start
    I think that should enable the amplifier at full volume? Although that may be too loud?
    You should prob. ask @JRetSapDoog about it...
  • Wuerfel_21 wrote: »
    Try putting
    OUTA[20]~~
    DIRA[20]~~
    
    into main.spin before sound.start
    I think that should enable the amplifier at full volume? Although that may be too loud?
    You should prob. ask @JRetSapDoog about it...
    I tried that and I'm afraid it had no effect.

  • No clue then. Is there any code that does produce proper sound that you can show me?
  • Wuerfel_21 wrote: »
    No clue then. Is there any code that does produce proper sound that you can show me?
    Thanks for trying to do this for me. I'll try to track down some sound code for the WordFire/Quby console.

  • This code generates a beep on the WordFire console:
    CON
        _clkmode  = xtal1 | pll16x
        _xinfreq  = 5_000_000
        speaker_pin  = 21
        volume_pin = 20
        fr = 2000
    
    OBJ
        sound : "Retronitus"
        music : "Alice"
        
    PUB Main
        'config audio pins
        dira[speaker_pin]~~                   'audio output pin
        dira[volume_pin]~~                   'volume control pin
    
        'set speaker volume
        ctra :=  %00110_000 << 23 + 1 << 9 + volume_pin   'counter mode = duty cycle for d/a using rc circuit (B pin is unused)
        frqa := $2000_0000                                'Vout = 3.3 * (frqa/2^32) = 3.3 * 0.5 = 1.65V max when frqa = $8000_0000 (can omit this line) 
    
        repeat 500
            outa[speaker_pin]~                            'one wave cycle
            waitcnt(clkfreq/fr+cnt)
            outa[speaker_pin]~~
            waitcnt(clkfreq/fr+cnt) 
    
        sound.start(speaker_pin,-1)
        sound.playMusic(music.melody)
            
        repeat
           waitcnt(cnt + 80_000_000)
    
  • Well, that won't work!
    the beeping loop leaves pin 21 high!
    Just put a "outa[speaker_pin]~ " after the loop
  • Wuerfel_21 wrote: »
    Well, that won't work!
    the beeping loop leaves pin 21 high!
    Just put a "outa[speaker_pin]~ " after the loop
    Okay, that works. It doesn't sound anywhere near as good as your MP3. Maybe I should try this on a board with stereo output. What output circuit do you recommend?

  • Anyway, this code works fine on the WordFire/Quby:
    CON
        _clkmode  = xtal1 | pll16x
        _xinfreq  = 5_000_000
        speaker_pin  = 21
        volume_pin = 20
        fr = 2000
    
    OBJ
        sound : "Retronitus"
        music : "Alice"
        
    PUB Main
    
        'config audio pins
        dira[speaker_pin]~~                   'audio output pin
        dira[volume_pin]~~                    'volume control pin
    
        'set speaker volume
        ctra :=  %00110_000 << 23 + 1 << 9 + volume_pin   'counter mode = duty cycle for d/a using rc circuit (B pin is unused)
        frqa := $2000_0000                                'Vout = 3.3 * (frqa/2^32) = 3.3 * 0.5 = 1.65V max when frqa = $8000_0000 (can omit this line) 
    
        sound.start(speaker_pin,-1)
        sound.playMusic(music.melody)
            
        repeat
           waitcnt(cnt + 80_000_000)
    
  • I'd try setting FRQA to a different value. Maybe the speaker is being overdriven?

    In terms of stereo circuit, this is what I used: audio.PNG
    Although in retrospect, I'd increase the value of the highpass/AC-coupling capacitor to get better frequency response.
    Note that I used "audio-grade" electrolytics for the 47uF ones and foil capacitors (=not microphonic) for the 10nF ones. Not sure if that really improves anything, but eh.
    395 x 403 - 30K
  • Wuerfel_21 wrote: »
    I'd try setting FRQA to a different value. Maybe the speaker is being overdriven?

    In terms of stereo circuit, this is what I used: audio.PNG
    Although in retrospect, I'd increase the value of the highpass/AC-coupling capacitor to get better frequency response.
    Note that I used "audio-grade" electrolytics for the 47uF ones and foil capacitors (=not microphonic) for the 10nF ones. Not sure if that really improves anything, but eh.
    Thanks for the circuit. What value coupling capacitor would you use?

  • I tried setting FRQA to $0800_0000 and the volume got lower but the sound quality didn't improve.
Sign In or Register to comment.