WordPress database error: [Incorrect file format 'wp_comments'] SELECT comment_author, comment_author_url, comment_ID, comment_post_ID FROM wp_comments WHERE comment_approved = '1' ORDER BY comment_date_gmt DESC LIMIT 10
(Note: I wrote this as something to tell to the clam-devel mailing list about some of my source-code commits)
About eight months ago, there was a foundation of something like an “audio club” in my university [1]. As soon i learned about that, i quickly got in touch with them and noticed that there was a major interest in analog issues (the only audio area with at least elective, courses in the university). So i told them about all the cool things that are available and ready to do with digital audio, mostly signal processing related. I talked in general, but of course i also talked about clam, with all its prototyping, real-time and easy development of plugins features. Even many of them ended installing and using it, and some even developing with more or less help. One thing to notice is that most of them are students from first years and most (but not all) are students with a basic programming level (because they are from electronics) but strong dsp knowledge (behind this is an university with more emphasis in theory than practice)
We started specifying plugins from a more abstract level (inputs/outputs/controls) and generating the source code base using CLAM’s Templated Plugins Code Generator [2] and prototyping some simple applications. But one of the things we ended up doing was to take advantage of clam as platform to prototype medic related applications like filter ECG signal from noise in realtime, and some like _vice-versa_, i mean applying some processing knowledge from that area to audio.
Hace bastante tiempo que tenia archivada esta conversación sobre síntesis por FM y Horgand que quería publicar.
Qué es Horgand? un sintetizador por soft capaz de realizar sonidos de órgano y otros tipos de sonido como pianos eléctricos (Rhodes , Wurlitzer, DX E.Piano ), Jazz Guitar, Strings, Brass, Fretless Bass, Accordion etc. Esta basado en síntesis por FM, según su web:
“Is based on a FM audio synthesizer with twenty carriers (20) without modulators in a plain based algorithm.
each carrier frequency can be modified for construct complex sounds. The synthesizer incorporate also a LFO (Low frequency oscillator) for generate tremolo effects and detune effects applying LFO Pitch and Amplitude to the carrier frequency’s. Some synthesizer parameters can be edited for each sound including two ADSR, (Normal and Percussion), Fine Frequency, Attenuation, Rotary Amplitude, Transpose, etc. Four DSP effects are available for obtain more complex sounds, Rotary, Chorus, Delay and Reverberation. Sounds are stored in banks of 32 organ sounds and can be changed externally with MIDI program change (1-32).”
También incorpora reconocimiento de acordes para producir acompañamiento automático (bajo y bateria) y con líneas de bajo editables para cada ritmo.
No conozco mucho de síntesis por FM y tenía curiosidad de como lograba el sonido y terminó saliendo una especie de entrevista improvisada, creo que puede ser interesante para quienes quieran adentrarse en este tipo de programación.
La conversación:
—
<hordia> despues me tenes que contar en que te basaste para conseguir el sonido de horgand digitalmente…
<holborn> pues en el DX7 …. tiene 32 algoritmos de colocacion de los operadores … pero si usas el plano (todos en linea)… todo lo que hagas suena a organo … a partir de ahi … pues añadirle los efectos … y claro en vez de 6 “osciladores” hay 10 … que en realidad son 20 … con lo cual pues es mas rico que un emulador de dx7 tipo hexter o en el dx7 mismo … en realidad .. para usar 20 osciladores no chupa CPU nada … otros porgramas usan 3 y ch
<holborn> claro que para ahorrar cpu .. tuve que limitar algunos parametros de edicion … pero bueno … yo lo que queria era que sonara … si nadie se pone a editar sonidos … ni dios vaya …
<hordia> que es el DX7? me suena a un teclado legendario pero no estoy seguro…
<holborn> el DX7 fue el primer sintetizador FM … es de yamaha .. y fue una revolucion porque era el primero que mas o menos imitaba bien sonidos reales … algunos mejor que otros …
<holborn> los vendieron todos y mas …
<holborn> yo realmente era un experto … en aquella epoca ni dios sabia nada de musica electronica … yo me hice un curso que daba un loco de la musica electronica .. y sabia programar sintes cosa que nadie sabia .. te estoy hablando de hace mil años …
<holborn> cuando salio el DX7 pues me tuve que empapar toda la info porque realmente es muy diferente a un sinte analogico tradicional … y bueno .. le pedi a un amigo que trabajaba en un distribuidor de yamaha .. que me consiguiera info de verdad … de hecho todavia la conservo ..por ahi ..
<hordia> :O
<holborn> yo llegue a trabajar programando sintes en un estudio de grabacion …. vaya no todos los dias pero me llamaban de vez en cuando
<holborn> haciendo presets … me refiero .. claro
<hordia> veo que horgand es el resultado de muchos años de experiencia…
<holborn> si … a ese nivel si … pero todo fue gracias a un ejemplo de la web de alsa .. .se llama fmminisynth.c … o lago asi … 100 lineas de codigo … entonces se me ocurrio … y empece ..
<holborn> luego buscando … encuentras mil ejemplos de codigo … en HArmony Central … no esta el codigo pero explican como funcionan los efectos … en cristiano .. sin mucha matematica … esta muy bien .. luego ya el implementarlo es cosa de uno … pero el mismo Paul Nasca dice por ahi (el del zyn) que se basa en esa explicaciones … y yo tambien claro
<holborn> ya te aseguro que su implementacion es mejor que la mia
<hordia> jeje
<holborn> ahora …la mia consume un tercio de cpu que la suya
<hordia> entonces hay que ver que parametros se toman para definir cual es mejor
<holborn> pues es un sinte … lo que suena … sus efectos suenan mejor …. pero … el usa 3 o 4 osciladores por sonido … yo uso 20 … con lo cual en algun lado hay que recortar …
—
After prototype different kind of simple distortions in NetworkEditor i managed to port all them to ladspa plugins. Despite the fact that the task was less difficult than i had expected at first, prototype with CLAM first worth a lot. Probably, if i had begun coding directly to ladspa source, reach the same status would be taken to me 10 or more times more. I think also was very interesting as “development process”, instead of modeling for example with matlab, you could easy modeling (among other things) in CLAM, and then, if you want/need make your final product by your own.
More, the other day i learned that is already possible to compile ladspa plugins directly from CLAM networks… very cool! Though i think this feature is not completely ready yet and i’m still have to dig in it, i don’t think that i have lost time porting manually because now i have a better knowledge and understanding about ladspa specification that for sure will be useful to work with this (for me “new”) feature, that probably needs some fixes.
About the ladspa plugins programming, i just downloaded the sdk from ladspa.org, read some of the ladspa.h file and some basic examples (the ones from sdk) and that was enough to handle the basis. Ah, i had to ask for some ladspa ID’s for my plugins here: ladspa at muse.demon.co.uk
A week or more ago, Daniel Vidal Chornet (collaborator of Musix) asked me if i can develop guitar distortion effects, because he couldn’t find something decent that suits his needs, i said “sadly i have no idea about distortions effects and anyway i have no time right now to do that”, but then i remembered how useful could be the clam framework and i tried to do a little spike about. Results were better than i had expected at first (is not a super cool distortion, but at least sound like one).
Basically i merged and tweaked a couple of simple/base algorithms found in the web for distortion and compression and in less than 30 minutes i had something working and sounds like a guitar distortion (”clean” ones seems to sound better easily). I was amazed how fast and easy (develop and test in clam/networkeditor, once you get the basis) was. I think right now is far to be a good distortion, but as learning process and first demo seems very good.
Some optional tweaks could include add a three band filter but i’m still not sure if it’s better to put it at first or at the end.
Special thanks for testing and audio samples to Daniel Vidal Chornet. I should take from my closet my fender stratocaster and do my own samples . OTOH, we already arrange to do a remote gig with this.
Another useful NetworkEditor processings plugins i had made during this “work”:
AutomaticGainControl: Adaptative automatic gain control. Given an output reference and step response adjusts the output volume to keep it constant (AutomaticGainControl.tar.gz)
AudioSwitch: Switchs between a configurable amount of inputs (like a multiplexer) (AudioSwitch.tar.gz)
Working to have audio-to-midi in NetworkEditor (CLAM) I needed to convert a fundamental frequency value to a MIDI note one.
I found some source code related with this in Voice2MIDI app, but was not explained at all, so looking for the reason of that formula I arrived at this:
Knowing about equal-tempered scale (check this) and relation between frequencies plus the fact that C4 or “middle c” has a MIDI value of 60, it’s easy to conclude that then A4 (which its frequency value is 440Hz, a standard for tunning and is 9 semi-tones more) has a MIDI value of 69.
Then, starting with:
It’s easy to arrive at this:
and then, also taking in account this mathematical relation::
Casualmente en la misma semana 2 personas, Cesar Perez (Colombia) y Elizabeth Coixet (España), me escribieron a este blog comentandome que estaban usando mis funciones con éxito pero tenian problemas al leer wav’s de 8 bits. Les recomendé que lo charlaramos en el grupo Buena Señal ya que entre todos (y posiblemente alguna contribución de alguno más de los del grupo) seguramente iba a ser más fácil y todos podriamos aprender algo de ello (ver estos 2 threads: 1, 2).
Y asi fue
Luego de que Cesar planteara el problema y yo hiciese mis apreciaciones sobre el asunto, Elizabeth encontró que el wav de 8 bits era unsigned y no signed (como el de 16 bits) con lo que se termino de resolver el misterio de porque la solución que manejabamos leia en forma extraña…
Morph effect (best know in images domain) it’s about hybridize two sounds so the resulting one has intermediate characteristics. This implementation is mainly based on interpolation (peaks and residual spectrum) and a balance (depending on interpolation factor) of fundamental.
All the code is mainly based on this idea: , where alpha is the interpolation factor (bounded to 0..1 range).
I’m still have to tweak it a bit… but anyway I’ve made some demos of it:
I’ll start talking a bit about this effect which is mainly used for vocal harmonizing. Given an input voice (or whatever) as output you obtain (how many as you want) automatic harmonic related voices (a minor/major third, a fifth, a sixth or any musical interval you want).
This implementation, is mainly based on many SMSpitch-shiftings (one for each voice) and a control gain for each one. Pitch controls are based on equal-tempered scale semitones, following relation for each voice.
This was my first version of the network:
Testing it, my voice never sounded so musical, hehehe… but still awful, so I was thinking in your ears health and demos are with Elvis one
Disclaimer: all audio demos are early testing versions (still with artifacts and clicks that should be removed soon)
but wait! a lot of graphics and this is also a ‘coding’ blog!!! here you have some code… and btw you can see that programming under CLAM could be very easy once you get the basics…