Giter Site home page Giter Site logo

jesusjimsa / drum-it-yourself-tfg Goto Github PK

View Code? Open in Web Editor NEW
0.0 3.0 0.0 2.65 MB

Electric drumset using sensors connected to the Raspberry Pi and Arduino boards.

License: GNU General Public License v3.0

C 81.68% Makefile 3.99% C++ 14.34%
drums c arduino raspberry-pi mpg123 libao diy sounds music sensor

drum-it-yourself-tfg's People

Contributors

jesusjimsa avatar

Watchers

 avatar  avatar  avatar

drum-it-yourself-tfg's Issues

Modify Arduino program to read from two sensors at the same time

Modify the Arduino program to read from two sensors at the same time and create a string with a similar style to this:

1:234:2:288

Where 1 and 2 are the instruments and 234 and 288 are the volumes.

The program in the Raspberry Pi must parse this string and generate the necessary values to call PressToPlay requesting one of the combined sounds.

Add LEDs to learn songs

Add LEDs to every patch to learn songs. When a patch needs to be hit, the LED blinks. It will keep blinking until it gets hit.

Warning from ao_play

The following warning is displayed when compiling the project.

src/play.c: In function ‘play’:
src/play.c:44:16: warning: pointer targets in passing argument 2 of ‘ao_play’ differ in signedness [-Wpointer-sign]
   ao_play(dev, buffer, done);
                ^~~~~~
