Keyboard Instruments

Ultrasound keyboard

4 replies 1,737 views

Started by

pianothor

Member

Member

Opening post by pianothor

Posts
217
City
Mantova

Hello, I am writing here because I would like to build a real "keyboard" instrument.

Being in my fifth year at the E. Fermi high school in Mantua, this year I will have to prepare for my final exam and consequently my thesis project..

For the thesis, I have proposed to design and create an ultrasonic keyboard (ultrasonic transducers).

I am looking for help regarding the programming/electronics part, hoping there is someone able to help me.

Obviously, it won't be an 88-key keyboard, nor 76 or 64, but something reduced (one octave), just to demonstrate the operating principle.

The idea was to connect 12 ultrasonic transducers side by side on a support and make them function as on/off switches first of all (so creating a simple toy keyboard without velocity, etc.) and then, if possible, vary the volume depending on the distance of the hand from each ultrasonic sensor by actually reading the distance (this is why transducers are needed rather than sensors).

My doubts are:

- by setting the transducers as on/off (??so there will be an on/off transistor circuit for each transducer??) can I enter the digital inputs of an Arduino and act on the Arduino to convert the signals arriving in MIDI format and send everything through the Arduino's USB output?

- if so, have I thought this through correctly or should I use another method to get the signals to the microprocessor?

- finally, the most important question: will I be able to connect this ultrasonic MIDI keyboard (TUM) to Windows and therefore to VSTs? Will the Arduino drivers be enough?

In short, I would like to build a MIDI controller with Arduino, but I cannot use a QWERTY keyboard from an old PC or an old toy keyboard; instead, I want to build the keyboard myself using ultrasonic transducers and I don't know how to do it, I need a little help

Administrator

Reply 2 by Thesimon

Posts
4,504
City
Ariccia, RM

Hi Pianothor,

the project seems a bit too ambitious for a final high school thesis...

I know Arduino but I have never used it. I'll tell you how I would build it.

I wouldn't use ultrasonic transducers for several reasons.

Since you need to create a MIDI keyboard, you must know the MIDI protocol by letter and already implement it (even in a reduced form within hardware like Arduino, it is not a very simple thing). I don't know if there is already open-source code available online that implements the standard MIDI protocol for Arduino. You should look around. In any case, you should know that the standard MIDI protocol uses 127 velocity levels and 127 note events. Therefore, you would have to narrow the field if you use ultrasound. You will probably get a distance measurement, but since you are working in a continuous field, you will therefore have to restrict it to a discrete field by assuming that within a certain interval, one and only one velocity must be produced. Then, with a decoder, you must produce an output y1 from an input x1, which must be managed via code. But beware, that's not enough; since MIDI is a serial protocol, this must be managed by a clock that handles data synchronization.

Starting from scratch to realize a project like this is truly difficult. My advice is to base yourself on some existing schematic and make modifications to make it work with ultrasonic transducers.

Member

Reply 3 by pianothor

Posts
217
City
Mantova

I will surely find something to base the project on.. but I didn't understand a few things:

- If I put the transducers in ON/OFF mode using transistors, I would see them as buttons.

Reading the distance given by my transducer (before the signal reaches the transistor), if I acted on a variable resistor that I put in series or instead of the speaker's volume knob, I would convert the distance into voltage or current, and this voltage/current into a resistance/impedance. Wouldn't I get the same effect? All this without VST because there is no MIDI.

- Reasoning about the MIDI variant instead.. I thought that I don't need the entire MIDI protocol, I only need the fourth octave and the volume, nothing else... couldn't I restrict everything to this? Furthermore, it seems to me there is a function to set an output clock and thus make it a serial output... if I managed to do everything, how would I read the MIDI if I don't have the drivers for my "keyboard"? Would I have to use the Arduino drivers to connect everything to some VST?

- First, I forgot one thing: if I used the MIDI protocol, would I be able to have a polyphonic or monophonic keyboard? What does this depend on?

Regarding the ultrasonic sensors configured as ON/OFF via transistors, I am sure I can do it because I have already done something similar, so in the end, the ultrasonic sensors are only used for "show"...

