PROCEDE DE SIMULATION DU TOUCHER SUR UN CLAVIER METHOD OF SIMULATING THE TOUCH ON A KEYBOARD
La présente invention concerne la simulation du toucher des instruments, et en particulier le toucher des instruments à clavier. Lorsqu'un instrumentiste joue d'un instrument à clavier, il se sert des touches du clavier ainsi que des éventuelles pédales jeux et accouplements pour produire une mélodie. La hauteur des notes jouées dépend de la touche enfoncée. La sonorité du son produit, notamment le timbre ou l'intensité sonore, dépend de la force qu'il a exercé sur la touche au cours de son mouvement.The present invention relates to the simulation of the touch of instruments, and in particular the touch of keyboard instruments. When an instrumentalist plays a keyboard instrument, he uses the keys of the keyboard as well as the possible pedal games and couplings to produce a melody. The pitch of the notes played depends on the key pressed. The tone of the sound produced, in particular the timbre or the loudness, depends on the force it exerted on the key during its movement.
Par exemple, pour le piano, l'intensité sonore d'une note dépend de la vitesse du marteau au moment du choc sur la corde. La décroissance de la note est déterminée par la position des étouffoirs après que le son ait été émis. La vitesse finale du marteau dépend quant à elle de la cinématique de la touche enfoncée par le pianiste.For example, for the piano, the sound intensity of a note depends on the speed of the hammer at the time of the impact on the string. The decay of the note is determined by the position of the dampers after the sound has been emitted. The final speed of the hammer depends on the kinematics of the key pressed by the pianist.
Lorsqu'un instrumentiste enfonce une touche, il ressent sous son doigt une force de réaction due à l'action nement du mécanisme lié à cette touche. L'évolution de cette force de réaction au cours du mouvement de la touche constitue le "toucher" d'un instrument à clavier. Le toucher est essentiel pour un instrumentiste car il lui permet de sentir les impulsions qu'il donne aux touches. Ainsi, il peut en fonction de sa sensibilité contrôler la sonorité des notes.When an instrumentalist presses a key, he feels a reaction force under his finger due to the action of the mechanism linked to this key. The evolution of this reaction force during the movement of the key constitutes the "touch" of a keyboard instrument. Touch is essential for an instrumentalist because it allows him to feel the impulses he gives to the keys. Thus, depending on its sensitivity, it can control the sound of the notes.
Dans les claviers électroniques, les sons sont générés électroniquement et non par le déclenchement d'un mécanisme. Les touches de ces claviers ne sont pas dotées du même mécanisme que celui d'un instrument traditionnel mais en général d'un mécanisme simplifié qui vise à offrir un toucher dynamique à l'instrumentiste. Il en résulte un toucher fort médiocre, incomparable à celui de l'instrument traditionnel. C'est pourquoi, des efforts ont été faits afin de reconstituer artificiellement sur des claviers électroniques un toucher s'apparentant au toucher de certains instruments existants.
Par exemple, le document US 4,899,631 décrit un clavier dans lequel la force de réaction est exercée par des moteurs électriques reliés aux touches par des câbles. Un microprocesseur permet de commander chaque moteur en fonction de la vitesse des touches, leur accélération, la force exercée par l'instrumentiste, des paramètres d'inertie et d'équilibre. A cet effet, les moteurs sont commandés par un paramètre électrique, par exemple l'intensité. La mesure d'un autre paramètre électrique, par exemple la tension, permet de connaître la vitesse du moteur et donc la vitesse de la touche associée. Le système comprend en outre une interface permettant de moduler certains paramètres de sensibilité de la réponse.In electronic keyboards, sounds are generated electronically and not by the triggering of a mechanism. The keys of these keyboards do not have the same mechanism as that of a traditional instrument but generally a simplified mechanism which aims to offer a dynamic touch to the instrumentalist. The result is a very mediocre feel, incomparable to that of the traditional instrument. This is why, efforts have been made to artificially reconstruct on electronic keyboards a touch similar to the touch of certain existing instruments. For example, document US 4,899,631 describes a keyboard in which the reaction force is exerted by electric motors connected to the keys by cables. A microprocessor makes it possible to control each motor according to the speed of the keys, their acceleration, the force exerted by the instrumentalist, inertia and balance parameters. To this end, the motors are controlled by an electrical parameter, for example the intensity. The measurement of another electrical parameter, for example the voltage, makes it possible to know the speed of the motor and therefore the speed of the associated key. The system further includes an interface for modulating certain response sensitivity parameters.
Le document US 5,922,983 propose un dispositif comprenant un clavier muni de capteurs, des actionneurs et un microprocesseur. La position, la vitesse et l'accélération d'une touche sont mesurées par les capteurs associés. La force appliquée sur cette touche par l'actionneur est la somme de trois composantes lues dans des tables de données.Document US 5,922,983 proposes a device comprising a keyboard provided with sensors, actuators and a microprocessor. The position, speed and acceleration of a key are measured by the associated sensors. The force applied to this key by the actuator is the sum of three components read from data tables.
L'inconvénient de ces différents dispositifs est qu'ils ne perrnettent pas de restituer fidèlement le toucher d'un instrument réel parce qu'ils génèrent une réaction en réponse à une mesure de paramètres instantanés du mouvement de la touche. Pour pallier cet inconvénient, l'invention propose un procédé de simulation de toucher permettant de prendre en compte non pas seulement les paramètres cinématiques instantanés de chaque touche actionnée mais la globalité de son mouvement depuis l'instant de début d'actionnement. Ceci est indispensable pour simuler le toucher d'instruments au mécanisme complexe pour lesquels le toucher dépend non seulement des paramètres cinématiques instantanés des touches mais aussi de ceux des pièces mobiles entraînés par les touches.The disadvantage of these various devices is that they do not allow the touch of a real instrument to be faithfully reproduced because they generate a reaction in response to a measurement of instantaneous parameters of the movement of the key. To overcome this drawback, the invention proposes a method of touch simulation making it possible to take into account not only the instantaneous kinematic parameters of each key pressed but the whole of its movement since the instant of start of actuation. This is essential to simulate the touch of instruments with a complex mechanism for which touch depends not only on the instantaneous kinematic parameters of the keys but also on those of the moving parts driven by the keys.
A cet effet, l'invention propose un procédé de simulation de toucher sur un clavier selon lequel : - on mesure au moins un paramètre de mouvement de chaque touche du clavier au moyen d'un capteur,
- on calcule un effort à exercer en fonction des paramètres mesurés et on en déduit une grandeur de commande,To this end, the invention proposes a method of simulating touch on a keyboard according to which: - at least one movement parameter of each key of the keyboard is measured by means of a sensor, - a force to be exerted is calculated as a function of the parameters measured and a control quantity is deduced therefrom,
- on commande un actionneur qui applique l'effort calculé à la touche, et par voie de conséquence au doigt de l'instrumentiste caractérisé en ce qu'on calcule ledit effort en fonction d'une modélisation du comportement mécanique dynamique des différents éléments d'un mécanisme d'un instrument à clavier que l'on veut simuler, l'effort calculé à l'aide de cette modélisation correspondant à la force de réaction qui serait exercée par le mécanisme sur la touche. Ce procédé permet de reproduire fidèlement le toucher d'un instrument existant dans la mesure où il prend en compte le comportement dynamique de chacun des éléments qui constituent le mécanisme réel reliant une touche à un élément produisant le son.- an actuator is controlled which applies the calculated force to the key, and consequently to the finger of the instrumentalist characterized in that said force is calculated according to a modeling of the dynamic mechanical behavior of the various elements of a mechanism of a keyboard instrument that we want to simulate, the force calculated using this modeling corresponding to the reaction force that would be exerted by the mechanism on the key. This process allows to faithfully reproduce the touch of an existing instrument insofar as it takes into account the dynamic behavior of each of the elements which constitute the real mechanism connecting a key to an element producing the sound.
En particulier, suivant le procédé de l'invention, on stocke, durant l'actionnement d'une touche, des informations sur le passé de la trajectoire de la touche ainsi que sur les pièces en mouvement de la mécanique à simuler, et on prend en compte ces informations pour calculer la force à exercer sur la touche.In particular, according to the method of the invention, during the actuation of a key, information is stored on the past of the trajectory of the key as well as on the moving parts of the mechanics to be simulated, and we take take this information into account to calculate the force to be exerted on the key.
Les paramètres de l'algorithme de calcul étant déterminés pour un type d'instrument donné, il est avantageusement possible de les modifier afin de moduler le toucher restitué. Par exemple, l'instrumentiste peut alléger ou durcir la réponse des touches.The parameters of the calculation algorithm being determined for a given type of instrument, it is advantageously possible to modify them in order to modulate the restored touch. For example, the player can lighten or harden the response of the keys.
Le procédé de simulation permet également de simuler un instrument complètement nouveau, dont le toucher ne se retrouve pas parmi les instruments traditionnels.The simulation process also makes it possible to simulate a completely new instrument, whose touch is not found among traditional instruments.
Etant donné que l'algorithme calcule en permanence la position des pièces en mouvement dans la mécanique qu'il simule, il est capable de fournir avec une grande précision l'instant où par exemple un marteau d'un piano touche une corde, et à quelle vitesse a lieu le choc. Il est donc possible grâce à cet algorithme de déterminer le moment exact où le son est produit et avec quelle intensité. On peut grâce au procédé de l'invention générer, transmettre ou enregistrer des ordres de jeu. Ces ordres de jeu
peuvent également être envoyés à un synthétiseur électronique ou à un instrument motorisé.Since the algorithm constantly calculates the position of moving parts in the mechanics it simulates, it is able to provide with great precision the moment when for example a hammer of a piano touches a string, and what speed the shock takes place. It is therefore possible thanks to this algorithm to determine the exact moment when the sound is produced and with what intensity. Thanks to the method of the invention, it is possible to generate, transmit or record game orders. These game orders can also be sent to an electronic synthesizer or a motorized instrument.
Le procédé présente également l'avantage de recourir exclusivement à un algorithme pour la détermination des forces dynamiques, ce qui prête à l'usage de capteurs et d'actionneurs naturellement digitaux, et à l'utilisation de flux numériques sous forme binaire, comme par exemple l'encodage par modulation de largeur d'impulsion.The method also has the advantage of exclusively using an algorithm for determining dynamic forces, which lends itself to the use of naturally digital sensors and actuators, and to the use of digital streams in binary form, as for example example encoding by pulse width modulation.
D'autres caractéristiques et avantages de l'invention ressortiront encore de la description qui suit, laquelle est purement illustrative et non limitative et doit être lue en regard de la figure annexée qui illustre un exemple de dispositif de mise en îoeuvre du procédé de l'invention.Other characteristics and advantages of the invention will emerge from the description which follows, which is purely illustrative and not limiting and should be read with reference to the appended figure which illustrates an example of a device for implementing the method of invention.
Sur l'exemple de la figure, le dispositif comprend un clavier 1. Chaque touche 2 du clavier 1 est reliée à un actionneur 3 apte à exercer un effort sur la touche. La touche 2 est munie d'un capteur 11 permettant de mesurer un paramètre de mouvement, par exemple sa position ou sa vitesse. La sortie du capteur 11 est connectée à un multiplexeur 10. Le multiplexeur 10 collecte les signaux issus d'un ensemble de capteurs liés aux touches du clavier 1. Le signal multiplexe est converti par un convertisseur analogique/numérique 9 avant d'être transmis à un calculateur 7.In the example of the figure, the device comprises a keyboard 1. Each key 2 of the keyboard 1 is connected to an actuator 3 capable of exerting a force on the key. Key 2 is provided with a sensor 11 making it possible to measure a movement parameter, for example its position or its speed. The output of the sensor 11 is connected to a multiplexer 10. The multiplexer 10 collects the signals coming from a set of sensors linked to the keys of the keyboard 1. The multiplex signal is converted by an analog / digital converter 9 before being transmitted to a computer 7.
Le calculateur 7 comprend une interface 8, des moyens de mémoire et des moyens de calcul. Il reçoit le signal numérique en provenance du convertisseur 9 et renvoie un signal numérique de consigne vers un convertisseur numérique/analogique 6. Le signal de consigne est démultiplexé par le multiplexeur 5. Le signal démultiplexé est transmis à un module de commande 4 d'un actionneur 3. L'actionneur 3 ainsi commandé agit sur la touche 2 correspondante. L'utilisation des multiplexeurs 5 et 10 permet de réduire le nombre de signaux à convertir.The computer 7 comprises an interface 8, memory means and calculation means. It receives the digital signal from the converter 9 and sends a digital setpoint signal to a digital / analog converter 6. The setpoint signal is demultiplexed by the multiplexer 5. The demultiplexed signal is transmitted to a control module 4 of a actuator 3. The actuator 3 thus controlled acts on the corresponding key 2. The use of multiplexers 5 and 10 makes it possible to reduce the number of signals to be converted.
Lorsque l'instrumentiste actionne la touche 2, le mouvement qu'il lui impose est mesuré par le capteur 11, codé et transmis au calculateur 7. Pour chaque touche, le calculateur 7 calcule en temps réel sa position, sa vitesse et son accélération instantanées, et en déduit en fonction d'un
algorithme la force à restituer à la touche 2. Il renvoie un signal de consigne vers l'actionneur 3 qui applique alors sur la touche 2 la force ainsi calculée.When the instrumentalist actuates the key 2, the movement which it imposes on it is measured by the sensor 11, coded and transmitted to the computer 7. For each key, the computer 7 calculates in real time its position, its instantaneous speed and acceleration , and deduces based on a algorithm the force to be restored to the key 2. It sends a setpoint signal back to the actuator 3 which then applies to the key 2 the force thus calculated.
Pour simuler le toucher d'un instrument à clavier réel, la force à restituer est la force que subirait le doigt d'un instrumentiste jouant sur un instrument réel. L'algorithme utilisé pour calculer la force contient des routines qui modélisent le comportement de certains éléments du mécanisme de l'instrument réel. On associe à cet instrument une routine ActionMechanics qui calcule à chaque pas de temps la force à appliquer sur une touche considérée. La routine ActionMechanics reçoit en entrée un pointeur sur une structure DynMsg qui contient le numéro de la touche, sa position, sa vitesse et son accélération :To simulate the touch of a real keyboard instrument, the force to be restored is the force that the finger of an instrumentalist playing on a real instrument would undergo. The algorithm used to calculate the force contains routines which model the behavior of certain elements of the mechanism of the real instrument. We associate with this instrument an ActionMechanics routine which calculates at each time step the force to be applied to a key considered. The ActionMechanics routine receives as input a pointer to a DynMsg structure which contains the number of the key, its position, its speed and its acceleration:
typedef struct { int channel; float position, velocity,acceleration; } DynMsg;typedef struct {int channel; float position, velocity, acceleration; } DynMsg;
Des informations sur le passé de la trajectoire d'une touche ainsi que sur les pièces en mouvement de la mécanique à simuler sont stockées dans des variables locales qui conservent les informations nécessaires, permettant à la routine ActionMechanics de calculer la force que doit ressentir l'instrumentiste. Cette force est le paramètre de sortie de la routine.Information on the past of the trajectory of a key as well as on the moving parts of the mechanics to simulate is stored in local variables which keep the necessary information, allowing the routine ActionMechanics to calculate the force which must feel the instrumentalist. This force is the output parameter of the routine.
L'interface 7 permet à un utilisateur de modifier au cours du jeu certains paramètres de la mécanique simulée. Ces paramètres sont stockés dans une structure de type kbm_aparameter, dont l'accès se fait par la macro PARAMETER(int).The interface 7 allows a user to modify certain parameters of the simulated mechanics during the game. These parameters are stored in a kbm_aparameter type structure, which is accessed by the PARAMETER (int) macro.
La mécanique de la plupart des instruments peut être modélisée par une série de poids statiques, ressorts, frottements, inertie, rebonds et masses lancées. Pour reproduire fidèlement le toucher simulé, on modélise séparément ces différents comportements.
Modélisation du poidsThe mechanics of most instruments can be modeled by a series of static weights, springs, friction, inertia, rebounds and masses launched. To faithfully reproduce the simulated touch, these different behaviors are modeled separately. Weight modeling
Le poids est une force constante. On simule un poids affectant à la force à déterminer un paramètre stocké en exécutant:Weight is a constant force. We simulate a weight affecting the force to determine a stored parameter by executing:
force=PARAMETER(n_poids) ;force = PARAMETER (n_weight);
où njpoids est le numéro du paramètre contenant le poids au repos à appliquer.where njpoids is the number of the parameter containing the resting weight to apply.
Modélisation d'une force élastiqueModeling of an elastic force
Simuler un ressort consiste à appliquer une force proportionnelle à la différence entre la position de la touche et sa position correspondant au ressort au repos. On simule un ressort en exécutant:Simulating a spring consists in applying a force proportional to the difference between the position of the key and its position corresponding to the spring at rest. We simulate a spring by executing:
ch=dynmsg->channel ;ch = dynmsg-> channel;
Y=dynmsg->position-HLG[ch].lowpos ; force=PARAMETER(n_raideur) *(Y-PARAMETER(n_repos)) ;Y = dynmsg-> position-HLG [ch] .lowpos; force = PARAMETER (n_raideur) * (Y-PARAMETER (n_repos));
où n_raideur est le numéro du paramètre décrivant la raideur du ressort et n_repos celui du paramètre donnant sa position de repos. Le tableau de structures HLGQ contient les postions des touches en haut et en bas ainsi qu'une valeur de calibration de l'effecteur (force par bit du convertisseur):where n_raideur is the number of the parameter describing the stiffness of the spring and n_repos that of the parameter giving its rest position. The HLGQ structure table contains the positions of the keys at the top and bottom as well as a calibration value of the effector (force per bit of the converter):
struct hi_lo_gain{ value_t hi_pos, low_pos; float gain;struct hi_lo_gain {value_t hi_pos, low_pos; float gain;
};};
Frottement Pour simuler un frottement visqueux, on applique une force proportionnelle à la vitesse de la touche, en sens opposé. On exécute:
V=dynmsg->velocity ; force=-V*PARAMETER(n_visco) ;Friction To simulate a viscous friction, apply a force proportional to the speed of the key, in the opposite direction. We execute: V = dynmsg->velocity; force = -V * PARAMETER (n_visco);
où n_visco est le numéro du paramètre décrivant la viscosité du frottement. Tout autre forme de frottement est envisageable selon le même principe, comme par exemple une force de frottement proportionnelle au cube de la vitesse de la touche.where n_visco is the number of the parameter describing the viscosity of friction. Any other form of friction can be envisaged according to the same principle, such as for example a friction force proportional to the cube of the speed of the key.
Inertie De même, pour simuler une masse inertielle, on applique une force proportionnelle à l'accélération de la touche, en sens opposé. On exécute:Inertia Similarly, to simulate an inertial mass, a force proportional to the acceleration of the key is applied in the opposite direction. We execute:
A-dynmsg->acceleraϋon ; force=-A*PARAMETER(n_inertia) ;A-dynmsg-> acceleraϋon; force = -A * PARAMETER (n_inertia);
où n nertia est le numéro du paramètre décrivant la masse en mouvement.where n nertia is the number of the parameter describing the mass in motion.
Masse lancéeMass launched
La modélisation d'une masse lancée nécessite le calcul de la cinématique de la masse en question. La masse lancée est décrite par sa position mass_pos et sa vitesse mass_velo. La force ressentie sous le doigt dépend de la présence ou non de la masse sur la tige ; le drapeau stuck rend compte de cette présence. Il faut décrire l'organe de couplage entre la tige et la masse. Un modèle simple consiste à utiliser un ressort en parallèle avec un frottement visqueux. Le choix de la raideur du ressort et de la viscosité du frottement permet le contrôle de la sensation du rebond. On exécute ainsi:The modeling of a launched mass requires the calculation of the kinematics of the mass in question. The mass launched is described by its mass_pos position and its mass_velo speed. The force felt under the finger depends on the presence or not of the mass on the rod; the stuck flag reflects this presence. It is necessary to describe the coupling member between the rod and the mass. A simple model is to use a spring in parallel with a viscous friction. The choice of the stiffness of the spring and the viscosity of the friction allows the control of the feeling of the rebound. We execute as follows:
if (stuck) force=(Y-mass_βos)*PARAMETER(n_raideur) - (V-mass_velo) ΨARAMETER(n_visco); else force=0 ;
La trajectoire de la masse dépend aussi du fait qu'elle repose sur la tige ou non:if (stuck) force = (Y-mass_βos) * PARAMETER (n_raideur) - (V-mass_velo) ΨARAMETER (n_visco); else force = 0; The mass trajectory also depends on whether it rests on the rod or not:
if (stuck) { mass_pos=Y ; mass_velo=V ; } else { mass_velo-=PARAMETER(n_gravité) ; mass_pos+=mass_velo; }if (stuck) {mass_pos = Y; mass_velo = V; } else {mass_velo- = PARAMETER (n_gravity); mass_pos + = mass_velo; }
où n_gravité décrit l'effet de la force de gravité sur la masse lorsque cette dernière est libre.where n_gravity describes the effect of the force of gravity on the mass when the latter is free.
Il reste à décrire le test de collage/décollement de la masse. Le. décollement a lieu si la force que subit la masse est supérieure à la gravité, tandis que le collage peut être arbitrairement choisi lorsque la masse passe sous la tige :It remains to describe the bonding / detachment test of the mass. The. detachment takes place if the force undergone by the mass is greater than gravity, while bonding can be arbitrarily chosen when the mass passes under the rod:
if (force>gravity) stuck≈O ; if (mass_pos<Y) { mass_pos=Y ; stuck=1 ; ;if (force> gravity) stuck≈O; if (mass_pos <Y) {mass_pos = Y; stuck = 1; ;
Ainsi, si le couplage masse/tige est raide, la masse va rebondir. Comme elle aura perdu de l'énergie à cause des frottements visqueux de l'organe de couplage, elle va remonter moins haut que lors du précédent rebond, pour finir par se recoller sur la tige.Thus, if the mass / rod coupling is stiff, the mass will rebound. As it will have lost energy due to the viscous friction of the coupling member, it will go back up lower than during the previous rebound, to end up sticking on the rod.
Le module damper_action.h reproduit poids, ressort, frottement visqueux et inertie. Le module mass_action.h simule le comportement d'une
balle qui peut être lancée par appui sur la touche et qui vient rebondir sur un feutre situé au bout du bras d'une touche.The damper_action.h module reproduces weight, spring, viscous friction and inertia. The mass_action.h module simulates the behavior of a ball which can be thrown by pressing the key and which rebounds on a felt located at the end of the arm of a key.
A partir de ces routines élémentaires, on construit un algorithme permettant de simuler un mécanisme. Les modules clavichord_action.h, harpsijaction.h, clavinova_action.h, organ2_action.h, et piano_action.h simulent respectivement les touchers d'un clavicorde, d'un clavecin, d'un clavier typique de piano numérique du commerce, d'un orgue et d'un piano.From these elementary routines, we build an algorithm allowing to simulate a mechanism. The clavichord_action.h, harpsijaction.h, clavinova_action.h, organ2_action.h, and piano_action.h modules simulate the touches of a clavichord, a harpsichord, a typical commercial digital piano keyboard, a organ and piano.
Simulation d'un clavicordeSimulation of a clavichord
Le mécanisme d'une touche de clavicorde consiste en un plectre (solidaire de la touche) qui vient frapper une corde. Trois forces sont donc en présence : le poids de la touche, son inertie, et la raideur de la corde si celle-ci est en contact avec le plectre. Quatre paramètres sont impliqués dans cette modélisation:The mechanism of a clavichord key consists of a plectrum (integral with the key) which strikes a string. Three forces are therefore present: the weight of the fingerboard, its inertia, and the stiffness of the string if it is in contact with the plectrum. Four parameters are involved in this modeling:
- PARAMETER(O) est le poids de la touche,- PARAMETER (O) is the weight of the key,
- PARAMETER(I) est la raideur de la corde,- PARAMETER (I) is the stiffness of the rope,
- PARAMETER(2) est la position de la corde,- PARAMETER (2) is the position of the string,
- PARAMETER(3) est l'inertie du mécanisme. Un paramètre supplémentaire PARAMETER(4) est introduit afin de pallier une tendance de la touche à osciller à cause de ses modes de flexion: au lieu de simuler l'inertie comme présenté ci-dessus, il est préférable de coupler la touche à une masse virtuelle via un élément dissipatif. La masse subit la force d'inertie et transmet son mouvement à la touche par l'intermédiaire d'une force proportionnelle au cube de la différence de leurs vitesses, le facteur de proportionnalité étant PARAMETER(4). Le calcul de la force s'écrit par conséquent :- PARAMETER (3) is the inertia of the mechanism. An additional parameter PARAMETER (4) is introduced in order to alleviate a tendency of the key to oscillate because of its flexion modes: instead of simulating the inertia as presented above, it is preferable to couple the key to a mass virtual via a dissipative element. The mass undergoes the force of inertia and transmits its movement to the key via a force proportional to the cube of the difference in their speeds, the proportionality factor being PARAMETER (4). The force calculation is therefore written:
//Action de la masse virtuelle sur la touche force=PARAMETER(4) *pow(mass_velo,3.); // Cinématique de la masse virtuelle mass_velo+=force/PARAMETER(3);
//Action du poids force+=PARAMETER(0); //Action de la corde bump=Y-PARAMETER(2) ; if (bump<0) force+=bump*PARAMETER(1) ;// Action of the virtual mass on the force key = PARAMETER (4) * pow (mass_velo, 3.); // Kinematics of the virtual mass mass_velo + = force / PARAMETER (3); // Force weight action + = PARAMETER (0); // Action of the string bump = Y-PARAMETER (2); if (bump <0) force + = bump * PARAMETER (1);
où bump mesure la distance entre le plectre et la corde. Le modèle permet de connaître exactement à quel instant le plectre vient frapper la corde, et peut alors donner l'ordre à un synthétiseur de générer un son de la hauteur correspondant à la touche et l'intensité sonore étant reliée à l'énergie cinétique du plectre (i.e. de la touche au moment du choc). Le drapeau ok est utilisé pour n'envoyer cet ordre qu'à chaque choc et non pas chaque fois que le plectre et la corde sont en contact:where bump measures the distance between the plectrum and the string. The model allows you to know exactly when the plectrum strikes the string, and can then give the order to a synthesizer to generate a sound of the pitch corresponding to the key and the sound intensity being related to the kinetic energy of the plectrum (ie of the touch at the moment of shock). The ok flag is used to send this order only on each shock and not each time the plectrum and the string are in contact:
if ((bump<0)&&(ok)) {if ((bump <0) && (ok)) {
// ordre au synthétiseur de jouer ReplySyntheOrder(ch,V*V) ; //Empêche le rebond sonore ok=0 ; ;// order the synthesizer to play ReplySyntheOrder (ch, V * V); // Prevents sound bounce ok = 0; ;
//Rearmement du drapeau si la touche est assez descendue if (bump>100) ok=1 ;// Reset the flag if the key is down enough if (bump> 100) ok = 1;
Simulation d'un clavecin Le mécanisme du clavecin est proche de celui du clavicorde : la corde est pincée par une pointe de plume maintenue par une lame en bois (le sautereau) solidaire de la touche. L'instrumentiste ne ressent que le poids et l'inertie de la touche tant que la plume n'entre pas en contact avec la corde. Une fois ce contact établi, le sautereau plie jusqu'à ce que la plume se dégage de la corde, libérant la touche. Au retour le même phénomène survient mais le sautereau se plie plus facilement et la plume - biseautée - se dégage plus vite.
Huit paramètres sont nécessaires pour modéliser ceci :Simulation of a harpsichord The mechanism of the harpsichord is similar to that of the clavichord: the string is pinched by a point of feather held by a wooden blade (the grasshopper) secured to the key. The instrumentalist only feels the weight and inertia of the fingerboard as long as the feather does not come into contact with the string. Once this contact is established, the grasshopper bends until the feather emerges from the rope, releasing the key. On the return the same phenomenon occurs but the grasshopper folds more easily and the feather - beveled - is released faster. Eight parameters are required to model this:
- PARAMETER(O) est le poids de la touche,- PARAMETER (O) is the weight of the key,
- PARAMETER(I) est la raideur du sautereau à la descente de la touche,- PARAMETER (I) is the stiffness of the grasshopper when the button is lowered,
- PARAMETER(2) est la raideur du sautereau à la remontée de la touche, - PARAMETER(3) est la position de la corde,- PARAMETER (2) is the stiffness of the grasshopper when the button is raised, - PARAMETER (3) is the position of the rope,
- PARAMETER(4) est la force maximale avant décrochement du sautereau à la descente de la touche,- PARAMETER (4) is the maximum force before unhooking the grasshopper when the button is lowered,
- PARAMETER(δ) est la force maximale avant décrochement du sautereau à la montée de la touche, - PARAMETER(β) est l'inertie du mécanisme,- PARAMETER (δ) is the maximum force before the toggle hangs up when the button is raised, - PARAMETER (β) is the inertia of the mechanism,
- PARAMETER(7) est la viscosité du couplage touche/masse virtuelle.- PARAMETER (7) is the viscosity of the virtual key / ground coupling.
L'action du poids et de l'inertie, modélisée par l'interaction avec une masse virtuelle, est calculée comme dans le cas du clavicorde. A une position donnée de la touche n'est pas associée une force unique : il faut tenir compte du fait que le sautereau peut être en contact avec la corde ou non. Ceci nécessite l'emploi d'une machine d'état (note_info_ring[ch].machinestate) qui passe à 1 quand le sautereau a dépassé la corde et revient à 0 quand il est repassé dessous. L'algorithme correspondant à l'interaction touche/corde s'écrit donc :The action of weight and inertia, modeled by the interaction with a virtual mass, is calculated as in the case of the clavichord. A single force is not associated with a given position of the key: it must be taken into account whether the grasshopper may be in contact with the rope or not. This requires the use of a state machine (note_info_ring [ch] .machinestate) which goes to 1 when the grasshopper has crossed the rope and returns to 0 when it is ironed below. The algorithm corresponding to the key / string interaction is therefore written:
// 1er cas : sautereau sous la corde if(note_info_ring[ch].machinestate==0){ if(Y<PARAMETER(3)){ // le sautereau plie fcompress=(PARAMETER(3)-Y)*PARAMETER(1); if(fcompress>PARAMETER(4)){ //force limite atteinte note_info_ring[ch].machinestate=1; fcompress=0.;// 1st case: grasshopper under the string if (note_info_ring [ch] .machinestate == 0) {if (Y <PARAMETER (3)) {// the grasshopper folds fcompress = (PARAMETER (3) -Y) * PARAMETER ( 1); if (fcompress> PARAMETER (4)) {// limit force reached note_info_ring [ch] .machinestate = 1; fcompress = 0 .;
//ordre au synthétiseur déjouer ReplySyntheOrder(ch, 1) ;
; force+=fcompress ;// order the synthesizer to foil ReplySyntheOrder (ch, 1); ; force + = fcompress;
} }else{ // 2eme cas : sautereau au dessus de la corde if(Y>PARAMETER(3)){}} else {// 2nd case: grasshopper above the string if (Y> PARAMETER (3)) {
//le sautereau plie fcompress=(Y-PARAMETER(3))*PARAMETER(2); if(fcompress>PARAMETER(5)){ note_info_ring[ch].machinestate=0; fcompress=0.;// the grasshopper folds fcompress = (Y-PARAMETER (3)) * PARAMETER (2); if (fcompress> PARAMETER (5)) {note_info_ring [ch] .machinestate = 0; fcompress = 0 .;
} force-≈fcompress ;} force-≈fcompress;
} ;};
Le son est émis lorsque le sautereau relâche la corde. De même lorsque la plume revient en contact avec la corde il est possible d'insérer une instruction commandant au synthétiseur d'étouffer le son avec le changement de timbre qui s'en accompagne.The sound is emitted when the grasshopper releases the rope. Similarly when the feather comes back into contact with the string it is possible to insert an instruction ordering the synthesizer to muffle the sound with the change of timbre which accompanies it.
Simulation d'un clavier de piano numériqueSimulation of a digital piano keyboard
La mécanique typique d'un piano "numérique" consiste en une simple combinaison de poids, inertie, ressort et frottement visqueux. Il se déduit par conséquent des exemples précédemment décrits. En particulier aucune variable "cachée" décrivant la dynamique d'un mécanisme interne n'est nécessaire.The typical mechanics of a "digital" piano consists of a simple combination of weight, inertia, spring and viscous friction. It is therefore deduced from the examples previously described. In particular, no "hidden" variable describing the dynamics of an internal mechanism is necessary.
Simulation d'un orgueSimulation of an organ
La mécanique du clavier de l'orgue peut être modélisée ainsi: la touche, affectée d'un poids et d'une inertie, est reliée à une soupape par
l'intermédiaire d'un ressort présentant du jeu et soumis à un frottement solide. La soupape, quant à elle, possède une inertie et est soumise à l'action du mécanisme la mettant en mouvement et de l'aspiration provoqué par l'air qui pénètre dans le tuyau qu'elle obstrue au repos. Comme dans le cas de la masse lancée, il est nécessaire de calculer la cinématique de la soupape et de savoir si elle est plaquée sur son siège ou non.The organ keyboard mechanics can be modeled as follows: the key, assigned a weight and inertia, is connected to a valve by through a spring with play and subjected to solid friction. The valve, for its part, has an inertia and is subjected to the action of the mechanism putting it in motion and of the suction caused by the air which penetrates into the pipe which it obstructs at rest. As in the case of the launched mass, it is necessary to calculate the kinematics of the valve and to know if it is pressed against its seat or not.
Simulation d'un pianoPiano simulation
La mécanique du piano, bien que complexe, peut elle aussi être décomposée en éléments simples modelisés par les algorithmes présentés ci-dessus. Chaque touche est soumise à son poids, son inertie, des frottements sur les feutres d'échappement et à la réaction du marteau qu'elle entraîne. Il est évidemment nécessaire de calculer la trajectoire du marteau, qui va permettre en outre de connaître à quel moment et avec quelle vigueur le son doit être émis. L'utilisation de machines d'état s'avère nécessaire pour savoir si le marteau est en contact avec la touche, libre ou dans l'attrape, et s'il a été réarmé ou non par le mécanisme de double échappement.The mechanics of the piano, although complex, can also be broken down into simple elements modeled by the algorithms presented above. Each key is subject to its weight, its inertia, friction on the exhaust felts and the reaction of the hammer it causes. It is obviously necessary to calculate the trajectory of the hammer, which will also make it possible to know when and with what vigor the sound must be emitted. The use of state machines is necessary to know if the hammer is in contact with the button, free or in the catch, and if it has been rearmed or not by the double escapement mechanism.
Considérations particulières liées aux problèmes d'asservissementSpecial considerations related to enslavement problems
Les exemples ci-dessus de modèles d'instruments ne tiennent pas compte d'éventuelles imperfections de mesure des capteurs 11 et des limites de réponse des actionneurs 3, ainsi que des imperfections mécaniques des touches 2. Il est donc nécessaire d'effectuer un traitement numérique sur les données brutes provenant des capteurs (filtrage, linéarisation...) avant de les injecter dans le modèle. De même, afin d'appliquer sur le doigt de l'instrumentiste la force exacte calculée par le modèle, il est nécessaire de tenir compte de l'ensemble des effets perturbateurs de l'ensemble électromécanique (masse et inertie de la touche 2, frottements, flexion de la touche 2, non-linéarité de l'actionneur 3 y compris de son électronique de commande...).
De par la variété des modélisations mécaniques susceptibles d'être utilisées pour la simulation du toucher, il n'est pas possible de garantir a priori la stabilité de l'ensemble du système mécanique comprenant la touche 2 et le doigt en interaction avec celle-ci sous l'effet de la force excercée par l'actionneur 3. En effet, quand bien même les stratégies de filtrage évoquées ci-dessus eussent pu contraindre le système isolé à la stabilité, la complexité de la réaction du doigt de l'instrumentiste sur la touche (écrasement dynamique de la pulpe, raidissement des tendons...) peuvent engendrer l'apparition de phénomènes oscillatoires parasites. L'utilisation de méthodes plus sophistiquées de traitement du signal, comme le filtrage adaptatif (détection et élimination par une équalisation dynamique des résonnances...) peut s'avérer nécessaire.The above examples of instrument models do not take into account possible measurement imperfections of the sensors 11 and the response limits of the actuators 3, as well as mechanical imperfections of the keys 2. It is therefore necessary to carry out a treatment digital on the raw data coming from the sensors (filtering, linearization ...) before injecting them into the model. Likewise, in order to apply the exact force calculated by the model to the player's finger, it is necessary to take into account all of the disturbing effects of the electromechanical assembly (mass and inertia of key 2, friction , bending of the key 2, non-linearity of the actuator 3 including its control electronics ...). Due to the variety of mechanical models that can be used for touch simulation, it is not possible to guarantee a priori the stability of the entire mechanical system including key 2 and the finger interacting with it under the effect of the force exerted by the actuator 3. Indeed, even if the filtering strategies mentioned above could have forced the isolated system to stability, the complexity of the reaction of the player's finger on the touch (dynamic crushing of the pulp, stiffening of the tendons ...) can cause the appearance of parasitic oscillatory phenomena. The use of more sophisticated signal processing methods, such as adaptive filtering (detection and elimination by dynamic equalization of resonances, etc.) may prove necessary.
On comprend que grâce au procédé de l'invention, on peut simuler le toucher de tout instrument existant à partir du moment où l'on sait modéliser son fonctionnement mécanique. Mais on peut aussi simuler des claviers dotés d'un toucher radicalement nouveau en programmant un nouvel algorithme de calcul du toucher.We understand that thanks to the method of the invention, we can simulate the touch of any existing instrument from the moment we know how to model its mechanical functioning. But we can also simulate keyboards with a radically new touch by programming a new algorithm for calculating touch.
Selon une première application de l'invention, l'interface 8 permet à l'utilisateur de modifier les paramètres des algorithmes. Il est par exemple possible de moduler le toucher de l'instrument. L'utilisateur peut demander que le clavier soit plus lourd, plus léger, plus véloce. Il peut même demander que chaque touche ait son propre toucher. Par exemple il peut alléger les aigus ou durcir la réponse des touches pour augmenter l'efficacité d'un exercice. Il peut aussi commander au calculateur 7 de modifier le toucher de certaines touches à certains moments du morceau uniquement, par exemple pour faciliter l'exécution d'un passage périlleux.According to a first application of the invention, the interface 8 allows the user to modify the parameters of the algorithms. It is for example possible to modulate the touch of the instrument. The user can request that the keyboard be heavier, lighter, faster. He can even request that each key has its own touch. For example, it can reduce the treble or harden the response of the keys to increase the effectiveness of an exercise. It can also command the computer 7 to modify the touch of certain keys at certain moments of the song only, for example to facilitate the execution of a perilous passage.
Selon une autre application de l'invention, le clavier simule le toucher d'un instrument réel, par exemple un piano. Le calculateur calcule les mouvement des différents éléments constitutifs du mécanisme. Il calcule le moment exact où un marteau touche une corde et avec quel énergie se fait le choc. Le calculateur est en mesure de donner des ordres de jeu à un
synthétiseur auquel il est relié. Les ordres de jeu délivrés peuvent être stockés dans une mémoire ou sur un support physique (disque dur, CD- ROM, etc.) afin que l'instrumentiste puisse enregistrer son jeu.According to another application of the invention, the keyboard simulates the touch of a real instrument, for example a piano. The calculator calculates the movements of the various components of the mechanism. It calculates the exact moment when a hammer hits a string and with what energy the impact is made. The calculator is able to give play orders to a synthesizer to which it is connected. The issued playing orders can be stored in a memory or on a physical medium (hard disk, CD-ROM, etc.) so that the player can record his playing.
Selon une autre application de l'invention, les ordres de jeu peuvent également être envoyés à un instrument traditionnel dont la mécanique aurait été motorisée. L'instrumentiste joue sur le clavier, les ordres sont transmis à un autre instrument qui reproduit le jeu de l'instrumentiste. Les ordres de jeu peuvent être envoyés aussi loin que désiré par le calculateur via un réseau de transmission d'informations, ce qui autorise qu'un instrumentiste jouant à un endroit dans le monde puisse être écouté au même instant, n'importe où ailleurs et sur n'importe quel instrument.According to another application of the invention, the playing orders can also be sent to a traditional instrument whose mechanics would have been motorized. The instrumentalist plays on the keyboard, the orders are transmitted to another instrument which reproduces the instrumentalist's playing. Game orders can be sent as far as desired by the calculator via an information transmission network, which allows an instrumentalist playing in one place in the world to be listened to at the same instant, anywhere else and on any instrument.
Enfin, si le calculateur est connecté à un réseau de transmission d'informations, il est possible de télécharger dans la mémoire du calculateur des algorithmes de toucher tels que ceux décrits précédemment. On peut aussi stocker ces algorithmes dans des supports tels que des disquettes ou des CD-ROM.
Finally, if the computer is connected to an information transmission network, it is possible to download to the computer memory touch algorithms such as those described above. These algorithms can also be stored in media such as floppy disks or CD-ROMs.