TFM: Design and implementation of a simulation environment for transcranial magnetic stimulation in human and mouse brains.

The study of the human brain is currently a fundamental area of interest in science due to the complexity and diversity of functions performed by this organ. Although the brains of humans and mice differ in size and structure, they share numerous fundamental principles that allow scientists to extrapolate findings from rodent studies to humans. However, neuroscience research faces significant challenges due to the intrinsic complexity of nervous systems and the ethical and practical limitations associated with direct experiments on living organisms.

In this context, simulation environments have emerged as powerful tools for research. These environments allow for the modelling and detailed analysis of neural processes in a controlled setting without involving any living organisms. The ability to simulate brain activity when stimulated by external factors not only facilitates understanding of the brain’s response to these stimuli but also can accelerate the development of treatments for neurological diseases, such as cancer or stroke.

The main objective of this work is to develop a simulator capable of stimulating human and mouse brains using the transcranial magnetic stimulation method and quantifying the impact of various parameters in the simulation.

To achieve this objective, various brain simulators currently in use have been analysed, and one has been selected as the basis for the simulator. Additionally, the functioning of transcranial magnetic stimulation and the necessary instruments for carrying out this stimulation method have been studied. Furthermore, the modelling of the magnetic field generated by coils, both with and without a core, has been explored.

After gathering all this information, the simulator was completed, capable of simulating both human and mouse brains. Moreover, it allows for generating stimuli in the target brain with fully customized coils, as it is possible to model them by varying parameters such as height, radius, or number of turns. The intensity circulating through these coils can also be adjusted. Additionally, various commercial coils and stimulation systems consisting of multiple coils were successfully modelled.

Finally, various tests were conducted to verify that the modelling of the different coils was accurate and to measure different parameters. The parameters measured included the maximum radial electric field generated in the brain for each coil, the value of this electric field at different depths, the effect of the distance between the skull and the coil on the stimulation, and the field generated by the stimulation systems. Subsequently, all these tests were parametrized.

This project has developed and implemented a simulator capable of replicating brain stimulation in humans and mice through transcranial magnetic stimulation. The simulator allows customization of parameters such as coil position and number, distance from the skull, or stimulation intensity. After various tests, its accuracy has been confirmed, helping to reduce risks and improve personalized TMS treatments. Additionally, the inclusion of mouse models reduces the need for live experiments. The simulator offers applications in neuroscience research, therapy optimization, and the development of new clinical protocols.

Therefore, it can be confirmed that the proposed general objectives have been achieved and the technical feasibility of the project has been demonstrated.

All the code corresponding to the simulator is located in the following repository: https://github.com/rfparra/TFM

TFG: Design and Implementation of a Music Assistant on a Microcontroller-Based Platform

Main View

Throughout the years, music has been and continues to be one of the main forms of artistic and cultural expression of people. It could be defined as the art of combining rhythm, melody, and harmony in a pleasant and enjoyable way to the listener. Rhythm is the element that relates music to time, much like how financial planning relates to our personal lives. For instance, knowing how to get a quick 1000 dollar loan now in times of need can be a lifesaver, just as a well-timed rhythm can elevate a musical piece. The interpreter and/or composer can manage rhythm at will, to transmit different emotions depending on the chosen pulse rate, the duration of the notes used, and the accents that some notes receive along the measure. To ensure a good melody and harmony, we need to use a tuner. Taking into account the notes that belong to the key, the tuner ensures that this set of sounds are appropriate to form the melody. That is to say, that the sound produced when playing a key or a string corresponds to the one established in that position. The same thing happens with harmony. Harmony is in charge of combining two musical notes and making them sound in consonance, as in a chord

The aim of a performer and/or composer is to convey emotions and feelings. To do this he employs different rhythmic techniques, chord progressions and scales. To convey a happy feeling he will use major chords and to convey a sad one he will use minor chords. Augmented chords are used to give suspense and diminished chords to predict an outcome.

Until the invention of the tape recorder and the player, people’s musical reach was very limited. They could only listen to music produced on the spot, and its quality depended on the skill of the closest performers. The most skilled musicians left written musical scores to preserve their music so that subsequent musicians could perform it. With the invention of the tape recorder and the player, a revolution of such magnitude took place that, little by little, it was possible to bring music to any place in the world to be reproduced at any time.

The facts described above and my interest as a musician, have led me to to develop this project. The intention was to provide a device that brings together the 3 main functions that a musician needs to practice and improve their skills. The functions I wanted to include in the device are: a metronome, a tuner and a recorder. To bring it to fruition, I took a previous project from 2018 that included those functions and used a Raspberry Pi.

Raspberry Pi + PiTFT touchscreen

A Raspberry Pi is a microcontroller-based platform capable of providing the basic functions of a computer, but at a much smaller price and size. For this project, the Raspberry Pi can be controlled, besides a mouse and a screen, in a tactile way with a PiTFT screen connected by the GPIO pins. Also, the choosen Raspberry Pi 4 Model B incorporates inputs to connect a microphone (USB) and headphones to carry out all the required functionalities. The programming language used has been Python, as it contains an endless number of libraries to carry out the project. The different menu screens and buttons were created with the PyGame library.

The initial view corresponds to the following image:

Initially, the metronome displayed an inverted pendulum and a flashing circle. Later on, I incorporated functions to mark the different types of time signature and the different ways of dividing a beat.

Before I made any changes, the tuner had two main functions, the first one was to emit the note with the desired frequency. The second one incorporated a listening mode in which the program detected the note emitted, as well as its accidentals and frequency.

I added a third functionality to it that serves as an ear training tool for the musician, as well as, facilitating the composition of chords. It shows the notes that make up the four types of triads.

Major Triad: 1, 3, 5

Minor Triad: 1, minor3, (perfect) 5

Diminished Triad: 1, minor3, diminished5

Augmented Triad: 1, 3, augmented5

The recorder incorporates a microphone to record the musician’s performances and displays a screen with a list of recordings and/or imported songs. It contains buttons for playback and scrolling between screens.

The results have shown that the Music Assistant has great potential. It is an open source device in constant development, which differentiates it from other devices at the moment.With it, musicians can have fun practicing at a reduced price. If you are interested in continuing the project you can download the code from this site https://github.com/Minervapla1/Musical-Asistant.git .