In file included from src/play.c:1:
/usr/include/ao/ao.h:119:23: note: expected ‘char *’ but argument is of type ‘unsigned char *’
 int                   ao_play(ao_device *device,
                       ^~~~~~~

One sensor not sending data

For some reason, one sensor won't send data to the serial monitor, being random at which one it is each time the Arduino and the sensors are set up.
All sensors work properly, they have been tested in all analog ports. Cables are not the problem either.

Add array with path to sounds

Add an array with all sounds' paths to remove the long switch in PressToPlay. This will make the program faster and more readable.

Arduino code rework

Right now, Arduino sends one line for each instrument. It chooses the one with the greater value and writes it in the monitor output. It can't read two at the same time so, when read in the Raspberry Pi, it only reads one, discarding the possibility of playing two patches at the same time.

Current monitor output

0:0
0:0
1:446
3:812
0:0
0:0

Monitor output proposal

0:0
0:0
1:446:2:0:3:812:4:0:5:0
0:0
0:0

This way, the Raspberry Pi would read the entire line and play the sound of the patches reporting a volume over 200. Also, in the Arduino code, it should create the string adding the read value of the sensors reporting over 200.
After parsing the line, the Raspberry Pi will create threads for each instrument over 200 to play them as simultaneously as possible.

This new implementation would also allow the Arduino to get rid of the myMax, maxSix and combinedSound functions, as well as the need of the combined sounds themselves.

Adapt Arduino program to accept two sounds with the same volume

With the current implementation (7e7a736), the Arduino program reads from all sensors and chooses the maximum value to play the sound. If another sensor returns a value greater than 200, it will look for the second maximum value by ignoring the already chosen.
This can cause problems in the situation when two sensors return the exact same volume. The program will return the maximum of the later sensor (from 0 to 5, 5 has priority over 0) and, when choosing the second one, it will ignore both values, making it seem like only one patch has been pressed when, in reality, two are being pressed.

Create remaining combined sounds

Create remaining combined sounds and their volume versions.

To do:

  • Closed Hi Hat + Crash
  • Closed Hi Hat + High Tom
  • Closed Hi Hat + Floor Tom
  • Closed Hi Hat + Bass Drum
  • Crash + High Tom
  • Crash + Floor Tom
  • Crash + Bass Drum
  • High Tom + Bass Drum

Create high and low volume versions of combined sounds

Create high and low volume versions of combined sounds.

  • bass_and_closed_hh.mp3
  • bass_and_crash.mp3
  • bass_and_floor.mp3
  • bass_and_high.mp3
  • bass_and_open_hh.mp3
  • bass_and_snare.mp3
  • closed_hh_and_crash.mp3
  • closed_hh_and_floor_tom.mp3
  • closed_hh_and_high_tom.mp3
  • closed_hh_and_snare.mp3
  • crash_and_floor_tom.mp3
  • crash_and_high_tom.mp3
  • crash_and_ryde.mp3
  • crash_and_snare.mp3
  • high_and_floor_tom.mp3
  • high_and_mid_tom.mp3
  • mid_and_floor_tom.mp3
  • open_hh_and_snare.mp3
  • snare_and_floor_tom.mp3
  • snare_and_high_tom.mp3
  • snare_and_mid_tom.mp3
  • snare_and_ryde.mp3

Update README

The README file in the repository needs to be updated to show something more than just TFG.

Segmentation fault when using threads

When calling the play function from a new thread, it eventually creates a segmentation fault, after just two or three sounds can successfully happen.

Save song played

Save mp3 file with song played during a certain period of time.

Cannot open sound file

When reading serial output, the program cannot read the mp3 file, the path is not saved correctly.

[src/libmpg123/readers.c:1184] error: Cannot open file Е�snare_drum.mp3: No such file or directory
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround71
[src/libmpg123/readers.c:1184] error: Cannot open file ��snare_drum.mp3: No such file or directory
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround71
[src/libmpg123/readers.c:1184] error: Cannot open file snare_drum.mp3: No such file or directory
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround71
[src/libmpg123/readers.c:1184] error: Cannot open file x]�snare_drum.mp3: No such file or directory
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround71
[src/libmpg123/readers.c:1184] error: Cannot open file xR�snare_drum.mp3: No such file or directory
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround71
[src/libmpg123/readers.c:1184] error: Cannot open file x��snare_drum.mp3: No such file or directory
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround71
[src/libmpg123/readers.c:1184] error: Cannot open file �S�snare_drum.mp3: No such file or directory
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround71
[src/libmpg123/readers.c:1184] error: Cannot open file ���snare_drum.mp3: No such file or directory
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround71
[src/libmpg123/readers.c:1184] error: Cannot open file @��snare_drum.mp3: No such file or directory
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround71
[src/libmpg123/readers.c:1184] error: Cannot open file �o�snare_drum.mp3: No such file or directory
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround71
[src/libmpg123/readers.c:1184] error: Cannot open file snare_drum.mp3: No such file or directory
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround71
[src/libmpg123/readers.c:1184] error: Cannot open file P/�snare_drum.mp3: No such file or directory
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround71
[src/libmpg123/readers.c:1184] error: Cannot open file `��snare_drum.mp3: No such file or directory
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround71
[src/libmpg123/readers.c:1184] error: Cannot open file �snare_drum.mp3: No such file or directory
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround71
[src/libmpg123/readers.c:1184] error: Cannot open file 8&�snare_drum.mp3: No such file or directory
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround71
[src/libmpg123/readers.c:1184] error: Cannot open file H�snare_drum.mp3: No such file or directory
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround71
[src/libmpg123/readers.c:1184] error: Cannot open file pW�snare_drum.mp3: No such file or directory
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround71
�snare_drum.mp3: No such file or directoryot open file �
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround71
[src/libmpg123/readers.c:1184] error: Cannot open file �ۙsnare_drum.mp3: No such file or directory
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround71
[src/libmpg123/readers.c:1184] error: Cannot open file P̙snare_drum.mp3: No such file or directory
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround71
[src/libmpg123/readers.c:1184] error: Cannot open file �z�snare_drum.mp3: No such file or directory
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround71
[src/libmpg123/readers.c:1184] error: Cannot open file �i�snare_drum.mp3: No such file or directory
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround71
[src/libmpg123/readers.c:1184] error: Cannot open file P٘snare_drum.mp3: No such file or directory
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround71
[src/libmpg123/readers.c:1184] error: Cannot open file @r�snare_drum.mp3: No such file or directory
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround71
[src/libmpg123/readers.c:1184] error: Cannot open file  �snare_drum.mp3: No such file or directory
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround71
[src/libmpg123/readers.c:1184] error: Cannot open file H�snare_drum.mp3: No such file or directory
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround71
[src/libmpg123/readers.c:1184] error: Cannot open file �snare_drum.mp3: No such file or directory
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround71
[src/libmpg123/readers.c:1184] error: Cannot open file ��snare_drum.mp3: No such file or directory
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround71
[src/libmpg123/readers.c:1184] error: Cannot open file (e�snare_drum.mp3: No such file or directory
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround71
[src/libmpg123/readers.c:1184] error: Cannot open file H�snare_drum.mp3: No such file or directory
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround71
[src/libmpg123/readers.c:1184] error: Cannot open file  ��snare_drum.mp3: No such file or directory
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround71
[src/libmpg123/readers.c:1184] error: Cannot open file �&�snare_drum.mp3: No such file or directory
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround71
[src/libmpg123/readers.c:1184] error: Cannot open file��snare_drum.mp3: No such file or directory
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround71
[src/libmpg123/readers.c:1184] error: Cannot open file snare_drum.mp3: No such file or directory
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround71
[src/libmpg123/readers.c:1184] error: Cannot open file  �snare_drum.mp3: No such file or directory
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround71
[src/libmpg123/readers.c:1184] error: Cannot open file ؁�snare_drum.mp3: No such file or directory
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround71
[src/libmpg123/readers.c:1184] error: Cannot open file �S�snare_drum.mp3: No such file or directory
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround71
[src/libmpg123/readers.c:1184] error: Cannot open file x6�snare_drum.mp3: No such file or directory
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround71
[src/libmpg123/readers.c:1184] error: Cannot open file  p�snare_drum.mp3: No such file or directory
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround71
[src/libmpg123/readers.c:1184] error: Cannot open file  k�snare_drum.mp3: No such file or directory
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround71
[src/libmpg123/readers.c:1184] error: Cannot open file 0�snare_drum.mp3: No such file or directory
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround71
[src/libmpg123/readers.c:1184] error: Cannot open file x�snare_drum.mp3: No such file or directory
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround71
[src/libmpg123/readers.c:1184] error: Cannot open file ��snare_drum.mp3: No such file or directory
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround71
[src/libmpg123/readers.c:1184] error: Cannot open file �l�snare_drum.mp3: No such file or directory
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround71
[src/libmpg123/readers.c:1184] error: Cannot open file x��snare_drum.mp3: No such file or directory
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround71
[src/libmpg123/readers.c:1184] error: Cannot open file @r�snare_drum.mp3: No such file or directory
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround71
[src/libmpg123/readers.c:1184] error: Cannot open file ��snare_drum.mp3: No such file or directory
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround71
[src/libmpg123/readers.c:1184] error: Cannot open file ���snare_drum.mp3: No such file or directory
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround71
[src/libmpg123/readers.c:1184] error: Cannot open file ��snare_drum.mp3: No such file or directory
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround71
[src/libmpg123/readers.c:1184] error: Cannot open file @j�snare_drum.mp3: No such file or directory
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround71
[src/libmpg123/readers.c:1184] error: Cannot open file Е�snare_drum.mp3: No such file or directory
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround71
[src/libmpg123/readers.c:1184] error: Cannot open file pB�snare_drum.mp3: No such file or directory
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround71
[src/libmpg123/readers.c:1184] error: Cannot open file ��snare_drum.mp3: No such file or directory
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround71
[src/libmpg123/readers.c:1184] error: Cannot open file  ��snare_drum.mp3: No such file or directory
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround71
[src/libmpg123/readers.c:1184] error: Cannot open file h=�snare_drum.mp3: No such file or directory
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround71
[src/libmpg123/readers.c:1184] error: Cannot open file ���snare_drum.mp3: No such file or directory
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround71
[src/libmpg123/readers.c:1184] error: Cannot open file `U�snare_drum.mp3: No such file or directory
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround71
[src/libmpg123/readers.c:1184] error: Cannot open file snare_drum.mp3: No such file or directory
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround71
[src/libmpg123/readers.c:1184] error: Cannot open file �O�snare_drum.mp3: No such file or directory
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround71
[src/libmpg123/readers.c:1184] error: Cannot open file (јsnare_drum.mp3: No such file or directory
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround71

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.