Playing a score with an int array?

Hey folks, trying to make a chip tone thing here. Anyway, what would be the best way?
I’ve tried making an array of bytes, and filling them with int values, but that didn’t work. What is a good solution?

Technically, an in is 2 bytes, but none-the-less… How come making an array of int’s wouldn’t work?

the score requires a byte array

Hmmm… Maybe I’m not understanding. How come you would be putting int’s into it, too?

By the way, feel free to post some code that’s giving you a headache. Maybe a fresh set of eyes can find the issue. It would be more helpful than saying that it simply didn’t work. :stuck_out_tongue:

maybe I don’t understand the library. Basically, I need to play a bunch of tones in order, without causing any speed issues on the main loop. That is the task. I’ll pick this up tomorrow, I am exhausted… Thanks!

Okie, dokie! I hope I wasn’t a bummer- I know that I’ve never really worked much with chip tunes. Especially any chiptune libraries.

Oh, not at all. Its just 1:36, and getting up tomorrow is gonna hurt

The search feature is pretty great on this discussion platform. But uh, it can be some reading sometimes. Here is a thread you might find useful :smiley:

You are looking for in particular, for taking a midi composition and translating it to a byte array.

I hope this helps : )

Just to clarify, the Arduino Playtune library functionality has been built into the Arduboy library’s tunes class. To play a Playtune compatible score (one or two parts) in the background, while your main loop continues to run, you would use something like:;

See the arduino-playtune README.txt file for the format of a Playtune score.

The “score” could just be a short multiple tone sound effect, which is what appears to be the goal of this topic. Flappy Ball is an example of a game that uses the tunes.playScore() function in this way.

The Tunes example sketch in the Arduboy library is an example of using the tunes.playScore() function to play an actual two part music composition in the background. You can open it using:
File > Examples > Arduboy > Tunes

Ah, ok. Thanks. I’ll do some intensive reading with that in a while. However, in experimenting, I found that if the score ISNT stored as a const in the PROGMEM, it won’t play.

Yeah that’s right, there are lots of little quirks when working with the platform and programming in general. It’s caught me out a few times.

@JO3RI is also working on some new music stuff too! :slight_smile:

And then midi tones provides a CLI application for converting MIDI sequences or something to this effect.

Yes. I didn’t mention this because it’s documented in the README.txt file that I linked too.

If you know what you’re doing, for a simple sequence of tones it can sometimes be easier to just write a Playtunes score directly, rather than composing with a MIDI tracker/sequencer then converting to Playtunes using a CLI.

Does anyone know if there’s something that can play a Playtunes score on a computer, so you could hear what it would sound like before adding it to a sketch and uploading it?

1 Like