Playing Midi files with Phoenix 6 Orchestra Class

Currently trying to figure out how to play midi files using TalonFX motors. Currently I have this code in Robot.java teleop init:

public void teleopInit() {
final TalonFX joe = new TalonFX(8);
try (Orchestra m_Orchestra = new Orchestra()) {
m_Orchestra.addInstrument(joe);

        var status = m_Orchestra.loadMusic("C:\\Users\\wawer\\Downloads\\output.chrp");

        if (!status.isOK()) {
            m_Orchestra.play();
        }
    }

Nothing plays when I enable teleop. I’m probably doing a lot of things wrong ;-;

  • Converted to chirp file using tool in Phoenix Tuner
1 Like

Bored ?

8 Likes

Not a programming guy but should the file be on the rio? It looks like you are referencing it on your laptop

1 Like

WDYM on the rio?


here are the directions from Phoenix Tuner.

Try to load the music into the deploy folder so it gets put on the roborio.

Do you ever feel like an easter egg is the whole freaking basket?

1 Like

Why are you checking if status is not ok? Shouldn’t it be the opposite?

Put the chirp file in src main deploy, still doesnt work. Changed file path in m_Orchestra.loadMusic(“”) to the new filepath within the deploy folder.

1 Like

Did you set the path to where it is on your computer or where it is on the roboRIO? It should be in /home/lvuser/deploy/.

3 Likes

I’m fairly certain theres a helper method to get that path dynamically too

Um, can you elaborate on that path? I can’t find it

That is the default roborio path I think. lvuser is the user, and whatever is put in the deploy folder gets put on that directory on the roborio. Sorry if I worded this poorly.

2 Likes

This PC > Users > ?
I cant find deploy folder there. Is this the same thing as the roboRIO FTP? roboRIO FTP — FIRST Robotics Competition documentation

The roborio is its own computer with a user (lvuser) and a folder called deploy inside it. From my knowledge the only way to access this is though the deploy folder in the code.

1 Like

Yep. To go into more detail, the roboRIO runs Linux, and in Linux, rather than a “C:” drive, you have a root directory, located at /. The home directory contains files for every user, and the robot code runs and deploys under the user lvuser. The deploy folder inside that is where the deploy script puts files from the deploy folder on your computer.

1 Like

The deploy folder is located at project-root/src/main/deploy and is copied into the roboRIO’s internal filesystem when you deploy your code.

I am also using the Orchestra class; I put my files in deploy/example.chrp and refer to them as loadMusic("example.chrp").

Hope this helps!

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.