Playing piano from the terminal
Hi guys.
In short, what I want to achieve is this: echo "a b c a" | piano.sh And hear it, like it was played on a piano. As you can see, I really would like to keep it simple, it is for a school project, and this is a minor but important thing. I am getting the data from the serial port and that part is working. I have been looking at software synthesizers etc. but again, I want it to be simple. :-) Has anyone done anything similar or related to this? Is it at all possible? Best regards Kresten |
The sound card drivers direct a sound card on what sounds/notes to play. So, you need to program something that will send the right instruction for each note to the sound card driver. You will need more than a script. The only sound that script languages like bash have been programmed to play is the monotone "beep". I am not sure whether an Amarok script will do what you need. A "how to" is at http://amarok.kde.org/wiki/Script-Wr...o#Introduction
|
Quote:
One way would be to generate midi notes; for example, in Python you could use a module such as pyfluidsynth, or even generate midi events directly from the incoming note list. A quick and ugly way would be to create a whole lot of mp3 files with the different notes, and then use a shell script to run mpg321 on the ones that match the notes coming in! |
Quote:
The use of MIDI is a traditional way, but I think if you can manage to somehow "mix" the sound of the mp3 notes (using PulseAudio or something like that), it will be much more real. The sound of MIDI notes is rather flat, you know. I'm no expert on programming and sound stuff, but an enthusiast of music and the console :D. Please keep posting the result of your work here. |
Just for fun, you can also use SoX to play notes in a script, taking notes on the standard input (separated by spaces or lf):
Code:
#!/bin/bash |
neonsignal,
Thanks for that. I do not know how after many years I missed SoX, that I now find is a standard offering of many Linux / Unix distributions. |
All times are GMT -5. The time now is 07:37 PM. |