Giter VIP home page Giter VIP logo

Comments (48)

onlaj avatar onlaj commented on May 28, 2024 1

Try to enable SPI

from piano-led-visualizer.

Kliklijoker avatar Kliklijoker commented on May 28, 2024

I already set RPi BT as input
Also set synthesia I/O both are RPi BT, but when I using synthesia, the led keep lighting even I press the right note and after I change RPi BT as input, the terminal still show my midi device as input.

from piano-led-visualizer.

onlaj avatar onlaj commented on May 28, 2024

Is BT connection between RPi and Synthesia works at all? When you press keys does Synthesia see it?

from piano-led-visualizer.

Kliklijoker avatar Kliklijoker commented on May 28, 2024

Update

Now the key will lighting and waiting me press, but when I press the key it still light. And when I press the key, synthesia doesn't have any reaction

The output is ok, but input has some problem, do I need to do any setting?

from piano-led-visualizer.

onlaj avatar onlaj commented on May 28, 2024

If you did everything correctly as instructed here there should be two-ways connection between both devices. Make sure you configured ports in Synthesia.

from piano-led-visualizer.

Kliklijoker avatar Kliklijoker commented on May 28, 2024

What's you mean two ways?
I think the computer set RPi BT as input
But it doesn't receive the signal, are you just plug you piano usb on rpi OTG hub?

from piano-led-visualizer.

onlaj avatar onlaj commented on May 28, 2024

Yes, you should connect your piano with OTG cable to RPi.
In Synthesia you should set RPI-Bluetooth as input and output.
If you want to light next-to-play keys by Synthesia you should set RPI-Bluetooth as input in Visualizer ports settings. If you want to just light up keys when pressing them you should set your piano as input.
I think this has nothing to do with my code, there must be a problem on Synthesia or this script side.

from piano-led-visualizer.

Kliklijoker avatar Kliklijoker commented on May 28, 2024

I have a question
Why RPi BT as input can let synthesia know when I press the key? In the synthesia you say you set RPi BT as I/O , do you have other setting in synthesia? Or just your computer can read RPi BT synthesia?

And as you say the link have some script problem, are you as follows all the instructions in your link?

My RPi BT out work well, but RPi BT in doesn't work, do I have another input can replace it?

from piano-led-visualizer.

onlaj avatar onlaj commented on May 28, 2024

"Why RPi BT as input can let synthesia know when I press the key?"
The script is sending messages from your piano to pc AND from pc to your piano. My script is only for handling lights.

"In the synthesia you say you set RPi BT as I/O , do you have other setting in synthesia?"
No, nothing else.

Try to run "connectall.rb" script manually to see if there are any errors.

from piano-led-visualizer.

Kliklijoker avatar Kliklijoker commented on May 28, 2024

after I command "connectall.rb"

/usr/local/bin/connectall.rb:12:in block in <main>': undefined local variable o r method names' for main:Object (NameError)
from /usr/local/bin/connectall.rb:6:in each' from /usr/local/bin/connectall.rb:6:in

'
Issue aconnect -l

client 0: 'System' [type=kernel]
0 'Timer '
1 'Announce '
client 14: 'Midi Through' [type=kernel]
0 'Midi Through Port-0'
client 20: 'Roland Digital Piano' [type=kernel,card=1]
0 'Roland Digital Piano MIDI 1'
client 128: 'RPi-Bluetooth' [type=user,pid=1930]
0 'RPi-Bluetooth '

image

from piano-led-visualizer.

Kliklijoker avatar Kliklijoker commented on May 28, 2024