Thank you very much for the answer

Administrator

Reply 4 by Thesimon

Posts
4,504
City
Ariccia, RM
pianothor wrote:

I will surely find something to base the project on.. but I didn't understand a few things:

- If I were to put the transducers in ON/OFF mode using transistors, I would see them as buttons.

Reading the distance provided by my transducer (before the signal reaches the transistor), if I acted on a variable resistor that I place in series or instead of the speaker's volume knob, I would convert the distance into voltage or current, and this voltage/current into resistance/impedance. Wouldn't I get the same effect? All this without VST because there is no MIDI.

- Reasoning about the MIDI variant instead.. I thought that the entire MIDI protocol isn't necessary; I only need the fourth octave and volume, nothing else... couldn't I restrict everything to this? Furthermore, it seems to me there is a function to set an output clock and thus make it a serial output... if I managed to do everything, how would I read the MIDI if I don't have the drivers for my "keyboard"? Would I have to use the Arduino drivers to connect everything to some VST?

- First, I forgot one thing: if I used the MIDI protocol, would I be able to have a polyphonic or monophonic keyboard? What does this depend on?

Regarding the ultrasonic sensors configured as ON/OFF via transistors, I am sure I can do it because I have already done something similar, so in the end, the ultrasonic sensors are only used for "show"...

Thank you very much for the answer.

When trying to engineer something, one always applies what is colloquially called operations research. That is, one seeks to eliminate redundancies at both hardware and software levels to reduce costs and system complexity, seeking the best compromise between functionality and production cost.

If it is not your intention to implement the discussion related to velocity, then the use of an ultrasonic system is perfectly useless, expensive, and costly in terms of project complexity. If I were the one evaluating your project, the first question I would ask you would concern exactly why using an ultrasonic system instead of simple microswitches. When we use constructs, whether they are hardware or software, they must always be linked to a precise choice. Therefore, if I were your professor, I would immediately challenge you on this.

Regarding the MIDI protocol, then, choosing to treat only one octave is completely indifferent to treating 5, 6, 8, or 10. A protocol is a system of instructions that is independent of how many outputs it has; therefore, writing a protocol for one octave would not change the logic compared to writing the same protocol for 8 octaves.

Regarding what you said about the transistors you need instead of switches, you are correct, but only if you intend to drive an analog oscillator. If what you want to do is a control surface that drives a sampler, there is no other way to do it than by using the MIDI protocol. The main problem, therefore, is that working in analog, you must perform a domain change; to drive digital instruments, you must insert something within the circuit that discriminates, according to certain parameters, the analog signal into a digital signal; secondly, you will have to take these digital data and create a protocol that handles transmitting the data produced by your interface to the MIDI player.

Since in this context, for the project you have chosen, there is very little electronics—inasmuch as unless you want to drive voltage-controlled oscillators, if you want to create a control surface, the work is 90% computer science—I can give you an idea.

I don't know if you know what a theremin is. It is an instrument controlled via hand movements in a magnetic field. You could propose an ultrasonic variant of the theremin. It is not difficult to find electrical diagrams of the theremin on the Internet, and I believe that building an ultrasonic variant would be more interesting from a creative point of view, as, from what I know, none exist, and therefore you would be proposing something new. On the other hand, it would seem to me like a much more flimsy project to present at a final exam (maturitĂ )."

Member

Reply 5 by pianothor

Posts
217
City
Mantova

I am responding now because I was on tour in Paris; now that I have finished the concerts, I can return to daily life.. (just kidding, at the moment I don't have any concerts scheduled in Paris yet)

Anyway, I have decided to replace the ultrasonic sensors with lasers and photoresistors or photodiodes, so as to make the measurement simpler and more precise.

The ultrasound was very random, and this reduces the problem.

The part regarding the MIDI protocol to be implemented in Arduino remains; I spoke with my professor and he told me that it is possible and that he has already done it, so I should be able to manage it.. When it is done, I will upload a mini HowTo guide for those who are interested in this.

Log in to participate