meltysynth icon indicating copy to clipboard operation
meltysynth copied to clipboard

Thanks for making this!!

Open chipweinberger opened this issue 2 years ago • 11 comments

I made a Dart port of MeltySynth =) Just wanted to let you know of its existence!

https://github.com/chipweinberger/DartMeltySoundFont

I looked around for days for a good SoundFont implementation to port to Dart, and yours is incredibly clean and well written. Really impressive! I looked in depth to at least 4 different implementations!

Really happy I found your implementation, and for all your work making this high quality library!

chipweinberger avatar Feb 18 '22 23:02 chipweinberger

Excellent work!!! It's always nice to see the same software written in different languages!

sinshu avatar Feb 19 '22 02:02 sinshu

Sorry to use this as a strange way to get in touch with you, great little project, well done! :) I was curious, what is the source of the chorus algorithm you implemented? Id like to go back to the source and learn how it really works. Thanks!

EDIT : It looks like the original flanger from Alex Veltsistas, but with a precomputed delay table.

-Mat

BleuBleu avatar Sep 20 '22 12:09 BleuBleu

The chorus implementation is taken from the textbook "Sound programming in C - Signal processing for sound effects". Although the textbook is written in Japanese, the example code should be helpful. You can get the example code from the following web page.

http://floor13.sakura.ne.jp/book03/book03.html

"ex9_1.c" in "chapter09.zip" is the original chorus implementation. Here is the original code with English comments by me.

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "wave.h"

int main(void)
{
  MONO_PCM pcm0, pcm1;
  int n, m;
  double d, depth, rate, t, tau, delta;
  
  mono_wave_read(&pcm0, "sample06.wav"); /* Read the mono sound data from the WAVE file */
  
  pcm1.fs = pcm0.fs; /* The sample rate */
  pcm1.bits = pcm0.bits; /* The bit depth */
  pcm1.length = pcm0.length; /* The length of the sound data */
  pcm1.s = calloc(pcm1.length, sizeof(double)); /* Memory allocation */
  
  d = pcm1.fs * 0.025; /* 25ms */
  depth = pcm1.fs * 0.01; /* 10ms */
  rate = 0.1; /* 0.1Hz */
  
  /* Chorus */
  for (n = 0; n < pcm1.length; n++)
  {
    pcm1.s[n] = pcm0.s[n];
    
    tau = d + depth * sin(2.0 * M_PI * rate * n / pcm1.fs);
    t = (double)n - tau;
    m = (int)t;
    delta = t - (double)m;
    if (m >= 0 && m + 1 < pcm1.length)
    {
      pcm1.s[n] += delta * pcm0.s[m + 1] + (1.0 - delta) * pcm0.s[m]; 
    }
  }
  
  mono_wave_write(&pcm1, "ex9_1.wav"); /* Output the mono sound data to the WAVE file */
  
  free(pcm0.s); /* Free memory */
  free(pcm1.s); /* Free memory */
  
  return 0;
}

sinshu avatar Sep 20 '22 12:09 sinshu

Thank you! That looks like such a good book. Too bad i cant read it, but i can read code.

-Mat

BleuBleu avatar Sep 20 '22 13:09 BleuBleu