Posted by hordia on 26th August 2007
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::

the final formula looks like:

and a final c++ code like:
fund_midinote = round( 69. + log(fundfrec/440.)*17.31234 );
Related post: nictuku’s inverse formula (i.e. from MIDI to Hz) here “Translanting MIDI Notes to frequencies in the diatonic scale using the central A (440hz) as reference“.
algorithms
, audio
, c++
, CLAM
, english
, GSoC2007
, math
, midi
, music theory
, programming
, standards 
Share This/Compártelo
Posted in audio, algorithms, programming, music theory, c++, midi, math, English, CLAM, standards, GSoC2007 | No Comments »
Posted by hordia on 31st July 2007
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 SMS pitch-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)
Elvis harmonized demo: elvis-harmonized.ogg (to hear the online/streaming version go here)
Prototype:
Configuration:
Note: demos were done without residual processing because adding residual does not improve results much and adds a lot of overhead.
Then, following xamat’s suggestions I also added a detunning effect (and delay, but this one isn’t working properly yet)
Elvis harmonized (detunned version) demo:
elvis-harmonized-detunned.ogg (to hear the online/streaming version go
here)
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…
bool SMSHarmonizer::Do( const SpectralPeakArray& inPeaks,
const Fundamental& inFund,
const Spectrum& inSpectrum,
SpectralPeakArray& outPeaks,
Fundamental& outFund,
Spectrum& outSpectrum
)
{
outPeaks = inPeaks;
outFund = inFund;
outSpectrum = inSpectrum;
TData gain0 = mInputVoiceGain.GetLastValue();
mSinusoidalGain.GetInControl("Gain").DoControl(gain0);
mSinusoidalGain.Do(outPeaks,outPeaks);
SpectralPeakArray mtmpPeaks;
Fundamental mtmpFund;
Spectrum mtmpSpectrum;
for (int i=0; i < mVoicesPitch.Size(); i++)
{
TData gain = mVoicesGain[i].GetLastValue();
if (gain<0.01) //means voice OFF
continue;
TData amount = mVoicesPitch[i].GetLastValue() + frand()*mVoicesDetuningAmount[i].GetLastValue(); //detuning
amount = CLAM_pow( 2., amount/12. ); //adjust to equal-tempered scale semitones
mPitchShift.GetInControl("PitchSteps").DoControl(amount);
mPitchShift.Do( inPeaks,
inFund,
inSpectrum,
mtmpPeaks,
mtmpFund,
mtmpSpectrum);
mSinusoidalGain.GetInControl("Gain").DoControl(gain);
mSinusoidalGain.Do(mtmpPeaks,mtmpPeaks);
TData delay = mVoicesDelay[i].GetLastValue();
if (delay>0.)
{
mPeaksDelay.GetInControl("Delay Control").DoControl(delay);
mPeaksDelay.Do(mtmpPeaks, mtmpPeaks);
}
outPeaks = outPeaks + mtmpPeaks;
if (!mIgnoreResidual)
mSpectrumAdder.Do(outSpectrum, mtmpSpectrum, outSpectrum);
}
return true;
}
The plan includes add MIDI control for each voice pitch (then will be easy to control them for example by a keyboard by the same singing person)
Next post: SMSMorph.
algorithms
, audio
, c++
, CLAM
, effects
, english
, GSoC2007
, GUI
, math
, midi
, music theory
, programming
, signal processing 
Share This/Compártelo
Posted in audio, algorithms, effects, signal processing, programming, music theory, c++, midi, math, English, CLAM, GSoC2007, GUI | 1 Comment »
Posted by hordia on 12th July 2007
CLAM es un completo framework para hacer investigación y desarrollo sobre audio y música (esto también incluye aplicaciones para usuarios finales). Ofrece un modelo conceptual y herramientas para el análisis, la síntesis y el procesamiento de señales de audio. Tiene una interfaz muy amigable, es Software Libre, multiplataforma y esta escrito en C++ (en muchas de sus aplicaciones utiliza tiempo real).
A pesar de que tuvo su origen en una Universidad de Barcelona, España, la documentación en español sobre este framework es escasa, asi que me decidí a hacer una pequeña introducción sobre las cosas básicas, pero con links (eso si, la mayoria en inglés) para el que quiera ir más allá. Pienso que le puede servir a más de uno para empezar.
Básicamente hay dos perfiles: el de usuario final (de las aplicaciones) y el de desarrolladores que quieran escribir sus propios programas sobre este framework.
En este momento se compone de 4 programas principales:
NetworkEditor:
Es una aplicación que permite conectar módulos en forma de red de procesamiento al estilo pd (pero mucho más amigable), MaxMSP o Reaktor (o para los que usan matlab, tipo simulink). Estas redes se ejecutan en tiempo real y se pueden correr con jack, portaudio, LADSPA o VST como backend.
Una de las características más interesantes es que esta red se puede exportar y después correr con una interfaz gráfica diseñada con QTDesigner (ambos programas exportan a un xml que luego se corre con la aplicación Prototyper)
Recomiendo ver esta presentación: “Visual prototyping of audio applications”
Es decir, un usuario que no es programador puede armar complejos plugins o aplicaciones sin escribir una sola línea de código. También es muy útil para armar prototipos de futuras aplicaciones o desarrollos.
En este momento se esta integrando con LADSPA, lv2 y se planea reforzar aún más la posibilidad de usar plugins externos (como un módulo más) dentro del NetworkEditor y vicerversa, usar estas redes como plugins en otras aplicaciones.
Para el que quiera empezar, recomiendo esto:
Annotator:
Es un programa para hacer transcripciones, en el estilo de Sonic Visualizer. Muy potente y con características que lo hacen único.
Para conocer más:
SMSTools:
Un analizador de señales de audio en el estilo de wavesurfer que soporta diferentes tipos de visualización como spectogramas, y todas las derivadas del módelo Sinusoides + Residuo asi como trasnformaciones complejas basadas en este modelo (gender change, pitch-shifting, morph, etc) y muchas otras cosas más (ver tutorial).
Voice2MIDI:
Convierte voz en MIDI. Esta comentado en este artículo de linuxjournal.
Para desarrolladores, sirve como entorno para realizar sus propias aplicaciones de forma fácil o como herramienta para hacer prototipos de sus futuras implementaciones.
Recomiendo:
Si uno quiere, puede aportar al proyecto mandando ‘patchs’ de código a los desarrolladores principales y hasta convertirse en ‘developer’ luego de haber mandado varios de ellos.
En fin, es un proyecto bastante grande y ambicioso. Incluso hay miles de desarrollos más sobre el mismo que no están en el ‘paquete principal’, pero me pareció útil dar un panorama general porque tal vez sea tan abarcativo que maree un poco para el que recién escucha algo de él.
Como ya dije, es multiplataforma y esta disponible para GNU/Linux (con paquetes para varias distribuciones), Windows y Mac (ver más y descargar)
Otro links interesantes:
algorithms
, audio
, c++
, Castellano
, CLAM
, effects
, free software
, GNU/Linux
, GPL
, GSoC2007
, GUI
, libraries
, library
, midi
, music
, noise
, programming
, projects
, publications
, signal processing
, speech
, standards 
Share This/Compártelo
Posted in audio, algorithms, effects, signal processing, music, free software, programming, GNU/Linux, GPL, c++, noise, libraries, midi, publications, projects, Castellano, CLAM, standards, speech, GSoC2007, GUI, library | No Comments »
Posted by hordia on 20th May 2007
Next Monday finally starts the google summer of code, here my finally accepted application:
Title: Real-time spectral transformations
Mentor: Pau Arumí Albó
License: GNU General Public License (GPL)
Abstract: Revamp all CLAM SMS transformations. Turn real-time all those still aren’t and have them working on Network Editor. For example: Harmonizer, Morph and Time Stretch. Make nice prototypes for use them with Prototyper and have special focus on some. Also make real-time Voice2Midi and all those widgets which can be needed.
Some words more about this:
- Port it to real-time and NetworkEditor these spectral transformations: Harmonizer, morph, time-stretch and pitch-discretization.
- Fix gender change (already real-time, residual improvement)
- Make a harmonizer prototype with sliders to control each “voice” gain and the option of control them by midi too.
- Realtime Voice2MIDI. Piano-roll widget for NetworkEditor/Prototyper.
- More general improvements on SMS transformations over issues that can arise during the development of the project.
Last days I was mainly reading about SMS transformations and its model and the “Spectral Processing” chapter of the DAFX (Digital Audio Effects) book.
More news and details about this project here soon.
audio
, books
, c++
, CLAM
, english
, GPL
, GSoC2007
, GUI
, midi
, programming
, signal processing 
Share This/Compártelo
Posted in audio, signal processing, programming, GPL, books, c++, midi, English, CLAM, GSoC2007, GUI | No Comments »
Posted by hordia on 11th April 2007
Hi all! I’m Hernán Ordiales, this is my first post to Planet CLAM but not my first post at all, I’m blogging since last year but mostly in spanish…
what to say about me?
I live in Buenos Aires, Argentina. Among other things, I love programming, audio and music. I’m studying (mainly)Electronics Engineering and Computer Engineering at FIUBA and for luck (and my fun) I’ve a work in a project related with audio, programming and GNU/Linux. I also have interest in communications (networking, protocols, etc) and all kind of digital systems.
I enjoy very much using/developing under Free Software (of course GNU/Linux is my OS of choice) and I also help with the linux audio distribution called Musix GNU+Linux.
After a long time of follow Xavier Amatriain blog, last weeks I’m started to get involved with CLAM and with every step I’m discovering a lot of new wonderful things and designs that it had never seen by me in another audio projects.
I expect to contribute to and/or develop under CLAM ASAP. I think I’ll start blogging about my progress or new things developed with this framework soon (among other things).
For those who still don’t know much about CLAM project, I’d recommend you:
Here, the “magic sentence” to start developing:
svn co http://iua-share.upf.edu/svn/clam/trunk clam
I also encourage you suscribe to user & dev mailing lists, and log in #clam channel at freenode.net!
See you!
algorithms
, audio
, c++
, CLAM
, effects
, english
, free software
, GPL
, GSoC2007
, libraries
, midi
, music
, programming
, projects
, publications
, signal processing
, sound 
Share This/Compártelo
Posted in audio, algorithms, effects, signal processing, music, free software, programming, GPL, c++, libraries, midi, publications, projects, English, CLAM, GSoC2007, sound | 1 Comment »
Posted by hordia on 23rd March 2007
Aprovecho la información que organicé para contestar un mail en una lista de Musix para hacer un post sobre conversión de audio a MIDI. El mail que contesté era de alguien que estaba buscando software de código abierto que hiciera eso (conversión audio-midi).
Dentro de los proyectos software libre yo conozco:
El wave2mid, que fue desarrollado como un proyecto de fin de carrera (Ingeniería Electrónica en la Universidad de Granada) por Pablo Busto González. Originalmente codificado en Matlab, luego fue migrado a Octave por la misma persona para poder distribuirlo libremente! Aún no tuve la oportunidad de probarlo ni examinar el código fuente, pero al menos parece estar bastante bien documentado (aunque en la misma página web anticipan que es muy lento, como era de esperar por estar desarrollado sobre este tipo de programas que en todo lo que no sea multiplicación de matrices dejan mucho que desear en cuanto a velocidad).
Programados en C++, están el Free Audio Note Recognition, también conocido simplemente como fanr (polifónico) y el Midingsolo (monofónico).
Nunca los probé y no se en que estado están. Tampoco se cual es el “estado del arte” en este tema, no se si hay algún programa (de código abierto o no) que realmente lo haga bien. La última vez que probé programas de este tipo fue hace muchos años y no quedé para nada conforme.
Algunas cosas relacionadas que conozco, que no hacen específicamente esto pero creo que pueden servir de referencia son:
El Voice2MIDI, que como su nombre lo indica esta orientado a la conversión de voz a midi, no de instrumentos. El trabajo que le dió origen parece estar aqui. Es parte del framework CLAM y según el pdf antes citado fue presentado como proyecto de fin de carrera de Ingeniería Técnica en Informática de Sistemas en la Universitat Pompeu Fabra y lo tuvo como director a Xavier Amatriain (uno de los principales desarrolladores del proyecto CLAM). Fue revisado aqui (en realidad se revisa el proyecto CLAM en general, pero también se le dedican unas palabras a este soft)
Tartini, una herramienta de análisis musical en tiempo real que esta orientado a una completa visualización del timbre de notas interpretadas por instrumentos o voz (tiene varios tipos de vistas) y entre otras cosas sirve para identificarlas (aunque creo que no de forma automatizada) y analizar su contenido espectral de diferentes maneras. Fue resultado de un trabajo para obtener un PhD y el autor, Philip McLeod ofrece un par de papers al respecto en su web (yo se los pedí hace un tiempo y me los envío enseguida).
Reciéntemente Avelino Herrera Morales hizo en su blog varios posts sobre separación de fuentes de sonido (que pueden venir bien para que sea polifónico!) y algunas implementaciones de algoritmos (liberadas bajo GPL!) para lograrlo:
¿Alguien conoce algo más?
algorithms
, audio
, Castellano
, CLAM
, formats
, free software
, GPL
, instruments
, matlab
, midi
, programming
, signal processing 
Share This/Compártelo
Posted in audio, algorithms, signal processing, free software, programming, instruments, matlab, GPL, formats, midi, Castellano, CLAM | No Comments »
Posted by hordia on 5th March 2007
Del 22 al 25 de marzo de este año se desarrollaran las 5tas jornadas de Linux Audio Conference (LAC) en Berlin, Alemania.
LAC2007 tiene como objetivo reunir a desarrolladores y usuarios de linux y software de audio open source con el objetivo de compartir información y discutir sobre proyectos y música.
Puntos más importantes:
- Charlas públicas y workshops
- Conciertos
- Tutoriales
- Presentación de papers
- Audio en vivo/streaming de video
- Entrada gratuita a todos los eventos (excepto para los conciertos)
(info de prensa del evento aqui)
El programa detallado del evento aca (por días)
Títulos de las charlas y workshops:
- A Tetrahedral Microphone Processor for Ambisonic Recording
Fons Adriaensen
- Renewed architecture of the sWONDER software for Wave Field Synthesis on large scale systems
Marije Baalman, Simon Schampijer, Torben Hohn, Thilo Koch, Daniel Plewe, Eddie Mond
- Music Composition through Spectral Modeling Synthesis and Pure Data.
Edgar Barroso
- A Software-based Mixing Desk for Acousmatic Sound Diffusion
André Bartetzki
- pnpd, a new audio synthesis engine with a dataflow language
Tim Blechman
- openSUSE JAD - Tutorials for installation and producing music
Michael Bohle
- Integrating Documentation, End-User Support, and Developer Resources using *.linuxaudio.org
Ivica Ico Bukvic, Robin Gareus, Daniel James
- Audio Metering and Linux
Andres Cabrera
- Qtractor - A Audio/MIDI multi-track sequencer
Rui Nuno Capela
- Compiling Simulink Models as SuperCollider UnitGenerators
Martin Carlé, Sönke Hahn
- Python for Sound Manipulation - A versatile creation environment Tutorial
Renato Fabbri and Fábio Furlanete
- Developing Shared Tools: a Researchers Integration Medium Workshop
Fábio Furlanete and Renato Fabbri
- Visual prototyping of audio applications (CLAM)
David Garcia, Pau Arumi, Xavier Amatriain
- Interfacing Pure Data with Faust
Albert Gräf
- Faust Hands On Demo
Yann Orlarey and Albert Gräf
- Proposal for an XML format for Time, Positions and Parts of Audio Waveforms
Jens Gulden and Hanns Holger Rutz
- JJack: Using the JACK Audio Connection Kit with Java
Jens Gulden
- Model Driven Software Development with SuperCollider and UML
Jens Gulden
- Offener Schaltkreis, An interactive Sound Installation
Christoph Haag, Martin Rumori, Franziska Windisch, Ludwig Zeller
- Stereo, Multichannel and Binaural Sound Spatialization in Pure-Data
Georg Holzmann
- Canorus - a music score editor - Workshop
Reinhard Katzmann, Matevz Jekovec
- Buzztard Music Production Environment Demo
Stefan Kost and Thomas Wabner
- The One Laptop Per Child (OLPC) Audio Subsystem
Jaya Kumar
- Musical Signal Scripting with PySndObj
Victor Lazzarini
- Stochastic Composition with SuperCollider
Sergio Luque
- Beyond open source music software: extending open source philosophy to the music with CODES
Evandro Manara MILETTO, Luciano Vargas FLORES, Daniel Eugenio KUCK, Marcelo Soares PIMENTA and Jerome RUTILY
- pure-dyne
Aymeric Mansoux, Antonios Galanopoulos and Chun Lee
- Getting Linux to produce Music fast and powerful
Hartmut Noack
- Firewire Audio on Linux - Demo
Pieter Palmers
- The Linux MIDI Studio - A workshop with Dave Phillips
Dave Philips
- From resistors to samples: Developing open hardware instruments using Arduino, Pure Data and Processing - Workshop
Recursive Dog collective (Dolo Piqueras, Emanuele Mazza and Enrique Tomás)
- Video Editing with the Open Movie Editor
Richard Spindler
- Developing LADSPA Plugins with Csound
Rory Walsh and Victor Lazzarini
- Real-Time Multiple-Description Coding of Speech Signals
Jan Weil, Kai Clüver, and Thomas Sikora
- blue: a music composition environment for Csound
Steven Yi
- Livecoding with SuperCollider
Alberto de Campo
Link a las descripciones de cada uno de los papers: abstracts
Update:
Update 2:
Hay streaming de audio y video en tiempo real de todas las conferencias y conciertos (luego también estará en diferido)
acoustics
, algorithms
, audio
, c++
, Castellano
, CLAM
, codecs
, conferences
, effects
, español
, events
, free software
, GNU/Linux
, libraries
, midi
, music
, open source
, programming
, publications
, python
, signal processing
, talks 
Share This/Compártelo
Posted in audio, acoustics, algorithms, effects, signal processing, music, free software, programming, GNU/Linux, open source, c++, codecs, libraries, midi, python, publications, Castellano, CLAM, talks, events, conferences | No Comments »