Shop OBEX P1 Docs P2 Docs Learn Events
Tiny wavetable synth! — Parallax Forums

Tiny wavetable synth!

LeonLeon Posts: 7,620
edited 2012-05-04 03:03 in General Discussion
This PIC32 application is very impressive:

http://dangerousprototypes.com/forum/viewtopic.php?f=56&t=3472

With that type of crude construction it can be possible to get something smaller than by using a PCB, primarily because the wires can cross one another.

Comments

  • GordonMcCombGordonMcComb Posts: 3,366
    edited 2012-05-02 08:19
    Very clever! Both in the construction, and the scripting for a minimal MIDI device.

    I'm not involved much with the PIC32, but would you know offhand how much RAM the wavetable takes up when compiled?

    -- Gordon
  • Invent-O-DocInvent-O-Doc Posts: 768
    edited 2012-05-02 09:10
    Someone had a nice prop-based midi synth that used the some of the synth objects talked about on this forum - they were interchangeable. He showed it at the parallax expo.
  • GordonMcCombGordonMcComb Posts: 3,366
    edited 2012-05-02 09:25
    Was it Ordinary Joe that demonstrated the synth?

    Anyway, that one wouldn't have used wavetables, which is what makes this PIC32 synth sound so nice. In other words, the PIC32 version started with actual sounds from a music box, that were then cropped down and stripped into very short "blips." Those were then encoded as wavetables, and (though I didn't look real close at the code so I'm not sure) additively mixed with other completely synthesized elements.

    For a synth with only a couple of instruments, it might be possible to create wavetables small enough to fit into the Prop's memory.

    -- Gordon
  • pik33pik33 Posts: 2,398
    edited 2012-05-02 10:57
    For a synth with only a couple of instruments, it might be possible to create wavetables small enough to fit into the Prop's memory.

    Look at 8-bit Atari Softsynth. And my (working) alpha of PC Softsynth.

    http://sourceforge.net/projects/pc-softsynth/files/

    This I want to convert to Propeller :) as soon as I can write fluent in spin. It is not far future from now :) You need one period of wave. Atari 8bit uses 256 bytes for it, my PC implementation uses 2048 bytes. Then you need something like ADSR. It uses 64 bytes (or rather nibbles) on 8-bit Atari and 256 bytes in my PC implementation. Having available something about 20 waveforms and 20 ADSR forms, then variable timings, you can create hundreds of instruments from this.

    To write music for it you use Basic-like language called Masic.

    All of these features are 100% available with Propeller. I only need to write it :)
  • GordonMcCombGordonMcComb Posts: 3,366
    edited 2012-05-02 11:45
    Do you have a YouTube video demonstrating the output of the Softsynths?

    I'd be a little surprised Spin would be fast enough for this task, but if it can be done, that would be great. I have a feeling, though, you'll need to do at least some of the work in PASM, assuming reasonable bit depths and sample rates. 16-bit and 40 kHz or higher sampling would be best.

    -- Gordon
  • Ahle2Ahle2 Posts: 1,179
    edited 2012-05-02 12:21
    I have been looking at the code and this isn't wavetable synthesis. This is just your ordinary sample player with pitch controll and an envelope put on top. (no synthesis at all)
    Would be super simple to do on the Propeller. The biggest problems is of course the lack of a multiplication intruction on the Prop; Otherwise 64 vioces in a single cog at a decent sample rate would have been quite realistic for such a simple implementation.
  • GordonMcCombGordonMcComb Posts: 3,366
    edited 2012-05-02 16:46
    Looked closer at the code, and yes indeed, there doesn't seem to be any synthesis happening. In any case, sampled or wavetabled, it sounds darn good. It helps that music boxes are simple instruments. There's no note-off command needed, for example.

    -- Gordon
  • Bob Lawrence (VE1RLL)Bob Lawrence (VE1RLL) Posts: 1,720
    edited 2012-05-02 19:27
    [h=2]Rainbow synthesizer: polyphonic, multitimbral wavetable synthesis[/h]

    http://forums.parallax.com/showthread.php?109498-Rainbow-synthesizer-polyphonic-multitimbral-wavetable-synthesis
  • pik33pik33 Posts: 2,398
    edited 2012-05-02 22:49
    This is how Atari Softsynth sounds on 8-bit Atari with 4bit/11 kHz sampling

    http://www.youtube.com/watch?v=Xm5vQm9-JQ4

    The same Masic source code interpreted by PC Softsynth (16bit/44kHz):

    http://eksperymenty.webh.pl/images/opswiata1.mp3

    Masic source code: 2kB
    Uses 12 samples - 24 kB on PC, 3 kB on Atari
    Uses 8 ADSRs - 2 kB on PC, 512 bytes on Atari

    And yet another Jakub Husak's 8-bit Atari masterpiece written in 1988 interpreted by PC: (search for Jakub Husak in Google to find what he did with Atari Softsynth... )

    http://eksperymenty.webh.pl/images/wodo.mp3

    I think it can be done with Propeller... I did it with PC, so I think I can do it. I need to write (1) masic interpreter - in Spin (2) synthesizer - in PASM.
  • LeonLeon Posts: 7,620
    edited 2012-05-03 01:48
    The web page I mentioned has this link:

    http://elm-chan.org/works/mxb/report.html

    which explains the technique in detail.
  • pik33pik33 Posts: 2,398
    edited 2012-05-03 02:59
    This is technique very similar to this used in Atari Softsynth. You have to have only one period of wave and envelope shape in memory. So, for 4 channels of sound (as in Atari Softsynth) to get a quality as in samples I linked to, you need 9 kB of RAM.

    Samples can be stored in eeprom and read on demand while playing, when a new instrument is set.
  • Ahle2Ahle2 Posts: 1,179
    edited 2012-05-03 04:55
    The PSG in the PC engine/Turbo Grafx 16 is based on a 32 samples big wavetable. Each channel can be programmed independently.
    The result can be quite "interesting", but the lack of modulation makes it a little bit dull compared to synthesis with filter, PWM, FM, Ring modulation... etc.
    Pure sample playback based on a phase accumulator was found in the Amiga and the result was excellent for the time.
    There was no limitation on what sounds that could be "generated" because ANY sound could be sampled and played back at arbitrary rate and volume.
    While it sounded extremely good and made people jealous of Amiga owners, it was technically much simpler than the SID for instance.
    Sample playback is about the simplest thing that you can do on any CPU with some kind of DAC connected. The real challenge lies in generating sounds on the fly of course... ;)
  • tonyp12tonyp12 Posts: 1,951
    edited 2012-05-03 09:12
    What I like about synthesized sound compared to wave tables.
    Synth, the sound just got born it have never been heard before.
    and you could change from sinewave to triangle in real-time in small steps etc.

    With sampled sound, someone had to first create this sound using synth.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2012-05-03 09:58
    For accurate reproduction, wavetable synth isn't as simple as recording one waveform and an envelope. That's because, in most instruments, the waveform varies with pitch. To reproduce such sounds, several samples at different pitches have to be obtained, then interpolated on the fly as they are used to produce pitches in between those of the samples.

    -Phil
  • GordonMcCombGordonMcComb Posts: 3,366
    edited 2012-05-03 17:22
    My Korg piano has a unique sample for every key, with multiple samples throughout the ADSR envelope. It's a somewhat older model, and I'm not sure what they do now, but it sounds more like a piano than most acoustic pianos. It does have one defect: C above middle-C is a little brighter than the others. It's not noticeable during regular play, but I know it's there and it bugs the heck out of me!

    Anyway, regardless of the technique used for the PIC32 project, it sounds great, he's provided full source and steps, and it's easily reproducible. I want to thank Leon for bringing it to our attention.

    -- Gordon
  • average joeaverage joe Posts: 795
    edited 2012-05-04 00:17
    I just saw this thread, and I WAS the one Invent-O-Doc was talking about. I was demonstrating the SidCog object, as well as SidSynth. I did demo a few other things, but none of these were wavetable. I might have mentioned that I would LIKE to do a wavetable synth. This will probably be based on a hardware approach but we need to get the controller working first!

    Now Phil is right about it being more complicated than a sample and an envelope. Some sampled sounds I use *eg BIG grand piano* have MANY LAYERS of samples. The "BIG grand" patch has a sample GROUP for every octave: except for the first octave and the last. These have 3 notes per sample span. There is also 3 LAYERS of samples for each sample GROUP. The layer that is played is determined by the notes velocity. The samples are also about 2.5 seconds long. This patch weighs in @ 7.2 MB which is very large but it sounds BEAUTIFUL.

    While this is interesting, it leaves quite a bit to be desired. I think the Propeller will make a much nicer wavetable synth when coupled with a couple srams and a couple 16bit DACs.
  • LeonLeon Posts: 7,620
    edited 2012-05-04 03:03
    I'm designing a PCB for Marcus's circuit. It'll be all surface-mount, with a SOIC PIC32. I'll make the board at home.

    Here's the schematic. I've dispensed with a regulator, it should run for a long time on a couple of AA cells.
Sign In or Register to comment.