If I just play the synthesia the LED will light sometimes white or green, sometimes white or blue(I don't know why it not just green and blue).
My RPi-BT (IN) doesn't have any reaction (I already set input as RPi BT) and I already plug into OTG on RPi.

from piano-led-visualizer.

onlaj avatar onlaj commented on May 28, 2024

Try to replace connectall.rb content with this code:

#!/usr/bin/ruby
#

t = `aconnect -i -l`
ports = []
names = []
t.lines.each do |l|
  /client (\d*)\:/=~l
  port = $1
  name = $1
 # we skip empty lines and the "Through" port
  unless $1.nil? || $1 == '0' || /Through/=~l
    ports << port
    names << name
  end
end

ports.each do |p1|
  ports.each do |p2|
    unless p1 == p2 # probably not a good idea to connect a port to itself
      system  "aconnect #{p1}:0 #{p2}:0"
    end
  end
end

Not sure if this is the case, but it is worth a shot. I basically defined "name" and "names" variables.
btw. can you run "printmidimessages.py" from tests folder and show me example of midi messages from your piano?

from piano-led-visualizer.

Kliklijoker avatar Kliklijoker commented on May 28, 2024

I already replace the code and command "connectall.rb" I got

/usr/local/bin/connectall.rb:22: syntax error, unexpected end-of-input, expecting keyword_end

from piano-led-visualizer.

onlaj avatar onlaj commented on May 28, 2024

My bad, I didn't copy last two lines, edited previous comment.

from piano-led-visualizer.

Kliklijoker avatar Kliklijoker commented on May 28, 2024

note_off channel=0 note=28 velocity=57 time=0
note_on channel=0 note=31 velocity=25 time=0
note_off channel=0 note=31 velocity=82 time=0
note_on channel=0 note=24 velocity=29 time=0
note_off channel=0 note=24 velocity=67 time=0
note_on channel=0 note=28 velocity=36 time=0
note_on channel=0 note=31 velocity=28 time=0
note_off channel=0 note=28 velocity=88 time=0
note_off channel=0 note=31 velocity=65 time=0
note_on channel=0 note=36 velocity=39 time=0
note_off channel=0 note=36 velocity=106 time=0
note_on channel=0 note=30 velocity=41 time=0
note_on channel=0 note=33 velocity=48 time=0
note_on channel=0 note=26 velocity=31 time=0
note_off channel=0 note=26 velocity=101 time=0
note_off channel=0 note=30 velocity=98 time=0
note_off channel=0 note=33 velocity=89 time=0
note_on channel=0 note=31 velocity=43 time=0
note_on channel=0 note=27 velocity=43 time=0
note_on channel=0 note=23 velocity=40 time=0
note_off channel=0 note=27 velocity=87 time=0
note_off channel=0 note=31 velocity=105 time=0
note_off channel=0 note=23 velocity=81 time=0
note_on channel=0 note=29 velocity=46 time=0
note_on channel=0 note=21 velocity=53 time=0
note_on channel=0 note=25 velocity=40 time=0
note_off channel=0 note=21 velocity=80 time=0
note_off channel=0 note=25 velocity=76 time=0
note_off channel=0 note=29 velocity=88 time=0
note_on channel=0 note=21 velocity=41 time=0
note_on channel=0 note=25 velocity=52 time=0
note_on channel=0 note=28 velocity=49 time=0
note_on channel=0 note=29 velocity=66 time=0
note_off channel=0 note=21 velocity=95 time=0
note_off channel=0 note=25 velocity=94 time=0
note_off channel=0 note=28 velocity=100 time=0
note_off channel=0 note=29 velocity=57 time=0

from piano-led-visualizer.

Kliklijoker avatar Kliklijoker commented on May 28, 2024

OMG, it work!!
but some wired problem, it should right green left blue, but my led sometimes will light right color, sometimes will be white, why?

from piano-led-visualizer.

onlaj avatar onlaj commented on May 28, 2024

You would have to edit printmidimessages.py (set RPI-Bluetooth as input) and check what messages Synthesia is sending when you play.

from piano-led-visualizer.

Kliklijoker avatar Kliklijoker commented on May 28, 2024

note_on channel=0 note=36 velocity=47 time=0
note_off channel=0 note=36 velocity=100 time=0
note_on channel=0 note=40 velocity=56 time=0
note_off channel=0 note=40 velocity=96 time=0
note_on channel=0 note=43 velocity=42 time=0
note_off channel=0 note=43 velocity=106 time=0
note_on channel=0 note=34 velocity=52 time=0
note_off channel=0 note=34 velocity=97 time=0
note_on channel=0 note=33 velocity=46 time=0
note_off channel=0 note=33 velocity=108 time=0
note_on channel=0 note=31 velocity=55 time=0
note_off channel=0 note=31 velocity=91 time=0
note_on channel=0 note=38 velocity=67 time=0
note_off channel=0 note=38 velocity=88 time=0
note_on channel=0 note=37 velocity=53 time=0
note_on channel=0 note=40 velocity=56 time=0
note_on channel=0 note=31 velocity=37 time=0
note_off channel=0 note=31 velocity=101 time=0
note_off channel=0 note=37 velocity=127 time=0
note_off channel=0 note=40 velocity=118 time=0
note_on channel=0 note=31 velocity=57 time=0
note_off channel=0 note=31 velocity=102 time=0
note_on channel=0 note=31 velocity=50 time=0
note_off channel=0 note=31 velocity=58 time=0
note_on channel=0 note=36 velocity=53 time=0
note_off channel=0 note=36 velocity=127 time=0
note_on channel=0 note=40 velocity=59 time=0
note_off channel=0 note=40 velocity=93 time=0
note_on channel=0 note=43 velocity=47 time=0
note_off channel=0 note=43 velocity=118 time=0
note_on channel=0 note=48 velocity=61 time=0
note_off channel=0 note=48 velocity=105 time=0
note_on channel=0 note=52 velocity=56 time=0
note_off channel=0 note=52 velocity=121 time=0
note_on channel=0 note=55 velocity=65 time=0
note_off channel=0 note=55 velocity=124 time=0
note_on channel=0 note=60 velocity=85 time=0
note_off channel=0 note=60 velocity=106 time=0

from piano-led-visualizer.

Kliklijoker avatar Kliklijoker commented on May 28, 2024

it just like I normal plug OTG cable with the note_on and note_off, what should I need to change?

from piano-led-visualizer.

onlaj avatar onlaj commented on May 28, 2024

I think "light up notes" might be disabled by default in Synthesia, try to change that.

from piano-led-visualizer.

Kliklijoker avatar Kliklijoker commented on May 28, 2024

Do you mean turn off the setting five?
image
After I chnage this, my LED will not with light instructions anymore :(

btw, when I set RPi IN as input in synthesia also menu, when I press the key the LED still will light with white color, it shouldn't with it, right?

Another question, what should I set as output when Piano visualizer and Synthesia mode

from piano-led-visualizer.

onlaj avatar onlaj commented on May 28, 2024

I think the order is the same but it would be easier if you would change language to english. First checkbox should be Off, same with last one, fifth should be set to "Finger-based channel".

from piano-led-visualizer.

Kliklijoker avatar Kliklijoker commented on May 28, 2024

image

image

It still sometimes will have white color :( (For the midi, I select all channel, does it right?)

Another question, what should I set as output when Piano visualizer and Synthesia mode?

My sound have some delay when I play as synthesia learning mode, why?

from piano-led-visualizer.

onlaj avatar onlaj commented on May 28, 2024

"For the midi, I select all channel, does it right?"
Yes.
"Another question, what should I set as output when Piano visualizer and Synthesia mode?"
You don't have to change anything in Synthesia, just input in Visualizer port settings.

"My sound have some delay when I play as synthesia learning mode, why?"
This is really weird, there should be no delay because it is your piano playing sound.
Try to restart your RPi after all those changes. Maybe there is something wrong with ports connections.

from piano-led-visualizer.

Kliklijoker avatar Kliklijoker commented on May 28, 2024

I already restart everything, I find a weird solution.
If I use song I classify myself, it work well, but if I use default song, it will have some bug(LED with white), I thought it cuz the original midi not all in channel as you write.

from piano-led-visualizer.

Kliklijoker avatar Kliklijoker commented on May 28, 2024

If I want to add new effect in ledsettings, where should I need to change?
I create a new effect in menu, but it always light as white.

And for the solid color select, where I can add or delete color? I can't find in code.

from piano-led-visualizer.

onlaj avatar onlaj commented on May 28, 2024

"And for the solid color select, where I can add or delete color? I can't find in code."
menu.xml

What effect you want to add?

from piano-led-visualizer.

Kliklijoker avatar Kliklijoker commented on May 28, 2024

The rainbow effect (when I hit the key it will light red to purple from left to right)

from piano-led-visualizer.

onlaj avatar onlaj commented on May 28, 2024

I added this effect few days ago, update your code :D

from piano-led-visualizer.

Kliklijoker avatar Kliklijoker commented on May 28, 2024

Does this effect still in the led settings?

from piano-led-visualizer.

onlaj avatar onlaj commented on May 28, 2024

Yeah, you need to update visualizer.py and menu.xml

from piano-led-visualizer.

Kliklijoker avatar Kliklijoker commented on May 28, 2024

Okay, so what is this effect name you called, do I just need to following the form like fading or velocity effect?

from piano-led-visualizer.

onlaj avatar onlaj commented on May 28, 2024

It is under "Led Strip Settings" -> "LED Color" -> "Rainbow Colors".
Under that menu you can configure how your rainbow looks. You have to press "enter" button on one of the options to activate rainbow effect.
You can combine it with "Fading" or "Velocity" mode.

from piano-led-visualizer.

Kliklijoker avatar Kliklijoker commented on May 28, 2024

Okay, so this effect just as you use for the animation, right?

from piano-led-visualizer.

onlaj avatar onlaj commented on May 28, 2024

No, keys lights up with rainbow effect when you play.

from piano-led-visualizer.

Kliklijoker avatar Kliklijoker commented on May 28, 2024

Can you clearly point out which line in your code you create the rainbow effect?

from piano-led-visualizer.

onlaj avatar onlaj commented on May 28, 2024

I just noticed that I forgot to commit changes in "menu.xml", updated now.
Check last two commits in which I added this feature.

from piano-led-visualizer.

Kliklijoker avatar Kliklijoker commented on May 28, 2024

Thank you :D , so the output port seems doesn't have any function here, I want to delete all of them in menu.xml and visualizer.py, where can I delete in visualizer.py?

from piano-led-visualizer.

onlaj avatar onlaj commented on May 28, 2024

What do you want to delete? Output port? Just delete it from menu.xml so you will not see it in menu.

from piano-led-visualizer.

Kliklijoker avatar Kliklijoker commented on May 28, 2024

Okay, thank you, here is my small question I only left.
As synthesia mode (input set as RPi BT) it can work well in the midi song in the same channel and separate manual by left and right by me, if the midi song are use separate channel in left and right, the LED will not light in correct color (green and blue), do you have the same problem?

from piano-led-visualizer.

onlaj avatar onlaj commented on May 28, 2024

No, it works fine for me, Synthesia sends midi messages with proper channel numbers.

from piano-led-visualizer.

Kliklijoker avatar Kliklijoker commented on May 28, 2024

I think it is because the midi channel, for you code I found you set channel 11 as right, channel 12 for left, do you also set the same channel in synthesia? Or it can be different channel?

from piano-led-visualizer.

onlaj avatar onlaj commented on May 28, 2024

https://www.synthesiagame.com/forum/viewtopic.php?p=43585#p43585

from piano-led-visualizer.

Kliklijoker avatar Kliklijoker commented on May 28, 2024

Thanks! That's what I need, after I check the built in songs in synthesia, it auto arrange channel 3 for right, channel 4 for left, I thought I need to change this to 11&12 for the code can work properly. Or can I just change channel 11&12(in code) to 3&4 for make code work?

from piano-led-visualizer.

onlaj avatar onlaj commented on May 28, 2024

Second option would be better, but anyway it is weird, Synthesia should set channels 11 and 12 for left and right hands.

from piano-led-visualizer.

Kliklijoker avatar Kliklijoker commented on May 28, 2024

OK, thank you again, sorry for me make some mistake.
image

In built-in songs, channel 1 for the right and channel 2 for the left, do you know how can I change synthesia to make default setting become channels 11 and 12 for left and right hands?

from piano-led-visualizer.

Kliklijoker avatar Kliklijoker commented on May 28, 2024

Sorry for another question, you say need to check the printmessages.py when I set RPi-BT as input, so what channel should show in there?

note_on channel=0 note=36 velocity=47 time=0
note_off channel=0 note=36 velocity=100 time=0

When I use synthesia, does it should automatic set right as channel 11, left as channel 12?
(btw, after I chnage the code channel, it still have some bugs)

In printmessages.py

import mido
from mido import MidiFile, Message, tempo2bpm, MidiTrack,MetaMessage

ports = mido.get_input_names()

for port in ports:
if "Through" not in port and "RPi" not in port and "RtMidOut" not in port:
try:
inport = mido.open_input(port)
print("Inport set to "+port)
except:
print ("Failed to set "+port+" as inport")

while True:
for msg in inport.iter_pending():
print(msg)

do I need to change anything? Or it can auto find RPi-BT as input?

from piano-led-visualizer.

omidfk avatar omidfk commented on May 28, 2024

Try to enable SPI

SPI is enable,but I execute the the command sudo -E python visualizer.py, I got following error.

Traceback (most recent call last):
File "visualizer.py", line 3, in
import LCD_1in44
File "/home/pi/Desktop/pianoled/LCD_1in44.py", line 28, in
import LCD_Config
File "/home/pi/Desktop/pianoled/LCD_Config.py", line 38, in
SPI = spidev.SpiDev(0, 0)
IOError: [Errno 2] No such file or directory

from piano-led-visualizer.

Related Issues (20)

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.